add system time, clean up pci into pci.sys, clean up syscall names, fix USERAPC1 typo

This commit is contained in:
maksw committed 2026-06-11 18:11:59 +02:00
1 parent c1a291c4c9
commit e41bf6e2c0
64 files changed
+4514 -2220

No files matched your search

+37 -16
View File
@@ -27,22 +27,42 @@ typedef struct HAL_TIMER {
uint8_t IrqNumber;
} HAL_TIMER;
typedef struct HAL_PCI {
uint32_t (*Read32)(uint8_t bus, uint8_t dev,
uint8_t fn, uint8_t reg);
void (*Write32)(uint8_t bus, uint8_t dev,
uint8_t fn, uint8_t reg, uint32_t val);
bool (*FindDevice)(uint16_t vendor, uint16_t device,
uint8_t* bus, uint8_t* dev, uint8_t* fn);
bool (*FindClass)(uint8_t classCode, uint8_t subclass,
uint8_t* bus, uint8_t* dev, uint8_t* fn);
// Returns the IRQ line from PCI config space (register 0x3C, byte 0).
// Returns 0xFF if no interrupt is wired.
uint8_t (*GetIrqLine)(uint8_t bus, uint8_t dev, uint8_t fn);
// Program a PCI MSI capability to deliver to vector (0x20 + irqSlot).
// irqSlot must correspond to a kernel IRQ stub/vector slot.
KSTATUS (*EnableMsi)(uint8_t bus, uint8_t dev, uint8_t fn, uint8_t irqSlot);
#define HAL_RTC_TIME_FLAG_VALID 0x0001u
#define HAL_RTC_TIME_FLAG_RTC 0x0002u
typedef struct HAL_RTC_TIME {
uint16_t Year;
uint8_t Month;
uint8_t Day;
uint8_t Hour;
uint8_t Minute;
uint8_t Second;
uint32_t Nanosecond;
uint16_t Flags;
uint16_t Reserved;
} HAL_RTC_TIME;
typedef struct HAL_RTC {
KSTATUS (*QueryTime)(HAL_RTC_TIME* outTime);
} HAL_RTC;
typedef struct HAL_PCI {
// Raw PCI configuration access. Policy-level operations such as
// enumeration, BAR decoding, interrupt discovery, and MSI programming
// belong to pci.sys.
uint32_t (*Read32)(uint16_t segment,
uint8_t bus,
uint8_t dev,
uint8_t fn,
uint16_t offset);
void (*Write32)(uint16_t segment,
uint8_t bus,
uint8_t dev,
uint8_t fn,
uint16_t offset,
uint32_t value);
} HAL_PCI;
typedef struct HAL_INTC {
@@ -63,6 +83,7 @@ typedef struct HAL_API {
void *(*PhysToVirt)(uint64_t physAddr);
HAL_SCREEN Screen;
HAL_TIMER Timer;
HAL_RTC Rtc;
HAL_PCI Pci;
HAL_INTC Intc;
HAL_POWER Power;
@@ -87,7 +108,7 @@ typedef struct HAL_INIT_PARAMS {
void* (*AllocatePool)(size_t size);
} HAL_INIT_PARAMS;
#define HAL_API_VERSION 3
#define HAL_API_VERSION 5
__declspec(dllexport) const HAL_API* HalGetApi(void);
__declspec(dllexport) void HalRegisterScheduler(void (*pKeSchedulerTick)(void));