arm: Provide TLS_BASE virtual register
This commit provides a universal TLS_BASE virtual register on ARM, similar to as exists on x86. Depending on the precise configuration this virtual register maps to a different register * aarch64: TPIDRURW is used for the TLS_BASE and is already declared and being saved and restored on context switches, so this just adds TLS_BASE as an alias of it * armv6: Has no hardware register for use for a TLS_BASE, and so the virtual register gets stored into the globals frame * armv7+: TPIDURO is used for TLS_BASE and so the restore paths are modified to load TLS_BASE into it
This commit is contained in:
parent
89297f96e0
commit
7d7f338b2b
5 changed files with 9 additions and 3 deletions
|
|
@ -135,6 +135,7 @@ fastpath_restore(word_t badge, word_t msgInfo, tcb_t *cur_thread)
|
|||
|
||||
#ifndef CONFIG_ARCH_ARM_V6
|
||||
writeTPIDRURW(getRegister(NODE_STATE(ksCurThread), TPIDRURW));
|
||||
writeTPIDRURO(getRegister(NODE_STATE(ksCurThread), TLS_BASE));
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_FPU
|
||||
|
|
|
|||
|
|
@ -95,13 +95,14 @@ enum _register {
|
|||
CPSR = 16,
|
||||
|
||||
FaultInstruction = 17,
|
||||
TLS_BASE = 18,
|
||||
#ifndef CONFIG_ARCH_ARM_V6
|
||||
/* user readable/writable thread ID register.
|
||||
* name comes from the ARM manual */
|
||||
TPIDRURW = 18,
|
||||
n_contextRegisters = 19,
|
||||
TPIDRURW = 19,
|
||||
n_contextRegisters = 20,
|
||||
#else
|
||||
n_contextRegisters = 18,
|
||||
n_contextRegisters = 19,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ enum _register {
|
|||
/* user readable/writable thread ID register.
|
||||
* name comes from the ARM manual */
|
||||
TPIDRURW = 35,
|
||||
TLS_BASE = 35,
|
||||
n_contextRegisters = 36,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ void VISIBLE NORETURN restore_user_context(void)
|
|||
|
||||
#ifndef CONFIG_ARCH_ARM_V6
|
||||
writeTPIDRURW(getRegister(NODE_STATE(ksCurThread), TPIDRURW));
|
||||
writeTPIDRURO(getRegister(NODE_STATE(ksCurThread), TLS_BASE));
|
||||
#endif
|
||||
|
||||
if (config_set(CONFIG_ARM_HYPERVISOR_SUPPORT)) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ Arch_switchToThread(tcb_t *tcb)
|
|||
setVMRoot(tcb);
|
||||
#if defined(CONFIG_IPC_BUF_GLOBALS_FRAME)
|
||||
*armKSGlobalsFrame = tcb->tcbIPCBuffer;
|
||||
armKSGlobalsFrame[1] = getRegister(tcb, TLS_BASE);
|
||||
#endif
|
||||
clearExMonitor();
|
||||
}
|
||||
|
|
@ -45,6 +46,7 @@ Arch_switchToIdleThread(void)
|
|||
|
||||
#ifdef CONFIG_IPC_BUF_GLOBALS_FRAME
|
||||
*armKSGlobalsFrame = 0;
|
||||
armKSGlobalsFrame[1] = 0;
|
||||
#endif /* CONFIG_IPC_BUF_GLOBALS_FRAME */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue