Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
add custom panic
Browse files Browse the repository at this point in the history
  • Loading branch information
gthvn1 committed Oct 29, 2023
1 parent a6144a7 commit 2e5ba4f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mini-zos.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const builtin = @import("std").builtin;
const startInfo = @import("start_info.zig");

// the stack should be aligned to 16-bytes boundary.
Expand All @@ -9,6 +10,13 @@ export var stack: [8 * 1024]u8 align(16) linksection(".bss") = undefined;
// Look in xen source: xen/arch/x86/guest/xen/hypercall_page.S
export var hypercall_page: [4 * 1024]u8 linksection(".hypercall_page") = undefined;

pub fn panic(msg: []const u8, stack_trace: ?*builtin.StackTrace, ret_addr: ?usize) noreturn {
_ = ret_addr;
_ = msg;
_ = stack_trace;
while (true) {}
}

// See modifiers for inline asm
// https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#x86Operandmodifiers
export fn _start() callconv(.Naked) noreturn {
Expand Down

0 comments on commit 2e5ba4f

Please sign in to comment.