2007-10-22 03:42:09 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003-2006, Haiku Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler <axeld@pinc-software.de>
|
|
|
|
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
|
|
|
|
*/
|
|
|
|
#ifndef _KERNEL_ARCH_M68K_THREAD_H
|
|
|
|
#define _KERNEL_ARCH_M68K_THREAD_H
|
|
|
|
|
|
|
|
#include <arch/cpu.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void m68k_push_iframe(struct iframe_stack *stack, struct iframe *frame);
|
|
|
|
void m68k_pop_iframe(struct iframe_stack *stack);
|
|
|
|
struct iframe *m68k_get_user_iframe(void);
|
|
|
|
|
2007-11-04 00:02:03 +03:00
|
|
|
/* as we won't support SMP on m68k (yet?) we can use a global here */
|
|
|
|
extern struct thread *gCurrentThread;
|
|
|
|
|
|
|
|
extern inline struct thread *
|
|
|
|
arch_thread_get_current_thread(void)
|
|
|
|
{
|
|
|
|
return gCurrentThread;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern inline void
|
|
|
|
arch_thread_set_current_thread(struct thread *t)
|
|
|
|
{
|
|
|
|
gCurrentThread = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* this would only work on 030... */
|
2007-10-22 03:42:09 +04:00
|
|
|
|
|
|
|
extern inline struct thread *
|
|
|
|
arch_thread_get_current_thread(void)
|
|
|
|
{
|
2007-10-24 03:48:02 +04:00
|
|
|
uint64 v = 0;
|
|
|
|
asm volatile("pmove %%srp,(%0)" : : "a"(&v));
|
2007-10-25 04:44:09 +04:00
|
|
|
return (struct thread *)(uint32)(v & 0xffffffff);
|
2007-10-22 03:42:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern inline void
|
|
|
|
arch_thread_set_current_thread(struct thread *t)
|
|
|
|
{
|
2007-10-24 03:48:02 +04:00
|
|
|
uint64 v;
|
|
|
|
asm volatile("pmove %%srp,(%0)\n" \
|
|
|
|
"move %1,(4,%0)\n" \
|
|
|
|
"pmove (%0),%%srp" : : "a"(&v), "d"(t));
|
2007-10-22 03:42:09 +04:00
|
|
|
}
|
2007-11-04 00:02:03 +03:00
|
|
|
#endif
|
2007-10-22 03:42:09 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _KERNEL_ARCH_M68K_THREAD_H */
|