:: commit ef122f652db088cd3699f1893555c0b7fc09003b

mintsuki <mintsuki@protonmail.com> — 2020-05-15 03:47

parents: ed8e7b962b

Add BIOS/UEFI flag to stivale spec

diff --git a/STIVALE.md b/STIVALE.md
index 3ec21f53..4f65e4e0 100644
--- a/STIVALE.md
+++ b/STIVALE.md
@@ -130,6 +130,9 @@ struct stivale_struct {
     uint64_t module_count;          // Count of modules that stivale loaded according to config
     uint64_t modules;               // Pointer to the first entry in the linked list of modules (described below)
     uint64_t epoch;                 // UNIX epoch at boot, read from system RTC
+    uint64_t flags;                 // Flags
+                                    // bit 0: 1 if booted with BIOS, 0 if booted with UEFI
+                                    // All other bits undefined.
 } __attribute__((packed));
 ```
 
diff --git a/qloader2.bin b/qloader2.bin
index 332003e9..538a9f37 100644
Binary files a/qloader2.bin and b/qloader2.bin differ
diff --git a/src/protos/stivale.c b/src/protos/stivale.c
index ca3551cd..d7e32f32 100644
--- a/src/protos/stivale.c
+++ b/src/protos/stivale.c
@@ -43,11 +43,14 @@ struct stivale_struct {
     uint64_t module_count;
     uint64_t modules;
     uint64_t epoch;
+    uint64_t flags;       // bit 0: 1 if booted with BIOS, 0 if booted with UEFI
 } __attribute__((packed));
 
 struct stivale_struct stivale_struct = {0};
 
 void stivale_load(char *cmdline, int boot_drive) {
+    stivale_struct.flags &= (1 << 0);  // set bit 0 since we are BIOS and not UEFI
+
     int kernel_drive; {
         char buf[32];
         if (!config_get_value(buf, 0, 32, "KERNEL_DRIVE")) {
tab: 248 wrap: offon