summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Private/NewBoot/Source')
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootKit.cxx28
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx33
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/Platform.cxx4
-rw-r--r--Private/NewBoot/Source/makefile4
4 files changed, 16 insertions, 53 deletions
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx b/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
index 68971e0c..19df55b0 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
@@ -8,8 +8,9 @@
*/
#include <BootKit/BootKit.hxx>
+#include <EFIKit/EFILib.hxx>
-constexpr HCore::UInt32 kVGABaseAddress = 0xb8000;
+#include "EFIKit/EFI.hxx"
HCore::SizeT BStrLen(const char *ptr) {
long long int cnt = 0;
@@ -40,29 +41,18 @@ HCore::SizeT BSetMem(char *src, const char byte, const HCore::SizeT len) {
/**
@brief puts wrapper over VGA.
*/
-void BKTextWriter::WriteString(const char *str, unsigned char forecolour,
- unsigned char backcolour, int x, int y) {
+void BTextWriter::WriteString(const CharacterType *str) {
if (*str == 0 || !str) return;
- for (SizeT idx = 0; idx < BStrLen(str); ++idx) {
- this->WriteCharacter(str[idx], forecolour, backcolour, x, y);
- ++x;
- }
+ ST->ConOut->OutputString(ST->ConOut, str);
}
/**
@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 BTextWriter::WriteCharacter(CharacterType c) {
+ EfiCharType str[2];
+ str[0] = c;
+ str[1] = 0;
+ ST->ConOut->OutputString(ST->ConOut, str);
}
diff --git a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
index b3e63bd9..89b3ece2 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
@@ -18,38 +18,11 @@ EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle,
EfiSystemTable* SystemTable) {
KeInitEFI(SystemTable);
- SystemTable->ConOut->OutputString(SystemTable->ConOut,
- L"HCoreLdr: Initializing...\r\n");
-
- EfiLoadImageProtocol* protocol = nullptr;
- EfiGUID guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
-
- Int32 statusCode = SystemTable->BootServices->OpenProtocol(
- ImageHandle, &guid, (VoidPtr*)&protocol, ImageHandle, nullptr,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-
- if (statusCode != kEfiOk) {
- SystemTable->ConOut->OutputString(
- SystemTable->ConOut,
- L"HCoreLdr: Could not locate EfiLoadImageProtocol! Aborting...\r\n");
-
- Detail::Stop(SystemTable);
- return kEfiFail;
- }
-
- SystemTable->BootServices->OpenProtocol(
- ImageHandle, &guid, (VoidPtr*)&protocol, ImageHandle, ImageHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-
- if (SystemTable->BootServices->ExitBootServices(ImageHandle, 0) != kEfiOk) {
- SystemTable->ConOut->OutputString(
- SystemTable->ConOut, L"HCoreLdr: Could not exit Boot Services!\r\n");
-
- Detail::Stop(SystemTable);
- }
+ BTextWriter writer;
+ writer.WriteString(L"HCoreLdr: Booting from disk...\r\n");
// TODO: Jump Code
- Detail::Stop(SystemTable);
+ EFI::Stop(SystemTable);
return kEfiOk;
}
diff --git a/Private/NewBoot/Source/HEL/AMD64/Platform.cxx b/Private/NewBoot/Source/HEL/AMD64/Platform.cxx
index a0c93ab5..f72e0be1 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Platform.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/Platform.cxx
@@ -9,8 +9,8 @@
/*
*
- * @file Processor.cxx
- * @brief Processor Specific Functions.
+ * @file Platform.cxx
+ * @brief Platform Specific Functions.
*
*/
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 2e092da2..74ab7878 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -12,8 +12,8 @@ FLAG_GNU=-fshort-wchar -fPIC -D__DBG__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I.
invalid-recipe:
@echo "invalid-recipe: Use make arch-<arch> all instead."
-.PHONY: arch-amd64
-arch-amd64:
+.PHONY: bootloader-amd64
+bootloader-amd64:
$(CC_GNU) $(FLAG_GNU) HEL/AMD64/*.cxx
$(LD_GNU) *.o -e efi_main -filealign:16 -shared --subsystem=10 -ffreestanding -o HCoreLdr.exe
cp HCoreLdr.exe CDROM/EFI/BOOT/BOOTX64.EFI