Rev 2745 | Rev 3187 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2745 | Rev 3057 | ||
---|---|---|---|
Line 316... | Line 316... | ||
316 | index_t index; |
316 | index_t index; |
317 | 317 | ||
318 | frame = list_get_instance(block, frame_t, buddy_link); |
318 | frame = list_get_instance(block, frame_t, buddy_link); |
319 | zone = (zone_t *) b->data; |
319 | zone = (zone_t *) b->data; |
320 | index = frame_index(zone, frame); |
320 | index = frame_index(zone, frame); |
321 | printf("%zd", index); |
321 | printf("%" PRIi, index); |
322 | } |
322 | } |
323 | 323 | ||
324 | /** Buddy system find_buddy implementation |
324 | /** Buddy system find_buddy implementation |
325 | * |
325 | * |
326 | * @param b Buddy system. |
326 | * @param b Buddy system. |
Line 842... | Line 842... | ||
842 | * @param count Size of zone in frames |
842 | * @param count Size of zone in frames |
843 | * @return Size of zone configuration info (in bytes) |
843 | * @return Size of zone configuration info (in bytes) |
844 | */ |
844 | */ |
845 | uintptr_t zone_conf_size(count_t count) |
845 | uintptr_t zone_conf_size(count_t count) |
846 | { |
846 | { |
847 | int size = sizeof(zone_t) + count*sizeof(frame_t); |
847 | int size = sizeof(zone_t) + count * sizeof(frame_t); |
848 | int max_order; |
848 | int max_order; |
849 | 849 | ||
850 | max_order = fnzb(count); |
850 | max_order = fnzb(count); |
851 | size += buddy_conf_size(max_order); |
851 | size += buddy_conf_size(max_order); |
852 | return size; |
852 | return size; |
Line 1157... | Line 1157... | ||
1157 | unsigned int i; |
1157 | unsigned int i; |
1158 | ipl_t ipl; |
1158 | ipl_t ipl; |
1159 | 1159 | ||
1160 | ipl = interrupts_disable(); |
1160 | ipl = interrupts_disable(); |
1161 | spinlock_lock(&zones.lock); |
1161 | spinlock_lock(&zones.lock); |
1162 | 1162 | ||
1163 | if (sizeof(void *) == 4) { |
1163 | #ifdef __32_BITS__ |
1164 | printf("# base address free frames busy frames\n"); |
1164 | printf("# base address free frames busy frames\n"); |
1165 | printf("-- ------------ ------------ ------------\n"); |
1165 | printf("-- ------------ ------------ ------------\n"); |
1166 | } else { |
1166 | #endif |
- | 1167 | ||
- | 1168 | #ifdef __64_BITS__ |
|
1167 | printf("# base address free frames busy frames\n"); |
1169 | printf("# base address free frames busy frames\n"); |
1168 | printf("-- -------------------- ------------ ------------\n"); |
1170 | printf("-- -------------------- ------------ ------------\n"); |
1169 | } |
1171 | #endif |
1170 | 1172 | ||
1171 | for (i = 0; i < zones.count; i++) { |
1173 | for (i = 0; i < zones.count; i++) { |
1172 | zone = zones.info[i]; |
1174 | zone = zones.info[i]; |
1173 | spinlock_lock(&zone->lock); |
1175 | spinlock_lock(&zone->lock); |
1174 | 1176 | ||
1175 | if (sizeof(void *) == 4) |
1177 | #ifdef __32_BITS__ |
1176 | printf("%-2d %#10zx %12zd %12zd\n", i, PFN2ADDR(zone->base), |
1178 | printf("%-2u %10p %12" PRIc " %12" PRIc "\n", i, PFN2ADDR(zone->base), |
1177 | zone->free_count, zone->busy_count); |
1179 | zone->free_count, zone->busy_count); |
1178 | else |
1180 | #endif |
- | 1181 | ||
- | 1182 | #ifdef __64_BITS__ |
|
1179 | printf("%-2d %#18zx %12zd %12zd\n", i, PFN2ADDR(zone->base), |
1183 | printf("%-2u %18p %12" PRIc " %12" PRIc "\n", i, PFN2ADDR(zone->base), |
1180 | zone->free_count, zone->busy_count); |
1184 | zone->free_count, zone->busy_count); |
- | 1185 | #endif |
|
1181 | 1186 | ||
1182 | spinlock_unlock(&zone->lock); |
1187 | spinlock_unlock(&zone->lock); |
1183 | } |
1188 | } |
1184 | 1189 | ||
1185 | spinlock_unlock(&zones.lock); |
1190 | spinlock_unlock(&zones.lock); |
Line 1209... | Line 1214... | ||
1209 | goto out; |
1214 | goto out; |
1210 | } |
1215 | } |
1211 | 1216 | ||
1212 | spinlock_lock(&zone->lock); |
1217 | spinlock_lock(&zone->lock); |
1213 | printf("Memory zone information\n"); |
1218 | printf("Memory zone information\n"); |
1214 | printf("Zone base address: %#.*p\n", sizeof(uintptr_t) * 2, |
1219 | printf("Zone base address: %p\n", PFN2ADDR(zone->base)); |
1215 | PFN2ADDR(zone->base)); |
- | |
1216 | printf("Zone size: %zd frames (%zd KB)\n", zone->count, |
1220 | printf("Zone size: %" PRIc " frames (%" PRIs " KB)\n", zone->count, |
1217 | SIZE2KB(FRAMES2SIZE(zone->count))); |
1221 | SIZE2KB(FRAMES2SIZE(zone->count))); |
1218 | printf("Allocated space: %zd frames (%zd KB)\n", zone->busy_count, |
1222 | printf("Allocated space: %" PRIc " frames (%" PRIs " KB)\n", zone->busy_count, |
1219 | SIZE2KB(FRAMES2SIZE(zone->busy_count))); |
1223 | SIZE2KB(FRAMES2SIZE(zone->busy_count))); |
1220 | printf("Available space: %zd frames (%zd KB)\n", zone->free_count, |
1224 | printf("Available space: %" PRIc " frames (%" PRIs " KB)\n", zone->free_count, |
1221 | SIZE2KB(FRAMES2SIZE(zone->free_count))); |
1225 | SIZE2KB(FRAMES2SIZE(zone->free_count))); |
1222 | buddy_system_structure_print(zone->buddy_system, FRAME_SIZE); |
1226 | buddy_system_structure_print(zone->buddy_system, FRAME_SIZE); |
1223 | spinlock_unlock(&zone->lock); |
1227 | spinlock_unlock(&zone->lock); |
1224 | 1228 | ||
1225 | out: |
1229 | out: |