replace ad hoc driver loading with a proper driver manager, new DDK, new PnP manager with device matching, asynchronous startup, resource ownership and removal, add shared PCI capability helpers, replace typed, rigid services with a proper service manager, implement proper system shutdown and restart, shutting down unloads drivers and shuts down services, add simple power button, remove heavyweight boot self-tests and SMP stress runs, add monotonic timestamps to kernel debug output, fruitless USB and PS/2 fixes, make test builds opt in.

This commit is contained in:
maksw committed 2026-10-26 10:08:03 +01:00
1 parent c0ad63c27f
commit d36f19509c
160 files changed
+6563 -7366

No files matched your search

+3 -3
View File
@@ -20,6 +20,6 @@ Build notes:
Load order:
`drivers.ini` should load `lwip.sys` before NIC drivers so the provider is
ready when the NIC registers. The kernel also supports provider-after-device
registration, but provider-first keeps boot logs cleaner.
`drivers.ini` v2 uses `class.network-stack` with `after=network-adapter`.
NIC modules initialize first; lwIP attaches to already registered adapters.
The stack also initializes normally when no physical NIC is present.
+11 -20
View File
@@ -1,3 +1,4 @@
#include <ntlite/ddk/module.h>
// lwIP stack provider glue. This file bridges the kernel network-device model into lwIP.
#include <ntlite/atomic.h>
@@ -111,7 +112,6 @@ typedef struct LWIP_PROVIDER_SOCKET {
static LWIP_BINDING* gBindings[LWIP_MAX_NETIFS];
static volatile int gLwipInitialized = 0;
static const NTL_DDK* gLwipDdk;
static KSTATUS LwipProviderAttachDevice(NET_DEVICE* device);
static KSTATUS LwipProviderReceiveFrame(NET_DEVICE* device, const void* frame, size_t length);
@@ -770,21 +770,15 @@ static void LwipInitDone(void* arg) {
// Delays the current provider thread through the DDK scheduler table.
static KSTATUS LwipDelayThread(uint64_t milliseconds) {
if (!gLwipDdk || !gLwipDdk->Scheduler || !gLwipDdk->Scheduler->DelayThread)
return NTLSTATUS_INVALID_PARAMETER;
return gLwipDdk->Scheduler->DelayThread(milliseconds);
return KeDelayThread(milliseconds);
}
// Implements the stack Initialize operation.
static KSTATUS LwipStackInitialize(const NTL_DDK* ddk) {
static KSTATUS LwipStackInitialize(void) {
if (gLwipInitialized)
return NTLSTATUS_SUCCESS;
if (!ddk || !ddk->Timer || !ddk->Timer->QueryTicks ||
!ddk->Scheduler || !ddk->Scheduler->DelayThread)
return NTLSTATUS_INVALID_PARAMETER;
gLwipDdk = ddk;
LwipPortSetTimerQuery(ddk->Timer->QueryTicks);
LwipPortSetTimerQuery(KeQueryTicks);
SEMAPHORE* done = 0;
KSTATUS st = KeSemaphoreCreate(0, 1, &done);
@@ -1822,9 +1816,9 @@ static KSTATUS LwipDispatchInternalDeviceControl(DEVICE_OBJECT* device, IRP* irp
return LwipDispatchSocketRequest(request);
}
// Implements the driver Entry operation.
KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
(void)init;
static KSTATUS DriverInitialize(NTL_MODULE* module) {
(void)module;
DbgPrint("lwIP: driver loading...\n");
LWIP_NETIF_CONFIG defaultConfig;
@@ -1835,7 +1829,7 @@ KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
return st;
}
st = LwipStackInitialize(ddk);
st = LwipStackInitialize();
if (!KSUCCESS(st)) {
DbgPrint("lwIP: initialization failed: 0x%x\n", st);
return st;
@@ -1844,12 +1838,6 @@ KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
IoInitializeDriverObject(&gLwipDriver, SYS_SV_LITERAL("lwip-stack"));
gLwipDriver.MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = LwipDispatchInternalDeviceControl;
st = IoRegisterDriverObject(&gLwipDriver);
if (!KSUCCESS(st)) {
DbgPrint("lwIP: driver object registration failed: 0x%x\n", st);
return st;
}
st = IoCreateDevice(&gLwipDriver, 0, &gLwipDevice);
if (!KSUCCESS(st)) {
DbgPrint("lwIP: stack device creation failed: 0x%x\n", st);
@@ -1867,3 +1855,6 @@ KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
DbgPrint("lwIP: driver initialized\n");
return NTLSTATUS_SUCCESS;
}
static DRIVER_OBJECT* const gModuleIoDrivers[] = { &gLwipDriver };
NTL_DECLARE_IO_MODULE(DriverInitialize, gModuleIoDrivers);