summaryrefslogtreecommitdiffhomepage
path: root/dev/ZBA
diff options
context:
space:
mode:
authorAmlal <amlal@el-mahrouss-logic.com>2024-09-11 22:34:21 +0200
committerAmlal <amlal@el-mahrouss-logic.com>2024-09-11 22:40:20 +0200
commit6d31d6e0959f224630317d247f489d18e65aa5bc (patch)
tree576f8e9b7e832807ea09df558373be9e75919c8c /dev/ZBA
parentbf11afdba8486d5b15445d55427a5e97385348fd (diff)
Did work on lowering overhead and a faster kernel to userspace loading.
- Userspace code and stack needs to be mapped to ring-3. - Reworking PML4 from the ground up on AMD64. - Start doing R&D on an ARM64 version of ZKA, running on CoreBoot. Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/ZBA')
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/BootAPI.S9
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/BootMain.cxx21
2 files changed, 12 insertions, 18 deletions
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootAPI.S b/dev/ZBA/Sources/HEL/AMD64/BootAPI.S
index 9db0961a..47f250f1 100644
--- a/dev/ZBA/Sources/HEL/AMD64/BootAPI.S
+++ b/dev/ZBA/Sources/HEL/AMD64/BootAPI.S
@@ -40,8 +40,13 @@ wait_gate2:
reset_wait:
jmp reset_wait
-.global write_cr3
+.global boot_write_cr3
+.global boot_read_cr3
-write_cr3:
+boot_read_cr3:
+ mov rax, rax
+ ret
+
+boot_write_cr3:
mov cr3, rcx
ret
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
index 2e20c5d3..55d93c29 100644
--- a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
+++ b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
@@ -79,7 +79,10 @@ STATIC Bool CheckBootDevice(BootDeviceATA& ataDev)
return true;
}
-EXTERN_C Void write_cr3(VoidPtr new_cr3);
+EXTERN_C VoidPtr boot_read_cr3();
+EXTERN_C Void boot_write_cr3(VoidPtr new_cr3);
+
+EXTERN EfiBootServices* BS;
/// @brief Main EFI entrypoint.
/// @param ImageHandle Handle of this image.
@@ -135,8 +138,6 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
auto guid_mp = EfiGUID(EFI_MP_SERVICES_PROTOCOL_GUID);
EfiMpServicesProtocol* mp = nullptr;
- EXTERN EfiBootServices* BS;
-
BS->LocateProtocol(&guid_mp, nullptr, reinterpret_cast<VoidPtr*>(&mp));
handover_hdr->f_HardwareTables.f_MpPtr = reinterpret_cast<VoidPtr>(mp);
@@ -203,19 +204,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
// Update handover file specific table and phyiscal start field.
//-----------------------------------------------------------//
- handover_hdr->f_PageStart =
- (VoidPtr)Descriptor[cDefaultMemoryMap].PhysicalStart;
-
- handover_hdr->f_FirmwareSpecific[HEL::kHandoverSpecificAttrib] =
- Descriptor[cDefaultMemoryMap].Attribute;
- handover_hdr->f_FirmwareSpecific[HEL::kHandoverSpecificKind] =
- Descriptor[cDefaultMemoryMap].Kind;
- handover_hdr->f_FirmwareSpecific[HEL::kHandoverSpecificMemoryEfi] =
- (UIntPtr)Descriptor;
-
- handover_hdr->f_BitMapStart =
- (VoidPtr)Descriptor[cDefaultMemoryMap].VirtualStart;
-
+ handover_hdr->f_BitMapStart = reinterpret_cast<VoidPtr>(kHandoverBitMapStart); /* # of pages */
handover_hdr->f_BitMapSize = kHandoverBitMapSz; /* # of pages */
handover_hdr->f_FirmwareCustomTables[0] = (VoidPtr)BS;