summaryrefslogtreecommitdiffstats
path: root/sys/ia64
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-06-28 09:22:25 +0000
committermarcel <marcel@FreeBSD.org>2003-06-28 09:22:25 +0000
commit96d5411913b53996217bc5657defd02e8efc2005 (patch)
treeeef1d36f8dd82dda99be57c7053e81c1953e7847 /sys/ia64
parent47cfe5988bf62d105571647ccaf6993bb0fedff5 (diff)
downloadFreeBSD-src-96d5411913b53996217bc5657defd02e8efc2005.zip
FreeBSD-src-96d5411913b53996217bc5657defd02e8efc2005.tar.gz
Implement cpu_set_upcall_kse(). Elementary testing shows that this
function behaves correctly in principle, but is not expected to be 100% complete. In any case, with this commit we have KSE ported enough to start runtime testing with threaded applications and fix whatever bugs or omissions we encounter. Yay!
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/ia64/vm_machdep.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c
index a9f927a..2aa78fd 100644
--- a/sys/ia64/ia64/vm_machdep.c
+++ b/sys/ia64/ia64/vm_machdep.c
@@ -149,6 +149,32 @@ cpu_set_upcall(struct thread *td, struct thread *td0)
void
cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku)
{
+ struct ia64_fdesc *fd;
+ struct trapframe *tf;
+ uint64_t stack;
+
+ tf = td->td_frame;
+ KASSERT(tf->tf_flags & FRAME_SYSCALL, ("foo"));
+ bzero(&tf->tf_special, sizeof(tf->tf_special));
+ /*
+ * ku->ku_func of course points to a function descriptor. Fetch the
+ * code address and GP value from userland.
+ */
+ fd = ku->ku_func;
+ tf->tf_special.rp = fuword(&fd->func);
+ tf->tf_special.gp = fuword(&fd->gp);
+ tf->tf_special.pfs = (3UL<<62) | (1UL<<7) | 1UL;
+ stack = (uint64_t)ku->ku_stack.ss_sp;
+ tf->tf_special.bspstore = stack + 8;
+ tf->tf_special.sp = (stack + ku->ku_stack.ss_size - 16) & ~15;
+ tf->tf_special.rsc = 0xf;
+ tf->tf_special.fpsr = IA64_FPSR_DEFAULT;
+ tf->tf_special.psr = IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT |
+ IA64_PSR_DT | IA64_PSR_RT | IA64_PSR_DFH | IA64_PSR_BN |
+ IA64_PSR_CPL_USER;
+
+ /* XXX assumes that (bspstore & 0x1f8) < 0x1e0. */
+ suword((caddr_t)tf->tf_special.bspstore - 8, (uint64_t)ku->ku_mailbox);
}
/*
OpenPOWER on IntegriCloud