summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2016-01-28 22:57:09 +0000
committerbrooks <brooks@FreeBSD.org>2016-01-28 22:57:09 +0000
commit7bb73c592a68b3ee7029bccf147c65d109d7f069 (patch)
treefa8ed6baabd6d68e741a24b2dbeab0db324a176c /lib/libc
parent7481d4e82bfe476abd07fb792c0dd88364e99c35 (diff)
downloadFreeBSD-src-7bb73c592a68b3ee7029bccf147c65d109d7f069.zip
FreeBSD-src-7bb73c592a68b3ee7029bccf147c65d109d7f069.tar.gz
MFC r294515:
Fix the implementations of PSEUDO_NOERROR and PSEUDO. The PSEUDO* macros should not declare <syscall>, only _<syscall> and __sys_<syscall>. This was causing the interposing C wrappers to be ignored due to link order. Reviewed by: kib Obtained from: CheriBSD (4e8e13c90fc6a80e1520de44a6864cfd78b3b56d) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D4097
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/mips/SYS.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/lib/libc/mips/SYS.h b/lib/libc/mips/SYS.h
index 10205b8..ceb6812 100644
--- a/lib/libc/mips/SYS.h
+++ b/lib/libc/mips/SYS.h
@@ -100,13 +100,31 @@
* Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
*/
#define RSYSCALL_NOERROR(x) \
- PSEUDO_NOERROR(x)
+LEAF(__sys_ ## x); \
+ .weak _C_LABEL(x); \
+ _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
+ .weak _C_LABEL(__CONCAT(_,x)); \
+ _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
+ SYSTRAP(x); \
+ j ra; \
+END(__sys_ ## x)
/*
* Do a normal syscall.
*/
#define RSYSCALL(x) \
- PSEUDO(x)
+LEAF(__sys_ ## x); \
+ .weak _C_LABEL(x); \
+ _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
+ .weak _C_LABEL(__CONCAT(_,x)); \
+ _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
+ PIC_PROLOGUE(__sys_ ## x); \
+ SYSTRAP(x); \
+ bne a3,zero,err; \
+ PIC_RETURN(); \
+err: \
+ PIC_TAILCALL(__cerror); \
+END(__sys_ ## x)
/*
* Do a renamed or pseudo syscall (e.g., _exit()), where the entrypoint
@@ -114,18 +132,14 @@
*/
#define PSEUDO_NOERROR(x) \
LEAF(__sys_ ## x); \
- .weak _C_LABEL(x); \
- _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
.weak _C_LABEL(__CONCAT(_,x)); \
_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
SYSTRAP(x); \
j ra; \
- END(__sys_ ## x)
+END(__sys_ ## x)
#define PSEUDO(x) \
LEAF(__sys_ ## x); \
- .weak _C_LABEL(x); \
- _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
.weak _C_LABEL(__CONCAT(_,x)); \
_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
PIC_PROLOGUE(__sys_ ## x); \
OpenPOWER on IntegriCloud