From 0ccee089139f5c8fcf8c4d51a0c9d166cf62c78b Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Nov 2022 03:15:54 +0200 Subject: [PATCH] Added stub code for kernel API --- Core/Driver.cpp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/Core/Driver.cpp b/Core/Driver.cpp index 517168d..df75237 100644 --- a/Core/Driver.cpp +++ b/Core/Driver.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -74,6 +75,31 @@ namespace Driver return memset(Destination, Value, Size); } + void DriverNetSend(unsigned int DriverID, unsigned char *Data, unsigned short Size) + { + DumpData("DriverNetSend", Data, Size); + } + + void DriverNetReceive(unsigned int DriverID, unsigned char *Data, unsigned short Size) + { + DumpData("DriverNetReceive", Data, Size); + } + + void DriverAHCIDiskRead(unsigned int DriverID, unsigned long Sector, unsigned char *Data, unsigned int SectorCount, unsigned char Port) + { + DumpData("DriverDiskRead", Data, SectorCount * 512); + } + + void DriverAHCIDiskWrite(unsigned int DriverID, unsigned long Sector, unsigned char *Data, unsigned int SectorCount, unsigned char Port) + { + DumpData("DriverDiskWrite", Data, SectorCount * 512); + } + + char *DriverPCIGetDeviceName(unsigned int VendorID, unsigned int DeviceID) + { + return (char *)"Unknown"; + } + KernelAPI KAPI = { .Version = { .Major = 0, @@ -91,8 +117,7 @@ namespace Driver .Unmap = UnmapMemory, }, .PCI = { - .GetDeviceName = nullptr, - .Write = nullptr, + .GetDeviceName = DriverPCIGetDeviceName, }, .Util = { .DebugPrint = DriverDebugPrint, @@ -102,13 +127,13 @@ namespace Driver }, .Commmand = { .Network = { - .SendPacket = nullptr, - .ReceivePacket = nullptr, + .SendPacket = DriverNetSend, + .ReceivePacket = DriverNetReceive, }, .Disk = { .AHCI = { - .ReadSector = nullptr, - .WriteSector = nullptr, + .ReadSector = DriverAHCIDiskRead, + .WriteSector = DriverAHCIDiskWrite, }, }, },