-/* $OpenBSD: eh_common.S,v 1.65 2023/10/24 13:20:10 claudio Exp $ */
+/* $OpenBSD: eh_common.S,v 1.66 2024/06/05 19:22:04 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
br 1b
/*
- * void proc_trampoline(void (*func)(void *), void *proc)
+ * void proc_trampoline()
*
* When a process setup by cpu_fork() resumes, it will find itself in
- * proc_trampoline, with r31 pointing to a ksigframe. proc_trampoline will
- * load func and proc values from ksigframe, call the function, and on return
- * pop off the ksigframe. Then, it will return to userland.
+ * proc_trampoline, with r14 and r15 referring to a function and its
+ * argument. proc_trampoline will call the function, and return to userland.
*/
ENTRY(proc_trampoline)
bsr proc_trampoline_mi
- ld %r1, %r31, 0 /* load func */
- ld %r2, %r31, 4 /* load arg */
- jsr.n %r1
- addu %r31, %r31, 8 /* release ksigframe */
+ jsr.n %r14
+ or %r2, %r15, 0 /* arg */
/*
* Load FPTR with a pointer to the trap frame for the current proc and
-/* $OpenBSD: vm_machdep.c,v 1.29 2024/05/21 23:16:06 jsg Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.30 2024/06/05 19:22:04 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
cpu_fork(struct proc *p1, struct proc *p2, void *stack, void *tcb,
void (*func)(void *), void *arg)
{
- struct ksigframe {
- void (*func)(void *);
- void *arg;
- } *ksfp;
extern void proc_trampoline(void);
+ struct m88100_pcb *mdpcb = &p2->p_addr->u_pcb.kernel_state;
/* Copy pcb from p1 to p2. */
if (p1 == curproc) {
if (tcb != NULL)
USER_REGS(p2)->r[27] = (u_int)tcb;
- ksfp = (struct ksigframe *)((char *)p2->p_addr + USPACE) - 1;
- ksfp->func = func;
- ksfp->arg = arg;
-
/*
- * When this process resumes, r31 will be ksfp and
- * the process will be at the beginning of proc_trampoline().
- * proc_trampoline will execute the function func, pop off
- * ksfp frame, and resume to userland.
+ * When this process resumes, the process will be at the beginning
+ * of proc_trampoline(). proc_trampoline will execute the function
+ * func and resume to userland.
*/
- p2->p_addr->u_pcb.kernel_state.pcb_sp = (u_int)ksfp;
- p2->p_addr->u_pcb.kernel_state.pcb_pc = (u_int)proc_trampoline;
+ mdpcb->pcb_r14 = (u_int)func;
+ mdpcb->pcb_r15 = (u_int)arg;
+ mdpcb->pcb_sp = (u_int)((char *)p2->p_addr + USPACE);
+ mdpcb->pcb_pc = (u_int)proc_trampoline;
}
/*