From 06c7bbac0d2f41e1cffad4458d6f58a21a478b09 Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 1 Nov 2022 11:10:55 +0100 Subject: [PATCH] Kernel: Make a portable wrapper for the breakpoint instruction --- moon/src/arch/x86_64/cpu.rs | 4 ++++ moon/src/main.rs | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/moon/src/arch/x86_64/cpu.rs b/moon/src/arch/x86_64/cpu.rs index ff8e4f44..16b3a9eb 100644 --- a/moon/src/arch/x86_64/cpu.rs +++ b/moon/src/arch/x86_64/cpu.rs @@ -24,4 +24,8 @@ pub fn halt() -> ! { pub fn wait_for_interrupt() -> () { unsafe { asm!("hlt"); } +} + +pub fn breakpoint() -> () { + unsafe { asm!("int3"); } } \ No newline at end of file diff --git a/moon/src/main.rs b/moon/src/main.rs index b51f7744..5d6e5760 100644 --- a/moon/src/main.rs +++ b/moon/src/main.rs @@ -15,8 +15,6 @@ mod log; use arch::cpu; use arch::interrupts; -use x86_64::instructions::interrupts::int3; - use video::Color; #[no_mangle] @@ -35,7 +33,7 @@ pub extern "C" fn _start() -> ! { interrupts::enable(); - int3(); + cpu::breakpoint(); println!("Still here!");