diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-26 15:37:37 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-26 15:37:37 +0100 |
| commit | 0476248f648ccddea9bdf9bae9095c3231e6643d (patch) | |
| tree | 61280ff1ad93b384a9697c0ee9d60854e12e58e9 /newBoot | |
| parent | ae89bf9564c59ea3aee10f175d473e562af793f8 (diff) | |
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 <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'newBoot')
| -rw-r--r-- | newBoot/BootKit/Boot.hpp | 19 | ||||
| -rw-r--r-- | newBoot/Source/Arch/AMD64/BootAMD64.cxx | 4 | ||||
| -rw-r--r-- | newBoot/Source/Arch/AMD64/Processor.cxx | 7 | ||||
| -rw-r--r-- | newBoot/Source/MPT/API.cxx | 67 | ||||
| -rw-r--r-- | newBoot/Source/MPT/API.hxx | 2 | ||||
| -rw-r--r-- | newBoot/Source/MPT/MPT.hxx | 6 | ||||
| -rw-r--r-- | newBoot/Source/Start.cxx | 2 |
7 files changed, 63 insertions, 44 deletions
diff --git a/newBoot/BootKit/Boot.hpp b/newBoot/BootKit/Boot.hpp index fabc6186..af86ce4c 100644 --- a/newBoot/BootKit/Boot.hpp +++ b/newBoot/BootKit/Boot.hpp @@ -22,9 +22,13 @@ enum kSegmentBss = 6, }; -class BTextWriter final +/** + * @brief BootKit Text Writer class + * Writes to VGA. + */ +class BKTextWriter final { - volatile UInt16* fWhere; + volatile UInt16* fWhere{ nullptr }; public: void WriteString(const char* c, @@ -40,12 +44,12 @@ public: int y); public: - BTextWriter() = default; - ~BTextWriter() = default; + BKTextWriter() = default; + ~BKTextWriter() = default; public: - BTextWriter& operator=(const BTextWriter&) = default; - BTextWriter(const BTextWriter&) = default; + BKTextWriter& operator=(const BKTextWriter&) = default; + BKTextWriter(const BKTextWriter&) = default; }; @@ -68,3 +72,6 @@ enum kYellow, kWhite, }; + +#define BK_START_KERNEL (0x00080000) + diff --git a/newBoot/Source/Arch/AMD64/BootAMD64.cxx b/newBoot/Source/Arch/AMD64/BootAMD64.cxx index 5543a34f..0ed59ff0 100644 --- a/newBoot/Source/Arch/AMD64/BootAMD64.cxx +++ b/newBoot/Source/Arch/AMD64/BootAMD64.cxx @@ -23,7 +23,7 @@ long long int BStrLen(const char* ptr) return cnt; } -void BTextWriter::WriteString( +void BKTextWriter::WriteString( const char* str, unsigned char forecolour, unsigned char backcolour, @@ -41,7 +41,7 @@ void BTextWriter::WriteString( } } -void BTextWriter::WriteCharacter( +void BKTextWriter::WriteCharacter( char c, unsigned char forecolour, unsigned char backcolour, diff --git a/newBoot/Source/Arch/AMD64/Processor.cxx b/newBoot/Source/Arch/AMD64/Processor.cxx index 18b5e8e7..50330e47 100644 --- a/newBoot/Source/Arch/AMD64/Processor.cxx +++ b/newBoot/Source/Arch/AMD64/Processor.cxx @@ -7,6 +7,13 @@ * ======================================================== */ +/* + * + * @file Processor.cxx + * @brief Processor Specific Functions. + * + */ + extern "C" void rt_halt(void) { asm volatile("hlt"); } extern "C" void rt_cli(void) { asm volatile("cli"); } 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<Files32FileGroup>(); + detail::kRootGroup = detail::new_class<detail::Files32FileGroup>(); - 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 diff --git a/newBoot/Source/Start.cxx b/newBoot/Source/Start.cxx index 0dbe1de0..5f320ac7 100644 --- a/newBoot/Source/Start.cxx +++ b/newBoot/Source/Start.cxx @@ -11,7 +11,7 @@ extern "C" void __AppMain(void) { - BTextWriter writer; + BKTextWriter writer; writer.WriteString("Starting hCore...", kBlack, kWhite, 0, 0); const char* args[] = { "/hCore.bin" }; |
