summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot
diff options
context:
space:
mode:
authoramlal <amlal@el-mahrouss-logic.com>2024-03-08 12:35:05 +0000
committeramlal <amlal@el-mahrouss-logic.com>2024-03-08 12:43:36 +0000
commit6f5eddc17785607e1cd5e8245d576874f1939beb (patch)
treedbc1f113be4e90b0de8de6916c7bd5084f6f604b /Private/NewBoot
parent842d35cdd8511adf379c4ccb52010b9b71e0757f (diff)
HCR-14: Fixes and improvements.
Signed-off-by: amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/NewBoot')
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx2
-rw-r--r--Private/NewBoot/Source/FileReader.cxx7
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/AMD64-VirtualMemory.asm8
-rw-r--r--Private/NewBoot/Source/makefile11
-rw-r--r--Private/NewBoot/Source/run-qemu.ps11
5 files changed, 13 insertions, 16 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index fa173f25..25a29ea1 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -157,8 +157,6 @@ inline UInt32 In32(UInt16 port) {
return value;
}
-extern "C" VoidPtr __cr3();
-
#endif // __EFI_x86_64__
/***********************************************************************************/
diff --git a/Private/NewBoot/Source/FileReader.cxx b/Private/NewBoot/Source/FileReader.cxx
index 158f9ab4..f24329e8 100644
--- a/Private/NewBoot/Source/FileReader.cxx
+++ b/Private/NewBoot/Source/FileReader.cxx
@@ -8,7 +8,7 @@
Revision History:
-
+ Fix stupid implementation for a more smarter one.
------------------------------------------- */
@@ -92,11 +92,12 @@ BFileReader::~BFileReader() {
this->mFile = nullptr;
}
+ if (this->mBlob)
+ BS->FreePool(mBlob);
+
BSetMem(this->mPath, 0, kPathLen);
}
-#define hTransferBufferAddress 0xffffffff10000000
-
/**
@brief this reads all of the buffer.
@param ImageHandle used internally.
diff --git a/Private/NewBoot/Source/HEL/AMD64/AMD64-VirtualMemory.asm b/Private/NewBoot/Source/HEL/AMD64/AMD64-VirtualMemory.asm
deleted file mode 100644
index 46928cf7..00000000
--- a/Private/NewBoot/Source/HEL/AMD64/AMD64-VirtualMemory.asm
+++ /dev/null
@@ -1,8 +0,0 @@
-bits 64
-global __cr3
-
-section .text
-
-__cr3:
- mov rax, cr3
- ret
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index c3b02fc6..057a5d44 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -5,8 +5,14 @@
CC_GNU=x86_64-w64-mingw32-g++
LD_GNU=x86_64-w64-mingw32-ld
+
+ifeq ($(shell uname), Darwin)
+EMU=qemu-system-x86_64
+else
+EMU=qemu-system-x86_64w.exe
+endif
+
LD_FLAGS=-e efi_main --subsystem=10
-ASM=nasm
OBJ=$(wildcard *.o) $(wildcard ../../Obj/*.obj) $(wildcard HEL/AMD64/*.obj)
REM=rm
@@ -22,7 +28,6 @@ invalid-recipe:
.PHONY: bootloader-amd64
bootloader-amd64:
$(CC_GNU) $(FLAG_GNU) HEL/AMD64/*.cxx *.cxx
- $(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 HCoreLdr.exe CDROM/EFI/BOOT/HCORELDR.EFI
@@ -30,7 +35,7 @@ bootloader-amd64:
.PHONY: run-efi-amd64
run-efi-amd64:
- qemu-system-x86_64 -net none -smp 2 -m 4G -M q35 -bios OVMF.fd -drive file=fat:rw:CDROM,index=1,format=raw -d int
+ $(EMU) -net none -smp 2 -m 4G -M q35 -bios OVMF.fd -drive file=fat:rw:CDROM,index=1,format=raw -d int
.PHONY: download-edk
download-edk:
diff --git a/Private/NewBoot/Source/run-qemu.ps1 b/Private/NewBoot/Source/run-qemu.ps1
new file mode 100644
index 00000000..d84c9327
--- /dev/null
+++ b/Private/NewBoot/Source/run-qemu.ps1
@@ -0,0 +1 @@
+qemu-system-x86_64w.exe -net none -smp 2 -m 4G -M q35 -bios OVMF.fd -drive file=fat:rw:CDROM,index=1,format=raw -d int \ No newline at end of file