aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap.s2
-rw-r--r--src/interrupt.zig8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/bootstrap.s b/src/bootstrap.s
index fefa602..612fac3 100644
--- a/src/bootstrap.s
+++ b/src/bootstrap.s
@@ -5,6 +5,8 @@
.extern _tstack
.section .vector_table
+.global init_vector_table
+init_vector_table:
.word _tstack
.word _start
.skip 4 * 14
diff --git a/src/interrupt.zig b/src/interrupt.zig
index 024efc5..f00fa22 100644
--- a/src/interrupt.zig
+++ b/src/interrupt.zig
@@ -1,8 +1,10 @@
-const vector_table_type = [256] *const fn () void;
+extern const init_vector_table: [2]u32;
+
+const vector_table_type = [128] *const fn () void; // up to 256
var vector_table: vector_table_type align(256) = undefined;
var vtor: **volatile vector_table_type = @ptrFromInt(0xE000ED08);
-pub const vector = enum(u8) {
+pub const vector = enum(u7) {
NMI = 2,
HardFault,
MemManage,
@@ -20,6 +22,8 @@ pub const vector = enum(u8) {
};
pub fn initialize() void {
+ vector_table[0] = @ptrFromInt(init_vector_table[0]);
+ vector_table[1] = @ptrFromInt(init_vector_table[1]);
register(.NMI, nmi);
register(.HardFault, hardfault);
register(.MemManage, memmanage);