Skip to content

Commit

Permalink
panic: delete unused code
Browse files Browse the repository at this point in the history
Signed-off-by: smallkirby <ssmallkirby@gmail.com>
  • Loading branch information
smallkirby committed Nov 4, 2024
1 parent f06b5f4 commit 5f23817
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions ymir/panic.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,22 @@ const format = std.fmt.format;

const ymir = @import("ymir");
const vmx = ymir.vmx;
const serial = ymir.serial;
const arch = ymir.arch;

/// Implementation of the panic function.
pub const panic_fn = panic;

/// Instance of the initialized serial console.
var sr: serial.Serial = undefined;
/// Instance of the virtual machine.
var vm: ?*vmx.Vm = null;

/// Flag to indicate that a panic occurred.
var panicked = false;

const PanicError = error{};
const Writer = std.io.Writer(
void,
PanicError,
writerFunction,
);

/// Set the target VM that is dumped when a panic occurs.
pub fn setVm(target_vm: *vmx.Vm) void {
vm = target_vm;
}

fn write(comptime fmt: []const u8, args: anytype) void {
format(
Writer{ .context = {} },
fmt,
args,
) catch {};
}

fn writerFunction(_: void, bytes: []const u8) PanicError!usize {
sr.writeString(bytes);
return bytes.len;
}

fn panic(msg: []const u8, _: ?*builtin.StackTrace, _: ?usize) noreturn {
@setCold(true);

Expand Down

0 comments on commit 5f23817

Please sign in to comment.