* Introduced structures {virtual,physical}_address_restrictions, which specify

restrictions for virtual/physical addresses.
* vm_page_allocate_page_run():
  - Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not
    taken into account.
  - Takes a physical_address_restrictions instead of base/limit and also
    supports alignment and boundary restrictions, now.
* map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/
  ReserveAddressRange() take a virtual_address_restrictions parameter, now. They
  also support an alignment independent from the range size.
* create_area_etc(), vm_create_anonymous_area(): Take
  {virtual,physical}_address_restrictions parameters, now.
* Removed no longer needed B_PHYSICAL_BASE_ADDRESS.
* DMAResources:
  - Fixed potential overflows of uint32 when initializing from device node
    attributes.
  - Fixed bounce buffer creation TODOs: By using create_area_etc() with the
    new restrictions parameters we can directly support physical high address,
    boundary, and alignment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-06-14 16:25:14 +00:00
parent 8d2572165b
commit a8ad734f1c
26 changed files with 461 additions and 229 deletions
+13 -6
View File
@@ -17,6 +17,9 @@
#include <vm/VMTranslationMap.h>
struct virtual_address_restrictions;
struct VMAddressSpace {
public:
class AreaIterator;
@@ -73,9 +76,11 @@ public:
uint32 allocationFlags) = 0;
virtual void DeleteArea(VMArea* area,
uint32 allocationFlags) = 0;
virtual status_t InsertArea(void** _address, uint32 addressSpec,
size_t size, VMArea* area,
uint32 allocationFlags) = 0;
virtual status_t InsertArea(VMArea* area, size_t size,
const virtual_address_restrictions*
addressRestrictions,
uint32 allocationFlags, void** _address)
= 0;
virtual void RemoveArea(VMArea* area,
uint32 allocationFlags) = 0;
@@ -87,9 +92,11 @@ public:
virtual status_t ShrinkAreaTail(VMArea* area, size_t newSize,
uint32 allocationFlags) = 0;
virtual status_t ReserveAddressRange(void** _address,
uint32 addressSpec, size_t size,
uint32 flags, uint32 allocationFlags) = 0;
virtual status_t ReserveAddressRange(size_t size,
const virtual_address_restrictions*
addressRestrictions,
uint32 flags, uint32 allocationFlags,
void** _address) = 0;
virtual status_t UnreserveAddressRange(addr_t address,
size_t size, uint32 allocationFlags) = 0;
virtual void UnreserveAllAddressRanges(
+10 -6
View File
@@ -77,9 +77,11 @@ void permit_page_faults(void);
void forbid_page_faults(void);
// private kernel only extension (should be moved somewhere else):
area_id create_area_etc(team_id team, const char *name, void **address,
uint32 addressSpec, uint32 size, uint32 lock, uint32 protection,
phys_addr_t physicalAddress, uint32 flags);
area_id create_area_etc(team_id team, const char *name, uint32 size,
uint32 lock, uint32 protection, uint32 flags,
const virtual_address_restrictions* virtualAddressRestrictions,
const physical_address_restrictions* physicalAddressRestrictions,
void **_address);
area_id transfer_area(area_id id, void** _address, uint32 addressSpec,
team_id target, bool kernel);
@@ -87,9 +89,11 @@ status_t vm_block_address_range(const char* name, void* address, addr_t size);
status_t vm_unreserve_address_range(team_id team, void *address, addr_t size);
status_t vm_reserve_address_range(team_id team, void **_address,
uint32 addressSpec, addr_t size, uint32 flags);
area_id vm_create_anonymous_area(team_id team, const char *name, void **address,
uint32 addressSpec, addr_t size, uint32 wiring, uint32 protection,
phys_addr_t physicalAddress, uint32 flags, bool kernel);
area_id vm_create_anonymous_area(team_id team, const char* name, addr_t size,
uint32 wiring, uint32 protection, uint32 flags,
const virtual_address_restrictions* virtualAddressRestrictions,
const physical_address_restrictions* physicalAddressRestrictions,
bool kernel, void** _address);
area_id vm_map_physical_memory(team_id team, const char *name, void **address,
uint32 addressSpec, addr_t size, uint32 protection,
phys_addr_t physicalAddress, bool alreadyWired);
+2 -2
View File
@@ -60,8 +60,8 @@ bool vm_page_try_reserve_pages(vm_page_reservation* reservation, uint32 count,
struct vm_page *vm_page_allocate_page(vm_page_reservation* reservation,
uint32 flags);
struct vm_page *vm_page_allocate_page_run(uint32 flags, phys_addr_t base,
phys_addr_t limit, page_num_t length, int priority);
struct vm_page *vm_page_allocate_page_run(uint32 flags, page_num_t length,
const physical_address_restrictions* restrictions, int priority);
struct vm_page *vm_page_at_index(int32 index);
struct vm_page *vm_lookup_page(page_num_t pageNumber);
bool vm_page_is_dummy(struct vm_page *page);
+24
View File
@@ -30,6 +30,30 @@ struct VMCacheRef;
typedef DoublyLinkedListLink<vm_page_mapping> vm_page_mapping_link;
struct virtual_address_restrictions {
void* address;
// base or exact address, depending on address_specification
uint32 address_specification;
// address specification as passed to create_area()
size_t alignment;
// address alignment; overridden when
// address_specification == B_ANY_KERNEL_BLOCK_ADDRESS
};
struct physical_address_restrictions {
phys_addr_t low_address;
// lowest acceptable address
phys_addr_t high_address;
// lowest no longer acceptable address; for ranges: the
// highest acceptable non-inclusive end address
phys_size_t alignment;
// address alignment
phys_size_t boundary;
// multiples of which may not be crossed by the address
// range
};
typedef struct vm_page_mapping {
vm_page_mapping_link page_link;
vm_page_mapping_link area_link;