diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-11-19 17:21:31 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-11-19 19:23:33 +0100 |
commit | 025a38a1f743fd9e89cbd477abe3f79a8d098097 (patch) | |
tree | a1f20c1b6a7f6c418bee641da923ab3d0d7208fe /thread.cpp | |
parent | 9e5875f2908c1ce506e7c5712ccabc379f911360 (diff) |
Moved os and hal related files into subdirectories.
Diffstat (limited to 'thread.cpp')
-rw-r--r-- | thread.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/thread.cpp b/thread.cpp deleted file mode 100644 index a08bd61..0000000 --- a/thread.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "thread.h" -#include "interrupt.h" - -Thread Thread::main_thread __attribute__ ((init_priority (1000))); -Thread* Thread::active_thread = &Thread::main_thread; - -inline void __attribute__((naked)) switch_context() { - asm volatile ("cpsid i"); - - // Save unsaved registers. - asm volatile ("push {r4, r5, r6, r7, r8, r9, r10, r11, lr}" ::: "memory"); - - // Store stack pointer for old thread. - asm volatile ("str sp, [%0]" :: "r" (&Thread::active_thread->sp)); - - // Update running thread. - Thread::active_thread = Thread::active_thread->next; - - // Fetch stack pointer for new thread. - asm volatile ("ldr sp, [%0]" :: "r" (&Thread::active_thread->sp)); - - asm volatile ("cpsie i"); - - // Load registers and return. - asm volatile ("pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}" ::: "memory"); -} - -template<> -void interrupt<Interrupt::SVCall>() { - switch_context(); -} |