summaryrefslogtreecommitdiff
path: root/interrupt/fault.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2021-01-16 01:25:21 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2021-01-16 01:25:21 +0100
commit172d694cf7ba582635ac38454bad0f0fdaa14773 (patch)
treeefb0d145ed7fb3eeb44541714568680a6451ab3d /interrupt/fault.cpp
parent9921c9db409ad5b00fe4a43a2459e2fd2de6b0cf (diff)
interrupt: Generate interrupts from platform spec.
Diffstat (limited to 'interrupt/fault.cpp')
-rw-r--r--interrupt/fault.cpp45
1 files changed, 0 insertions, 45 deletions
diff --git a/interrupt/fault.cpp b/interrupt/fault.cpp
deleted file mode 100644
index 0d91c1d..0000000
--- a/interrupt/fault.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "interrupt.h"
-#include <os/thread.h>
-#include <os/time.h>
-
-inline void __attribute__((naked)) switch_context() {
- #if ! (defined(STM32F0) || defined(STM32L0)) // TODO: cortex-m0/+ unsupported for now.
-
- 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");
-
- #endif
-}
-
-template<>
-void interrupt<Interrupt::SVCall>() {
- switch_context();
-}
-
-template<>
-void interrupt<Interrupt::SysTick>() {
- Time::tick();
-}
-
-template<> void interrupt<Interrupt::NMI>() { while(1); }
-template<> void interrupt<Interrupt::HardFault>() { while(1); }
-template<> void interrupt<Interrupt::MemManage>() { while(1); }
-template<> void interrupt<Interrupt::BusFault>() { while(1); }
-template<> void interrupt<Interrupt::UsageFault>() { while(1); }
-template<> void interrupt<Interrupt::PendSV>() { while(1); }