diff options
author | Richard Braun <rbraun@sceen.net> | 2016-09-03 15:18:46 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2016-09-03 16:59:04 +0200 |
commit | f6a2436d282a06e5f34789c8c5917e838fa26643 (patch) | |
tree | d04e9761ce58b7236567671bc2757ed78f319a39 /i386/i386at/biosmem.h | |
parent | 094cfe430457e15d34098af6a04e7f9af950d414 (diff) | |
download | gnumach-f6a2436d282a06e5f34789c8c5917e838fa26643.tar.gz gnumach-f6a2436d282a06e5f34789c8c5917e838fa26643.tar.bz2 gnumach-f6a2436d282a06e5f34789c8c5917e838fa26643.zip |
Fix early physical page allocation
Import upstream biosmem and vm_page changes, and adjust for local
modifications.
Specifically, the biosmem module was mistakenly loading physical
segments that did not clip with the heap as completely available.
This change makes it load them as completely unavailable during
startup, and once the VM system is ready, additional pages are
loaded.
* i386/i386at/biosmem.c (DEBUG): New macro.
(struct biosmem_segment): Remove members `avail_start' and `avail_end'.
(biosmem_heap_cur): Remove variable.
(biosmem_heap_bottom, biosmem_heap_top, biosmem_heap_topdown): New variables.
(biosmem_find_boot_data_update, biosmem_find_boot_data): Remove functions.
(biosmem_find_heap_clip, biosmem_find_heap): New functions.
(biosmem_setup_allocator): Rewritten to use the new biosmem_find_heap
function.
(biosmem_bootalloc): Support both bottom-up and top-down allocations.
(biosmem_directmap_size): Renamed to ...
(biosmem_directmap_end): ... this function.
(biosmem_load_segment): Fix segment loading.
(biosmem_setup): Restrict usable memory to the directmap segment.
(biosmem_free_usable_range): Add checks on input parameters.
(biosmem_free_usable_update_start, biosmem_free_usable_start,
biosmem_free_usable_reserved, biosmem_free_usable_end): Remove functions.
(biosmem_free_usable_entry): Rewritten to use the new biosmem_find_heap
function.
(biosmem_free_usable): Restrict usable memory to the directmap segment.
* i386/i386at/biosmem.h (biosmem_bootalloc): Update description.
(biosmem_directmap_size): Renamed to ...
(biosmem_directmap_end): ... this function.
(biosmem_free_usable): Update declaration.
* i386/i386at/model_dep.c (machine_init): Call biosmem_free_usable.
* vm/vm_page.c (DEBUG): New macro.
(struct vm_page_seg): New member `heap_present'.
(vm_page_load): Remove heap related parameters.
(vm_page_load_heap): New function.
* vm/vm_page.h (vm_page_load): Remove heap related parameters. Update
description.
(vm_page_load_heap): New function.
Diffstat (limited to 'i386/i386at/biosmem.h')
-rw-r--r-- | i386/i386at/biosmem.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/i386/i386at/biosmem.h b/i386/i386at/biosmem.h index 1db63f9f..f48cfc30 100644 --- a/i386/i386at/biosmem.h +++ b/i386/i386at/biosmem.h @@ -56,20 +56,21 @@ void biosmem_bootstrap(struct multiboot_raw_info *mbi); /* * Allocate contiguous physical pages during bootstrap. * - * This function is called before paging is enabled. It should only be used - * to allocate initial page table pages. Those pages are later loaded into - * the VM system (as reserved pages) which means they can be freed like other - * regular pages. Users should fix up the type of those pages once the VM - * system is initialized. + * This function is called before paging is enabled. The pages returned + * are guaranteed to be part of the direct physical mapping when paging + * is enabled. + * + * This function should only be used to allocate initial page table pages. + * Those pages are later loaded into the VM system (as reserved pages) + * which means they can be freed like other regular pages. Users should + * fix up the type of those pages once the VM system is initialized. */ unsigned long biosmem_bootalloc(unsigned int nr_pages); /* - * Return the amount of physical memory that can be directly mapped. - * - * This includes the size of both the DMA/DMA32 and DIRECTMAP segments. + * Return the limit of physical memory that can be directly mapped. */ -phys_addr_t biosmem_directmap_size(void); +phys_addr_t biosmem_directmap_end(void); /* * Set up physical memory based on the information obtained during bootstrap @@ -79,10 +80,9 @@ void biosmem_setup(void); /* * Free all usable memory. - * - * This includes ranges that weren't part of the bootstrap allocator initial - * heap, e.g. because they contained boot data. */ -void biosmem_free_usable(void); +#ifndef MACH_HYP +void biosmem_free_usable(struct multiboot_raw_info *mbi); +#endif /* MACH_HYP */ #endif /* _X86_BIOSMEM_H */ |