Restored FAKE_MCOUNT() and MEXITCOUNT invocations and adjusted them for
amd64 as necessary. This is routine, except: - the FAKE_MCOUNT($bintr) in doreti was missing the '$'. This gave a a garbage address made up of padding bytes (with the nop byte 0x90 as the MSB) instead of the intended address of bintr. This accidentally worked on i386's because (0x90 << 24) is close enough to bintr, but it doesn't work on amd64's because (0x90 << 56) is much further away from bintr. - the FAKE_MCOUNT($btrap) in calltrap was similarly broken. It hasn't been needed since FreeBSD-1, so just delete it.
This commit is contained in:
parent
29d81b7db1
commit
03d5ca33db
@ -163,8 +163,10 @@ alltraps_pushregs_no_rdi:
|
||||
movq %r14,TF_R14(%rsp)
|
||||
movq %r15,TF_R15(%rsp)
|
||||
alltraps_with_regs_pushed:
|
||||
FAKE_MCOUNT(TF_RIP(%rsp))
|
||||
calltrap:
|
||||
call trap
|
||||
MEXITCOUNT
|
||||
jmp doreti /* Handle any pending ASTs */
|
||||
|
||||
/*
|
||||
@ -239,6 +241,7 @@ IDTVEC(fast_syscall)
|
||||
movq %r13,TF_R13(%rsp) /* C preserved */
|
||||
movq %r14,TF_R14(%rsp) /* C preserved */
|
||||
movq %r15,TF_R15(%rsp) /* C preserved */
|
||||
FAKE_MCOUNT(TF_RIP(%rsp))
|
||||
call syscall
|
||||
movq PCPU(CURPCB),%rax
|
||||
testq $PCB_FULLCTX,PCB_FLAGS(%rax)
|
||||
@ -253,6 +256,7 @@ IDTVEC(fast_syscall)
|
||||
call ast
|
||||
jmp 1b
|
||||
2: /* restore preserved registers */
|
||||
MEXITCOUNT
|
||||
movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */
|
||||
movq TF_RSI(%rsp),%rsi /* bonus: preserve arg 2 */
|
||||
movq TF_RDX(%rsp),%rdx /* return value 2 */
|
||||
@ -271,6 +275,7 @@ IDTVEC(fast_syscall)
|
||||
sysretq
|
||||
3: /* Requested full context restore, use doreti for that */
|
||||
andq $~PCB_FULLCTX,PCB_FLAGS(%rax)
|
||||
MEXITCOUNT
|
||||
jmp doreti
|
||||
|
||||
/*
|
||||
@ -286,6 +291,7 @@ ENTRY(fork_trampoline)
|
||||
movq %rbx, %rsi /* arg1 */
|
||||
movq %rsp, %rdx /* trapframe pointer */
|
||||
call fork_exit
|
||||
MEXITCOUNT
|
||||
jmp doreti /* Handle any ASTs */
|
||||
|
||||
.data
|
||||
@ -301,6 +307,7 @@ ENTRY(fork_trampoline)
|
||||
.globl doreti
|
||||
.type doreti,@function
|
||||
doreti:
|
||||
FAKE_MCOUNT($bintr) /* init "from" bintr -> doreti */
|
||||
/*
|
||||
* Check if ASTs can be handled now.
|
||||
*/
|
||||
@ -330,6 +337,7 @@ doreti_ast:
|
||||
* registers. The fault is handled in trap.c.
|
||||
*/
|
||||
doreti_exit:
|
||||
MEXITCOUNT
|
||||
movq TF_RDI(%rsp),%rdi
|
||||
movq TF_RSI(%rsp),%rsi
|
||||
movq TF_RDX(%rsp),%rdx
|
||||
|
Loading…
Reference in New Issue
Block a user