mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-23 22:36:48 +03:00
pmm_randomise_memory: Add guard for BIOS port to avoid accessing bogus pointers
This commit is contained in:
parent
3fa7d9d1fa
commit
9fc8ec0ce3
@ -89,7 +89,7 @@ Some keys take *URIs* as values; these are described in the next section.
|
||||
* `EDITOR_HIGHLIGHTING` - If set to `no`, syntax highlighting in the editor will be disabled. Defaults to `yes`.
|
||||
* `EDITOR_VALIDATION` - If set to `no`, the editor will not alert you about invalid keys / syntax errors. Defaults to `yes`.
|
||||
* `VERBOSE` - If set to `yes`, print additional information during boot. Defaults to not verbose.
|
||||
* `RANDOMISE_MEMORY` - If set to `yes`, randomise the contents of RAM at bootup in order to find bugs related to non zeroed memory or for security reasons. This option will slow down boot time significantly.
|
||||
* `RANDOMISE_MEMORY` - If set to `yes`, randomise the contents of RAM at bootup in order to find bugs related to non zeroed memory or for security reasons. This option will slow down boot time significantly. For the BIOS port of Limine, this will only randomise memory below 4GiB.
|
||||
* `RANDOMIZE_MEMORY` - Alias of `RANDOMISE_MEMORY`.
|
||||
|
||||
*Locally assignable (non protocol specific)* keys are:
|
||||
|
@ -9,6 +9,14 @@ void pmm_randomise_memory(void) {
|
||||
if (memmap[i].type != MEMMAP_USABLE)
|
||||
continue;
|
||||
|
||||
#if bios == 1
|
||||
// We're not going to randomise memory above 4GiB from protected mode,
|
||||
// are we?
|
||||
if (memmap[i].base >= 0x100000000) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t *ptr = (void *)(uintptr_t)memmap[i].base;
|
||||
size_t len = memmap[i].length;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user