Do not save/restore the TLS pointer on context switch for armv6. The
pointer cannot be changed directly by userland code on armv6 (it can be on armv4), so there's no need to save/restore. Submitted by: Michal Meloun
This commit is contained in:
parent
8533535e11
commit
22da00a29e
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -145,7 +145,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
|
||||
}
|
||||
|
||||
@ -274,7 +274,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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user