sparc: implement thread local storage support

The sparc ABI reserves the g7 register for this.

Change-Id: I93b81ecef72cde859972ef7b7f6b9991d35f9f29
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3583
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
PulkoMandy
2021-01-01 00:45:13 +00:00
committed by waddlesplash
parent c99c0d9d5a
commit 6fd0953545
2 changed files with 9 additions and 8 deletions
@@ -16,17 +16,11 @@
extern "C" {
#endif
void ppc_push_iframe(struct iframe_stack *stack, struct iframe *frame);
void ppc_pop_iframe(struct iframe_stack *stack);
struct iframe *ppc_get_user_iframe(void);
static inline Thread *
arch_thread_get_current_thread(void)
{
Thread *t;
//asm volatile("mfsprg2 %0" : "=r"(t));
t = NULL;
asm volatile("mov %%g7, %0" : "=r"(t));
return t;
}
@@ -34,7 +28,7 @@ arch_thread_get_current_thread(void)
static inline void
arch_thread_set_current_thread(Thread *t)
{
//asm volatile("mtsprg2 %0" : : "r"(t));
asm volatile("mov %0,%%g7" : : "r"(t));
}
@@ -44,6 +44,13 @@ arch_debug_call_with_fault_handler(cpu_ent* cpu, jmp_buf jumpBuffer,
}
void
arch_debug_unset_current_thread(void)
{
asm volatile("mov %g0, %g7");
}
bool
arch_is_debug_variable_defined(const char* variableName)
{