diff --git a/docs/develop/kernel/arch_vm_translation_map_x86 b/docs/develop/kernel/arch_vm_translation_map_x86 deleted file mode 100644 index c95b0c2a5f..0000000000 --- a/docs/develop/kernel/arch_vm_translation_map_x86 +++ /dev/null @@ -1,72 +0,0 @@ -static void init_pdentry(pdentry *e) - Sets e's value to 0. - -static void init_ptentry(ptentry *e) - Sets e's value to 0. - -static void _update_all_pgdirs(int index, pdentry e) - For every entry in the translation map, set the index'th entry to e. - -static int lock_tmap(vm_translation_map *map) - Locks the map; if we are the only ones, sets invalidated page count to 0. - -static int unlock_tmap(vm_translation_map *map) - unlocks the map; if no one else has it, call flush_tmap - -static void destroy_tmap(vm_translation_map *map) - Iterate over the entries in the tmap list, removing map when found. Frees the pages associated with this map. - -static void put_pgtable_in_pgdir(pdentry *e, addr pgtable_phys, int attributes) - Populates the pdentry with pgtable_phys and attributes - -static int map_tmap(vm_translation_map *map, addr va, addr pa, unsigned int attributes) - Allocates, if necessary, a page table entry. Gets the page for the page table entry (new or not), populates the page tabel entry with pa and attributes. Puts back the page table entry. Updates the pages to invalidate list. - -static int unmap_tmap(vm_translation_map *map, addr start, addr end) - Loops over the pagetable, finding the page that is present that holds this address. Gets it, and marks the page as not present. Replaces the page and updates the pages to invalidate list. - -static int query_tmap(vm_translation_map *map, addr va, addr *out_physical, unsigned int *out_flags) - Finds the page table's entry for this virtual address. Returns the physical address and flags. - -static addr get_mapped_size_tmap(vm_translation_map *map) - Returns map_count. - -static int protect_tmap(vm_translation_map *map, addr base, addr top, unsigned int attributes) - Unimplemented. - -static int clear_flags_tmap(vm_translation_map *map, addr va, unsigned int flags) - Finds the PTE and clears the requested flags. - -static void flush_tmap(vm_translation_map *map) - Invalidates the TLBs. If too many are in the list, all of the TLBs are invalidated. If not, a list is invalidated. - -static int map_iospace_chunk(addr va, addr pa) - Creates 1024 page table entries, for io. - -static int get_physical_page_tmap(addr pa, addr *va, int flags) - Looks to see if pa is already mapped. If so, return its virtual address in va. If not, find a place to map it and do so. - -static int put_physical_page_tmap(addr va) - Releases a reference to a "checked out" virtual mapping - -int vm_translation_map_create(vm_translation_map *new_map, bool kernel) - Sets up new_map, allocating memory and setting its initial state. - -int vm_translation_map_module_init(kernel_args *ka) - Clears the bottom 2 gig of memory's page mapping. Allocates space for page maps. Initializes data structures. Puts the page tables in the kernel's pagedir. - -void vm_translation_map_module_init_post_sem(kernel_args *ka) - Initializes this module's semaphores and mutexes. - -int vm_translation_map_module_init2(kernel_args *ka) - Creates anonymous regions for the kernel pagedir, physical page mappings, iospaces' virtual chunk descriptors and iospaces' page tables. Creates a null region for iospace. - -int vm_translation_map_quick_map(kernel_args *ka, addr va, addr pa, unsigned int attributes, addr (get_free_page)(kernel_args *)) - Maps a page, ignoring already set up info. - -static int vm_translation_map_quick_query(addr va, addr *out_physical) - Gets the physical address for a page. - -addr vm_translation_map_get_pgdir(vm_translation_map *map) - Returns the pagedirectory structure. - diff --git a/docs/develop/kernel/arch_vm_x86 b/docs/develop/kernel/arch_vm_x86 deleted file mode 100644 index 8b8a943195..0000000000 --- a/docs/develop/kernel/arch_vm_x86 +++ /dev/null @@ -1,11 +0,0 @@ -int arch_vm_init (kernel_args *ka) - First round of initialization; does nothing. - -int arch_vm_init2 (kernel_args *ka) - Marks the bios and dma ranges as "in use". - -int arch_vm_init_endvm (kernel_args *ka) - Maps the dma region into kernel space - -void arch_vm_aspace_swap(vm_address_space *aspace) - Calls i386_swap_pgdir \ No newline at end of file diff --git a/src/system/kernel/arch/x86/arch_vm.c b/src/system/kernel/arch/x86/arch_vm.c index 02caa1f608..1c2cb9b980 100644 --- a/src/system/kernel/arch/x86/arch_vm.c +++ b/src/system/kernel/arch/x86/arch_vm.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001, Travis Geiselbrecht. All rights reserved. @@ -163,6 +163,7 @@ arch_vm_init(kernel_args *args) } +/*! Marks DMA region as in-use, and maps it into the kernel space */ status_t arch_vm_init_post_area(kernel_args *args) { @@ -186,13 +187,15 @@ arch_vm_init_post_area(kernel_args *args) } +/*! Gets rid of all yet unmapped (and therefore now unused) page tables */ status_t arch_vm_init_end(kernel_args *args) { TRACE(("arch_vm_init_endvm: entry\n")); // throw away anything in the kernel_args.pgtable[] that's not yet mapped - vm_free_unused_boot_loader_range(KERNEL_BASE, 0x400000 * args->arch_args.num_pgtables); + vm_free_unused_boot_loader_range(KERNEL_BASE, + 0x400000 * args->arch_args.num_pgtables); return B_OK; } diff --git a/src/system/kernel/arch/x86/arch_vm_translation_map.c b/src/system/kernel/arch/x86/arch_vm_translation_map.c index ad47a0677a..39387207b0 100644 --- a/src/system/kernel/arch/x86/arch_vm_translation_map.c +++ b/src/system/kernel/arch/x86/arch_vm_translation_map.c @@ -183,6 +183,9 @@ early_query(addr_t va, addr_t *_physicalAddress) } +/*! Acquires the map's recursive lock, and resets the invalidate pages counter + in case it's the first locking recursion. +*/ static status_t lock_tmap(vm_translation_map *map) { @@ -199,6 +202,10 @@ lock_tmap(vm_translation_map *map) } +/*! Unlocks the map, and, if we'll actually losing the recursive lock, + flush all pending changes of this map (ie. flush TLB caches as + needed). +*/ static status_t unlock_tmap(vm_translation_map *map) {