Add definition of memory map to stivale spec

This commit is contained in:
mintsuki 2020-04-23 23:52:47 +02:00
parent 312cc56a7d
commit bcfd9e5f91
2 changed files with 26 additions and 5 deletions

View File

@ -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`.

View File

@ -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