Skip to content

Commit

Permalink
refactor: simplify interrupt enable asm
Browse files Browse the repository at this point in the history
  • Loading branch information
Tropix126 committed Aug 31, 2024
1 parent 1767fe7 commit 0e5c808
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub mod xil;
use log::LevelFilter;
use logger::KernelLogger;
use peripherals::{GIC, PRIVATE_TIMER, UART1, WATCHDOG_TIMER};
use sdk::vexSystemTimeGet;
use vex_v5_qemu_protocol::{code_signature::CodeSignature, HostBoundPacket};

extern "C" {
Expand Down Expand Up @@ -59,12 +60,6 @@ pub extern "C" fn _start() -> ! {
// `vectors` module.
vectors::set_vbar(core::ptr::addr_of!(VECTORS_START) as u32);

// Enable IRQ and FIQ interrupts by masking CPSR with the IRQ and FIQ enable bits.
core::arch::asm!(
"mrs r1, cpsr
bic r1, r1, #0b11000000
msr cpsr_c, r1"
, options(nomem, nostack));

// Register SDK exception handlers for data/prefetch/undefined aborts.
vectors::register_sdk_exception_handlers();
Expand All @@ -75,6 +70,9 @@ pub extern "C" fn _start() -> ! {
// Enable MMU
hardware::mmu::enable_mmu();

// Enable IRQ and FIQ interrupts by masking CPSR with the IRQ and FIQ enable bits.
core::arch::asm!("cpsie if");

// Initialize heap memory
allocator::init_heap();
}
Expand Down

0 comments on commit 0e5c808

Please sign in to comment.