:: commit a82e67d9a489314437bf1989a4582a3c6682a1ed

mintsuki <mintsuki@protonmail.com> — 2024-10-28 06:10

parents: e6d7352401

protos/limine: Make some pointers physical for base rev 3

diff --git a/PROTOCOL.md b/PROTOCOL.md
index 9aaf6bcd..30629f6c 100644
--- a/PROTOCOL.md
+++ b/PROTOCOL.md
@@ -1129,7 +1129,7 @@ struct limine_rsdp_response {
 };
 ```
 
-* `address` - Address of the RSDP table.
+* `address` - Address of the RSDP table. Physical for base revision >= 3.
 
 ### SMBIOS Feature
 
@@ -1156,8 +1156,8 @@ struct limine_smbios_response {
 };
 ```
 
-* `entry_32` - Address of the 32-bit SMBIOS entry point. NULL if not present.
-* `entry_64` - Address of the 64-bit SMBIOS entry point. NULL if not present.
+* `entry_32` - Address of the 32-bit SMBIOS entry point. NULL if not present. Physical for base revision >= 3.
+* `entry_64` - Address of the 64-bit SMBIOS entry point. NULL if not present. Physical for base revision >= 3.
 
 ### EFI System Table Feature
 
@@ -1183,7 +1183,7 @@ struct limine_efi_system_table_response {
 };
 ```
 
-* `address` - Address of EFI system table.
+* `address` - Address of EFI system table. Physical for base revision >= 3.
 
 ### EFI Memory Map Feature
 
@@ -1212,7 +1212,7 @@ struct limine_efi_memmap_response {
 };
 ```
 
-* `memmap` - Address (HHDM) of the EFI memory map.
+* `memmap` - Address (HHDM for base revision <= 2, else physical) of the EFI memory map.
 * `memmap_size` - Size in bytes of the EFI memory map.
 * `desc_size` - EFI memory map descriptor size in bytes.
 * `desc_version` - Version of EFI memory map descriptors.
diff --git a/common/protos/limine.c b/common/protos/limine.c
index b9f34c04..66fbebf1 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -937,7 +937,7 @@ FEAT_START
     struct limine_rsdp_response *rsdp_response =
         ext_mem_alloc(sizeof(struct limine_rsdp_response));
 
-    rsdp_response->address = reported_addr(rsdp);
+    rsdp_response->address = base_revision <= 2 ? reported_addr(rsdp) : (uintptr_t)rsdp;
 
     rsdp_request->response = reported_addr(rsdp_response);
 FEAT_END
@@ -959,10 +959,10 @@ FEAT_START
         ext_mem_alloc(sizeof(struct limine_smbios_response));
 
     if (smbios_entry_32) {
-        smbios_response->entry_32 = reported_addr(smbios_entry_32);
+        smbios_response->entry_32 = base_revision <= 2 ? reported_addr(smbios_entry_32) : (uintptr_t)smbios_entry_32;
     }
     if (smbios_entry_64) {
-        smbios_response->entry_64 = reported_addr(smbios_entry_64);
+        smbios_response->entry_64 = base_revision <= 2 ? reported_addr(smbios_entry_64) : (uintptr_t)smbios_entry_64;
     }
 
     smbios_request->response = reported_addr(smbios_response);
@@ -979,7 +979,7 @@ FEAT_START
     struct limine_efi_system_table_response *est_response =
         ext_mem_alloc(sizeof(struct limine_efi_system_table_response));
 
-    est_response->address = reported_addr(gST);
+    est_response->address = base_revision <= 2 ? reported_addr(gST) : (uintptr_t)gST;
 
     est_request->response = reported_addr(est_response);
 FEAT_END
@@ -1368,7 +1368,7 @@ FEAT_START
     struct limine_efi_memmap_response *efi_memmap_response =
         ext_mem_alloc(sizeof(struct limine_efi_memmap_response));
 
-    efi_memmap_response->memmap = reported_addr(efi_mmap);
+    efi_memmap_response->memmap = base_revision <= 2 ? reported_addr(efi_mmap) : (uintptr_t)efi_mmap;
     efi_memmap_response->memmap_size = efi_mmap_size;
     efi_memmap_response->desc_size = efi_desc_size;
     efi_memmap_response->desc_version = efi_desc_ver;
tab: 248 wrap: offon