1 /* 2 * Copyright 2003-2011, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler <axeld@pinc-software.de> 7 * Ingo Weinhold <bonefish@cs.tu-berlin.de> 8 */ 9 #ifndef _KERNEL_ARCH_M68K_THREAD_H 10 #define _KERNEL_ARCH_M68K_THREAD_H 11 12 #include <arch/cpu.h> 13 #include <arch/thread.h> 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 void m68k_push_iframe(struct iframe_stack *stack, struct iframe *frame); 20 void m68k_pop_iframe(struct iframe_stack *stack); 21 struct iframe *m68k_get_user_iframe(void); 22 23 uint32 m68k_next_page_directory(Thread *from, Thread *to); 24 25 /* as we won't support SMP on m68k (yet?) we can use a global here */ 26 extern Thread *gCurrentThread; 27 28 extern inline Thread * 29 arch_thread_get_current_thread(void) 30 { 31 return gCurrentThread; 32 } 33 34 35 extern inline void 36 arch_thread_set_current_thread(Thread *t) 37 { 38 gCurrentThread = t; 39 } 40 41 #if 0 42 /* this would only work on 030... */ 43 44 extern inline Thread * 45 arch_thread_get_current_thread(void) 46 { 47 uint64 v = 0; 48 asm volatile("pmove %%srp,(%0)" : : "a"(&v)); 49 return (Thread *)(uint32)(v & 0xffffffff); 50 } 51 52 53 extern inline void 54 arch_thread_set_current_thread(Thread *t) 55 { 56 uint64 v; 57 asm volatile("pmove %%srp,(%0)\n" \ 58 "move %1,(4,%0)\n" \ 59 "pmove (%0),%%srp" : : "a"(&v), "d"(t)); 60 } 61 #endif 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 68 #endif /* _KERNEL_ARCH_M68K_THREAD_H */ 69