Adjust the syscall stub macros to be consistent in their meaning. In
particular: SYSCALL() makes a syscall, with errno handling, and continues execution directly after the macro in the non-error case. RSYSCALL() is just like SYSCALL(), but returns after success. Both SYSCALL(name) and RSYSCALL(name) export "__sys_name" as a strong symbol, with "_name" and "name" as weak aliases. PSEUDO() is just like RSYSCALL(), but skipping the "name" weak alias. It still does "__sys_name" and "_name". Change i386 to add errno handling to PSEUDO. The same for amd64 and sparc64, with appear to have copied the behavior. ia64 was correct (as was alpha). Just remove some apparently unused variants of the macros. (untested!) I believe powerpc is correct. Fix arm to not export "name" from the PSEUDO case. Remove apparently extra unused variants. (untested!) The errno problem manifested on i386/amd64/sparc64 by having "PSEUDO" classified syscalls return without setting errno. eg: "addr = mmap()" could return with "addr" = 22 instead of setting errno to 22 and returning -1. Approved by: re (kensmith)
This commit is contained in:
parent
6d9e6c677c
commit
1b55a32fbf
@ -44,6 +44,12 @@
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
|
||||
2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx
|
||||
|
||||
#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret ; \
|
||||
2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx
|
||||
#else
|
||||
#define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(x); \
|
||||
@ -52,11 +58,12 @@
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
|
||||
2: jmp HIDENAME(cerror)
|
||||
#endif
|
||||
|
||||
#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
mov __CONCAT($SYS_,x),%rax; KERNCALL; ret
|
||||
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
|
||||
2: jmp HIDENAME(cerror)
|
||||
#endif
|
||||
|
||||
#define KERNCALL movq %rcx, %r10; syscall
|
||||
|
@ -56,26 +56,19 @@
|
||||
_SYSCALL_NOERROR(x); \
|
||||
bcs PIC_SYM(CERROR, PLT)
|
||||
|
||||
#define SYSCALL_NOERROR(x) \
|
||||
_SYSCALL_NOERROR(x)
|
||||
|
||||
#define SYSCALL(x) \
|
||||
_SYSCALL(x)
|
||||
|
||||
|
||||
#define PSEUDO_NOERROR(x) \
|
||||
_SYSCALL_NOERROR(x); \
|
||||
#define PSEUDO(x) \
|
||||
ENTRY(__CONCAT(__sys_, x)); \
|
||||
.weak _C_LABEL(__CONCAT(_,x)); \
|
||||
.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x)); \
|
||||
SYSTRAP(x)
|
||||
bcs PIC_SYM(CERROR, PLT)
|
||||
RET
|
||||
|
||||
#define PSEUDO(x) \
|
||||
#define RSYSCALL(x) \
|
||||
_SYSCALL(x); \
|
||||
RET
|
||||
|
||||
|
||||
#define RSYSCALL_NOERROR(x) \
|
||||
PSEUDO_NOERROR(x)
|
||||
|
||||
#define RSYSCALL(x) \
|
||||
PSEUDO(x)
|
||||
|
||||
.globl CERROR
|
||||
|
@ -46,10 +46,11 @@
|
||||
|
||||
#define RSYSCALL(x) SYSCALL(x); ret
|
||||
|
||||
#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
|
||||
#define PSEUDO(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \
|
||||
ENTRY(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
mov __CONCAT($SYS_,x),%eax; KERNCALL; ret
|
||||
mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b; 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
|
||||
|
@ -50,28 +50,14 @@ ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
|
||||
WEAK_ALIAS(_ ## name, __sys_ ## name); \
|
||||
CALLSYS_NOERROR(name)
|
||||
|
||||
|
||||
#define RSYSCALL(name) \
|
||||
SYSCALL(name); \
|
||||
br.ret.sptk.few rp; \
|
||||
END(__sys_ ## name)
|
||||
|
||||
#define RSYSCALL_NOERROR(name) \
|
||||
SYSCALL_NOERROR(name); \
|
||||
br.ret.sptk.few rp; \
|
||||
END(__sys_ ## name)
|
||||
|
||||
|
||||
#define PSEUDO(name) \
|
||||
ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
|
||||
WEAK_ALIAS(_ ## name, __sys_ ## name); \
|
||||
CALLSYS_ERROR(name); \
|
||||
br.ret.sptk.few rp; \
|
||||
END(__sys_ ## name);
|
||||
|
||||
#define PSEUDO_NOERROR(name) \
|
||||
ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
|
||||
WEAK_ALIAS(_ ## name, __sys_ ## name); \
|
||||
CALLSYS_NOERROR(name); \
|
||||
br.ret.sptk.few rp; \
|
||||
END(__sys_ ## name);
|
||||
|
@ -78,8 +78,7 @@ ENTRY(__CONCAT(__sys_,x)) ; \
|
||||
.weak CNAME(__CONCAT(_,x)) ; \
|
||||
.type CNAME(__CONCAT(_,x)),@function ; \
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)) ; \
|
||||
mov __CONCAT(SYS_,x), %g1 ; \
|
||||
ta %xcc, ST_SYSCALL ; \
|
||||
_SYSCALL(x) ; \
|
||||
retl ; \
|
||||
nop ; \
|
||||
.size CNAME(__CONCAT(__sys_,x)), . - CNAME(__CONCAT(__sys_,x)) ; \
|
||||
|
Loading…
Reference in New Issue
Block a user