summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-31 12:48:54 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-31 12:50:14 +0100
commitfdb8b146b2dd9d21bdc966e180632ba489accd6f (patch)
tree9ace38c1d1f116721e4d87d5d082e9fd5a5b58df /src
parentadfd7dac5376c24e44f5f217f387784a8f614a74 (diff)
feat: pre-release improvements and harderning.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src')
-rw-r--r--src/boot/modules/BootNet/amd64.json1
-rw-r--r--src/boot/modules/SysChk/SysChk.cc4
-rw-r--r--src/boot/modules/SysChk/amd64-ahci-epm.json1
-rw-r--r--src/boot/modules/SysChk/amd64-ahci-gpt.json1
-rw-r--r--src/boot/modules/SysChk/amd64-pio-epm.json1
-rw-r--r--src/boot/modules/SysChk/amd64-pio-gpt.json1
-rw-r--r--src/boot/src/HEL/AMD64/BootEFI.cc53
-rw-r--r--src/boot/src/HEL/ARM64/BootEFI.cc32
-rw-r--r--src/kernel/FirmwareKit/Handover.h1
-rw-r--r--src/kernel/HALKit/AMD64/HalKernelMain.cc4
-rw-r--r--src/kernel/HALKit/AMD64/Processor.h2
-rw-r--r--src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc2
-rw-r--r--src/kernel/NeKit/ErrorOr.h2
-rw-r--r--src/kernel/NeKit/Pmm.h2
-rw-r--r--src/kernel/NetworkKit/IPC.h10
-rw-r--r--src/kernel/amd64-ci.make2
-rw-r--r--src/kernel/src/BitMapMgr.cc10
-rw-r--r--src/kernel/src/FS/OpenHeFS+FileMgr.cc2
-rw-r--r--src/kernel/src/FS/OpenHeFS+FileSystemParser.cc2
-rw-r--r--src/kernel/src/HeapMgr.cc4
-rw-r--r--src/kernel/src/Network/IPCMessage.cc4
21 files changed, 52 insertions, 89 deletions
diff --git a/src/boot/modules/BootNet/amd64.json b/src/boot/modules/BootNet/amd64.json
index c0037580..5cbefe3d 100644
--- a/src/boot/modules/BootNet/amd64.json
+++ b/src/boot/modules/BootNet/amd64.json
@@ -27,6 +27,7 @@
"__BOOTZ__",
"__BOOTZ_STANDALONE__",
"__NE_AMD64__",
+ "__nekernel_max_cores=8 ",
"kBootNetVersionHighest=0x0100",
"kBootNetVersionLowest=0x0100",
"kBootNetEFIVersion=0x0100"
diff --git a/src/boot/modules/SysChk/SysChk.cc b/src/boot/modules/SysChk/SysChk.cc
index baedf3e8..ebc2be68 100644
--- a/src/boot/modules/SysChk/SysChk.cc
+++ b/src/boot/modules/SysChk/SysChk.cc
@@ -25,9 +25,9 @@ EXTERN_C Int32 SysChkModuleMain(Kernel::HEL::BootInfoHeader* handover) {
fw_init_efi((EfiSystemTable*) handover->f_FirmwareCustomTables[Kernel::HEL::kHandoverTableST]);
#if defined(__ATA_PIO__)
- Boot::BDiskFormatFactory<BootDeviceATA> partition_factory;
+ Boot::BDiskFormatFactory<Boot::BootDeviceATA> partition_factory;
#elif defined(__AHCI__)
- Boot::BDiskFormatFactory<BootDeviceSATA> partition_factory;
+ Boot::BDiskFormatFactory<Boot::BootDeviceSATA> partition_factory;
#endif
if (partition_factory.IsPartitionValid()) return kEfiOk;
diff --git a/src/boot/modules/SysChk/amd64-ahci-epm.json b/src/boot/modules/SysChk/amd64-ahci-epm.json
index 8ce9bfd8..48da0f86 100644
--- a/src/boot/modules/SysChk/amd64-ahci-epm.json
+++ b/src/boot/modules/SysChk/amd64-ahci-epm.json
@@ -33,6 +33,7 @@
"__AHCI__",
"__SYSCHK__",
"BOOTZ_EPM_SUPPORT",
+ "__nekernel_max_cores=8 ",
"__NE_VEPM__",
"__NE_MODULAR_KERNEL_COMPONENTS__",
"kChkVersionHighest=0x0100",
diff --git a/src/boot/modules/SysChk/amd64-ahci-gpt.json b/src/boot/modules/SysChk/amd64-ahci-gpt.json
index 80bb433e..91ab6291 100644
--- a/src/boot/modules/SysChk/amd64-ahci-gpt.json
+++ b/src/boot/modules/SysChk/amd64-ahci-gpt.json
@@ -30,6 +30,7 @@
"__NEOSKRNL__",
"__NE_AMD64__",
"__AHCI__",
+ "__nekernel_max_cores=8 ",
"__SYSCHK__",
"BOOTZ_GPT_SUPPORT",
"__NE_MODULAR_KERNEL_COMPONENTS__",
diff --git a/src/boot/modules/SysChk/amd64-pio-epm.json b/src/boot/modules/SysChk/amd64-pio-epm.json
index b1b95d8d..c7276d4e 100644
--- a/src/boot/modules/SysChk/amd64-pio-epm.json
+++ b/src/boot/modules/SysChk/amd64-pio-epm.json
@@ -31,6 +31,7 @@
"__BOOTZ__",
"__BOOTZ_STANDALONE__",
"__NE_AMD64__",
+ "__nekernel_max_cores=8 ",
"__ATA_PIO__",
"BOOTZ_EPM_SUPPORT",
"__NE_VEPM__",
diff --git a/src/boot/modules/SysChk/amd64-pio-gpt.json b/src/boot/modules/SysChk/amd64-pio-gpt.json
index b1a4d38b..88dae9be 100644
--- a/src/boot/modules/SysChk/amd64-pio-gpt.json
+++ b/src/boot/modules/SysChk/amd64-pio-gpt.json
@@ -33,6 +33,7 @@
"__NE_AMD64__",
"__ATA_PIO__",
"__NE_VEPM__",
+ "__nekernel_max_cores=8 ",
"BOOTZ_GPT_SUPPORT",
"kChkVersionHighest=0x0100",
"kChkVersionLowest=0x0100",
diff --git a/src/boot/src/HEL/AMD64/BootEFI.cc b/src/boot/src/HEL/AMD64/BootEFI.cc
index 59b0d239..d275a13d 100644
--- a/src/boot/src/HEL/AMD64/BootEFI.cc
+++ b/src/boot/src/HEL/AMD64/BootEFI.cc
@@ -36,7 +36,7 @@ STATIC Bool boot_init_fb() {
if (BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*) &kGop) != kEfiOk) return No;
- // AMLALE: Ok that ain't great, open to fixes.
+ // TODO: Ok that ain't great, open to fixes.
kGopStride = 4;
return Yes;
@@ -124,38 +124,41 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
// Fill handover header now.
- handover_hdr->f_BitMapStart = nullptr; /* Start of bitmap. */
- handover_hdr->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap in bytes. */
+ handover_hdr->f_BitMapStart = nullptr; /* Start of bitmap. */
+ handover_hdr->f_BitMapSize = 0UL; /* Size of bitmap in bytes. */
- kHandoverHeader->f_BitMapStart = nullptr; /* Start of bitmap. */
- kHandoverHeader->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap in bytes. */
+ kHandoverHeader->f_BitMapStart = nullptr; /* Start of bitmap. */
+ kHandoverHeader->f_BitMapSize = 0UL; /* Size of bitmap in bytes. */
- // open to patches.
- UInt16 trials = 15;
-
- while (BS->AllocatePool(EfiLoaderData, kHandoverHeader->f_BitMapSize,
- &kHandoverHeader->f_BitMapStart) != kEfiOk) {
- --trials;
-
- if (trials) {
- writer.Write("BootZ: Unable to allocate sufficient memory, trying again...\r");
+ // Get memory map to determine available memory for bitmap allocation.
+ BS->GetMemoryMap(&size_struct_ptr, struct_ptr, &map_key, &sz_desc, &rev_desc);
- if (kHandoverHeader->f_BitMapSize > 0)
- kHandoverHeader->f_BitMapSize =
- kHandoverHeader->f_BitMapSize / 2; /* Size of bitmap in bytes. */
+ // Allocate space for the memory descriptors.
+ BS->AllocatePool(EfiLoaderData, size_struct_ptr, (VoidPtr*) &struct_ptr);
+ BS->GetMemoryMap(&size_struct_ptr, struct_ptr, &map_key, &sz_desc, &rev_desc);
- while (BS->AllocatePool(EfiLoaderData, kHandoverHeader->f_BitMapSize,
- &kHandoverHeader->f_BitMapStart) != kEfiOk) {
- --trials;
+ // Calculate initial bitmap size by summing all free memory pages.
+ UInt64 free_pages = 0;
+ VoidPtr first_free_page = nullptr;
- if (!trials) {
- writer.Write("BootZ: Unable to allocate sufficient memory, aborting...\r");
- Boot::Stop();
- }
+ for (UInt32 i = 0; i < size_struct_ptr / sz_desc; ++i) {
+ EfiMemoryDescriptor* desc = (EfiMemoryDescriptor*) ((UInt8*) struct_ptr + (i * sz_desc));
+ if (desc->Kind == EfiConventionalMemory) {
+ if (first_free_page == nullptr) {
+ first_free_page = (VoidPtr) desc->PhysicalStart;
}
+ free_pages += desc->NumberOfPages;
}
}
+ // Set bitmap to use the first free page region found.
+ kHandoverHeader->f_BitMapStart = first_free_page;
+ handover_hdr->f_BitMapStart = first_free_page;
+
+ // Convert pages to bytes (assuming 4K pages) for bitmap size.
+ kHandoverHeader->f_BitMapSize = free_pages * 4096;
+ handover_hdr->f_BitMapSize = free_pages * 4096;
+
handover_hdr->f_FirmwareCustomTables[Kernel::HEL::kHandoverTableBS] = (VoidPtr) BS;
handover_hdr->f_FirmwareCustomTables[Kernel::HEL::kHandoverTableST] = (VoidPtr) ST;
@@ -175,8 +178,6 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
syschk_thread->Start(handover_hdr, NO);
}
- BS->GetMemoryMap(&size_struct_ptr, struct_ptr, &map_key, &sz_desc, &rev_desc);
-
handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
handover_hdr->f_Magic = kHandoverMagic;
diff --git a/src/boot/src/HEL/ARM64/BootEFI.cc b/src/boot/src/HEL/ARM64/BootEFI.cc
index a393e841..6322d311 100644
--- a/src/boot/src/HEL/ARM64/BootEFI.cc
+++ b/src/boot/src/HEL/ARM64/BootEFI.cc
@@ -120,39 +120,9 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
}
//-------------------------------------------------------------//
- // Allocate heap.
+ // TODO: Allocate heap.
//-------------------------------------------------------------//
- Boot::BootTextWriter writer;
-
- kHandoverHeader->f_BitMapStart = nullptr; /* Start of bitmap. */
- kHandoverHeader->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap in bytes. */
-
- UInt16 trials = 15;
-
- while (BS->AllocatePool(EfiLoaderData, kHandoverHeader->f_BitMapSize,
- &kHandoverHeader->f_BitMapStart) != kEfiOk) {
- --trials;
-
- if (trials) {
- writer.Write("BootZ: Unable to allocate sufficient memory, trying again...\r");
-
- if (kHandoverHeader->f_BitMapSize > 0)
- kHandoverHeader->f_BitMapSize =
- kHandoverHeader->f_BitMapSize / 2; /* Size of bitmap in bytes. */
-
- while (BS->AllocatePool(EfiLoaderData, kHandoverHeader->f_BitMapSize,
- &kHandoverHeader->f_BitMapStart) != kEfiOk) {
- --trials;
-
- if (!trials) {
- writer.Write("BootZ: Unable to allocate sufficient memory, aborting...\r");
- Boot::Stop();
- }
- }
- }
- }
-
// ------------------------------------------ //
// null these fields, to avoid being reused later.
// ------------------------------------------ //
diff --git a/src/kernel/FirmwareKit/Handover.h b/src/kernel/FirmwareKit/Handover.h
index 06e99c83..4128db2c 100644
--- a/src/kernel/FirmwareKit/Handover.h
+++ b/src/kernel/FirmwareKit/Handover.h
@@ -12,7 +12,6 @@
#define kHandoverVersion (0x0117)
/* Initial bitmap pointer location and size. */
-#define kHandoverBitMapSz (gib_cast(4))
#define kHandoverStructSz sizeof(HEL::BootInfoHeader)
namespace Kernel::HEL {
diff --git a/src/kernel/HALKit/AMD64/HalKernelMain.cc b/src/kernel/HALKit/AMD64/HalKernelMain.cc
index 4cf7d608..e54c0d84 100644
--- a/src/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/src/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -142,10 +142,10 @@ EXTERN_C Kernel::Void hal_real_init(Kernel::Void) {
UserProcessScheduler::The().SwitchTeam(kRTUserTeam);
- // AMLALE: TODO: Prosan, Process sanitizer.
+ // TODO: Prosan, Process sanitizer.
rtl_create_user_process([]() -> void { while (YES); }, "ProSan");
- // AMLALE: TODO, Vet sanitizer.
+ //TODO: Vet sanitizer.
rtl_create_user_process([]() -> void { while (YES); }, "VetSan");
HAL::mp_init_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr);
diff --git a/src/kernel/HALKit/AMD64/Processor.h b/src/kernel/HALKit/AMD64/Processor.h
index 7501ec63..8bd7b226 100644
--- a/src/kernel/HALKit/AMD64/Processor.h
+++ b/src/kernel/HALKit/AMD64/Processor.h
@@ -270,7 +270,7 @@ EXTERN_C ATTRIBUTE(naked) Kernel::Void hal_load_idt(Kernel::HAL::Register64 ptr)
EXTERN_C ATTRIBUTE(naked) Kernel::Void hal_load_gdt(Kernel::HAL::Register64 ptr);
inline Kernel::VoidPtr kKernelBitMpStart = nullptr;
-inline Kernel::UIntPtr kKernelBitMpSize = 0UL;
+inline Kernel::SizeT kKernelBitMpSize = 0UL;
#endif // __NE_AMD64__ */
diff --git a/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index 28969475..456b6a2a 100644
--- a/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -384,7 +384,7 @@ STATIC Bool drv_init_command_structures_ahci() {
/// @param atapi reference value, tells whether we should detect ATAPI instead of SATA.
/// @return if the disk was successfully initialized or not.
STATIC Bool drv_std_init_ahci(UInt16& pi, BOOL& atapi) {
- /// AMLALE: TODO: Iterator is good enough, but we need to expand it.
+ /// TODO: Iterator is good enough, but we need to expand it.
PCI::Iterator iterator(Types::PciDeviceKind::MassStorageController, 0x00);
for (SizeT device_index = 0; device_index < NE_BUS_COUNT; ++device_index) {
diff --git a/src/kernel/NeKit/ErrorOr.h b/src/kernel/NeKit/ErrorOr.h
index b471e33e..87031b75 100644
--- a/src/kernel/NeKit/ErrorOr.h
+++ b/src/kernel/NeKit/ErrorOr.h
@@ -24,7 +24,7 @@ class ErrorOr final {
using TypePtr = T*;
explicit ErrorOr(ErrorT err) : mRef((T*) RTL_ALLOCA(sizeof(T))), mId(err) {
- // AMLALE: Invalidate the value of mRef to make computational evaluations false.
+ // TODO: Invalidate the value of mRef to make computational evaluations false.
mRef = nullptr;
}
diff --git a/src/kernel/NeKit/Pmm.h b/src/kernel/NeKit/Pmm.h
index 894e28c9..35357e60 100644
--- a/src/kernel/NeKit/Pmm.h
+++ b/src/kernel/NeKit/Pmm.h
@@ -13,7 +13,7 @@ namespace Kernel {
class Pmm;
class PTEWrapper;
-// AMLALE: A PMM stands for Page Memory Manager. Which guarantees page retrieval and free.
+// TODO: A PMM stands for Page Memory Manager. Which guarantees page retrieval and free.
class Pmm final {
public:
explicit Pmm();
diff --git a/src/kernel/NetworkKit/IPC.h b/src/kernel/NetworkKit/IPC.h
index 0d42de31..27f39079 100644
--- a/src/kernel/NetworkKit/IPC.h
+++ b/src/kernel/NetworkKit/IPC.h
@@ -2,8 +2,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/nekernel-org/nekernel
-#ifndef INC_IPC_H
-#define INC_IPC_H
+#ifndef NETWORKKIT_IPC_H
+#define NETWORKKIT_IPC_H
#include <NeKit/Config.h>
#include <NeKit/KString.h>
@@ -47,8 +47,6 @@ enum {
kIPCMixedEndian = 2,
};
-constexpr inline auto kIPCMsgSize = 6094U;
-
enum {
kIPCLockInvalid = 0,
kIPCLockFree = 1,
@@ -65,8 +63,8 @@ typedef struct IPC_MSG final {
UInt32 IpcCRC32;
UInt32 IpcMsg;
UInt32 IpcMsgSz;
- UInt8 IpcData[kIPCMsgSize];
UInt32 IpcLock;
+ UInt8* IpcData;
/// @brief Passes the message to target, could be anything, HTTP packet, JSON or whatever.
static Bool Pass(IPC_MSG* self, IPC_MSG* target);
} PACKED ALIGN(8) IPC_MSG;
@@ -82,4 +80,4 @@ BOOL ipc_sanitize_packet(_Input IPC_MSG* pckt_in);
BOOL ipc_construct_packet(_Output _Input IPC_MSG** pckt_in);
} // namespace Kernel
-#endif // INC_IPC_H
+#endif // NETWORKKIT_IPC_H
diff --git a/src/kernel/amd64-ci.make b/src/kernel/amd64-ci.make
index 203d0dc9..ad0e96b3 100644
--- a/src/kernel/amd64-ci.make
+++ b/src/kernel/amd64-ci.make
@@ -5,7 +5,7 @@
CXX = x86_64-w64-mingw32-g++
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -fshort-wchar -c -D__NE_AMD64__ -D__NEOSKRNL__ -D__NE_VEPM__ -Werror -Wall -Wpedantic -Wextra -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__NE_SUPPORT_NX__ -O0 -I../vendor -D__FSKIT_INCLUDES_NEFS__ -D__NEKERNEL__ -D__HAVE_NE_APIS__ -D__FREESTANDING__ -D__NE_VIRTUAL_MEMORY_SUPPORT__ -D__NE_AUTO_FORMAT__ -D__NE__ -I./ -I../ -I../boot
+CCFLAGS = -fshort-wchar -D__nekernel_max_cores=8 -c -D__NE_AMD64__ -D__NEOSKRNL__ -D__NE_VEPM__ -Werror -Wall -Wpedantic -Wextra -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__NE_SUPPORT_NX__ -O0 -I../vendor -D__FSKIT_INCLUDES_NEFS__ -D__NEKERNEL__ -D__HAVE_NE_APIS__ -D__FREESTANDING__ -D__NE_VIRTUAL_MEMORY_SUPPORT__ -D__NE_AUTO_FORMAT__ -D__NE__ -I./ -I../ -I../boot
ASM = nasm
diff --git a/src/kernel/src/BitMapMgr.cc b/src/kernel/src/BitMapMgr.cc
index d6541769..5cae02c1 100644
--- a/src/kernel/src/BitMapMgr.cc
+++ b/src/kernel/src/BitMapMgr.cc
@@ -78,17 +78,7 @@ namespace HAL {
auto FindBitMap(VoidPtr base_ptr, SizeT size, Bool wr, Bool user, SizeT pad) -> VoidPtr {
if (!size) return nullptr;
- if (kBitMapCursor > kKernelBitMpSize) {
- err_global_get() = kErrorOutOfBitMapMemory;
-
- (Void)(kout << "Bitmap limit reached, can't allocate more bitmaps." << kendl);
- return nullptr;
- }
-
VoidPtr base = reinterpret_cast<VoidPtr>(base_ptr);
- MUST_PASS(base);
-
- if (!base) return nullptr;
STATIC SizeT biggest = 0UL;
diff --git a/src/kernel/src/FS/OpenHeFS+FileMgr.cc b/src/kernel/src/FS/OpenHeFS+FileMgr.cc
index abe8164c..7008c491 100644
--- a/src/kernel/src/FS/OpenHeFS+FileMgr.cc
+++ b/src/kernel/src/FS/OpenHeFS+FileMgr.cc
@@ -49,7 +49,7 @@ NodePtr HeFileSystemMgr::Create(_Input const Char* path) {
return nullptr;
}
- // AMLALE: TODO, its own helper!
+ //TODO: its own helper!
SizeT len = oe_string_len<Char>(path);
#if defined(__clang__)
diff --git a/src/kernel/src/FS/OpenHeFS+FileSystemParser.cc b/src/kernel/src/FS/OpenHeFS+FileSystemParser.cc
index 8db1a01f..93cc5a63 100644
--- a/src/kernel/src/FS/OpenHeFS+FileSystemParser.cc
+++ b/src/kernel/src/FS/OpenHeFS+FileSystemParser.cc
@@ -876,7 +876,7 @@ _Output Bool HeFileSystemParser::Format(_Input _Output DriveTrait* mnt, _Input c
return NO;
}
- /// AMLALE: Better way to create default directories than before.
+ /// TODO: Better way to create default directories than before.
const Utf8Char* kFileMap[] = {u8"/", u8"/boot", u8"/system", u8"/network",
u8"/devices", u8"/media", u8"/dev", (Utf8Char*) nullptr};
diff --git a/src/kernel/src/HeapMgr.cc b/src/kernel/src/HeapMgr.cc
index be6c60bf..f549f60c 100644
--- a/src/kernel/src/HeapMgr.cc
+++ b/src/kernel/src/HeapMgr.cc
@@ -244,9 +244,9 @@ _Output Boolean mm_protect_ptr(VoidPtr heap_ptr) {
reinterpret_cast<Detail::MM_INFORMATION_BLOCK_PTR>((UIntPtr) heap_ptr -
sizeof(Detail::MM_INFORMATION_BLOCK));
- /// AMLALE: if valid, present and is heap header, then compute crc32
+ /// TODO: if valid, present and is heap header, then compute crc32
if (heap_info_ptr && heap_info_ptr->fPresent && kHeapMgrMagic == heap_info_ptr->fMagic) {
- /// AMLALE: Protect only the header, information in it may change.
+ /// TODO: Protect only the header, information in it may change.
heap_info_ptr->fCRC32 =
ke_calculate_crc32((Char*) heap_info_ptr, sizeof(Detail::MM_INFORMATION_BLOCK));
diff --git a/src/kernel/src/Network/IPCMessage.cc b/src/kernel/src/Network/IPCMessage.cc
index 6a565604..7db9f022 100644
--- a/src/kernel/src/Network/IPCMessage.cc
+++ b/src/kernel/src/Network/IPCMessage.cc
@@ -34,7 +34,7 @@ Bool ipc_int_sanitize_packet(IPC_MSG* pckt) {
goto ipc_check_failed;
}
- if (pckt->IpcFrom == pckt->IpcTo || pckt->IpcPacketSize > kIPCMsgSize) {
+ if (pckt->IpcFrom == pckt->IpcTo || pckt->IpcPacketSize < 1) {
goto ipc_check_failed;
}
@@ -115,7 +115,7 @@ Bool IPC_MSG::Pass(IPC_MSG* src, IPC_MSG* target) {
++target->IpcLock;
- rt_copy_memory_safe(src->IpcData, target->IpcData, src->IpcMsgSz, kIPCMsgSize);
+ rt_copy_memory_safe(src->IpcData, target->IpcData, src->IpcMsgSz, target->IpcMsgSz);
--target->IpcLock;