introduce a stable NTL_DDK driver ABI to replace direct HAL_API and kernel-header access in drivers, add code/kernel/io_ddk.c and code/public/ntlite/ddk/ headers, change DriverEntry to take (const NTL_DDK*, NTL_DRIVER_INIT*), update kmain to build the DDK once via IoInitializeDdk/IoGetDdk and hand it to both boot and runtime drivers, downgrade code/public/ntlite/ddi/io_driver.h to a legacy I/O model header pulling from ntlite/ddk instead of kernel internals, move code/third_party/lwip into code/drivers/net/lwip/third_party, fix up lwip_sources.txt and build.c include paths to match, split build.c's single CFLAGS macro into COMMON/KERNEL/USER/BOOT/DRIVER cflags.

This commit is contained in:
maksw committed 2026-07-01 23:19:11 +02:00
1 parent 08329516ba
commit 485a6bbfe7
385 files changed
+1822 -1079

No files matched your search

+24 -13
View File
@@ -5,15 +5,15 @@
#include <stdbool.h>
#include <string.h>
#include <ntlite/ddi/hal_api.h>
#include <ntlite/ddk/ddk.h>
#include <ntlite/status.h>
#include <ntlite/ddi/io_driver.h>
#include <kernel/ke_debug.h>
#include <kernel/ke_sched.h>
#include <kernel/ke_settings.h>
#include <kernel/ke_semaphore.h>
#include <kernel/ob_object.h>
#include <kernel/mm_virt.h>
#include <ntlite/ddk/debug.h>
#include <ntlite/ddk/scheduler.h>
#include <ntlite/ddk/settings.h>
#include <ntlite/ddk/semaphore.h>
#include <ntlite/ddk/object.h>
#include <ntlite/ddk/memory.h>
#include <ntlite/ddi/net_device.h>
#include <ntlite/ddi/net_stack.h>
@@ -100,6 +100,7 @@ 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);
@@ -753,14 +754,23 @@ static void LwipInitDone(void* arg) {
KeSignalSemaphore(sem);
}
// 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);
}
// Implements the stack Initialize operation.
static KSTATUS LwipStackInitialize(const HAL_API* hal) {
static KSTATUS LwipStackInitialize(const NTL_DDK* ddk) {
if (gLwipInitialized)
return NTLSTATUS_SUCCESS;
if (!hal || !hal->Timer.QueryTicks)
if (!ddk || !ddk->Timer || !ddk->Timer->QueryTicks ||
!ddk->Scheduler || !ddk->Scheduler->DelayThread)
return NTLSTATUS_INVALID_PARAMETER;
LwipPortSetTimerQuery(hal->Timer.QueryTicks);
gLwipDdk = ddk;
LwipPortSetTimerQuery(ddk->Timer->QueryTicks);
SEMAPHORE* done = 0;
KSTATUS st = KeSemaphoreCreate(0, 1, &done);
@@ -1148,7 +1158,7 @@ static KSTATUS LwipProviderConnect(void* socket, const SYS_SOCKET_ADDRESS_K* add
}
LwipSocketUnlock(s);
(void)KeDelayThread(LWIP_PROVIDER_CANCEL_POLL_MS);
(void)LwipDelayThread(LWIP_PROVIDER_CANCEL_POLL_MS);
st = LwipSocketLock(s);
if (!KSUCCESS(st))
return st;
@@ -1716,7 +1726,8 @@ static KSTATUS LwipDispatchInternalDeviceControl(DEVICE_OBJECT* device, IRP* irp
}
// Implements the driver Entry operation.
KSTATUS DriverEntry(const HAL_API* hal) {
KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
(void)init;
DbgPrint("lwIP: driver loading...\n");
LWIP_NETIF_CONFIG defaultConfig;
@@ -1727,7 +1738,7 @@ KSTATUS DriverEntry(const HAL_API* hal) {
return st;
}
st = LwipStackInitialize(hal);
st = LwipStackInitialize(ddk);
if (!KSUCCESS(st)) {
DbgPrint("lwIP: initialization failed: 0x%x\n", st);
return st;