btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / vm / VMUserAddressSpace.h
blobbb26ca9221e4262daac11e858885e25a926abfc3
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef VM_USER_ADDRESS_SPACE_H
6 #define VM_USER_ADDRESS_SPACE_H
9 #include <vm/VMAddressSpace.h>
11 #include "VMUserArea.h"
14 struct VMUserAddressSpace : VMAddressSpace {
15 public:
16 VMUserAddressSpace(team_id id, addr_t base,
17 size_t size);
18 virtual ~VMUserAddressSpace();
20 virtual VMArea* FirstArea() const;
21 virtual VMArea* NextArea(VMArea* area) const;
23 virtual VMArea* LookupArea(addr_t address) const;
24 virtual VMArea* CreateArea(const char* name, uint32 wiring,
25 uint32 protection, uint32 allocationFlags);
26 virtual void DeleteArea(VMArea* area,
27 uint32 allocationFlags);
28 virtual status_t InsertArea(VMArea* area, size_t size,
29 const virtual_address_restrictions*
30 addressRestrictions,
31 uint32 allocationFlags, void** _address);
32 virtual void RemoveArea(VMArea* area,
33 uint32 allocationFlags);
35 virtual bool CanResizeArea(VMArea* area, size_t newSize);
36 virtual status_t ResizeArea(VMArea* area, size_t newSize,
37 uint32 allocationFlags);
38 virtual status_t ShrinkAreaHead(VMArea* area, size_t newSize,
39 uint32 allocationFlags);
40 virtual status_t ShrinkAreaTail(VMArea* area, size_t newSize,
41 uint32 allocationFlags);
43 virtual status_t ReserveAddressRange(size_t size,
44 const virtual_address_restrictions*
45 addressRestrictions,
46 uint32 flags, uint32 allocationFlags,
47 void** _address);
48 virtual status_t UnreserveAddressRange(addr_t address,
49 size_t size, uint32 allocationFlags);
50 virtual void UnreserveAllAddressRanges(
51 uint32 allocationFlags);
53 virtual void Dump() const;
55 private:
56 inline bool _IsRandomized(uint32 addressSpec) const;
57 static addr_t _RandomizeAddress(addr_t start, addr_t end,
58 size_t alignment, bool initial = false);
60 status_t _InsertAreaIntoReservedRegion(addr_t start,
61 size_t size, VMUserArea* area,
62 uint32 allocationFlags);
63 status_t _InsertAreaSlot(addr_t start, addr_t size,
64 addr_t end, uint32 addressSpec,
65 size_t alignment, VMUserArea* area,
66 uint32 allocationFlags);
68 private:
69 static const addr_t kMaxRandomize;
70 static const addr_t kMaxInitialRandomize;
72 VMUserAreaList fAreas;
73 mutable VMUserArea* fAreaHint;
77 #endif /* VM_USER_ADDRESS_SPACE_H */