From c3b3b7727b9e2e7cbddcd0997c53d96ba3bb0e82 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 12 Apr 2024 12:54:30 +0200 Subject: kernel: update IPC protocol header, framebuffer header. servers/display: Add display server. private: rename LinkerScripts to just Linker. Signed-off-by: Amlal El Mahrouss --- Private/KernelKit/Framebuffer.hpp | 20 ++++++++++++-------- Private/Linker/16x0.json | 6 ++++++ Private/Linker/32x0.json | 6 ++++++ Private/Linker/64x0.json | 6 ++++++ Private/LinkerScripts/16x0.json | 6 ------ Private/LinkerScripts/32x0.json | 6 ------ Private/LinkerScripts/64x0.json | 6 ------ Private/NetworkKit/IPCEP.hxx | 33 +++++++++++++++++++-------------- Private/Source/Network/IPCEP.cxx | 7 +++++++ Servers/DisplayManager/Server.c | 30 ++++++++++++++++++++++++++++++ 10 files changed, 86 insertions(+), 40 deletions(-) create mode 100644 Private/Linker/16x0.json create mode 100644 Private/Linker/32x0.json create mode 100644 Private/Linker/64x0.json delete mode 100644 Private/LinkerScripts/16x0.json delete mode 100644 Private/LinkerScripts/32x0.json delete mode 100644 Private/LinkerScripts/64x0.json create mode 100644 Private/Source/Network/IPCEP.cxx create mode 100644 Servers/DisplayManager/Server.c diff --git a/Private/KernelKit/Framebuffer.hpp b/Private/KernelKit/Framebuffer.hpp index 39b1eb5e..555aad2d 100644 --- a/Private/KernelKit/Framebuffer.hpp +++ b/Private/KernelKit/Framebuffer.hpp @@ -2,6 +2,9 @@ Copyright Mahrouss Logic + File: Framebuffer.hpp + Purpose: Framebuffer object. + ------------------------------------------- */ #ifndef __INC_FB_HPP__ @@ -45,12 +48,12 @@ class Framebuffer final { Ref &Leak(); /// @brief Draws a rectangle inside the fb. - /// @param width - /// @param height - /// @param x - /// @param y - /// @param color - /// @return + /// @param width the width of it + /// @param height the height of it + /// @param x its x coord. + /// @param y its y coord. + /// @param color the color of it. + /// @return the framebuffer object. Framebuffer &DrawRect(SizeT width, SizeT height, SizeT x, SizeT y, UInt32 color); @@ -58,7 +61,7 @@ class Framebuffer final { /// @param x where in X /// @param y where in Y /// @param color the color of it. - /// @return + /// @return the framebuffer object. Framebuffer &PutPixel(SizeT x, SizeT y, UInt32 color); private: @@ -67,7 +70,7 @@ class Framebuffer final { }; /***********************************************************************************/ -/// Color utils. +/// Some common colors. /***********************************************************************************/ extern const UInt32 kRgbRed; @@ -81,6 +84,7 @@ extern const UInt32 kRgbWhite; /// Color macros. /***********************************************************************************/ +/// @brief Macro hack to make a color (as hexadecimal) #define RGB(R, G, B) (NewOS::UInt32)(0x##R##G##B) #endif /* ifndef __INC_FB_HPP__ */ diff --git a/Private/Linker/16x0.json b/Private/Linker/16x0.json new file mode 100644 index 00000000..1dd7abbd --- /dev/null +++ b/Private/Linker/16x0.json @@ -0,0 +1,6 @@ +{ + "executable_type": "kernel", + "output_name": "NewKernel.exe", + "start_proc": "Main", + "format": "PEF" +} diff --git a/Private/Linker/32x0.json b/Private/Linker/32x0.json new file mode 100644 index 00000000..1dd7abbd --- /dev/null +++ b/Private/Linker/32x0.json @@ -0,0 +1,6 @@ +{ + "executable_type": "kernel", + "output_name": "NewKernel.exe", + "start_proc": "Main", + "format": "PEF" +} diff --git a/Private/Linker/64x0.json b/Private/Linker/64x0.json new file mode 100644 index 00000000..1dd7abbd --- /dev/null +++ b/Private/Linker/64x0.json @@ -0,0 +1,6 @@ +{ + "executable_type": "kernel", + "output_name": "NewKernel.exe", + "start_proc": "Main", + "format": "PEF" +} diff --git a/Private/LinkerScripts/16x0.json b/Private/LinkerScripts/16x0.json deleted file mode 100644 index 1dd7abbd..00000000 --- a/Private/LinkerScripts/16x0.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "executable_type": "kernel", - "output_name": "NewKernel.exe", - "start_proc": "Main", - "format": "PEF" -} diff --git a/Private/LinkerScripts/32x0.json b/Private/LinkerScripts/32x0.json deleted file mode 100644 index 1dd7abbd..00000000 --- a/Private/LinkerScripts/32x0.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "executable_type": "kernel", - "output_name": "NewKernel.exe", - "start_proc": "Main", - "format": "PEF" -} diff --git a/Private/LinkerScripts/64x0.json b/Private/LinkerScripts/64x0.json deleted file mode 100644 index 1dd7abbd..00000000 --- a/Private/LinkerScripts/64x0.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "executable_type": "kernel", - "output_name": "NewKernel.exe", - "start_proc": "Main", - "format": "PEF" -} diff --git a/Private/NetworkKit/IPCEP.hxx b/Private/NetworkKit/IPCEP.hxx index b3b8a759..cd7345e4 100644 --- a/Private/NetworkKit/IPCEP.hxx +++ b/Private/NetworkKit/IPCEP.hxx @@ -1,6 +1,8 @@ /* ------------------------------------------- - Copyright Mahrouss Logic + Copyright Mahrouss Logic. + + File: IPCEP.hxx, Purpose: Common IPC protocol. ------------------------------------------- */ @@ -10,36 +12,39 @@ #include #include -/// @brief IPC Endpoint Protocol (IPCEP) definition. +/// @brief Common IPC Endpoint Protocol (Common IPC for short). /// IA separator. #define kRemoteSeparator "." -/// Interchange address, consists of domain+namespace. -#define kRemoteInvalid "00.00.00.00:0" -#define kRemoteMaxLen 21 +/// Interchange address, consists of domain:namespace. +#define kRemoteInvalid "00.00.00.00:0000" +#define kRemoteBitWidth 96 /* 96-bit address space. */ -#define kRemoteHeaderMagic 0xFFEEAACCEE +#define kRemoteHeaderMagic 0xFEEDFACE namespace NewOS { /// @brief 96-bit number to represent the domain and namespace -struct PACKED IPCEPNumber final { +struct PACKED IPCEPAddress { UInt32 RemoteAddress; UInt64 RemoteNamespace; }; -typedef struct IPCEPNumber IPCEPNumberType; +typedef struct IPCEPAddress IPCEPAddressType; + +enum { kIPCEPLittleEndian = 0, kIPCEPBigEndian = 1 }; /// @brief IPCEP connection header -typedef struct IPCEPConnectionHeader final { - UInt64 IpcHeader; // 0xFFEEAACCEE +typedef struct IPCEPConnectionHeader { + UInt32 IpcHeader; // kRemoteHeaderMagic UInt8 IpcEndianess; // 0 : LE, 1 : BE SizeT IpcPacketSize; - IPCEPNumberType IpcFrom; - IPCEPNumberType IpcTo; + IPCEPAddressType IpcFrom; + IPCEPAddressType IpcTo; UInt32 IpcCRC32; - Char IpcPad[8]; + SizeT IpcDataSize; + Char IpcData[]; } PACKED IPCEPConnectionHeader; } // namespace NewOS -#endif // _INC_IPC_ENDPOINT_HXX_ \ No newline at end of file +#endif // _INC_IPC_ENDPOINT_HXX_ diff --git a/Private/Source/Network/IPCEP.cxx b/Private/Source/Network/IPCEP.cxx new file mode 100644 index 00000000..67c0b5a8 --- /dev/null +++ b/Private/Source/Network/IPCEP.cxx @@ -0,0 +1,7 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include diff --git a/Servers/DisplayManager/Server.c b/Servers/DisplayManager/Server.c new file mode 100644 index 00000000..673cf479 --- /dev/null +++ b/Servers/DisplayManager/Server.c @@ -0,0 +1,30 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Server.c + Purpose: DisplayManager server. + +------------------------------------------- */ + +#include "Server.h" + +/// @brief Called when the server starts. +DWordType ServerStartup(VoidType) +{ + DMInitDisplay(kDMNoFlags); // init standard display. Need to notify other endpoits. + // as well. + // + + IPCSendMessage(kIPCBroadcast); /// broadcast our presence + + return 0; +} + +/// @brief Called when the server shuts down. +DWordType ServerShutdown(VoidType) +{ + DMCloseDisplay(); /// takes no arguments. + return 0; +} + -- cgit v1.2.3