remove weird double spaces, remove /EXPORT from build.bat in favor of __declspec(dllexport)

This commit is contained in:
maksw committed 2026-05-03 19:54:51 +02:00
1 parent 9fa2a7e0db
commit 83d48e09bb
41 files changed
+156 -170

No files matched your search

+5 -5
View File
@@ -65,8 +65,8 @@ typedef struct HAL_INTC {
} HAL_INTC;
typedef struct HAL_POWER {
// ACPI S5 soft-off. Disables interrupts, writes SLP_EN to PM1a/b_CNT,
// and halts if firmware doesn't respond. Does not return.
// ACPI S5 soft-off. Disables interrupts, writes SLP_EN to PM1a/b_CNT,
// and halts if firmware doesn't respond. Does not return.
void (*Shutdown)(void);
} HAL_POWER;
@@ -101,6 +101,6 @@ typedef struct HAL_INIT_PARAMS {
#define HAL_API_VERSION 1
const HAL_API* HalGetApi(void);
void HalRegisterScheduler(void (*pKeSchedulerTick)(void));
KSTATUS HalInitialize(const HAL_INIT_PARAMS* params);
__declspec(dllexport) const HAL_API* HalGetApi(void);
__declspec(dllexport) void HalRegisterScheduler(void (*pKeSchedulerTick)(void));
__declspec(dllexport) KSTATUS HalInitialize(const HAL_INIT_PARAMS* params);
+4 -4
View File
@@ -6,7 +6,7 @@
// in the dependency graph.
//
// HalDiskDispatch is the one bridge: it calls the driver's SubmitIrp (async)
// or runs the sync callbacks inline and writes irp->Status. It does not
// or runs the sync callbacks inline and writes irp->Status. It does not
// touch irp->CompletionEvent — that is ke_irp.c's responsibility.
#include <stdint.h>
@@ -20,7 +20,7 @@
static DISK_DRIVER gDrives[MAX_DRIVES];
static bool gPresent[MAX_DRIVES];
KSTATUS IoRegisterDisk(uint8_t index, const DISK_DRIVER *driver) {
__declspec(dllexport) KSTATUS IoRegisterDisk(uint8_t index, const DISK_DRIVER *driver) {
if (index >= MAX_DRIVES || !driver) return STATUS_INVALID_PARAMETER;
if (gPresent[index]) return STATUS_ALREADY_EXISTS;
gDrives[index] = *driver;
@@ -39,10 +39,10 @@ KSTATUS IoRegisterDisk(uint8_t index, const DISK_DRIVER *driver) {
// ke_irp.c must NOT touch irp->CompletionEvent
// yet; the driver will fire it.
// Returns STATUS_SUCCESS — sync fallback ran; irp->Status is already
// written. ke_irp.c should fire completion hooks.
// written. ke_irp.c should fire completion hooks.
// Returns STATUS_NOT_FOUND — drive not registered.
KSTATUS HalDiskDispatch(uint8_t drive, IRP *irp) {
__declspec(dllexport) KSTATUS HalDiskDispatch(uint8_t drive, IRP *irp) {
if (drive >= MAX_DRIVES || !gPresent[drive]) return STATUS_NOT_FOUND;
DISK_DRIVER *drv = &gDrives[drive];
+6 -6
View File
@@ -1,15 +1,15 @@
// hal_keyboard.c – PS/2 keyboard, interrupt-driven, 256-entry ring buffer
//
// Scan-code set 1 (XT-compatible), as output by the 8042's built-in
// translation layer. Supports make/break for all standard keys, Shift /
// translation layer. Supports make/break for all standard keys, Shift /
// Ctrl / Alt / CapsLock / NumLock modifiers, and the E0-prefixed extended
// key set (arrows, Home/End/PgUp/PgDn/Ins/Del, RCtrl, RAlt, numpad-Enter,
// numpad-divide).
//
// Threading model
// ---------------
// Single-producer (ISR on IRQ 1) / single-consumer ring buffer. All
// ISR-written state is declared volatile. On a uniprocessor, volatile
// Single-producer (ISR on IRQ 1) / single-consumer ring buffer. All
// ISR-written state is declared volatile. On a uniprocessor, volatile
// plus the natural atomicity of aligned int reads/writes is sufficient.
// On SMP, add acquire/release memory barriers around gHead and gTail.
//
@@ -69,7 +69,7 @@ static volatile bool gNextExtended = false; // previous byte was 0xE0
static void (* volatile gCallback)(uint8_t) = NULL;
// -- ASCII translation tables – scan-code set 1, non-extended keys only --------
// Index = 7-bit make code (SC1_BREAK_BIT cleared). 0 = no printable glyph.
// Index = 7-bit make code (SC1_BREAK_BIT cleared). 0 = no printable glyph.
// Numpad digits yield their digit characters; a NumLock-aware wrapper can
// substitute cursor-movement codes (e.g. HAL_KEY_HOME) when NumLock is clear.
//
@@ -234,7 +234,7 @@ static bool KbdPoll(void) {
return gHead != gTail;
}
// Blocking read. Spins with PAUSE until a make code is available.
// Blocking read. Spins with PAUSE until a make code is available.
// On a preemptive kernel, replace the _mm_pause() loop with a
// condition variable or sti/hlt to avoid wasting CPU cycles.
static uint8_t KbdReadScancode(void) {
@@ -247,7 +247,7 @@ static uint8_t KbdReadScancode(void) {
}
// Returns the ASCII character for the next keypress, applying the current
// Shift and CapsLock state. Returns 0 for keys with no ASCII mapping
// Shift and CapsLock state. Returns 0 for keys with no ASCII mapping
// (function keys, arrows, unmodified Ctrl/Alt keys, etc.).
//
// CapsLock inverts shift only for alphabetic keys (a–z); digit and symbol
+5 -5
View File
@@ -295,7 +295,7 @@ static void WalkAcpi(uintptr_t rsdpPhys) {
}
// ---------------------------------------------------------------------------
// HalShutdown - ACPI S5 soft power-off. Does not return.
// HalShutdown - ACPI S5 soft power-off. Does not return.
// ---------------------------------------------------------------------------
#include <intrin.h>
@@ -309,12 +309,12 @@ static void HalShutdown(void) {
if (gPm1aCntBlk) __outword(gPm1aCntBlk, valA);
if (gPm1bCntBlk) __outword(gPm1bCntBlk, valB);
// Firmware should have powered off by now. If it didn't, halt.
// Firmware should have powered off by now. If it didn't, halt.
while (true) __halt();
}
// ---------------------------------------------------------------------------
KSTATUS HalInitialize(const HAL_INIT_PARAMS* initParams) {
__declspec(dllexport) KSTATUS HalInitialize(const HAL_INIT_PARAMS* initParams) {
if (gInitialised) return STATUS_ALREADY_EXISTS;
gPhysBase = initParams->PhysicalWindowBase;
gApi.PhysToVirt = HalPhysToVirt;
@@ -360,8 +360,8 @@ KSTATUS HalInitialize(const HAL_INIT_PARAMS* initParams) {
return STATUS_SUCCESS;
}
void HalRegisterScheduler(void (*pKeSchedulerTick)(void)) {
__declspec(dllexport) void HalRegisterScheduler(void (*pKeSchedulerTick)(void)) {
gTimerCallback = pKeSchedulerTick;
}
const HAL_API* HalGetApi(void) { return &gApi; }
__declspec(dllexport) const HAL_API* HalGetApi(void) { return &gApi; }
+2 -2
View File
@@ -1,7 +1,7 @@
// hal_screen.c - GOP framebuffer screen driver with embedded 8x16 font
//
// The 8x16 bitmap font is a standard VGA/PC font. We embed just the
// printable ASCII range (0x20–0x7E). Each glyph is 16 bytes; bit 7 of
// The 8x16 bitmap font is a standard VGA/PC font. We embed just the
// printable ASCII range (0x20–0x7E). Each glyph is 16 bytes; bit 7 of
// each byte is the leftmost pixel.
#include <stdint.h>
#include <string.h>
+5 -5
View File
@@ -1,7 +1,7 @@
#pragma once
// io_driver.h - driver-side interface for registering disk controllers
//
// DISK_DRIVER.SubmitIrp is the async path. IRP is forward-declared here so
// DISK_DRIVER.SubmitIrp is the async path. IRP is forward-declared here so
// this header (and hal_disk.c) remain free of kernel sync-object dependencies.
// Drivers that implement SubmitIrp include ke_irp.h themselves.
@@ -25,16 +25,16 @@ typedef struct DISK_DRIVER {
// --- Asynchronous path (optional) --------------------------------------
// NULL = driver has not implemented async; IoSubmitIrp() falls back to
// the sync path. Returns STATUS_PENDING when the IRP is accepted.
// the sync path. Returns STATUS_PENDING when the IRP is accepted.
KSTATUS (*SubmitIrp)(void *ctx, struct IRP *irp);
uint64_t SectorCount;
} DISK_DRIVER;
KSTATUS IoRegisterDisk (uint8_t driveIndex, const DISK_DRIVER *driver);
__declspec(dllexport) KSTATUS IoRegisterDisk(uint8_t driveIndex, const DISK_DRIVER *driver);
// Internal dispatch used by ke_irp.c. Calls SubmitIrp if present, otherwise
// Internal dispatch used by ke_irp.c. Calls SubmitIrp if present, otherwise
// runs the sync callbacks inline and writes irp->Status; does NOT touch any
// kernel sync objects so it is safe to call from the HAL layer.
// Returns STATUS_PENDING (async path taken) or STATUS_SUCCESS (ran inline).
KSTATUS HalDiskDispatch (uint8_t drive, struct IRP *irp);
__declspec(dllexport) KSTATUS HalDiskDispatch(uint8_t drive, struct IRP *irp);