summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2005-04-23 02:32:32 +0000
committerdavidxu <davidxu@FreeBSD.org>2005-04-23 02:32:32 +0000
commit2155a04472ed5deabbc69faec29261b585206f8b (patch)
treee8274d07cfba3da625ef093c47b41f515a3a074f /sys/arm
parent71a428392919fe740ff01650702e52473e5c3dbc (diff)
downloadFreeBSD-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/arm')
-rw-r--r--sys/arm/arm/vm_machdep.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c
index a90cf62..9c43362 100644
--- a/sys/arm/arm/vm_machdep.c
+++ b/sys/arm/arm/vm_machdep.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sf_buf.h>
#include <machine/cpu.h>
#include <machine/pcb.h>
+#include <machine/sysarch.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <sys/lock.h>
@@ -279,18 +280,32 @@ cpu_set_upcall(struct thread *td, struct thread *td0)
* in thread_userret() itself can be done as well.
*/
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 = td->td_frame;
- tf->tf_usr_sp = ((int)ku->ku_stack.ss_sp + ku->ku_stack.ss_size
+ tf->tf_usr_sp = ((int)stack->ss_sp + stack->ss_size
- sizeof(struct trapframe)) & ~7;
- tf->tf_pc = (int)ku->ku_func;
- tf->tf_r0 = (int)ku->ku_mailbox;
+ tf->tf_pc = (int)entry;
+ tf->tf_r0 = (int)arg;
tf->tf_spsr = PSR_USR32_MODE;
}
void
+cpu_set_user_tls(struct thread *td, void *tls_base)
+{
+
+ if (td != curthread)
+ td->td_md.md_tp = tls_base;
+ else {
+ critical_enter();
+ *(void **)ARM_TP_ADDRESS = tls_base;
+ critical_exit();
+ }
+}
+
+void
cpu_thread_exit(struct thread *td)
{
}
OpenPOWER on IntegriCloud