summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-24 10:37:20 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-24 10:37:20 +0100
commitb842e2d8e09189d527006ca5b3dec58128afe953 (patch)
treea410656e642c4ae4472c054b7c69fef98d2c5433 /Private/NewBoot
parenteaf9ec361fa0b9a56057a7143d15a0ee31258f0d (diff)
Kernel: :boom: Fixing stuff due to misguided efforts.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot')
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx1
-rw-r--r--Private/NewBoot/Source/BootMain.cxx11
-rw-r--r--Private/NewBoot/Source/TextWriter.cxx20
-rw-r--r--Private/NewBoot/Source/bundle.mk3
-rw-r--r--Private/NewBoot/Source/standard.mk1
5 files changed, 32 insertions, 4 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 093b20dc..5128d02f 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -41,6 +41,7 @@ typedef WideChar CharacterType;
*/
class BTextWriter final {
public:
+ BTextWriter &WriteString(const Long &num);
BTextWriter &WriteString(const CharacterType *str);
BTextWriter &WriteCharacter(CharacterType c);
diff --git a/Private/NewBoot/Source/BootMain.cxx b/Private/NewBoot/Source/BootMain.cxx
index ea83e1f4..73ca1364 100644
--- a/Private/NewBoot/Source/BootMain.cxx
+++ b/Private/NewBoot/Source/BootMain.cxx
@@ -72,7 +72,7 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle,
.WriteString(L"\r\n");
#endif
- BFileReader img(L"HCOREKRNL.EXE", ImageHandle);
+ BFileReader img(L"HCOREKRNL.DLL", ImageHandle);
img.Size(kHeadersSz);
img.ReadAll();
@@ -90,6 +90,13 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle,
ExecOptionalHeaderPtr optHdr = reinterpret_cast<ExecOptionalHeaderPtr>(
ptrHdr + sizeof(ExecHeader));
+ if (optHdr->mSubsystem != 0xAFAF) {
+ writer.WriteString(L"HCoreLdr: This is not an HCore app: Subsystem: ")
+ .WriteString(optHdr->mSubsystem)
+ .WriteString(L"\r\n");
+ EFI::Stop();
+ }
+
UInt32 MapKey = 0;
UInt32* Size;
EfiMemoryDescriptor* Descriptor;
@@ -157,7 +164,7 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle,
#ifdef __BUNDLE_KERNEL__
RuntimeMain(handoverHdrPtr);
#else
- // Load HCoreKrnl.exe (TODO)
+ // Load HCoreKrnl.dll (TODO)
#endif // ifdef __BUNDLE_KERNEL__
diff --git a/Private/NewBoot/Source/TextWriter.cxx b/Private/NewBoot/Source/TextWriter.cxx
index 0ea3a972..fe058aa4 100644
--- a/Private/NewBoot/Source/TextWriter.cxx
+++ b/Private/NewBoot/Source/TextWriter.cxx
@@ -40,3 +40,23 @@ BTextWriter &BTextWriter::WriteCharacter(CharacterType c) {
return *this;
}
+
+BTextWriter &BTextWriter::WriteString(const Long &x) {
+ int y = x / 16;
+ int h = x % 16;
+
+ if (y) this->WriteString(y);
+
+ /* fail if the hex number is not base-16 */
+ if (h > 15) {
+ this->WriteCharacter('?');
+ return *this;
+ }
+
+ if (y < 0) y = -y;
+
+ const char g_numbers[17] = "0123456789ABCDEF";
+
+ this->WriteCharacter(g_numbers[h]);
+ return *this;
+}
diff --git a/Private/NewBoot/Source/bundle.mk b/Private/NewBoot/Source/bundle.mk
index 3f1df9e0..e0894f94 100644
--- a/Private/NewBoot/Source/bundle.mk
+++ b/Private/NewBoot/Source/bundle.mk
@@ -22,8 +22,7 @@ bootloader-amd64:
$(ASM) $(FLAG_ASM) HEl/AMD64/AMD64-VirtualMemory.asm
$(LD_GNU) $(OBJ) $(LD_FLAGS) -o HCoreKrnl.exe
cp HCoreKrnl.exe CDROM/EFI/BOOT/BOOTX64.EFI
- cp HCoreKrnl.exe CDROM/HCOREKRNL.DLL
- cp ../../Root/System/LookAndFeel.css CDROM/LOOK.CSS
+ cp ../../HCoreKrnl.dll CDROM/HCOREKRNL.DLL
.PHONY: run-efi-amd64
run-efi-amd64:
diff --git a/Private/NewBoot/Source/standard.mk b/Private/NewBoot/Source/standard.mk
index 2ca70592..1177a437 100644
--- a/Private/NewBoot/Source/standard.mk
+++ b/Private/NewBoot/Source/standard.mk
@@ -22,6 +22,7 @@ bootloader-amd64:
$(ASM) $(FLAG_ASM) HEl/AMD64/AMD64-VirtualMemory.asm
$(LD_GNU) $(OBJ) $(LD_FLAGS) -o HCoreLdr.exe
cp HCoreLdr.exe CDROM/EFI/BOOT/BOOTX64.EFI
+ cp ../../HCoreKrnl.dll CDROM/HCOREKRNL.DLL
.PHONY: run-efi-amd64
run-efi-amd64: