const vector_table_type = [256] *const fn () void; var vector_table: vector_table_type align(256) = undefined; var vtor: **volatile vector_table_type = @ptrFromInt(0xE000ED08); pub const vector = enum(u8) { NMI = 2, HardFault, MemManage, BusFault, UsageFault, rsvd7, rsvd8, rsvd9, rsvd10, SVCall, DebugMonitor, rsvd13, PendSV, SysTick, }; pub fn initialize() void { register(.NMI, nmi); register(.HardFault, hardfault); register(.MemManage, memmanage); register(.BusFault, busfault); register(.UsageFault, usagefault); vtor.* = &vector_table; } pub fn register(index: vector, handler: *const fn () void) void { vector_table[@intFromEnum(index)] = handler; } fn nmi() void { while (true) {} } fn hardfault() void { while (true) {} } fn memmanage() void { while (true) {} } fn busfault() void { while (true) {} } fn usagefault() void { while (true) {} }