Introduce a WEAK_REFERENCE() alias and use it. Get rid of the CNAME and the
CONCAT macros in SYS.h. Reviewed by: bde, kib
This commit is contained in:
parent
1e7652cc76
commit
d2ef321a59
@ -36,20 +36,17 @@
|
||||
#include <sys/syscall.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
#define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(x); \
|
||||
.set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
mov __CONCAT($SYS_,x),%eax; KERNCALL; \
|
||||
#define RSYSCALL(name) ENTRY(__sys_##name); \
|
||||
WEAK_REFERENCE(__sys_##name, name); \
|
||||
WEAK_REFERENCE(__sys_##name, _##name); \
|
||||
mov $SYS_##name,%eax; KERNCALL; \
|
||||
jb HIDENAME(cerror); ret; \
|
||||
END(__CONCAT(__sys_,x))
|
||||
END(__sys_##name)
|
||||
|
||||
#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
mov __CONCAT($SYS_,x),%eax; KERNCALL; \
|
||||
#define PSEUDO(name) ENTRY(__sys_##name); \
|
||||
WEAK_REFERENCE(__sys_##name, _##name); \
|
||||
mov $SYS_##name,%eax; KERNCALL; \
|
||||
jb HIDENAME(cerror); ret; \
|
||||
END(__CONCAT(__sys_,x))
|
||||
END(__sys_##name)
|
||||
|
||||
#define KERNCALL movq %rcx, %r10; syscall
|
||||
#define KERNCALL movq %rcx, %r10; syscall
|
||||
|
@ -63,8 +63,7 @@ ENTRY(_setjmp)
|
||||
ret
|
||||
END(_setjmp)
|
||||
|
||||
.weak CNAME(_longjmp)
|
||||
.set CNAME(_longjmp),CNAME(___longjmp)
|
||||
WEAK_REFERENCE(___longjmp, _longjmp)
|
||||
ENTRY(___longjmp)
|
||||
movq %rdi,%rdx
|
||||
/* Restore the mxcsr, but leave exception flags intact. */
|
||||
|
@ -73,8 +73,7 @@ ENTRY(setjmp)
|
||||
ret
|
||||
END(setjmp)
|
||||
|
||||
.weak CNAME(longjmp)
|
||||
.set CNAME(longjmp),CNAME(__longjmp)
|
||||
WEAK_REFERENCE(__longjmp, longjmp)
|
||||
ENTRY(__longjmp)
|
||||
pushq %rdi
|
||||
pushq %rsi
|
||||
|
@ -80,8 +80,7 @@ ENTRY(sigsetjmp)
|
||||
ret
|
||||
END(sigsetjmp)
|
||||
|
||||
.weak CNAME(siglongjmp)
|
||||
.set CNAME(siglongjmp),CNAME(__siglongjmp)
|
||||
WEAK_REFERENCE(__siglongjmp, siglongjmp)
|
||||
ENTRY(__siglongjmp)
|
||||
cmpl $0,88(%rdi)
|
||||
jz 2f
|
||||
|
@ -34,10 +34,8 @@ __FBSDID("$FreeBSD$");
|
||||
* Otherwise, the setcontext() syscall will return here and we'll
|
||||
* pop off the return address and go to the *setcontext* call.
|
||||
*/
|
||||
.weak _getcontext
|
||||
.set _getcontext,__sys_getcontext
|
||||
.weak getcontext
|
||||
.set getcontext,__sys_getcontext
|
||||
WEAK_REFERENCE(__sys_getcontext, _getcontext)
|
||||
WEAK_REFERENCE(__sys_getcontext, getcontext)
|
||||
ENTRY(__sys_getcontext)
|
||||
movq (%rsp),%rsi /* save getcontext return address */
|
||||
mov $SYS_getcontext,%rax
|
||||
|
@ -38,10 +38,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.weak _pipe
|
||||
.set _pipe,__sys_pipe
|
||||
.weak pipe
|
||||
.set pipe,__sys_pipe
|
||||
WEAK_REFERENCE(__sys_pipe, _pipe)
|
||||
WEAK_REFERENCE(__sys_pipe, pipe)
|
||||
ENTRY(__sys_pipe)
|
||||
mov $SYS_pipe,%rax
|
||||
KERNCALL
|
||||
|
@ -38,10 +38,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.weak _reboot
|
||||
.set _reboot,__sys_reboot
|
||||
.weak reboot
|
||||
.set reboot,__sys_reboot
|
||||
WEAK_REFERENCE(__sys_reboot, _reboot)
|
||||
WEAK_REFERENCE(__sys_reboot, reboot)
|
||||
ENTRY(__sys_reboot)
|
||||
mov $SYS_reboot,%rax
|
||||
KERNCALL
|
||||
|
@ -40,10 +40,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
.globl CNAME(_logname_valid) /* in _getlogin() */
|
||||
|
||||
.weak _setlogin
|
||||
.set _setlogin,__sys_setlogin
|
||||
.weak setlogin
|
||||
.set setlogin,__sys_setlogin
|
||||
WEAK_REFERENCE(__sys_setlogin, _setlogin)
|
||||
WEAK_REFERENCE(__sys_setlogin, setlogin)
|
||||
ENTRY(__sys_setlogin)
|
||||
mov $SYS_setlogin,%rax
|
||||
KERNCALL
|
||||
|
@ -38,10 +38,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.weak _vfork
|
||||
.set _vfork,__sys_vfork
|
||||
.weak vfork
|
||||
.set vfork,__sys_vfork
|
||||
WEAK_REFERENCE(__sys_vfork, _vfork)
|
||||
WEAK_REFERENCE(__sys_vfork, vfork)
|
||||
ENTRY(__sys_vfork)
|
||||
popq %rsi /* fetch return address (%rsi preserved) */
|
||||
mov $SYS_vfork,%rax
|
||||
|
@ -77,6 +77,15 @@
|
||||
#endif
|
||||
|
||||
#define END(x) .size x, . - x
|
||||
/*
|
||||
* WEAK_REFERENCE(): create a weak reference alias from sym.
|
||||
* The macro is not a general asm macro that takes arbitrary names,
|
||||
* but one that takes only C names. It does the non-null name
|
||||
* translation inside the macro.
|
||||
*/
|
||||
#define WEAK_REFERENCE(sym, alias) \
|
||||
.weak CNAME(alias); \
|
||||
.equ CNAME(alias),CNAME(sym)
|
||||
|
||||
#define RCSID(x) .text; .asciz x
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user