:: commit bcfd9e5f915188e14d0009af1d63547e0e058a5e

mintsuki <mintsuki@protonmail.com> — 2020-04-23 21:52

parents: 312cc56a7d

Add definition of memory map to stivale spec

diff --git a/README.md b/README.md
index 2e06086a..9923f609 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ x86/x86_64 BIOS Bootloader
 
 ### Supported boot protocols
 * Linux
-* stivale (qloader2's native boot protocol, TODO: write specification)
+* stivale (qloader2's native boot protocol, see STIVALE.md for details)
 
 ### Supported filesystems
 * ext2
@@ -34,8 +34,8 @@ fdisk <device>    # Create bootloader partition using your favourite method
 ```
 
 Then make sure the device/image contains at least 1 partition formatted in
-a supported filesystem containing a `qloader2.cfg` file and the kernel/modules one
-wants to load.
+a supported filesystem containing a `/qloader2.cfg` or `/boot/qloader2.cfg` file
+and the kernel/modules one wants to load.
 
 An example `qloader2.cfg` file can be found in `test/qloader2.cfg`.
 
diff --git a/STIVALE.md b/STIVALE.md
index aa22ed62..e6f20d84 100644
--- a/STIVALE.md
+++ b/STIVALE.md
@@ -86,7 +86,7 @@ The stivale structure returned by the bootloader looks like this:
 ```c
 struct stivale_struct {
     uint64_t cmdline;               // Pointer to a null-terminated cmdline
-    uint64_t memory_map_addr;       // Pointer to the memory map
+    uint64_t memory_map_addr;       // Pointer to the memory map (entries described below)
     uint64_t memory_map_entries;    // Count of memory map entries
     uint64_t framebuffer_addr;      // Address of the framebuffer and related info
     uint16_t framebuffer_pitch;
@@ -95,10 +95,31 @@ struct stivale_struct {
     uint16_t framebuffer_bpp;
     uint64_t rsdp;                  // Pointer to the ACPI RSDP structure
     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
+    uint64_t modules;               // Pointer to the first entry in the linked list of modules (described below)
 } __attribute__((packed));
 ```
 
+## Memory map entry
+
+```c
+struct mmap_entry {
+    uint64_t base;      // Base of the memory section
+    uint64_t length;    // Length of the section
+    uint32_t type;      // Type (described below)
+    uint32_t unused;
+} __attribute__((packed));
+```
+
+`type` is an enumeration that can have the following values:
+
+1. Usable RAM
+2. Reserved
+3. ACPI reclaimable
+4. ACPI NVS
+5. Bad memory
+
+All other values are undefined.
+
 ## Modules
 
 The `modules` variable points to the first entry of the linked list of module
tab: 248 wrap: offon