* Added vm_page::accessed flag. Works analogously to vm_page::modified.

* Reorganized the code for [un]mapping pages:
  - Added new VMTranslationMap::Unmap{Area,Page[s]}() which essentially do what
    vm_unmap_page[s]() did before, just in the architecture specific code, which
    allows for specific optimizations. UnmapArea() is for the special case that
    the complete area is unmapped. Particularly in case the address space is
    deleted, some work can be saved. Several TODOs could be slain.
  - Since they are only used within vm.cpp vm_map_page() and vm_unmap_page[s]()
    are now static and have lost their prefix (and the "preserveModified"
    parameter).
* Added VMTranslationMap::Protect{Page,Area}(). They are just inline wrappers
  for Protect().
* X86VMTranslationMap::Protect(): Make sure not to accidentally clear the
  accessed/dirty flags.
* X86VMTranslationMap::Unmap()/Protect(): Make page table skipping actually
  work. It was only skipping to the next page.
* Adjusted the PPC code to at least compile.

No measurable effect for the -j8 Haiku image build time, though the kernel time
drops minimally.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35089 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-01-15 22:32:51 +00:00
parent e25dcf1a96
commit f082f7f019
13 changed files with 698 additions and 369 deletions
+2 -1
View File
@@ -192,7 +192,8 @@ VMAddressSpace::GetAreaIterator()
extern "C" {
#endif
status_t vm_delete_areas(struct VMAddressSpace *aspace);
status_t vm_delete_areas(struct VMAddressSpace *aspace,
bool deletingAddressSpace);
#define vm_swap_address_space(from, to) arch_vm_aspace_swap(from, to)
#ifdef __cplusplus
@@ -14,6 +14,7 @@
struct kernel_args;
struct VMArea;
struct VMTranslationMap {
@@ -34,6 +35,14 @@ struct VMTranslationMap {
uint32 attributes) = 0;
virtual status_t Unmap(addr_t start, addr_t end) = 0;
// map not locked
virtual status_t UnmapPage(VMArea* area, addr_t address) = 0;
virtual void UnmapPages(VMArea* area, addr_t base,
size_t size);
virtual void UnmapArea(VMArea* area,
bool deletingAddressSpace,
bool ignoreTopCachePageFlags);
virtual status_t Query(addr_t virtualAddress,
addr_t* _physicalAddress,
uint32* _flags) = 0;
@@ -43,6 +52,11 @@ struct VMTranslationMap {
virtual status_t Protect(addr_t base, addr_t top,
uint32 attributes) = 0;
status_t ProtectPage(VMArea* area, addr_t address,
uint32 attributes);
status_t ProtectArea(VMArea* area,
uint32 attributes);
virtual status_t ClearFlags(addr_t virtualAddress,
uint32 flags) = 0;
@@ -93,6 +107,22 @@ struct VMPhysicalPageMapper {
};
inline status_t
VMTranslationMap::ProtectPage(VMArea* area, addr_t address, uint32 attributes)
{
return Protect(address, address + B_PAGE_SIZE - 1, attributes);
}
#include <vm/VMArea.h>
inline status_t
VMTranslationMap::ProtectArea(VMArea* area, uint32 attributes)
{
return Protect(area->Base(), area->Base() + area->Size() - 1, attributes);
}
#include <arch/vm_translation_map.h>
#endif /* KERNEL_VM_VM_TRANSLATION_MAP_H */
-6
View File
@@ -94,12 +94,6 @@ bool vm_test_map_modification(struct vm_page *page);
int32 vm_test_map_activation(struct vm_page *page, bool *_modified);
void vm_clear_map_flags(struct vm_page *page, uint32 flags);
void vm_remove_all_page_mappings(struct vm_page *page, uint32 *_flags);
bool vm_unmap_page(struct VMArea* area, addr_t virtualAddress,
bool preserveModified);
status_t vm_unmap_pages(struct VMArea *area, addr_t base, size_t length,
bool preserveModified);
status_t vm_map_page(struct VMArea *area, struct vm_page *page, addr_t address,
uint32 protection);
status_t vm_get_physical_page(addr_t paddr, addr_t* vaddr, void** _handle);
status_t vm_put_physical_page(addr_t vaddr, void* handle);
+2 -2
View File
@@ -11,7 +11,6 @@
#include <arch/vm_types.h>
#include <arch/vm_translation_map.h>
#include <condition_variable.h>
#include <kernel.h>
#include <lock.h>
@@ -98,8 +97,9 @@ struct vm_page {
bool is_dummy : 1;
bool busy_writing : 1;
// used in VMAnonymousCache::Merge()
bool accessed : 1;
bool modified : 1;
uint8 unused : 2;
uint8 unused : 1;
int8 usage_count;
uint16 wired_count;