From 480a728dee614ba5f8afda7d09ca6be8ffa5e860 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sat, 31 May 2003 21:14:25 +0000 Subject: [PATCH] Implement cpu_set_upcall(). Required by libthr and used by thr_create(2). This implementation is so far only compile tested. But since this is also the last of the functions required to support libthr, we're now functionally complete (for some weird definition of functionally; and complete). Runtime testing can commence. --- sys/ia64/ia64/vm_machdep.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c index d0ecb6e667a..28227642a5d 100644 --- a/sys/ia64/ia64/vm_machdep.c +++ b/sys/ia64/ia64/vm_machdep.c @@ -114,6 +114,28 @@ cpu_thread_setup(struct thread *td) void cpu_set_upcall(struct thread *td, void *pcb) { + struct pcb *pcb2; + struct trapframe *tf; + + pcb2 = td->td_pcb; + bcopy(pcb, pcb2, sizeof(*pcb2)); + + tf = (struct trapframe *)pcb2 - 1; + td->td_frame = tf; + tf->tf_length = sizeof(struct trapframe); + tf->tf_flags = FRAME_SYSCALL; + + tf->tf_scratch.gr8 = 0; + tf->tf_scratch.gr9 = 1; + tf->tf_scratch.gr10 = 0; + + /* XXX */ + pcb2->pcb_special.bspstore = td->td_kstack + tf->tf_special.ndirty; + pcb2->pcb_special.pfs = 0; + pcb2->pcb_current_pmap = vmspace_pmap(td->td_proc->p_vmspace); + pcb2->pcb_special.sp = (uintptr_t)tf - 16; + pcb2->pcb_special.rp = FDESC_FUNC(fork_trampoline); + cpu_set_fork_handler(td, (void (*)(void*))fork_return, td); } void