Changes in kernel/arch/arm32/src/mm/frame.c [7852625:6250c37] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mm/frame.c
r7852625 r6250c37 39 39 #include <config.h> 40 40 #include <align.h> 41 #include <macros.h>42 41 43 static void frame_common_arch_init(bool low) 42 /** Address of the last frame in the memory. */ 43 uintptr_t last_frame = 0; 44 45 /** Creates memory zones. */ 46 void frame_arch_init(void) 44 47 { 45 uintptr_t base; 46 size_t size; 48 uintptr_t mem_start, mem_size; 49 uintptr_t first_frame; 50 uintptr_t num_frames; 47 51 48 machine_get_memory_extents(&base, &size); 49 base = ALIGN_UP(base, FRAME_SIZE); 50 size = ALIGN_DOWN(size, FRAME_SIZE); 52 machine_get_memory_extents(&mem_start, &mem_size); 53 first_frame = ALIGN_UP(mem_start, FRAME_SIZE); 54 last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE); 55 num_frames = (last_frame - first_frame) >> FRAME_WIDTH; 51 56 52 if (!frame_adjust_zone_bounds(low, &base, &size)) 53 return; 54 55 if (low) { 56 zone_create(ADDR2PFN(base), SIZE2FRAMES(size), 57 BOOT_PAGE_TABLE_START_FRAME + 58 BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 59 ZONE_AVAILABLE | ZONE_LOWMEM); 60 } else { 61 pfn_t conf = zone_external_conf_alloc(SIZE2FRAMES(size)); 62 if (conf != 0) 63 zone_create(ADDR2PFN(base), SIZE2FRAMES(size), conf, 64 ZONE_AVAILABLE | ZONE_HIGHMEM); 65 } 57 /* All memory as one zone */ 58 zone_create(first_frame >> FRAME_WIDTH, num_frames, 59 BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0); 66 60 67 }68 69 /** Create low memory zones. */70 void frame_low_arch_init(void)71 {72 frame_common_arch_init(true);73 74 61 /* blacklist boot page table */ 75 62 frame_mark_unavailable(BOOT_PAGE_TABLE_START_FRAME, … … 77 64 78 65 machine_frame_init(); 79 }80 81 /** Create high memory zones. */82 void frame_high_arch_init(void)83 {84 frame_common_arch_init(false);85 66 } 86 67
Note:
See TracChangeset
for help on using the changeset viewer.