.globl _start
_start:
jmp 1f ; two bytes
- .byte 0 ; one byte of padding
+ .byte 0 ; two bytes of padding
.byte 'F', 'Z', 'X', '1' ; magic starts at 0x8003
- .word 0 ; chmem
+ .byte 0x80 ; page to start at
+ .word 0 ; chmem (0 means 'all')
.word __data_start
- .word __data_end
- .word __bss_end
+ .word __data_len
+ .word __bss_len
.word 0 ; spare
- .align 2
1:
; Wipe BSS.
mov #__bss_start, r12
; On entry, the syscall number is in r11 and the four parameters in
; r12-r15 (luckily, these are all caller saved).
calla &(_start-4)
- ; On exit from the kernel, the result in r12 is either 0 or an errno.
- tst r12
+ ; On exit from the kernel, the result is in r12 and r13 is an errno.
+ tst r13
jz 1f
; Error path.
- mov r12, &errno
+ mov r13, &errno
mov #-1, r12
1:
ret
"\t.globl _syscall\n"
"\t.globl %1$s\n\n"
"%1$s:\n", syscall_name[n]);
+ if (syscall_args[n] == VARARGS)
+ {
+ /* Varargs syscalls have the first argument in r12 and the others on
+ * the stack. We support up to four parameters. */
+ fprintf(fp, "\tmov 2(sp), r13\n"
+ "\tmov 4(sp), r14\n"
+ "\tmov 6(sp), r15\n");
+ }
fprintf(fp, "\tmov #%d, r11\n"
"\tbr #_syscall\n",
n);