summaryrefslogtreecommitdiffhomepage
path: root/Private
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-18 20:01:38 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-18 20:01:38 +0100
commit98347089c7e4e2b306d25a0db77e00aa2ea50882 (patch)
treea0b3a1130bff9068055aea87f3e3b964dc9fce0a /Private
parent4c714f2c24c5df78bae2f35c42c73107de4c8c71 (diff)
unstable, secret: Very important changes done to the system API, add
threading functions. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private')
-rw-r--r--Private/CompilerKit/Detail.hxx4
-rw-r--r--Private/KernelKit/ThreadLocalStorage.hxx5
-rw-r--r--Private/NetworkKit/NetworkDevice.hpp17
-rw-r--r--Private/NewBoot/Source/makefile2
-rw-r--r--Private/NewKit/Defines.hpp6
-rw-r--r--Private/Source/Network/NetworkDevice.cxx2
-rw-r--r--Private/Source/ThreadLocalStorage.cxx6
-rw-r--r--Private/makefile2
8 files changed, 26 insertions, 18 deletions
diff --git a/Private/CompilerKit/Detail.hxx b/Private/CompilerKit/Detail.hxx
index 0c7a7c46..78a08dcf 100644
--- a/Private/CompilerKit/Detail.hxx
+++ b/Private/CompilerKit/Detail.hxx
@@ -6,7 +6,9 @@
#pragma once
-#include <NewKit/Defines.hpp>
+#ifdef __KERNEL__
+# include <NewKit/Defines.hpp>
+#endif // ifdef __KERNEL__
#define HCORE_COPY_DELETE(KLASS) \
KLASS &operator=(const KLASS &) = delete; \
diff --git a/Private/KernelKit/ThreadLocalStorage.hxx b/Private/KernelKit/ThreadLocalStorage.hxx
index 25c9c48f..2fab5026 100644
--- a/Private/KernelKit/ThreadLocalStorage.hxx
+++ b/Private/KernelKit/ThreadLocalStorage.hxx
@@ -38,7 +38,8 @@ struct ThreadInformationBlock final {
HCore::UIntPtr StartData; // Allocation Heap
HCore::UIntPtr StartStack; // Stack Pointer.
HCore::Int32 Arch; // Architecture and/or platform.
- rt_cookie_type Cookie; // Not shown in public header, this is the way we tell
+ HCore::Int32 ID; // Thread execution ID.
+ rt_cookie_type Cookie; // Not shown in public header, location of the cookie header is store here, this is the way we tell
// something went wrong.
};
@@ -46,7 +47,7 @@ struct ThreadInformationBlock final {
EXTERN_C void rt_install_tib(ThreadInformationBlock *pTib, HCore::VoidPtr pPib);
///! @brief Cookie Sanity check.
-HCore::Boolean tls_check(ThreadInformationBlock *ptr);
+HCore::Boolean tls_check_tib(ThreadInformationBlock *ptr);
/// @brief TLS check system call
EXTERN_C HCore::Void tls_check_syscall_impl(HCore::HAL::StackFramePtr stackPtr) noexcept;
diff --git a/Private/NetworkKit/NetworkDevice.hpp b/Private/NetworkKit/NetworkDevice.hpp
index 74b60068..d85cb939 100644
--- a/Private/NetworkKit/NetworkDevice.hpp
+++ b/Private/NetworkKit/NetworkDevice.hpp
@@ -4,8 +4,8 @@
------------------------------------------- */
-#ifndef _INC_NETWORKDEVICE_HPP__
-#define _INC_NETWORKDEVICE_HPP__
+#ifndef __NETWORK_DEVICE__
+#define __NETWORK_DEVICE__
#include <KernelKit/DeviceManager.hpp>
#include <NetworkKit/IP.hpp>
@@ -30,17 +30,18 @@ class NetworkDevice final : public DeviceInterface<NetworkDeviceCommand> {
NetworkDevice(const NetworkDevice &) = default;
public:
- const char *Name() const override { return "NetworkDevice"; }
+ const char *Name() const override;
private:
void (*fCleanup)(void);
};
struct PACKED NetworkDeviceCommand final {
- UInt32 Command;
- UInt32 VLan;
- UInt32 DmaLow;
- UInt32 DmaHigh;
+ UInt32 CommandName;
+ UInt32 CommandType;
+ UInt32 CommandFlags;
+ VoidPtr CommandBuffer;
+ SizeT CommandSizeBuffer;
};
/// @brief TCP device.
@@ -58,4 +59,4 @@ using HPCNetworkDevice = NetworkDevice;
#include <NetworkKit/NetworkDevice.inl>
-#endif // !_INC_NETWORKDEVICE_HPP__
+#endif // !__NETWORK_DEVICE__
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 801e7699..2eab4a84 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -23,7 +23,7 @@ REM=rm
REM_FLAG=-f
FLAG_ASM=-f win64
-FLAG_GNU=-fshort-wchar -DkBootKrnlSections=9 -mgeneral-regs-only -mno-red-zone -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -D__BOOTLOADER__ -I./
+FLAG_GNU=-fshort-wchar -DkBootKrnlSections=9 -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -D__BOOTLOADER__ -I./
.PHONY: invalid-recipe
invalid-recipe:
diff --git a/Private/NewKit/Defines.hpp b/Private/NewKit/Defines.hpp
index bc41633f..563af7d2 100644
--- a/Private/NewKit/Defines.hpp
+++ b/Private/NewKit/Defines.hpp
@@ -8,7 +8,11 @@
#include <NewKit/Macros.hpp>
-#define NEWKIT_VERSION "1.00"
+#ifndef __KERNEL__
+# error You are not compiling the kernel.
+#endif
+
+#define NEWKIT_VERSION "1.01"
#if !defined(_INC_NO_STDC_HEADERS) && defined(__GNUC__)
#include <CRT/__cxxkit_defines.hxx>
diff --git a/Private/Source/Network/NetworkDevice.cxx b/Private/Source/Network/NetworkDevice.cxx
index eba95a2c..f43ef335 100644
--- a/Private/Source/Network/NetworkDevice.cxx
+++ b/Private/Source/Network/NetworkDevice.cxx
@@ -7,5 +7,5 @@
#include <NetworkKit/NetworkDevice.hpp>
namespace HCore {
-
+const char *NetworkDevice::Name() const { return "NetworkDevice"; }
} // namespace HCore
diff --git a/Private/Source/ThreadLocalStorage.cxx b/Private/Source/ThreadLocalStorage.cxx
index 395b9dc6..8fd61d5e 100644
--- a/Private/Source/ThreadLocalStorage.cxx
+++ b/Private/Source/ThreadLocalStorage.cxx
@@ -25,12 +25,12 @@ using namespace HCore;
* @return if the cookie is enabled.
*/
-Boolean tls_check(VoidPtr ptr) {
+Boolean tls_check_tib(VoidPtr ptr) {
if (!ptr) return false;
const char* _ptr = (const char*)ptr;
- kcout << "HCoreKrnl\\TLS: Checking for cookie...\n";
+ kcout << "HCoreKrnl\\TLS: Checking for a valid cookie...\n";
return _ptr[0] == kCookieMag0 && _ptr[1] == kCookieMag1 &&
_ptr[2] == kCookieMag2;
@@ -44,7 +44,7 @@ Boolean tls_check(VoidPtr ptr) {
EXTERN_C Void tls_check_syscall_impl(HCore::HAL::StackFramePtr stackPtr) noexcept {
ThreadInformationBlock* tib = (ThreadInformationBlock*)stackPtr->Gs;
- if (!tls_check(tib->Cookie)) {
+ if (!tls_check_tib(tib->Cookie)) {
kcout << "HCoreKrnl\\TLS: Verification failed, Crashing...\n";
ProcessManager::Shared().Leak().GetCurrent().Leak().Crash();
}
diff --git a/Private/makefile b/Private/makefile
index d64889a3..e9528a48 100644
--- a/Private/makefile
+++ b/Private/makefile
@@ -5,7 +5,7 @@
CC = x86_64-w64-mingw32-gcc
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -c -ffreestanding -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__HAVE_HCORE_APIS__ -D__HCORE__ -I../ -I./
+CCFLAGS = -c -ffreestanding -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_HCORE_APIS__ -D__HCORE__ -I../ -I./
ASM = nasm
# Add assembler, linker, and object files variables.