From 55059428bfd6a18451bc1ed3ee64e7bb04c395cd Mon Sep 17 00:00:00 2001 From: amlal Date: Sat, 16 Mar 2024 14:22:21 +0100 Subject: HCR-14: See below. - Pretty big modifications, add kernel mouse. Signed-off-by: amlal --- Private/KernelKit/FileManager.hpp | 20 ++++++++-------- Private/KernelKit/LoaderInterface.hpp | 1 + Private/KernelKit/ProcessTeam.hpp | 2 +- Private/KernelKit/Rsrc/Cursor.rsrc | 40 ++++++++++++++++++++++++++++++++ Private/KernelKit/Rsrc/Util.hxx | 27 +++++++++++++++++++++ Private/KernelKit/ThreadLocalStorage.hxx | 10 ++++---- Private/KernelKit/ThreadLocalStorage.inl | 8 +++---- 7 files changed, 88 insertions(+), 20 deletions(-) create mode 100644 Private/KernelKit/Rsrc/Cursor.rsrc (limited to 'Private/KernelKit') diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp index 3d986ddc..a00476bd 100644 --- a/Private/KernelKit/FileManager.hpp +++ b/Private/KernelKit/FileManager.hpp @@ -50,18 +50,18 @@ typedef VoidPtr NodePtr; @brief Filesystem Manager Interface class @brief Used to provide common I/O for a specific filesystem. */ -class IFilesystemManager { +class FilesystemManagerInterface { public: - IFilesystemManager() = default; - virtual ~IFilesystemManager() = default; + FilesystemManagerInterface() = default; + virtual ~FilesystemManagerInterface() = default; public: - HCORE_COPY_DEFAULT(IFilesystemManager); + HCORE_COPY_DEFAULT(FilesystemManagerInterface); public: - static bool Mount(IFilesystemManager *pMount); - static IFilesystemManager *Unmount(); - static IFilesystemManager *GetMounted(); + static bool Mount(FilesystemManagerInterface *pMount); + static FilesystemManagerInterface *Unmount(); + static FilesystemManagerInterface *GetMounted(); public: virtual NodePtr Create(_Input const char *path) = 0; @@ -91,9 +91,9 @@ class IFilesystemManager { #ifdef __FSKIT_NEWFS__ /** - * @brief Based of IFilesystemManager, takes care of managing NewFS disks. + * @brief Based of FilesystemManagerInterface, takes care of managing NewFS disks. */ -class NewFilesystemManager final : public IFilesystemManager { +class NewFilesystemManager final : public FilesystemManagerInterface { public: explicit NewFilesystemManager(); ~NewFilesystemManager() override; @@ -158,7 +158,7 @@ class NewFilesystemManager final : public IFilesystemManager { * @tparam Encoding file encoding (char, wchar_t...) * @tparam FSClass Filesystem contract who takes care of it. */ -template +template class FileStream final { public: explicit FileStream(const Encoding *path, const Encoding *restrict_type); diff --git a/Private/KernelKit/LoaderInterface.hpp b/Private/KernelKit/LoaderInterface.hpp index 51257e72..5beb403f 100644 --- a/Private/KernelKit/LoaderInterface.hpp +++ b/Private/KernelKit/LoaderInterface.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include diff --git a/Private/KernelKit/ProcessTeam.hpp b/Private/KernelKit/ProcessTeam.hpp index b60a8a0d..9538bbae 100644 --- a/Private/KernelKit/ProcessTeam.hpp +++ b/Private/KernelKit/ProcessTeam.hpp @@ -6,4 +6,4 @@ #pragma once -#include \ No newline at end of file +#include diff --git a/Private/KernelKit/Rsrc/Cursor.rsrc b/Private/KernelKit/Rsrc/Cursor.rsrc new file mode 100644 index 00000000..94922ca7 --- /dev/null +++ b/Private/KernelKit/Rsrc/Cursor.rsrc @@ -0,0 +1,40 @@ +#pragma once + +#define POINTER_HEIGHT 32 +#define POINTER_WIDTH 32 + +// array size is 3072 +static const unsigned int Pointer[] = { + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0xf7f7f7, 0xb6b6b6, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0xd5d5d5, 0xffffff, 0xa2a2a2, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x7a7a7a, 0xfefefe, 0xfafafa, 0x696969, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0xcacaca, 0xffffff, 0xe1e1e1, 0x272727, 0x767676, 0xececec, 0x878787, 0x000000, 0xf3f3f3, 0x909090, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x4a4a4a, 0xf3f3f3, 0xfefefe, 0xd5d5d5, 0x404040, 0xe2e2e2, 0xfbfbfb, 0xa1a1a1, 0xd5d5d5, 0xf9f9f9, 0x8c8c8c, 0xd9d9d9, 0x353535, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x9d9d9d, 0xfefefe, 0xfefefe, 0xf1f1f1, 0xdfdfdf, 0xfefefe, 0xfefefe, 0xf7f7f7, 0xfefefe, 0xeaeaea, 0xe5e5e5, 0xc8c8c8, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xdbdbdb, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfbfbfb, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x636363, 0xf8f8f8, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0xdbdbdb, 0xf9f9f9, 0xdfdfdf, 0xa5a5a5, 0x383838, 0xb0b0b0, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x9b9b9b, 0xd9d9d9, 0xfbfbfb, 0xfcfcfc, 0xf2f2f2, 0xb8b8b8, 0xececec, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x666666, 0xcacaca, 0xf9f9f9, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x666666, 0xe1e1e1, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x3b3b3b, 0xd9d9d9, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xf9f9f9, 0xd6d6d6, 0x8e8e8e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x525252, 0xc1c1c1, 0xcecece, 0xd6d6d6, 0xd1d1d1, 0xb5b5b5, 0x5d5d5d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 +}; \ No newline at end of file diff --git a/Private/KernelKit/Rsrc/Util.hxx b/Private/KernelKit/Rsrc/Util.hxx index 03013888..2ff81076 100644 --- a/Private/KernelKit/Rsrc/Util.hxx +++ b/Private/KernelKit/Rsrc/Util.hxx @@ -33,4 +33,31 @@ } \ } +/// @brief cleans a resource. +#define KeClearZone(_Height, _Width, BaseX, BaseY) \ + \ + for (HCore::SizeT i = BaseX; i < _Height + BaseX; ++i) { \ + for (HCore::SizeT u = BaseY; u < _Width + BaseY; ++u) { \ + *(((volatile HCore::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * \ + kHandoverHeader->f_GOP \ + .f_PixelPerLine * \ + i + \ + 4 * u))) = RGB(0, 0, 0); \ + } \ + } + +#define KeDrawZone(_Clr, _Height, _Width, BaseX, BaseY) \ + \ + for (HCore::SizeT i = BaseX; i < _Height + BaseX; ++i) { \ + for (HCore::SizeT u = BaseY; u < _Width + BaseY; ++u) { \ + *(((volatile HCore::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * \ + kHandoverHeader->f_GOP \ + .f_PixelPerLine * \ + i + \ + 4 * u))) = _Clr; \ + } \ + } + #endif diff --git a/Private/KernelKit/ThreadLocalStorage.hxx b/Private/KernelKit/ThreadLocalStorage.hxx index ba2f021f..25c9c48f 100644 --- a/Private/KernelKit/ThreadLocalStorage.hxx +++ b/Private/KernelKit/ThreadLocalStorage.hxx @@ -16,13 +16,13 @@ #define kCookieMag2 'o' template -T *hcore_tls_new_ptr(void); +T *tls_new_ptr(void); template -bool hcore_tls_delete_ptr(T *ptr); +bool tls_delete_ptr(T *ptr); template -T *hcore_tls_new_class(Args &&...args); +T *tls_new_class(Args &&...args); #define kTLSCookieLen 3 @@ -46,10 +46,10 @@ struct ThreadInformationBlock final { EXTERN_C void rt_install_tib(ThreadInformationBlock *pTib, HCore::VoidPtr pPib); ///! @brief Cookie Sanity check. -HCore::Boolean hcore_tls_check(ThreadInformationBlock *ptr); +HCore::Boolean tls_check(ThreadInformationBlock *ptr); /// @brief TLS check system call -EXTERN_C HCore::Void hcore_tls_check_syscall_impl(HCore::HAL::StackFramePtr stackPtr) noexcept; +EXTERN_C HCore::Void tls_check_syscall_impl(HCore::HAL::StackFramePtr stackPtr) noexcept; #include diff --git a/Private/KernelKit/ThreadLocalStorage.inl b/Private/KernelKit/ThreadLocalStorage.inl index a42c2381..4a8a816a 100644 --- a/Private/KernelKit/ThreadLocalStorage.inl +++ b/Private/KernelKit/ThreadLocalStorage.inl @@ -11,7 +11,7 @@ #endif template -inline T* hcore_tls_new_ptr(void) { +inline T* tls_new_ptr(void) { using namespace HCore; MUST_PASS(ProcessManager::Shared().Leak().GetCurrent()); @@ -24,7 +24,7 @@ inline T* hcore_tls_new_ptr(void) { //! @brief TLS delete implementation. template -inline bool hcore_tls_delete_ptr(T* ptr) { +inline bool tls_delete_ptr(T* ptr) { if (!ptr) return false; using namespace HCore; @@ -38,8 +38,8 @@ inline bool hcore_tls_delete_ptr(T* ptr) { } template -T* hcore_tls_new_class(Args&&... args) { - T* ptr = hcore_tls_new_ptr(); +T* tls_new_class(Args&&... args) { + T* ptr = tls_new_ptr(); if (ptr) { *ptr = T(HCore::forward(args)...); -- cgit v1.2.3