From ca55abf319c2f815cb2c84655b25482829c1646d Mon Sep 17 00:00:00 2001 From: deischen Date: Mon, 29 Jan 2001 03:23:46 +0000 Subject: Clean up syscall generation in libc by removing HIDDEN_SYSCALLS and treating (almost) all system calls the same way: __sys_foo - actual syscall foo, _foo - weak definitions to __sys_foo Change PSEUDO syscalls (currently only _exit and _getlogin) to be __sys_foo (T) and _foo (W). Add $FreeBSD$ to a few files to satisfy commitprep. Suggested by: bde --- lib/libc/amd64/SYS.h | 37 ++++++------------------------------- lib/libc/amd64/sys/Makefile.inc | 6 +----- lib/libc/amd64/sys/pipe.S | 2 +- lib/libc/amd64/sys/sigreturn.S | 2 +- 4 files changed, 9 insertions(+), 38 deletions(-) (limited to 'lib/libc/amd64') diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h index 2d58562..ba56bce 100644 --- a/lib/libc/amd64/SYS.h +++ b/lib/libc/amd64/SYS.h @@ -42,32 +42,6 @@ #include "DEFS.h" #define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \ - ENTRY(__CONCAT(_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(_,x)); \ - lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b - -#define RSYSCALL(x) SYSCALL(x); ret - -#define PSEUDO(x,y) ENTRY(__CONCAT(_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(_,x)); \ - lea __CONCAT(SYS_,y), %eax; KERNCALL; ret - -/* gas messes up offset -- although we don't currently need it, do for BCS */ -#define LCALL(x,y) .byte 0x9a ; .long y; .word x - -/* - * Design note: - * - * The macros PSYSCALL() and PRSYSCALL() are intended for use where a - * syscall needs to be renamed in the threaded library. - */ -/* - * For the thread_safe versions, we prepend __sys_ to the function - * name so that the 'C' wrapper can go around the real name. - */ -#define PSYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \ ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(x); \ .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ @@ -75,14 +49,15 @@ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b -#define PRSYSCALL(x) PSYSCALL(x); ret +#define RSYSCALL(x) SYSCALL(x); ret -#define PPSEUDO(x,y) ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ +#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - lea __CONCAT(SYS_,y), %eax; KERNCALL; ret + lea __CONCAT(SYS_,x), %eax; KERNCALL; ret + +/* gas messes up offset -- although we don't currently need it, do for BCS */ +#define LCALL(x,y) .byte 0x9a ; .long y; .word x #ifdef __ELF__ #define KERNCALL int $0x80 /* Faster */ diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc index 4a60875..98d9deb 100644 --- a/lib/libc/amd64/sys/Makefile.inc +++ b/lib/libc/amd64/sys/Makefile.inc @@ -14,11 +14,7 @@ NOASM= __semctl.o break.o exit.o ftruncate.o getdomainname.o getlogin.o \ semop.o setdomainname.o shmat.o shmctl.o shmdt.o shmget.o sstk.o \ truncate.o uname.o vfork.o yield.o -PSEUDO= _getlogin.o - -# Pseudo syscalls that are renamed as __sys_{pseudo} so that libc_r can -# override them with replacements. -PSEUDOR= _exit.o +PSEUDO= _getlogin.o _exit.o .if ${LIB} == "c" MAN2+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 diff --git a/lib/libc/amd64/sys/pipe.S b/lib/libc/amd64/sys/pipe.S index 1684611..fca1187 100644 --- a/lib/libc/amd64/sys/pipe.S +++ b/lib/libc/amd64/sys/pipe.S @@ -43,7 +43,7 @@ #include "SYS.h" -PSYSCALL(pipe) +SYSCALL(pipe) movl 4(%esp),%ecx movl %eax,(%ecx) movl %edx,4(%ecx) diff --git a/lib/libc/amd64/sys/sigreturn.S b/lib/libc/amd64/sys/sigreturn.S index 7405c34..449149f 100644 --- a/lib/libc/amd64/sys/sigreturn.S +++ b/lib/libc/amd64/sys/sigreturn.S @@ -48,5 +48,5 @@ * must be saved. On FreeBSD, this is not the case. */ -PSYSCALL(sigreturn) +SYSCALL(sigreturn) ret -- cgit v1.1