Changeset ad12b5ea in mainline
- Timestamp:
- 2011-11-20T16:53:04Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2686705
- Parents:
- a55ddc64
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/mm/frame.c
ra55ddc64 rad12b5ea 57 57 58 58 for (i = 0; i < e820counter; i++) { 59 uint64_t base = e820table[i].base_address; 60 uint64_t size = e820table[i].size; 61 uintptr_t limit = config.identity_size; 59 uintptr_t base = (uintptr_t) e820table[i].base_address; 60 size_t size = (size_t) e820table[i].size; 62 61 63 if (low) { 64 if (base > limit) 65 continue; 66 if (base + size > limit) 67 size = limit - base; 68 } else { 69 if (base + size <= limit) 70 continue; 71 if (base <= limit) { 72 size -= limit - base; 73 base = limit; 74 } 75 } 62 if (!frame_adjust_zone_bounds(low, &base, &size)) 63 continue; 76 64 77 65 if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) { … … 93 81 ZONE_AVAILABLE | ZONE_LOWMEM); 94 82 } else { 95 printf("count=%lld\n", (long long int) count);96 83 conf = zone_external_conf_alloc(count); 97 84 zone_create(pfn, count, conf, -
kernel/generic/include/mm/frame.h
ra55ddc64 rad12b5ea 159 159 160 160 extern void frame_init(void); 161 extern bool frame_adjust_zone_bounds(bool, uintptr_t *, size_t *); 161 162 extern void *frame_alloc_generic(uint8_t, frame_flags_t, size_t *); 162 163 extern void *frame_alloc(uint8_t, frame_flags_t); -
kernel/generic/src/mm/frame.c
ra55ddc64 rad12b5ea 1264 1264 } 1265 1265 1266 /** Adjust bounds of physical memory region according to low/high memory split. 1267 * 1268 * @param low[in] If true, the adujstment is performed to make the region 1269 * fit in the low memory. Otherwise the adjustment is 1270 * performed to make the region fit in the high memory. 1271 * @param basep[inout] Pointer to a variable which contains the region's base 1272 * address and which may receive the adjusted base address. 1273 * @param sizep[inout] Pointer to a variable which contains the region's size 1274 * and which may receive the adjusted size. 1275 * @retun True if the region still exists even after the 1276 * adjustment, false otherwise. 1277 */ 1278 bool frame_adjust_zone_bounds(bool low, uintptr_t *basep, size_t *sizep) 1279 { 1280 uintptr_t limit = config.identity_size; 1281 1282 if (low) { 1283 if (*basep > limit) 1284 return false; 1285 if (*basep + *sizep > limit) 1286 *sizep = limit - *basep; 1287 } else { 1288 if (*basep + *sizep <= limit) 1289 return false; 1290 if (*basep <= limit) { 1291 *sizep -= limit - *basep; 1292 *basep = limit; 1293 } 1294 } 1295 return true; 1296 } 1297 1266 1298 /** Return total size of all zones. 1267 1299 *
Note:
See TracChangeset
for help on using the changeset viewer.