os/libc/errno.c

14 lines
242 B
C
Raw Normal View History

#include <sys/syscalls.h>
#define QUAUX(X) #X
#define QU(X) QUAUX(X)
2019-04-08 15:58:30 -05:00
int* __get_errno_address() {
int* address;
asm volatile(" \
mov $" QU(SYSCALL_GET_ERRNO_ADDR) ", %%eax; \
2019-04-08 15:58:30 -05:00
int $80; \
":"=b"(address):);
return address;
}