From 06e7f90794756ce9701c75eb2a85f6990efb3d98 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Mon, 21 Sep 2020 14:08:45 +0200 Subject: [PATCH] Update markdowns --- CONFIG.md | 1 + README.md | 8 ++++++-- STIVALE.md | 50 ++++++++++++++++++++++++++++++++++---------------- STIVALE2.md | 37 +++++++++++++++++++++++++++---------- 4 files changed, 68 insertions(+), 28 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 529cdebf..5615aea4 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -21,6 +21,7 @@ Some *local assignments* are shared between entries using any *protocol*, while *Globally assignable* keys are: * `TIMEOUT` - Specifies the timeout in seconds before the first *entry* is automatically booted. +* `TEXTMODE` - If set to `on`, do not use graphical VESA framebuffer for the boot menu. *Locally assignable (non protocol specific)* keys are: * `PROTOCOL` - The boot protocol that will be used to boot the kernel. Valid protocols are: `linux`, `stivale`, `chainload`. diff --git a/README.md b/README.md index b3479ed9..9302f75a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # Limine +### What is Limine? + Limine is an advanced x86/x86_64 BIOS Bootloader which supports *modern* PC features -such as AMD64, 5-level paging, and SMP (multicore), to name a few. +such as Long Mode, 5-level paging, and SMP (multicore), to name a few. + +## Limine's boot menu ![Reference screenshot](/screenshot.png?raw=true "Reference screenshot") @@ -10,7 +14,7 @@ such as AMD64, 5-level paging, and SMP (multicore), to name a few. * stivale and stivale2 (Limine's native boot protocols, see STIVALE{,2}.md for details) ### Supported filesystems -* ext2 +* ext2/3/4 * echfs * FAT32 diff --git a/STIVALE.md b/STIVALE.md index 772a85f2..c53a5c73 100644 --- a/STIVALE.md +++ b/STIVALE.md @@ -14,19 +14,16 @@ stivale will recognise whether the ELF file is 32-bit or 64-bit and load the ker into the appropriate CPU mode. stivale natively supports (only for 64-bit kernels) and encourages higher half kernels. -The kernel can load itself at `0xffffffff80100000` (as defined in the linker script) +The kernel can load itself at `0xffffffff80000000` (as defined in the linker script) and the bootloader will take care of everything, no AT linker script directives needed. -If the kernel loads itself in the lower half (`0x100000` or higher), the bootloader -will not perform the higher half relocation. +If the kernel loads itself in the lower half, the bootloader will not perform the +higher half relocation. -The kernel MUST NOT overwrite anything below `0x100000` (physical memory) as that -is where the bootloader memory structures reside. -Once the kernel is DONE depending on the bootloader (for page tables, structures, ...) -then these areas can be reclaimed if one wants. - -The kernel MUST NOT request to load itself at an address lower than `0x100000` -(or `0xffffffff80100000` for higher half kernels) for the same reasons as above. +*Note: In order to maintain compatibility with Limine and other stivale-compliant* +*bootloaders it is strongly advised never to load the kernel or any of its* +*sections below the 1 MiB physical memory mark. This may work with some stivale* +*loaders, but it WILL NOT work with Limine and it's explicitly discouraged.* ## Kernel entry machine state @@ -110,6 +107,26 @@ before the entry point is called. All other general purpose registers are set to 0. +## Bootloader-reserved memory + +In order for stivale to function, it needs to reserve memory areas for either internal +usage (such as page tables, GDT, SMP), or for kernel interfacing (such as returned +structures). + +stivale ensures that none of these areas are found in any of the sections +marked as "usable" in the memory map. + +The location of these areas may vary and it is implementation specific; +these areas may be in any non-usable memory map section, or in unmarked memory. + +The OS must make sure to be done consuming bootloader information and services +before switching to its own address space, as unmarked memory areas in use by +the bootloader may become unavailable. + +Once the OS is done needing the bootloader, memory map areas marked as "bootloader +reclaimable" may be used as usable memory. These areas are not guaranteed to be +aligned, but they are guaranteed to not overlap other sections of the memory map. + ## stivale header (.stivalehdr) The kernel executable shall have a section `.stivalehdr` which will contain @@ -180,12 +197,13 @@ struct mmap_entry { `type` is an enumeration that can have the following values: ``` -1 - Usable RAM -2 - Reserved -3 - ACPI reclaimable -4 - ACPI NVS -5 - Bad memory -10 - Kernel/Modules +1 - Usable RAM +2 - Reserved +3 - ACPI reclaimable +4 - ACPI NVS +5 - Bad memory +10 - Kernel/Modules +0x1000 - Bootloader Reclaimable ``` All other values are undefined. diff --git a/STIVALE2.md b/STIVALE2.md index c44d2c30..ec34a13c 100644 --- a/STIVALE2.md +++ b/STIVALE2.md @@ -14,19 +14,16 @@ stivale2 will recognise whether the ELF file is 32-bit or 64-bit and load the ke into the appropriate CPU mode. stivale2 natively supports (only for 64-bit kernels) and encourages higher half kernels. -The kernel can load itself at `0xffffffff80100000` or higher (as defined in the linker script) +The kernel can load itself at `0xffffffff80000000` or higher (as defined in the linker script) and the bootloader will take care of everything, no AT linker script directives needed. -If the kernel loads itself in the lower half (`0x100000` or higher), the bootloader -will not perform the higher half relocation. +If the kernel loads itself in the lower half, the bootloader will not perform the +higher half relocation. -The kernel MUST NOT overwrite anything below `0x100000` (physical memory) as that -is where the bootloader memory structures reside. -Once the kernel is DONE depending on the bootloader (for page tables, structures, ...) -then these areas can be reclaimed if one wants. - -The kernel MUST NOT request to load itself at an address lower than `0x100000` -(or `0xffffffff80100000` for higher half kernels) for the same reasons as above. +*Note: In order to maintain compatibility with Limine and other stivale2-compliant* +*bootloaders it is strongly advised never to load the kernel or any of its* +*sections below the 1 MiB physical memory mark. This may work with some stivale2* +*loaders, but it WILL NOT work with Limine and it's explicitly discouraged.* ## Kernel entry machine state @@ -110,6 +107,26 @@ before the entry point is called. All other general purpose registers are set to 0. +## Bootloader-reserved memory + +In order for stivale2 to function, it needs to reserve memory areas for either internal +usage (such as page tables, GDT, SMP), or for kernel interfacing (such as returned +structures). + +stivale2 ensures that none of these areas are found in any of the sections +marked as "usable" in the memory map. + +The location of these areas may vary and it is implementation specific; +these areas may be in any non-usable memory map section, or in unmarked memory. + +The OS must make sure to be done consuming bootloader information and services +before switching to its own address space, as unmarked memory areas in use by +the bootloader may become unavailable. + +Once the OS is done needing the bootloader, memory map areas marked as "bootloader +reclaimable" may be used as usable memory. These areas are not guaranteed to be +aligned, but they are guaranteed to not overlap other sections of the memory map. + ## stivale2 header (.stivale2hdr) The kernel executable shall have a section `.stivale2hdr` which will contain