diff options
author | peter <peter@FreeBSD.org> | 1996-05-05 07:56:21 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-05-05 07:56:21 +0000 |
commit | 4b7195c99191637bf59fd4ad626297296bf3610f (patch) | |
tree | bea8a07c70223c0e39939063c6dbbdf8eb9d0f17 /lib/libc/i386/SYS.h | |
parent | 93f1aa601a7bda9bd9b83bf5098c3f05f6edd744 (diff) | |
download | FreeBSD-src-4b7195c99191637bf59fd4ad626297296bf3610f.zip FreeBSD-src-4b7195c99191637bf59fd4ad626297296bf3610f.tar.gz |
Add support to enable libc to be compiled in ELF format. (#ifdef __ELF__)
In a nutshell, this macroizes the local/global symbol scoping rules
that are different in a.out and ELF. It also makes the i386 assembler
stubs conform to i386 PIC calling conventions - the a.out ld.so didn't
object, but the ELF one needs it as it implements PIC jumps via PLT's as
well as calls. The a.out rtld only worked because it was accidently
snooping the grandparent calling function's return address off the stack..
This also affects the libc_r code a little, because of cpp macro nesting.
Diffstat (limited to 'lib/libc/i386/SYS.h')
-rw-r--r-- | lib/libc/i386/SYS.h | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/libc/i386/SYS.h b/lib/libc/i386/SYS.h index 9e989e5..caea98f 100644 --- a/lib/libc/i386/SYS.h +++ b/lib/libc/i386/SYS.h @@ -35,7 +35,7 @@ * * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91 * - * $Id: SYS.h,v 1.2 1994/08/05 01:17:57 wollman Exp $ + * $Id: SYS.h,v 1.3 1996/01/22 00:00:51 julian Exp $ */ #include <sys/syscall.h> @@ -61,28 +61,27 @@ #define PIC_GOTOFF(x) x #endif -#define SYSCALL(x) 2: jmp cerror; ENTRY(x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b +#define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); ENTRY(x); lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b #define RSYSCALL(x) SYSCALL(x); ret -#ifdef _THREAD_SAFE /* - * Support for user-space threads which require that some syscalls be - * private to the threaded library. + * For the thread_safe versions, we prepend _thread_sys_ to the function + * name so that the 'C' wrapper can go around the real name. */ -#define PSYSCALL(x) 2: jmp cerror; ENTRY(_thread_sys_/**/x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b -#else -/* - * The non-threaded library defaults to traditional syscalls where - * the function name matches the syscall name. - */ -#define PSYSCALL(x) SYSCALL(x) +#ifdef _THREAD_SAFE /* in case */ +#define PSYSCALL(x,y) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); ENTRY(y); lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b +#define PRSYSCALL(x,y) PSYSCALL(x,y); ret #endif -#define PRSYSCALL(x) PSYSCALL(x); ret -#define PSEUDO(x,y) ENTRY(x); lea SYS_/**/y, %eax; ; LCALL(7,0); ret -#define CALL(x,y) call _/**/y; addl $4*x,%esp + +#define PSEUDO(x,y) ENTRY(x); lea __CONCAT(SYS_,y), %eax; KERNCALL; ret +#define CALL(x,y) call CNAME(y); addl $4*x,%esp /* gas fucks up offset -- although we don't currently need it, do for BCS */ #define LCALL(x,y) .byte 0x9a ; .long y; .word x -#define ASMSTR .asciz +#ifdef __ELF__ +#define KERNCALL int $0x80 /* Faster */ +#else +#define KERNCALL LCALL(7,0) /* The old way */ +#endif - .globl cerror +#define ASMSTR .asciz |