Change the syscall stub branch orders so that the static branch prediction
will assume that syscalls will succeed rather than fail.
This commit is contained in:
parent
ce2cfa1a8b
commit
025be3a06b
@ -41,26 +41,23 @@
|
||||
#include <machine/asm.h>
|
||||
|
||||
#ifdef PIC
|
||||
#define SYSCALL(x) 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; \
|
||||
jmp *%rcx; \
|
||||
ENTRY(__CONCAT(__sys_,x)); \
|
||||
#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),%rax; KERNCALL; jb 2b
|
||||
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
|
||||
2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx
|
||||
#else
|
||||
#define SYSCALL(x) 2: jmp HIDENAME(cerror); \
|
||||
ENTRY(__CONCAT(__sys_,x)); \
|
||||
#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),%rax; KERNCALL; jb 2b
|
||||
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
|
||||
2: jmp HIDENAME(cerror)
|
||||
#endif
|
||||
|
||||
#define RSYSCALL(x) SYSCALL(x); ret
|
||||
|
||||
#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
|
||||
.weak CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
|
||||
|
@ -42,8 +42,22 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
SYSCALL(pipe)
|
||||
.weak _pipe
|
||||
.set _pipe,__sys_pipe
|
||||
.weak pipe
|
||||
.set pipe,__sys_pipe
|
||||
ENTRY(__sys_pipe)
|
||||
mov $SYS_pipe,%rax
|
||||
KERNCALL
|
||||
jb 1f
|
||||
movl %eax,(%rdi) /* %rdi is preserved by syscall */
|
||||
movl %edx,4(%rdi)
|
||||
movq $0,%rax
|
||||
ret
|
||||
1:
|
||||
#ifdef PIC
|
||||
movq PIC_GOT(HIDENAME(cerror)),%rdx
|
||||
jmp *%rdx
|
||||
#else
|
||||
jmp HIDENAME(cerror)
|
||||
#endif
|
||||
|
@ -42,5 +42,19 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
SYSCALL(reboot)
|
||||
.weak _reboot
|
||||
.set _reboot,__sys_reboot
|
||||
.weak reboot
|
||||
.set reboot,__sys_reboot
|
||||
ENTRY(__sys_reboot)
|
||||
mov $SYS_reboot,%rax
|
||||
KERNCALL
|
||||
jb 1f
|
||||
iretq
|
||||
1:
|
||||
#ifdef PIC
|
||||
movq PIC_GOT(HIDENAME(cerror)),%rdx
|
||||
jmp *%rdx
|
||||
#else
|
||||
jmp HIDENAME(cerror)
|
||||
#endif
|
||||
|
@ -44,7 +44,14 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
.globl CNAME(_logname_valid) /* in _getlogin() */
|
||||
|
||||
SYSCALL(setlogin)
|
||||
.weak _setlogin
|
||||
.set _setlogin,__sys_setlogin
|
||||
.weak setlogin
|
||||
.set setlogin,__sys_setlogin
|
||||
ENTRY(__sys_setlogin)
|
||||
mov $SYS_setlogin,%rax
|
||||
KERNCALL
|
||||
jb 1f
|
||||
#ifdef PIC
|
||||
movq PIC_GOT(CNAME(_logname_valid)),%rdx
|
||||
movl $0,(%rdx)
|
||||
@ -52,3 +59,10 @@ SYSCALL(setlogin)
|
||||
movl $0,CNAME(_logname_valid)(%rip)
|
||||
#endif
|
||||
ret /* setlogin(name) */
|
||||
1:
|
||||
#ifdef PIC
|
||||
movq PIC_GOT(HIDENAME(cerror)),%rdx
|
||||
jmp *%rdx
|
||||
#else
|
||||
jmp HIDENAME(cerror)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user