mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Kernel: Initialize and use interrupts in the aarch64 Kernel
Now that everything is in place, we can actually use interrupts in the aarch64 Kernel build. :^)
This commit is contained in:
parent
dab6dbe893
commit
1072d523e2
Notes:
sideshowbarker
2024-07-17 10:30:18 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/1072d523e2 Pull-request: https://github.com/SerenityOS/serenity/pull/14146 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/nico ✅
1 changed files with 14 additions and 9 deletions
|
@ -10,6 +10,8 @@
|
|||
#include <AK/Format.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
#include <Kernel/Arch/InterruptManagement.h>
|
||||
#include <Kernel/Arch/Interrupts.h>
|
||||
#include <Kernel/Arch/Processor.h>
|
||||
#include <Kernel/Arch/aarch64/BootPPMParser.h>
|
||||
#include <Kernel/Arch/aarch64/CPU.h>
|
||||
|
@ -106,6 +108,10 @@ extern "C" [[noreturn]] void init()
|
|||
|
||||
load_kernel_symbol_table();
|
||||
|
||||
initialize_interrupts();
|
||||
InterruptManagement::initialize();
|
||||
Processor::enable_interrupts();
|
||||
|
||||
auto firmware_version = query_firmware_version();
|
||||
dbgln("Firmware version: {}", firmware_version);
|
||||
|
||||
|
@ -117,17 +123,16 @@ extern "C" [[noreturn]] void init()
|
|||
draw_logo();
|
||||
}
|
||||
|
||||
auto& timer = RPi::Timer::the();
|
||||
timer.set_interrupt_interval_usec(1'000'000);
|
||||
timer.enable_interrupt_mode();
|
||||
|
||||
dbgln("Enter loop");
|
||||
|
||||
auto& timer = RPi::Timer::the();
|
||||
u64 start_musec = 0;
|
||||
for (;;) {
|
||||
u64 now_musec;
|
||||
while ((now_musec = timer.microseconds_since_boot()) - start_musec < 1'000'000)
|
||||
;
|
||||
start_musec = now_musec;
|
||||
dbgln("Timer: {}", now_musec);
|
||||
}
|
||||
// This will not disable interrupts, so the timer will still fire and show that
|
||||
// interrupts are working!
|
||||
for (;;)
|
||||
asm volatile("wfi");
|
||||
}
|
||||
|
||||
class QueryFirmwareVersionMboxMessage : RPi::Mailbox::Message {
|
||||
|
|
Loading…
Reference in a new issue