|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
var vector_table: [256] *const fn () void = undefined;
|
|
|
|
|
var vtor: *u32 = @ptrFromInt(0xE000ED08);
|
|
|
|
|
const vector_table_type = [256] *const fn () void;
|
|
|
|
|
var vector_table: vector_table_type = undefined;
|
|
|
|
|
var vtor: **volatile vector_table_type = @ptrFromInt(0xE000ED08);
|
|
|
|
|
|
|
|
|
|
pub const vector = enum(u8) {
|
|
|
|
|
NMI = 2,
|
|
|
|
@ -25,7 +26,7 @@ pub fn initialize() void {
|
|
|
|
|
register(.BusFault, busfault);
|
|
|
|
|
register(.UsageFault, usagefault);
|
|
|
|
|
|
|
|
|
|
vtor.* = @as(u32, @intFromPtr(&vector_table));
|
|
|
|
|
vtor.* = &vector_table;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn register(index: vector, handler: *const fn () void) void {
|
|
|
|
|