Factor common code for syscalls

This commit is contained in:
Pierre Pronchery 2018-04-02 12:34:57 +02:00
parent 290855355a
commit d1d4cc194e
2 changed files with 16 additions and 4 deletions

View File

@ -4,13 +4,22 @@
.section .text
_syscall:
int $0x80
jnc .errnoret
.errno:
mov %eax, errno
mov $-1, %eax
.errnoret:
ret
/* exit */
.global _exit
.type _exit, @function
_exit:
mov $0x1, %eax
int $0x80
ret
jmp _syscall
/* start */
@ -66,8 +75,7 @@ auxv_done:
.type _write, @function
_write:
mov $0x4, %eax
int $0x80
ret
jmp _syscall
#if defined(__NetBSD__)

View File

@ -1 +1,5 @@
#include "../src/main.c"
/* variables */
int errno = 0;