diff options
author | ian <ian@FreeBSD.org> | 2015-05-23 23:27:00 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2015-05-23 23:27:00 +0000 |
commit | 45e1cf60a142653a0d963cfcc63e4ecd0823a7b5 (patch) | |
tree | 18ad62c7bf65bb7cdf943aa6bd8e68f54657dec0 /sys/arm | |
parent | 9e0f8345df115d65713e07d4c02059227fddf47f (diff) | |
download | FreeBSD-src-45e1cf60a142653a0d963cfcc63e4ecd0823a7b5.zip FreeBSD-src-45e1cf60a142653a0d963cfcc63e4ecd0823a7b5.tar.gz |
MFC r280278, r280402:
Allow to override default kernel virtual address assignment on ARM.
Do not save/restore the TLS pointer on context switch for armv6.
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/swtch.S | 11 | ||||
-rw-r--r-- | sys/arm/arm/sys_machdep.c | 15 | ||||
-rw-r--r-- | sys/arm/arm/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/arm/include/vmparam.h | 2 |
4 files changed, 14 insertions, 18 deletions
diff --git a/sys/arm/arm/swtch.S b/sys/arm/arm/swtch.S index e9d6f61..6972c50 100644 --- a/sys/arm/arm/swtch.S +++ b/sys/arm/arm/swtch.S @@ -255,7 +255,7 @@ ENTRY(cpu_switch) mov r4, r0 /* Save the old thread. */ #ifdef ARM_TP_ADDRESS - /* Store the old tp */ + /* Store the old tp; userland can change it on armv4. */ ldr r3, =ARM_TP_ADDRESS ldr r9, [r3] str r9, [r0, #(TD_MD + MD_TP)] @@ -272,11 +272,10 @@ ENTRY(cpu_switch) ldr r9, [r1, #(TD_MD + MD_RAS_END)] str r9, [r3, #8] #else - /* Store the old tp */ - mrc p15, 0, r9, c13, c0, 3 - str r9, [r0, #(TD_MD + MD_TP)] - - /* Set the new tp */ + /* + * Set new tp. No need to store the old one first, userland can't + * change it directly on armv6. + */ ldr r9, [r1, #(TD_MD + MD_TP)] mcr p15, 0, r9, c13, c0, 3 #endif diff --git a/sys/arm/arm/sys_machdep.c b/sys/arm/arm/sys_machdep.c index e860e5d..b12cdd5 100644 --- a/sys/arm/arm/sys_machdep.c +++ b/sys/arm/arm/sys_machdep.c @@ -84,13 +84,11 @@ static int arm32_set_tp(struct thread *td, void *args) { - if (td != curthread) - td->td_md.md_tp = (register_t)args; - else + td->td_md.md_tp = (register_t)args; #ifndef ARM_TP_ADDRESS - set_tls(args); + set_tls(args); #else - *(register_t *)ARM_TP_ADDRESS = (register_t)args; + *(register_t *)ARM_TP_ADDRESS = (register_t)args; #endif return (0); } @@ -99,13 +97,10 @@ static int arm32_get_tp(struct thread *td, void *args) { - if (td != curthread) - td->td_retval[0] = td->td_md.md_tp; - else #ifndef ARM_TP_ADDRESS - td->td_retval[0] = (register_t)get_tls(); + td->td_retval[0] = td->td_md.md_tp; #else - td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS; + td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS; #endif return (0); } diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 9f730d4..39b47e8 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -182,7 +182,7 @@ cpu_fork(register struct thread *td1, register struct proc *p2, #ifdef ARM_TP_ADDRESS td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS; #else - td2->td_md.md_tp = (register_t) get_tls(); + td2->td_md.md_tp = td1->td_md.md_tp; #endif } @@ -411,7 +411,7 @@ cpu_set_user_tls(struct thread *td, void *tls_base) #ifdef ARM_TP_ADDRESS *(register_t *)ARM_TP_ADDRESS = (register_t)tls_base; #else - set_tls((void *)tls_base); + set_tls(tls_base); #endif critical_exit(); } diff --git a/sys/arm/include/vmparam.h b/sys/arm/include/vmparam.h index 1c6085e..6ebdd0c 100644 --- a/sys/arm/include/vmparam.h +++ b/sys/arm/include/vmparam.h @@ -68,7 +68,9 @@ * The line between user space and kernel space * Mappings >= KERNEL_BASE are constant across all processes */ +#ifndef KERNBASE #define KERNBASE 0xc0000000 +#endif /* * max number of non-contig chunks of physical RAM you can have |