Merge pull request #11 from neuschaefer/dev

Add file type check to parse_fxf_binary
This commit is contained in:
Ry 2023-02-01 13:41:08 -08:00 committed by GitHub
commit 9c55c79d85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,14 +4,22 @@
; inputs: ; inputs:
; r0: pointer to memory buffer containing an FXF binary ; r0: pointer to memory buffer containing an FXF binary
; outputs: ; outputs:
; r0: relocation address ; r0: relocation address or 0 on error
parse_fxf_binary: parse_fxf_binary:
; TODO: check the magic bytes and header version push r1
mov r1, [r0]
cmp r1, [fxf_magic]
ifnz pop r1
ifnz mov r0, 0
ifnz ret
pop r1
call fxf_reloc call fxf_reloc
ret ret
fxf_magic: data.str "FXF" data.8 0
#include "fxf/reloc.asm" #include "fxf/reloc.asm"
const FXF_CODE_SIZE: 0x00000004 const FXF_CODE_SIZE: 0x00000004