diff options
Diffstat (limited to 'Private/NewBoot')
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/Boot.cxx | 57 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx | 21 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/Processor.cxx | 20 | ||||
| -rw-r--r-- | Private/NewBoot/Source/makefile | 2 |
4 files changed, 44 insertions, 56 deletions
diff --git a/Private/NewBoot/Source/HEL/AMD64/Boot.cxx b/Private/NewBoot/Source/HEL/AMD64/Boot.cxx index 96c30c12..70f280e6 100644 --- a/Private/NewBoot/Source/HEL/AMD64/Boot.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/Boot.cxx @@ -11,46 +11,43 @@ constexpr hCore::UInt32 kVGABaseAddress = 0xb8000; -hCore::SizeT BStrLen(const char *ptr) -{ - long long int cnt = 0; +hCore::SizeT BStrLen(const char *ptr) { + long long int cnt = 0; - while (*ptr != 0) - { - ++ptr; - ++cnt; - } + while (*ptr != 0) { + ++ptr; + ++cnt; + } - return cnt; + return cnt; } /** @brief puts wrapper over VGA. */ -void BKTextWriter::WriteString(const char *str, unsigned char forecolour, unsigned char backcolour, int x, int y) -{ - if (*str == 0 || !str) - return; - - for (SizeT idx = 0; idx < BStrLen(str); ++idx) - { - this->WriteCharacter(str[idx], forecolour, backcolour, x, y); - ++x; - } +void BKTextWriter::WriteString(const char *str, unsigned char forecolour, + unsigned char backcolour, int x, int y) { + if (*str == 0 || !str) return; + + for (SizeT idx = 0; idx < BStrLen(str); ++idx) { + this->WriteCharacter(str[idx], forecolour, backcolour, x, y); + ++x; + } } /** @brief putc wrapper over VGA. */ -void BKTextWriter::WriteCharacter(char c, unsigned char forecolour, unsigned char backcolour, int x, int y) -{ - UInt16 attrib = (backcolour << 4) | (forecolour & 0x0F); - - // Video Graphics Array - // Reads at kVGABaseAddress - // Decodes UInt16, gets attributes (back colour, fore colour) - // Gets character, send it to video display with according colour in the registry. - - fWhere = (volatile UInt16 *)kVGABaseAddress + (y * 80 + x); - *fWhere = c | (attrib << 8); +void BKTextWriter::WriteCharacter(char c, unsigned char forecolour, + unsigned char backcolour, int x, int y) { + UInt16 attrib = (backcolour << 4) | (forecolour & 0x0F); + + // Video Graphics Array + // Reads at kVGABaseAddress + // Decodes UInt16, gets attributes (back colour, fore colour) + // Gets character, send it to video display with according colour in the + // registry. + + fWhere = (volatile UInt16 *)kVGABaseAddress + (y * 80 + x); + *fWhere = c | (attrib << 8); } diff --git a/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx b/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx index 0102fa8c..0d44086b 100644 --- a/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx @@ -11,16 +11,19 @@ #include <BootKit/Processor.hxx> #include <BootKit/Protocol.hxx> -EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle, EfiSystemTable *SystemTable) -{ - SystemTable->ConOut->OutputString(SystemTable->ConOut, L"HCoreLdr: Starting \\EPM\\HCore...\r\n"); +EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle, + EfiSystemTable *SystemTable) { + SystemTable->ConOut->OutputString(SystemTable->ConOut, + L"HCoreLdr: Starting \\EPM\\HCore...\r\n"); - if (SystemTable->BootServices->ExitBootServices(ImageHandle, kBaseHandoverStruct) != kEfiOk) - { - SystemTable->ConOut->OutputString(SystemTable->ConOut, L"HCoreLdr: Could not Exit UEFI!\r\nHanging...\r\n"); + if (SystemTable->BootServices->ExitBootServices( + ImageHandle, kBaseHandoverStruct) != kEfiOk) { + SystemTable->ConOut->OutputString( + SystemTable->ConOut, + L"HCoreLdr: Could not Exit UEFI!\r\nHanging...\r\n"); - return kEfiFail; - } + return kEfiFail; + } - return kEfiOk; + return kEfiOk; } diff --git a/Private/NewBoot/Source/HEL/AMD64/Processor.cxx b/Private/NewBoot/Source/HEL/AMD64/Processor.cxx index f1f9b617..a0c93ab5 100644 --- a/Private/NewBoot/Source/HEL/AMD64/Processor.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/Processor.cxx @@ -16,22 +16,10 @@ #include <BootKit/Processor.hxx> -extern "C" void rt_halt(void) -{ - asm volatile("hlt"); -} +extern "C" void rt_halt(void) { asm volatile("hlt"); } -extern "C" void rt_cli(void) -{ - asm volatile("cli"); -} +extern "C" void rt_cli(void) { asm volatile("cli"); } -extern "C" void rt_sti(void) -{ - asm volatile("sti"); -} +extern "C" void rt_sti(void) { asm volatile("sti"); } -extern "C" void rt_cld(void) -{ - asm volatile("cld"); -} +extern "C" void rt_cld(void) { asm volatile("cld"); } diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index 6ccec377..1fa6cc46 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -6,7 +6,7 @@ CC_GNU=x86_64-w64-mingw32-g++ LD_GNU=x86_64-w64-mingw32-ld -FLAG_GNU=-fshort-wchar -fPIC -D__DBG__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I../../efiSDK/inc -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__hCore__ -I./ -I$(HOME)/ +FLAG_GNU=-fshort-wchar -fPIC -D__DBG__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I../../efiSDK/inc -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -I./ -I$(HOME)/ .PHONY: arch-amd64 arch-amd64: |
