diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-27 08:43:21 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-27 08:43:21 +0200 |
| commit | d7519f338b544624145997576d2800f9670aa699 (patch) | |
| tree | c0e4045729a2017aea1eeb04a27eb8e115a12223 | |
| parent | d10241467cc3f77988927a48a4384f63297465dd (diff) | |
MHR-18: Kernel patches, improved documentation and new FloatType in
user-space SystemLib.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | Private/HALKit/AMD64/HalACPIFactoryInterface.cxx | 2 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp | 2 | ||||
| -rw-r--r-- | Private/KernelKit/DebugOutput.hpp | 11 | ||||
| -rw-r--r-- | Private/NewBoot/BootKit/BootKit.hxx | 11 | ||||
| -rw-r--r-- | Public/Developer/SystemLib/Headers/Defines.h | 28 | ||||
| -rw-r--r-- | Public/Developer/SystemLib/Headers/Wm.h | 2 | ||||
| -rw-r--r-- | Public/Developer/SystemLib/Sources/Wm.c | 4 |
7 files changed, 32 insertions, 28 deletions
diff --git a/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx b/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx index d18d49cf..d20bf222 100644 --- a/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx +++ b/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx @@ -64,7 +64,7 @@ ErrorOr<voidPtr> ACPIFactoryInterface::Find(const char *signature) { SizeT num = xsdt->Length + sizeof(SDT) / 8; kcout << "ACPI: Number of entries: " << number(num) << endl; - kcout << "ACPI: Address of XSDT: " << number((UIntPtr)xsdt) << endl; + kcout << "ACPI: Address of XSDT: " << hex_number((UIntPtr)xsdt) << endl; constexpr short ACPI_SIGNATURE_LENGTH = 4; diff --git a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp index 37e8f0cc..5c845812 100644 --- a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp @@ -6,7 +6,7 @@ #include <Builtins/ACPI/ACPIFactoryInterface.hxx> #include <HALKit/AMD64/Processor.hpp> -#include "NewKit/KernelCheck.hpp" +#include <NewKit/KernelCheck.hpp> /////////////////////////////////////////////////////////////////////////////////////// diff --git a/Private/KernelKit/DebugOutput.hpp b/Private/KernelKit/DebugOutput.hpp index f24933cc..6c4da58e 100644 --- a/Private/KernelKit/DebugOutput.hpp +++ b/Private/KernelKit/DebugOutput.hpp @@ -57,8 +57,8 @@ inline TerminalDevice carriage_return() { namespace Detail { inline TerminalDevice _write_number(const Long &x, TerminalDevice& term) { - int y = x / 10; - int h = x % 10; + UInt64 y = (x > 0 ? x : -x) / 10; + UInt64 h = (x > 0 ? x : -x) % 10; if (y) _write_number(y, term); @@ -81,8 +81,8 @@ inline TerminalDevice _write_number(const Long &x, TerminalDevice& term) { } inline TerminalDevice _write_number_hex(const Long &x, TerminalDevice& term) { - int y = x / 16; - int h = x % 16; + UInt64 y = (x > 0 ? x : -x) / 16; + UInt64 h = (x > 0 ? x : -x) % 16; if (y) _write_number_hex(y, term); @@ -94,7 +94,7 @@ inline TerminalDevice _write_number_hex(const Long &x, TerminalDevice& term) { if (y < 0) y = -y; - const char NUMBERS[17] = "0123456789"; + const char NUMBERS[17] = "0123456789ABCDEF"; Char buf[2]; buf[0] = NUMBERS[h]; @@ -143,4 +143,3 @@ class DebuggerPortHeader final { #define kcout TerminalDevice::Shared() #define endl end_line() - diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx index 26c6c755..a1eb9d76 100644 --- a/Private/NewBoot/BootKit/BootKit.hxx +++ b/Private/NewBoot/BootKit/BootKit.hxx @@ -247,9 +247,12 @@ public: private: /// @brief Write all of the requested catalogs into the filesystem. - Boolean WriteContent(BFileDescriptor* fileBlobs, SizeT blobCount, - SizeT sectorSz, NewPartitionBlock& partBlock) { - if (sectorSz != BootDev::kSectorSize) return false; + /// @param fileBlobs the blobs. + /// @param blobCount the number of blobs to write. + /// @param partBlock the NewFS partition block. + Boolean FormatCatalog(BFileDescriptor* fileBlobs, SizeT blobCount, + NewPartitionBlock& partBlock) { + if (partBlock.SectorSize != BootDev::kSectorSize) return false; BFileDescriptor* blob = fileBlobs; Lba startLba = partBlock.StartCatalog; @@ -390,7 +393,7 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const char* partName, partBlock->StartCatalog = kNewFSCatalogStartAddress; partBlock->DiskSize = fDiskDev.GetDiskSize(); - if (this->WriteContent(fileBlobs, blobCount, sectorSz, *partBlock)) { + if (this->FormatCatalog(fileBlobs, blobCount, *partBlock)) { fDiskDev.Leak().mBase = (kNewFSAddressAsLba); fDiskDev.Leak().mSize = sectorSz; diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h index 3be7552f..57bfffdf 100644 --- a/Public/Developer/SystemLib/Headers/Defines.h +++ b/Public/Developer/SystemLib/Headers/Defines.h @@ -52,8 +52,10 @@ typedef void* PtrVoidType; typedef void VoidType; #ifdef __SINGLE_PRECISION__ +typedef float FloatType; typedef float PositionType; #else +typedef double FloatType; typedef double PositionType; #endif @@ -84,23 +86,23 @@ typedef CharacterTypeUTF8 BooleanType; # define CA_FAR # define CA_NEAR -#endif +#endif #ifdef __aarch64__ # define _M_AARCH64 3 -#endif +#endif #ifdef __powerpc64__ -# define _M_PPC64 4 -#endif +# define _M_PPC64 4 +#endif #ifdef __64x0__ -# define _M_64000 5 -#endif +# define _M_64000 5 +#endif #ifdef __riscv__ # define _M_RISCV 6 -#endif +#endif #define CA_STATIC static #define CA_INLINE inline @@ -191,18 +193,18 @@ using StrType = CharacterTypeUTF8[N]; #endif // ifdef C++ /// @brief Get app singleton. -/// @param -/// @return +/// @param +/// @return CA_EXTERN_C ApplicationRef RtGetAppPointer(VoidType); /// @brief Get argument count -/// @param -/// @return +/// @param +/// @return CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType); /// @brief Get argument pointer. -/// @param -/// @return +/// @param +/// @return CA_EXTERN_C CharacterTypeUTF8** RtGetAppArgumentsPtr(VoidType); CA_EXTERN_C ApplicationRef kSharedApplication; diff --git a/Public/Developer/SystemLib/Headers/Wm.h b/Public/Developer/SystemLib/Headers/Wm.h index f6484c29..c2c9738d 100644 --- a/Public/Developer/SystemLib/Headers/Wm.h +++ b/Public/Developer/SystemLib/Headers/Wm.h @@ -173,4 +173,4 @@ CA_EXTERN_C WindowPort* WmGetOSDlg(void); /// @brief Draws a blur effect on the window. /// @param wndPort the window port. -CA_EXTERN_C VoidType WmBlur(WindowPort* wndPort); +CA_EXTERN_C VoidType WmBlur(WindowPort* wndPort); diff --git a/Public/Developer/SystemLib/Sources/Wm.c b/Public/Developer/SystemLib/Sources/Wm.c index 79eda22a..72ae5919 100644 --- a/Public/Developer/SystemLib/Sources/Wm.c +++ b/Public/Developer/SystemLib/Sources/Wm.c @@ -82,7 +82,7 @@ CA_EXTERN_C VoidType WmBlur(WindowPort* wndPort) { if (wndPort != NullPtr) { WmGFXRef refGfx = wndPort->windowGfx; - UInt32Type lookupTbl[4] = {0.21336, 0.41336, 0.61336, 0.81336}; + FloatType lookupTbl[4] = {0.21336, 0.41336, 0.61336, 0.81336}; for (SizeType width = 0; width < refGfx->DataFrameWidth; ++width) { for (SizeType height = 0; height < refGfx->DataFrameHeight; ++height) { @@ -100,4 +100,4 @@ CA_EXTERN_C VoidType WmInvalidateGfx(WindowPort* wndPort) { if (wndPort) { wndPort->windowInvalidate = Yes; } -}
\ No newline at end of file +} |
