add lwIP TCP/IP stack as a runtime driver, native socket syscalls, SysGetMemoryStatus replacing CatchAllDebugBucket, fix timeGetTime to return milliseconds, fix SysSleep to interpret argument as milliseconds, SysGetTick now returns microseconds, harden all syscalls against bad user pointers with CopyFromUser/CopyToUser/MmProbeUser throughout, add networking test apps, port-forward 8080 in runa.bat, split LWIP_DRIVER_CFLAGS, add settings.ini to deploy, remove ethernet.c stub
This commit is contained in:
1 parent
18b4dd0f61
commit
df13b8056c
365 files changed
+143263
-1362
No files matched your search
+2
-76
@@ -13,7 +13,7 @@
|
||||
#include <ke_irq.h>
|
||||
#include <ke_dpc.h>
|
||||
#include <ke_syscall.h>
|
||||
#include <ethernet.h>
|
||||
#include <net_device.h>
|
||||
#include <ke_debug.h>
|
||||
#include <ke_util.h>
|
||||
#include <ldr_image.h>
|
||||
@@ -420,80 +420,6 @@ void SystemInitThread(void* arg) {
|
||||
MmFreePool(args);
|
||||
}
|
||||
|
||||
// for debug! for science!
|
||||
uint64_t KeCatchAllDebugBucket(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5) {
|
||||
if (a0 == 0) {
|
||||
DbgPrint(
|
||||
"Memory Status:\n"
|
||||
" -> Free (PMM): %.2f MB\n"
|
||||
" -> Kernel Pool: %.2f MB\n"
|
||||
" -> User Heap: %.2f MB\n",
|
||||
(float)MmFreeFrameCount() * PAGE_SIZE / (1024.0f * 1024.0f),
|
||||
(float)MmGetKernelPoolUsage() / (1024.0f * 1024.0f),
|
||||
(float)MmGetUserHeapUsage() / (1024.0f * 1024.0f)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a0 == 1) {
|
||||
uint32_t deviceIndex = (uint32_t)a1;
|
||||
uint32_t targetIp;
|
||||
|
||||
// Usage from shell debug mode:
|
||||
// 1,0,10,0,2,2 ping 10.0.2.2 on eth0
|
||||
// 1,0,167772674,0,0,0 ping packed IPv4 0x0A000202 on eth0
|
||||
// 1,0,0,0,0,0 ping the default QEMU gateway 10.0.2.2
|
||||
if (a2 == 0 && a3 == 0 && a4 == 0 && a5 == 0) {
|
||||
targetIp = NET_IPV4_ADDR(10, 0, 2, 2);
|
||||
} else if (a3 == 0 && a4 == 0 && a5 == 0 && a2 > 0xFFu) {
|
||||
targetIp = (uint32_t)a2;
|
||||
} else {
|
||||
if (a2 > 0xFFu || a3 > 0xFFu || a4 > 0xFFu || a5 > 0xFFu) {
|
||||
DbgPrint("DebugBucket[1]: invalid IPv4 octet(s): %llu.%llu.%llu.%llu\n",
|
||||
a2, a3, a4, a5);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
targetIp = NET_IPV4_ADDR((uint8_t)a2, (uint8_t)a3,
|
||||
(uint8_t)a4, (uint8_t)a5);
|
||||
}
|
||||
|
||||
DbgPrint("DebugBucket[1]: ping eth%u %u.%u.%u.%u\n",
|
||||
deviceIndex,
|
||||
(targetIp >> 24) & 0xFFu,
|
||||
(targetIp >> 16) & 0xFFu,
|
||||
(targetIp >> 8) & 0xFFu,
|
||||
targetIp & 0xFFu);
|
||||
|
||||
KSTATUS status = NetPingIpv4(deviceIndex, targetIp);
|
||||
DbgPrint("DebugBucket[1]: NetPingIpv4 returned 0x%X\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (a0 == 2) {
|
||||
LIST_ENTRY* listHead = KeGetProcessList();
|
||||
LIST_ENTRY* current;
|
||||
|
||||
DbgPrint("\nPID | Name | Threads | ExitCode\n");
|
||||
DbgPrint("---------------------------------------------\n");
|
||||
|
||||
for (current = listHead->Fwd; current != listHead; current = current->Fwd) {
|
||||
// Translate the list entry back to the PROCESS structure
|
||||
PROCESS* proc = CONTAINING_RECORD(current, PROCESS, GlobalLink);
|
||||
|
||||
DbgPrint("%-5u | %-16s | %-7u | %d\n",
|
||||
proc->ProcessId,
|
||||
proc->Name,
|
||||
proc->ThreadCount,
|
||||
proc->ExitCode);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
DbgPrint("DebugBucket: unknown command %llu\n", a0);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Main Kernel Entry
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -557,7 +483,7 @@ extern void KernelMain(BOOT_INFO* bootInfo) {
|
||||
|
||||
HalRegisterScheduler(KeSchedulerTick);
|
||||
|
||||
KeSyscallInit(hal, KeCatchAllDebugBucket);
|
||||
KeSyscallInit(hal);
|
||||
|
||||
//
|
||||
// Dynamic Linking & Driver Execution
|
||||
|
||||
Reference in new issue
Block a user