diff options
author | davidxu <davidxu@FreeBSD.org> | 2005-04-23 02:32:32 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2005-04-23 02:32:32 +0000 |
commit | 2155a04472ed5deabbc69faec29261b585206f8b (patch) | |
tree | e8274d07cfba3da625ef093c47b41f515a3a074f /sys/powerpc/aim/vm_machdep.c | |
parent | 71a428392919fe740ff01650702e52473e5c3dbc (diff) | |
download | FreeBSD-src-2155a04472ed5deabbc69faec29261b585206f8b.zip FreeBSD-src-2155a04472ed5deabbc69faec29261b585206f8b.tar.gz |
Change cpu_set_kse_upcall to more generic style, so we can reuse it
in other codes. Add cpu_set_user_tls, use it to tweak user register
and setup user TLS. I ever wanted to merge it into cpu_set_kse_upcall,
but since cpu_set_kse_upcall is also used by M:N threads which may
not need this feature, so I wrote a separated cpu_set_user_tls.
Diffstat (limited to 'sys/powerpc/aim/vm_machdep.c')
-rw-r--r-- | sys/powerpc/aim/vm_machdep.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c index 71c5c79..60274f3 100644 --- a/sys/powerpc/aim/vm_machdep.c +++ b/sys/powerpc/aim/vm_machdep.c @@ -333,23 +333,31 @@ cpu_set_upcall(struct thread *td, struct thread *td0) } void -cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku) +cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, + stack_t *stack) { struct trapframe *tf; uint32_t sp; tf = td->td_frame; /* align stack and alloc space for frame ptr and saved LR */ - sp = ((uint32_t)ku->ku_stack.ss_sp + ku->ku_stack.ss_size + sp = ((uint32_t)stack->ss_sp + stack->ss_size - 2*sizeof(u_int32_t)) & ~0x1f; bzero(tf, sizeof(struct trapframe)); tf->fixreg[1] = (register_t)sp; - tf->fixreg[3] = (register_t)ku->ku_mailbox; - tf->srr0 = (register_t)ku->ku_func; + tf->fixreg[3] = (register_t)arg; + tf->srr0 = (register_t)entry; tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT; td->td_pcb->pcb_flags = 0; - td->td_retval[0] = (register_t)ku->ku_func; + td->td_retval[0] = (register_t)entry; td->td_retval[1] = 0; } + +void +cpu_set_user_tls(struct thread *td, void *tls_base) +{ + + td->td_frame->fixreg[2] = (register_t)tls_base; +} |