Change interface between cpu_fork() and proc_trampoline() so that `tf_pc'
(instead of `tf_npc') contains the user-space return address. This ensures entering the signal trampoline code correctly in case we take handled signal during child_return().
This commit is contained in:
parent
95c845e4fc
commit
76634d2635
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.s,v 1.149 2001/12/11 03:46:59 uwe Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.150 2001/12/30 16:41:29 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Paul Kranenburg
|
||||
|
@ -4837,14 +4837,14 @@ ENTRY(proc_trampoline)
|
|||
mov %l1, %o0
|
||||
|
||||
/*
|
||||
* Here we finish up as in syscall, but simplified. We need to
|
||||
* fiddle pc and npc a bit, as execve() / setregs() will have
|
||||
* set npc only, anticipating that trap.c will advance past the
|
||||
* trap instruction; but we bypass that, so we must do it manually.
|
||||
* Here we finish up as in syscall, but simplified.
|
||||
* cpu_fork() or sendsig() (if we took a pending signal
|
||||
* in child_return()) will have set the user-space return
|
||||
* address in tf_pc. In both cases, %npc should be %pc + 4.
|
||||
*/
|
||||
mov PSR_S, %l0 ! user psr (no need to load it)
|
||||
!?wr %g0, 2, %wim ! %wim = 2
|
||||
ld [%sp + CCFSZ + 8], %l1 ! pc = tf->tf_npc from execve/fork
|
||||
ld [%sp + CCFSZ + 4], %l1 ! pc = tf->tf_pc from cpu_fork()
|
||||
b return_from_syscall
|
||||
add %l1, 4, %l2 ! npc = pc+4
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_machdep.c,v 1.60 2001/09/10 21:19:25 chris Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.61 2001/12/30 16:41:29 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
|
@ -266,7 +266,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
|
|||
/* Duplicate efforts of syscall(), but slightly differently */
|
||||
if (tf2->tf_global[1] & SYSCALL_G2RFLAG) {
|
||||
/* jmp %g2 (or %g7, deprecated) on success */
|
||||
tf2->tf_npc = tf2->tf_global[2];
|
||||
tf2->tf_pc = tf2->tf_global[2];
|
||||
} else {
|
||||
/*
|
||||
* old system call convention: clear C on success
|
||||
|
@ -274,7 +274,9 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
|
|||
* returning to user mode.
|
||||
*/
|
||||
/*tf2->tf_psr &= ~PSR_C; -* success */
|
||||
tf2->tf_pc = tf2->tf_npc;
|
||||
}
|
||||
/* proc_trampoline() will do npc = pc + 4 */
|
||||
|
||||
/* Set return values in child mode */
|
||||
tf2->tf_out[0] = 0;
|
||||
|
|
Loading…
Reference in New Issue