Changes in kernel/generic/include/mm/frame.h [1a313f7:26aafe8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/mm/frame.h
r1a313f7 r26aafe8 50 50 typedef uint8_t frame_flags_t; 51 51 52 #define FRAME_NONE 0x053 52 /** Convert the frame address to kernel VA. */ 54 53 #define FRAME_KA 0x1 … … 59 58 /** Do not reserve / unreserve memory. */ 60 59 #define FRAME_NO_RESERVE 0x8 61 /** Allocate a frame which can be identity-mapped. */62 #define FRAME_LOWMEM 0x1063 /** Allocate a frame which cannot be identity-mapped. */64 #define FRAME_HIGHMEM 0x2065 60 66 61 typedef uint8_t zone_flags_t; 67 62 68 #define ZONE_NONE 0x069 63 /** Available zone (free for allocation) */ 70 #define ZONE_AVAILABLE 0x 164 #define ZONE_AVAILABLE 0x0 71 65 /** Zone is reserved (not available for allocation) */ 72 #define ZONE_RESERVED 0x 266 #define ZONE_RESERVED 0x8 73 67 /** Zone is used by firmware (not available for allocation) */ 74 #define ZONE_FIRMWARE 0x4 75 /** Zone contains memory that can be identity-mapped */ 76 #define ZONE_LOWMEM 0x8 77 /** Zone contains memory that cannot be identity-mapped */ 78 #define ZONE_HIGHMEM 0x10 68 #define ZONE_FIRMWARE 0x10 79 69 80 /** Mask of zone bits that must be matched exactly. */ 81 #define ZONE_EF_MASK 0x7 82 83 #define FRAME_TO_ZONE_FLAGS(ff) \ 84 ((((ff) & FRAME_LOWMEM) ? ZONE_LOWMEM : \ 85 (((ff) & FRAME_HIGHMEM) ? ZONE_HIGHMEM : \ 86 ZONE_LOWMEM /* | ZONE_HIGHMEM */)) | \ 87 ZONE_AVAILABLE) 88 89 #define ZONE_FLAGS_MATCH(zf, f) \ 90 (((((zf) & ZONE_EF_MASK)) == ((f) & ZONE_EF_MASK)) && \ 91 (((zf) & ~ZONE_EF_MASK) & (f))) 70 /** Currently there is no equivalent zone flags 71 for frame flags */ 72 #define FRAME_TO_ZONE_FLAGS(frame_flags) 0 92 73 93 74 typedef struct { 94 75 size_t refcount; /**< Tracking of shared frames */ 76 uint8_t buddy_order; /**< Buddy system block order */ 95 77 link_t buddy_link; /**< Link to the next free block inside 96 78 one order */ 97 79 void *parent; /**< If allocated by slab, this points there */ 98 uint8_t buddy_order; /**< Buddy system block order */99 80 } frame_t; 100 81 … … 148 129 } 149 130 131 NO_TRACE static inline bool zone_flags_available(zone_flags_t flags) 132 { 133 return ((flags & (ZONE_RESERVED | ZONE_FIRMWARE)) == 0); 134 } 135 150 136 #define IS_BUDDY_ORDER_OK(index, order) \ 151 137 ((~(((sysarg_t) -1) << (order)) & (index)) == 0) … … 160 146 161 147 extern void frame_init(void); 162 extern bool frame_adjust_zone_bounds(bool, uintptr_t *, size_t *);163 148 extern void *frame_alloc_generic(uint8_t, frame_flags_t, size_t *); 164 149 extern void *frame_alloc(uint8_t, frame_flags_t); … … 176 161 extern void frame_mark_unavailable(pfn_t, size_t); 177 162 extern size_t zone_conf_size(size_t); 178 extern pfn_t zone_external_conf_alloc(size_t);179 163 extern bool zone_merge(size_t, size_t); 180 164 extern void zone_merge_all(void);
Note:
See TracChangeset
for help on using the changeset viewer.