mirror of
https://github.com/LIV2/a4091-software.git
synced 2025-12-06 06:22:44 +00:00
Add rErrno variable to relocator
0 is used as error condition, so add a way to pass some more detailed error information to the caller.
This commit is contained in:
parent
ce96f096fe
commit
e221cea549
14
reloc.S
14
reloc.S
@ -67,9 +67,10 @@ HunkLoop
|
||||
|
||||
; We don't know this hunk
|
||||
RelocateFail
|
||||
; Save hunk number in rErrno as error code
|
||||
lea _rErrno(pc),a0
|
||||
move.l d0,(a0)
|
||||
bsr RelocateCleanup
|
||||
; Save hunk number in d1 as error code
|
||||
move.l d0,d1
|
||||
moveq.l #0,d0 ; NULL = Failure
|
||||
rts
|
||||
|
||||
@ -145,7 +146,11 @@ SkipSymbol
|
||||
HunkEnd
|
||||
addq.l #4,a5
|
||||
dbra d6,HunkLoop
|
||||
moveq.l #$0,d0
|
||||
|
||||
lea _rErrno(pc),a0
|
||||
moveq.l #0,d0
|
||||
move.l d0,(a0)
|
||||
|
||||
bsr.s CreateSegList
|
||||
move.l _pHunks(pc),a0
|
||||
move.l (a0),d2
|
||||
@ -264,4 +269,7 @@ ReadHandle
|
||||
_pHunks
|
||||
dc.l 0
|
||||
|
||||
public _rErrno
|
||||
_rErrno
|
||||
dc.l 0
|
||||
CODE
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
|
||||
#include <clib/exec_protos.h>
|
||||
uint32_t relocate(ULONG offset asm("d0"), uint8_t *program asm("a0"));
|
||||
extern uint32_t rErrno;
|
||||
extern uint8_t device[];
|
||||
|
||||
static void hexdump(unsigned char *data, size_t size)
|
||||
@ -51,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
printf("Calling relocate()\n");
|
||||
ret=relocate(0, device);
|
||||
printf("... relocate returned %x\n", ret);
|
||||
printf("... relocate returned %x (rErrno=0x%x)\n", ret, rErrno);
|
||||
|
||||
seg=(uint32_t *)ret;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user