2009-07-27 16:23:08 +00:00
|
|
|
/*
|
2022-09-01 22:55:15 +02:00
|
|
|
* Copyright 2003-2022, Haiku Inc. All rights reserved.
|
2009-07-27 16:23:08 +00:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler <axeld@pinc-software.de>
|
|
|
|
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
|
|
|
|
* Johannes Wischert <johanneswi@gmail.com>
|
|
|
|
*/
|
|
|
|
#ifndef _KERNEL_ARCH_ARM_THREAD_H
|
|
|
|
#define _KERNEL_ARCH_ARM_THREAD_H
|
|
|
|
|
|
|
|
#include <arch/cpu.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void arm_push_iframe(struct iframe_stack *stack, struct iframe *frame);
|
|
|
|
void arm_pop_iframe(struct iframe_stack *stack);
|
|
|
|
struct iframe *arm_get_user_iframe(void);
|
|
|
|
|
|
|
|
|
2011-01-10 21:54:38 +00:00
|
|
|
extern inline Thread *
|
2009-07-27 16:23:08 +00:00
|
|
|
arch_thread_get_current_thread(void)
|
|
|
|
{
|
2022-09-01 22:55:15 +02:00
|
|
|
// read pointer to thread data structure from TPIDRPRW
|
|
|
|
Thread* t;
|
|
|
|
asm volatile("MRC p15, 0, %0, c13, c0, 4" : "=r" (t));
|
|
|
|
return t;
|
2009-07-27 16:23:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern inline void
|
2011-01-10 21:54:38 +00:00
|
|
|
arch_thread_set_current_thread(Thread *t)
|
2009-07-27 16:23:08 +00:00
|
|
|
{
|
2022-09-01 22:55:15 +02:00
|
|
|
// set TPIDRPRW to point to thread data structure
|
|
|
|
asm volatile("MCR p15, 0, %0, c13, c0, 4" : : "r" (t));
|
2009-07-27 16:23:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _KERNEL_ARCH_ARM_THREAD_H */
|