From 0476248f648ccddea9bdf9bae9095c3231e6643d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 26 Jan 2024 15:37:37 +0100 Subject: Kernel: Retarget AMD64 according to spec. Kernel/Toolchain: Now move hKernel to /System/ when building the system. MPT: Fix API. newBoot: This is the priority, get a standard file layout to load the kernel at BK_START_KERNEL (0x00080000) Signed-off-by: Amlal El Mahrouss --- newBoot/Source/MPT/API.cxx | 67 +++++++++++++++++++++++++--------------------- newBoot/Source/MPT/API.hxx | 2 +- newBoot/Source/MPT/MPT.hxx | 6 ++--- 3 files changed, 40 insertions(+), 35 deletions(-) (limited to 'newBoot/Source/MPT') diff --git a/newBoot/Source/MPT/API.cxx b/newBoot/Source/MPT/API.cxx index c5e31d7f..e607eecd 100644 --- a/newBoot/Source/MPT/API.cxx +++ b/newBoot/Source/MPT/API.cxx @@ -10,22 +10,6 @@ #include "API.hxx" #include "Detail.hxx" -struct Files32FileHdr final -{ - char Filename[32]; - char Ext[3]; - char Attr; - char Case; - char CreateMs; - unsigned short Create; - unsigned short CreateDate; - unsigned short LastAccess; - unsigned short Timestamp; - unsigned short Datestamp; - unsigned short StartLba; - unsigned int SizeFile; -}; - #define kFilesR 0x01 /* read-only */ #define kFilesH 0x02 /* hidden */ #define kFilesS 0x04 /* system */ @@ -36,29 +20,50 @@ struct Files32FileHdr final // @brief Array of unused bits. #define kFilesU { 0x40, 0x80 } -struct Files32FileGroup final +namespace mpt::detail { - Files32FileHdr* fHdr{ nullptr }; + struct Files32FileHdr final + { + char Filename[32]; + char Ext[3]; + char Attr; + char Case; + char CreateMs; + unsigned short Create; + unsigned short CreateDate; + unsigned short LastAccess; + unsigned short Timestamp; + unsigned short Datestamp; + unsigned short StartLba; + unsigned int SizeFile; + }; + + struct Files32FileGroup final + { + Files32FileHdr* fHdr{ nullptr }; + + Files32FileGroup* fUpper{ nullptr }; + Files32FileGroup* fLower{ nullptr }; + Files32FileGroup* fPrev{ nullptr }; + Files32FileGroup* fNext{ nullptr }; + }; - Files32FileGroup* fUpper{ nullptr }; - Files32FileGroup* fLower{ nullptr }; - Files32FileGroup* fPrev{ nullptr }; - Files32FileGroup* fNext{ nullptr }; -} kRootGroup = nullptr; + /* @brief external inits */ + extern "C" int init_ata_mpt(void); + extern "C" int init_mpt(void); -/* @brief external inits */ -extern "C" int init_ata_mpt(void); -extern "C" int init_mpt(void); + Files32FileGroup* kRootGroup = nullptr; +} namespace mpt { - bool filesystem_init(void) noexcept + bool init_mpt() noexcept { - kRootGroup = detail::new_class(); + detail::kRootGroup = detail::new_class(); - assert(kRootGroup != nullptr); - assert(init_ata_mpt() == detail::okay); - assert(init_mpt() == detail::okay); + assert(detail::kRootGroup != nullptr); + assert(detail::init_ata_mpt() == detail::okay); + assert(detail::init_mpt() == detail::okay); return true; } diff --git a/newBoot/Source/MPT/API.hxx b/newBoot/Source/MPT/API.hxx index 1c5123b1..3ce689e7 100644 --- a/newBoot/Source/MPT/API.hxx +++ b/newBoot/Source/MPT/API.hxx @@ -13,5 +13,5 @@ namespace mpt { /// initializes the Master Partition Table and the Files32 filesystem. /// \return status, assert(fail) is also triggered, use filesystem_hook_error if you want to catch it. - bool filesystem_init(void) noexcept; + bool init_mpt() noexcept; } \ No newline at end of file diff --git a/newBoot/Source/MPT/MPT.hxx b/newBoot/Source/MPT/MPT.hxx index cd97b113..e8bbe7cd 100644 --- a/newBoot/Source/MPT/MPT.hxx +++ b/newBoot/Source/MPT/MPT.hxx @@ -23,7 +23,7 @@ struct MasterPartitionTable final enum { - kPartEfi = 'efi', - kPartEpm = 'epm', - kPartEbr = 'ebr', + kPartEfi = 0x10, + kPartEpm = 0x11, + kPartEbr = 0x12, }; \ No newline at end of file -- cgit v1.2.3