feat: make kernel architecture-agnostic; primitive work on arm port

This commit is contained in:
daniel committed 2026-10-24 21:25:18 +02:00
1 parent dab7d5427b
commit 1bae77ec84
164 files changed
+3664 -1641

No files matched your search

+6 -7
View File
@@ -5,6 +5,7 @@
*/
#include "MassStorage.hpp"
#include <Arch/Cpu.hpp>
#include "Xhci.hpp"
#include "UsbDevice.hpp"
#include <Drivers/Storage/BlockDevice.hpp>
@@ -15,7 +16,7 @@
#include <Memory/HHDM.hpp>
#include <Memory/PageFrameAllocator.hpp>
#include <Libraries/Memory.hpp>
#include <Timekeeping/ApicTimer.hpp>
#include <Timekeeping/Timer.hpp>
#include <atomic>
using namespace Kt;
@@ -130,12 +131,10 @@ namespace Drivers::USB::MassStorage {
}
static void PollWaitMs(uint32_t ms) {
uint64_t flags;
asm volatile("pushfq; pop %0" : "=r"(flags));
if ((flags & (1 << 9)) == 0) {
if (!Arch::InterruptsEnabled()) {
for (uint64_t i = 0; i < (uint64_t)ms * 1000; i++) {
Xhci::PollEvents();
asm volatile("outb %%al, $0x80" ::: "memory");
Arch::IoDelay();
}
return;
}
@@ -143,7 +142,7 @@ namespace Drivers::USB::MassStorage {
uint64_t start = Timekeeping::GetMilliseconds();
while (Timekeeping::GetMilliseconds() - start < ms) {
Xhci::PollEvents();
asm volatile("pause" ::: "memory");
Arch::Pause();
}
}
@@ -221,7 +220,7 @@ namespace Drivers::USB::MassStorage {
std::memory_order_acquire,
std::memory_order_relaxed)) {
expected = false;
asm volatile("pause" ::: "memory");
Arch::Pause();
}
}