--- Gnu-Mach/vm/pmap.h 2020/09/02 04:36:57 1.1.1.1 +++ Gnu-Mach/vm/pmap.h 2020/09/02 04:52:08 1.1.1.5 @@ -42,6 +42,7 @@ #include #include #include +#include /* * The following is a description of the interface to the @@ -62,21 +63,12 @@ * but it is not part of the interface. */ -extern vm_offset_t pmap_steal_memory(); /* During VM initialization, - * steal a chunk of memory. - */ -extern unsigned int pmap_free_pages(); /* During VM initialization, - * report remaining unused - * physical pages. - */ -extern void pmap_startup(); /* During VM initialization, - * use remaining physical pages - * to allocate page frames. - */ -extern void pmap_init(); /* Initialization, - * after kernel runs - * in virtual memory. - */ +/* During VM initialization, steal a chunk of memory. */ +extern vm_offset_t pmap_steal_memory(vm_size_t); +/* During VM initialization, report remaining unused physical pages. */ +extern unsigned int pmap_free_pages(void); +/* Initialization, after kernel runs in virtual memory. */ +extern void pmap_init(void); #ifndef MACHINE_PAGES /* @@ -85,25 +77,17 @@ extern void pmap_init(); /* Initializa * Otherwise, it must implement * pmap_free_pages * pmap_virtual_space - * pmap_next_page * pmap_init - * and vm/vm_resident.c implements pmap_steal_memory and pmap_startup - * using pmap_free_pages, pmap_next_page, pmap_virtual_space, - * and pmap_enter. pmap_free_pages may over-estimate the number - * of unused physical pages, and pmap_next_page may return FALSE - * to indicate that there are no more unused pages to return. + * and vm/vm_resident.c implements pmap_steal_memory using + * pmap_free_pages, pmap_virtual_space, and pmap_enter. + * + * pmap_free_pages may over-estimate the number of unused physical pages. * However, for best performance pmap_free_pages should be accurate. */ -extern boolean_t pmap_next_page(); /* During VM initialization, - * return the next unused - * physical page. - */ -extern void pmap_virtual_space(); /* During VM initialization, - * report virtual space - * available for the kernel. - */ -#endif MACHINE_PAGES +/* During VM initialization, report virtual space available for the kernel. */ +extern void pmap_virtual_space(vm_offset_t *, vm_offset_t *); +#endif /* MACHINE_PAGES */ /* * Routines to manage the physical map data structure. @@ -115,10 +99,10 @@ pmap_t pmap_create(vm_size_t size); /* Return the kernel's pmap_t. */ #ifndef pmap_kernel extern pmap_t pmap_kernel(void); -#endif pmap_kernel +#endif /* pmap_kernel */ /* Gain and release a reference. */ -extern void pmap_reference(pmap_t pmap); +extern void pmap_reference(pmap_t pmap); extern void pmap_destroy(pmap_t pmap); /* Enter a mapping */ @@ -139,12 +123,10 @@ void pmap_protect(pmap_t pmap, vm_offset /* * Routines to set up hardware state for physical maps to be used. */ -extern void pmap_activate(); /* Prepare pmap_t to run - * on a given processor. - */ -extern void pmap_deactivate(); /* Release pmap_t from - * use on processor. - */ +/* Prepare pmap_t to run on a given processor. */ +extern void pmap_activate(pmap_t, thread_t, int); +/* Release pmap_t from use on processor. */ +extern void pmap_deactivate(pmap_t, thread_t, int); /* @@ -166,7 +148,7 @@ void pmap_clear_reference(vm_offset_t pa /* Return reference bit */ #ifndef pmap_is_referenced boolean_t pmap_is_referenced(vm_offset_t pa); -#endif pmap_is_referenced +#endif /* pmap_is_referenced */ /* Clear modify bit */ void pmap_clear_modify(vm_offset_t pa); @@ -174,62 +156,59 @@ void pmap_clear_modify(vm_offset_t pa); /* Return modify bit */ boolean_t pmap_is_modified(vm_offset_t pa); +/* + * Sundry required routines + */ +/* Return a virtual-to-physical mapping, if possible. */ +extern vm_offset_t pmap_extract(pmap_t, vm_offset_t); +/* Perform garbage collection, if any. */ +extern void pmap_collect(pmap_t); +/* Specify pageability. */ +extern void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); /* - * Statistics routines + * Optional routines */ -extern void pmap_statistics(); /* Return statistics */ +#ifndef pmap_copy +/* Copy range of mappings, if desired. */ +extern void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, + vm_offset_t); +#endif /* pmap_copy */ +#ifndef pmap_attribute +/* Get/Set special memory attributes. */ +extern kern_return_t pmap_attribute(void); +#endif /* pmap_attribute */ -#ifndef pmap_resident_count -extern int pmap_resident_count(); -#endif pmap_resident_count +/* + * Grab a physical page: + * the standard memory allocation mechanism + * during system initialization. + */ +extern vm_offset_t pmap_grab_page (void); + +extern boolean_t pmap_valid_page(vm_offset_t x); /* - * Sundry required routines + * Make the specified pages (by pmap, offset) + * pageable (or not) as requested. */ -extern vm_offset_t pmap_extract(); /* Return a virtual-to-physical - * mapping, if possible. - */ - -extern boolean_t pmap_access(); /* Is virtual address valid? */ - -extern void pmap_collect(); /* Perform garbage - * collection, if any - */ - -extern void pmap_change_wiring(); /* Specify pageability */ - -#ifndef pmap_phys_address -extern vm_offset_t pmap_phys_address(); /* Transform address - * returned by device - * driver mapping function - * to physical address - * known to this module. - */ -#endif pmap_phys_address -#ifndef pmap_phys_to_frame -extern int pmap_phys_to_frame(); /* Inverse of - * pmap_phys_address, - * for use by device driver - * mapping function in - * machine-independent - * pseudo-devices. - */ -#endif pmap_phys_to_frame +extern void pmap_pageable( + pmap_t pmap, + vm_offset_t start, + vm_offset_t end, + boolean_t pageable); /* - * Optional routines + * Back-door routine for mapping kernel VM at initialization. + * Useful for mapping memory outside the range + * [phys_first_addr, phys_last_addr) (i.e., devices). + * Otherwise like pmap_map. */ -#ifndef pmap_copy -extern void pmap_copy(); /* Copy range of - * mappings, if desired. - */ -#endif pmap_copy -#ifndef pmap_attribute -extern kern_return_t pmap_attribute(); /* Get/Set special - * memory attributes - */ -#endif pmap_attribute +extern vm_offset_t pmap_map_bd( + vm_offset_t virt, + vm_offset_t start, + vm_offset_t end, + vm_prot_t prot); /* * Routines defined as macros. @@ -239,24 +218,24 @@ extern kern_return_t pmap_attribute(); / if ((pmap) != kernel_pmap) \ PMAP_ACTIVATE(pmap, thread, cpu); \ } -#endif PMAP_ACTIVATE_USER +#endif /* PMAP_ACTIVATE_USER */ #ifndef PMAP_DEACTIVATE_USER #define PMAP_DEACTIVATE_USER(pmap, thread, cpu) { \ if ((pmap) != kernel_pmap) \ PMAP_DEACTIVATE(pmap, thread, cpu); \ } -#endif PMAP_DEACTIVATE_USER +#endif /* PMAP_DEACTIVATE_USER */ #ifndef PMAP_ACTIVATE_KERNEL #define PMAP_ACTIVATE_KERNEL(cpu) \ PMAP_ACTIVATE(kernel_pmap, THREAD_NULL, cpu) -#endif PMAP_ACTIVATE_KERNEL +#endif /* PMAP_ACTIVATE_KERNEL */ #ifndef PMAP_DEACTIVATE_KERNEL #define PMAP_DEACTIVATE_KERNEL(cpu) \ PMAP_DEACTIVATE(kernel_pmap, THREAD_NULL, cpu) -#endif PMAP_DEACTIVATE_KERNEL +#endif /* PMAP_DEACTIVATE_KERNEL */ /* * Exported data structures @@ -264,4 +243,4 @@ extern kern_return_t pmap_attribute(); / extern pmap_t kernel_pmap; /* The kernel's map */ -#endif _VM_PMAP_H_ +#endif /* _VM_PMAP_H_ */