--- Gnu-Mach/i386/i386at/biosmem.h 2020/09/02 04:53:39 1.1 +++ Gnu-Mach/i386/i386at/biosmem.h 2020/09/02 04:55:40 1.1.1.2 @@ -40,36 +40,51 @@ #define BIOSMEM_END 0x100000 /* - * Early initialization of the biosmem module. + * Report reserved addresses to the biosmem module. * - * This function processes the given multiboot data for BIOS-provided - * memory information, and sets up a bootstrap physical page allocator. + * Once all boot data have been registered, the user can set up the + * early page allocator. * - * It is called before paging is enabled. + * If the range is marked temporary, it will be unregistered when + * biosmem_free_usable() is called, so that pages that used to store + * these boot data may be released to the VM system. + */ +void biosmem_register_boot_data(phys_addr_t start, phys_addr_t end, + boolean_t temporary); + +/* + * Initialize the early page allocator. + * + * This function uses the memory map provided by the boot loader along + * with the registered boot data addresses to set up a heap of free pages + * of physical memory. + * + * Note that on Xen, this function registers all the Xen boot information + * as boot data itself. */ #ifdef MACH_HYP void biosmem_xen_bootstrap(void); #else /* MACH_HYP */ -void biosmem_bootstrap(struct multiboot_raw_info *mbi); +void biosmem_bootstrap(const struct multiboot_raw_info *mbi); #endif /* MACH_HYP */ /* * 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. + * 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 @@ -80,8 +95,8 @@ 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. + * This function releases all pages that aren't used by boot data and have + * not already been loaded into the VM system. */ void biosmem_free_usable(void);