diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-04-26 12:29:13 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-04-26 12:29:13 +0000 |
| commit | 97eb8462433a831f8a02a08acfc7ca32e794d37d (patch) | |
| tree | e7cddb857e50a2cca41a5364b4240cd8c6c0ec13 /Private/HALKit | |
| parent | f7a7080d18ac2be758b242c22f020c018b1c4824 (diff) | |
| parent | 313c303fab092b1c45e615f960826375e7eef093 (diff) | |
Merged in MHR-16 (pull request #6)
MHR-16 - A lot of features and USA design.
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/AMD64/HalNewBoot.asm | 17 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalProcessor.cpp | 2 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/Storage/AHCI.cxx | 8 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/Storage/ATA-PIO.cxx | 18 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalStartSequence.s | 8 |
5 files changed, 25 insertions, 28 deletions
diff --git a/Private/HALKit/AMD64/HalNewBoot.asm b/Private/HALKit/AMD64/HalNewBoot.asm index 995a848c..e9034f05 100644 --- a/Private/HALKit/AMD64/HalNewBoot.asm +++ b/Private/HALKit/AMD64/HalNewBoot.asm @@ -23,22 +23,19 @@ HandoverMagic: dq kHandoverMagic HandoverType: dw kTypeKernel HandoverArch: dw kArchAmd64 ;; This NewBootStart points to Main. -HandoverStart: dq Main +HandoverStart: dq __ImageStart section .text -global Main +global __ImageStart +global __NewBootJumpProc + extern hal_init_platform ;; Just a simple setup, we'd also need to tell some before -Main: - push rax +__NewBootJumpProc: +__ImageStart: push rcx call hal_init_platform pop rcx - pop rax -;; Go to sleep. -MainLoop: - cli - hlt - jmp $ + ret diff --git a/Private/HALKit/AMD64/HalProcessor.cpp b/Private/HALKit/AMD64/HalProcessor.cpp index 4fea4e7e..61d98c8c 100644 --- a/Private/HALKit/AMD64/HalProcessor.cpp +++ b/Private/HALKit/AMD64/HalProcessor.cpp @@ -8,7 +8,7 @@ /** * @file Processor.cpp - * @brief This file is about processor specific functions (in/out...) + * @brief This file is about processor specific functions (in/out/cli/std...) */ namespace NewOS::HAL { diff --git a/Private/HALKit/AMD64/Storage/AHCI.cxx b/Private/HALKit/AMD64/Storage/AHCI.cxx index 5e6b3348..c9db540a 100644 --- a/Private/HALKit/AMD64/Storage/AHCI.cxx +++ b/Private/HALKit/AMD64/Storage/AHCI.cxx @@ -33,11 +33,11 @@ NewOS::Boolean drv_std_init(NewOS::UInt16& PortsImplemented) { for (SizeT devIndex = 0; devIndex < NEWOS_BUS_COUNT; ++devIndex) { if (iterator[devIndex].Leak().Subclass() == kSATASubClass && iterator[devIndex].Leak().ProgIf() == kSATAProgIfAHCI) { - iterator[devIndex].Leak().EnableMmio(); - kAhciDevice = iterator[devIndex].Leak(); + iterator[devIndex].Leak().EnableMmio(); /// enable the memory i/o for this ahci device. + kAhciDevice = iterator[devIndex].Leak(); /// and then leak the reference. kcout << "NewKernel: [PCI] Found AHCI controller.\r\n"; - + return true; } } @@ -54,4 +54,4 @@ NewOS::Void drv_std_read(NewOS::UInt64 Lba, NewOS::Char* Buf, NewOS::Void drv_std_write(NewOS::UInt64 Lba, NewOS::Char* Buf, NewOS::SizeT SectorSz, NewOS::SizeT Size) {} -#endif // __AHCI__
\ No newline at end of file +#endif // __AHCI__ diff --git a/Private/HALKit/AMD64/Storage/ATA-PIO.cxx b/Private/HALKit/AMD64/Storage/ATA-PIO.cxx index 3cbba6f7..beb113d3 100644 --- a/Private/HALKit/AMD64/Storage/ATA-PIO.cxx +++ b/Private/HALKit/AMD64/Storage/ATA-PIO.cxx @@ -58,7 +58,7 @@ Void drv_std_select(UInt16 Bus) { Boolean drv_std_init(UInt16 Bus, UInt8 Drive, UInt16& OutBus, UInt8& OutMaster) { - if (drv_std_detected()) return false; + if (drv_std_detected()) return true; UInt16 IO = Bus; @@ -132,15 +132,15 @@ ATAInit_Retry: Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz, SizeT Size) { - UInt8 Command = (!Master ? 0xE0 : 0xF0); + UInt8 Command = ((!Master )? 0xE0 : 0xF0); - Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0xF)); - Out8(IO + ATA_REG_SEC_COUNT0, SectorSz); + Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F)); + Out8(IO + ATA_REG_SEC_COUNT0, 1); Out8(IO + ATA_REG_LBA0, (Lba)); Out8(IO + ATA_REG_LBA1, (Lba) >> 8); Out8(IO + ATA_REG_LBA2, (Lba) >> 16); - Out8(IO + ATA_REG_LBA3, (Lba) >> 24); + Out8(IO + ATA_REG_LBA4, (Lba) >> 24); Out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO); @@ -155,15 +155,15 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz, SizeT Size) { - UInt8 Command = (!Master ? 0xE0 : 0xF0); + UInt8 Command = ((!Master) ? 0xE0 : 0xF0); - Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0xF)); - Out8(IO + ATA_REG_SEC_COUNT0, SectorSz); + Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F)); + Out8(IO + ATA_REG_SEC_COUNT0, 1); Out8(IO + ATA_REG_LBA0, (Lba)); Out8(IO + ATA_REG_LBA1, (Lba) >> 8); Out8(IO + ATA_REG_LBA2, (Lba) >> 16); - Out8(IO + ATA_REG_LBA3, (Lba) >> 24); + Out8(IO + ATA_REG_LBA4, (Lba) >> 24); Out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO); diff --git a/Private/HALKit/POWER/HalStartSequence.s b/Private/HALKit/POWER/HalStartSequence.s index f50a4d4f..fd018304 100644 --- a/Private/HALKit/POWER/HalStartSequence.s +++ b/Private/HALKit/POWER/HalStartSequence.s @@ -4,11 +4,11 @@ ------------------------------------------- */ -.globl Main -.extern HalKernelMain +.globl __ImageStart +.extern hal_init_platform .align 4 .text -Main: - bl HalKernelMain +__ImageStart: + bl hal_init_platform blr |
