Use the new thunk_makecontext() scheme with function and upto 3 aguments

This commit is contained in:
reinoud 2011-09-09 20:06:04 +00:00
parent ed2801c109
commit a1730aac72
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.42 2011/09/09 18:41:16 reinoud Exp $ */
/* $NetBSD: cpu.c,v 1.43 2011/09/09 20:06:04 reinoud Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@ -30,7 +30,7 @@
#include "opt_hz.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.42 2011/09/09 18:41:16 reinoud Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.43 2011/09/09 20:06:04 reinoud Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -315,20 +315,20 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
if (thunk_getcontext(&pcb2->pcb_ucp))
panic("getcontext failed");
/* set up the ucontext for the userland */
/* set up the ucontext for the userland switch */
pcb2->pcb_ucp.uc_stack.ss_sp = stack;
pcb2->pcb_ucp.uc_stack.ss_size = stacksize;
pcb2->pcb_ucp.uc_link = &pcb2->pcb_userland_ucp;
pcb2->pcb_ucp.uc_flags = _UC_STACK | _UC_CPU;
thunk_makecontext(&pcb2->pcb_ucp, (void (*)(void))cpu_lwp_trampoline,
2, func, arg);
thunk_makecontext(&pcb2->pcb_ucp, (void (*)(void)) cpu_lwp_trampoline,
2, func, arg, NULL);
/* set up the ucontext for the syscall */
pcb2->pcb_syscall_ucp.uc_flags = _UC_CPU;
pcb2->pcb_syscall_ucp.uc_link = &pcb2->pcb_userland_ucp;
pcb2->pcb_syscall_ucp.uc_stack.ss_size = 0; /* no stack move */
thunk_makecontext(&pcb2->pcb_syscall_ucp, (void (*)(void)) syscall,
0, NULL, NULL);
0, NULL, NULL, NULL);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.28 2011/09/09 12:44:27 reinoud Exp $ */
/* $NetBSD: machdep.c,v 1.29 2011/09/09 20:06:04 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <reinoud@netbsd.org>
@ -32,7 +32,7 @@
#include "opt_urkelvisor.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.28 2011/09/09 12:44:27 reinoud Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.29 2011/09/09 20:06:04 reinoud Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -200,7 +200,7 @@ setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
ucp->uc_stack.ss_sp = (void *) (stack-4); /* to prevent clearing */
ucp->uc_stack.ss_size = 0; //pack->ep_ssize;
thunk_makecontext(ucp, (void *) pack->ep_entry, 0, NULL, NULL);
thunk_makecontext(ucp, (void *) pack->ep_entry, 0, NULL, NULL, NULL);
/* patch up */
reg[ 8] = l->l_proc->p_psstrp; /* _REG_EBX */