Rev 1767 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1767 | Rev 1780 | ||
---|---|---|---|
Line 63... | Line 63... | ||
63 | 63 | ||
64 | #define FRAME_OK 0 /* frame_alloc return status */ |
64 | #define FRAME_OK 0 /* frame_alloc return status */ |
65 | #define FRAME_NO_MEMORY 1 /* frame_alloc return status */ |
65 | #define FRAME_NO_MEMORY 1 /* frame_alloc return status */ |
66 | #define FRAME_ERROR 2 /* frame_alloc return status */ |
66 | #define FRAME_ERROR 2 /* frame_alloc return status */ |
67 | 67 | ||
68 | static inline __address PFN2ADDR(pfn_t frame) |
68 | static inline uintptr_t PFN2ADDR(pfn_t frame) |
69 | { |
69 | { |
70 | return (__address)(frame << FRAME_WIDTH); |
70 | return (uintptr_t)(frame << FRAME_WIDTH); |
71 | } |
71 | } |
72 | 72 | ||
73 | static inline pfn_t ADDR2PFN(__address addr) |
73 | static inline pfn_t ADDR2PFN(uintptr_t addr) |
74 | { |
74 | { |
75 | return (pfn_t)(addr >> FRAME_WIDTH); |
75 | return (pfn_t)(addr >> FRAME_WIDTH); |
76 | } |
76 | } |
77 | 77 | ||
78 | static inline count_t SIZE2FRAMES(size_t size) |
78 | static inline count_t SIZE2FRAMES(size_t size) |
Line 80... | Line 80... | ||
80 | if (!size) |
80 | if (!size) |
81 | return 0; |
81 | return 0; |
82 | return (count_t)((size-1) >> FRAME_WIDTH)+1; |
82 | return (count_t)((size-1) >> FRAME_WIDTH)+1; |
83 | } |
83 | } |
84 | 84 | ||
85 | #define IS_BUDDY_ORDER_OK(index, order) ((~(((__native) -1) << (order)) & (index)) == 0) |
85 | #define IS_BUDDY_ORDER_OK(index, order) ((~(((unative_t) -1) << (order)) & (index)) == 0) |
86 | #define IS_BUDDY_LEFT_BLOCK(zone, frame) (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) |
86 | #define IS_BUDDY_LEFT_BLOCK(zone, frame) (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) |
87 | #define IS_BUDDY_RIGHT_BLOCK(zone, frame) (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) |
87 | #define IS_BUDDY_RIGHT_BLOCK(zone, frame) (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) |
88 | #define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame) (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) |
88 | #define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame) (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) |
89 | #define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame) (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) |
89 | #define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame) (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) |
90 | 90 | ||
91 | #define frame_alloc(order, flags) frame_alloc_generic(order, flags, NULL) |
91 | #define frame_alloc(order, flags) frame_alloc_generic(order, flags, NULL) |
92 | 92 | ||
93 | extern void frame_init(void); |
93 | extern void frame_init(void); |
94 | extern void * frame_alloc_generic(__u8 order, int flags, int *pzone); |
94 | extern void * frame_alloc_generic(uint8_t order, int flags, int *pzone); |
95 | extern void frame_free(__address frame); |
95 | extern void frame_free(uintptr_t frame); |
96 | extern void frame_reference_add(pfn_t pfn); |
96 | extern void frame_reference_add(pfn_t pfn); |
97 | 97 | ||
98 | extern int zone_create(pfn_t start, count_t count, pfn_t confframe, int flags); |
98 | extern int zone_create(pfn_t start, count_t count, pfn_t confframe, int flags); |
99 | void * frame_get_parent(pfn_t frame, int hint); |
99 | void * frame_get_parent(pfn_t frame, int hint); |
100 | void frame_set_parent(pfn_t frame, void *data, int hint); |
100 | void frame_set_parent(pfn_t frame, void *data, int hint); |
101 | void frame_mark_unavailable(pfn_t start, count_t count); |
101 | void frame_mark_unavailable(pfn_t start, count_t count); |
102 | __address zone_conf_size(count_t count); |
102 | uintptr_t zone_conf_size(count_t count); |
103 | void zone_merge(int z1, int z2); |
103 | void zone_merge(int z1, int z2); |
104 | void zone_merge_all(void); |
104 | void zone_merge_all(void); |
105 | 105 | ||
106 | /* |
106 | /* |
107 | * Console functions |
107 | * Console functions |