:: commit 9f57585e0a698e5315858b5ee49fb0bea9924ac9

Marvin Friedrich <contact@marvinf.com> — 2024-12-03 23:38

parents: 3ced8e1024

test: Add test for RISC-V BSP Hart ID request

diff --git a/test/limine.c b/test/limine.c
index ecb5b36c..f4276203 100644
--- a/test/limine.c
+++ b/test/limine.c
@@ -152,6 +152,14 @@ static volatile struct limine_paging_mode_request _pm_request = {
     .min_mode = LIMINE_PAGING_MODE_MIN
 };
 
+#ifdef __riscv
+__attribute__((section(".limine_requests")))
+static volatile struct limine_riscv_bsp_hartid_request _bsp_request = {
+    .id = LIMINE_RISCV_BSP_HARTID_REQUEST,
+    .revision = 0, .response = NULL,
+};
+#endif
+
 __attribute__((used, section(".limine_requests_end_marker")))
 static volatile LIMINE_REQUESTS_END_MARKER;
 
@@ -539,5 +547,15 @@ FEAT_START
     e9_printf("  mode: %d", pm_response->mode);
 FEAT_END
 
+FEAT_START
+    e9_printf("");
+    struct limine_riscv_bsp_hartid_response *bsp_response = _bsp_request.response;
+    if (bsp_response == NULL) {
+        e9_printf("RISC-V BSP Hart ID was not passed");
+        break;
+    }
+    e9_printf("RISC-V BSP Hart ID: %x", bsp_response->bsp_hartid);
+FEAT_END
+
     for (;;);
 }
tab: 248 wrap: offon