Changes in kernel/arch/ia32/src/mm/frame.c [40c8c17:dc0b964] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/mm/frame.c
r40c8c17 rdc0b964 46 46 #include <print.h> 47 47 48 #define PHYSMEM_LIMIT32 UINT64_C(0x07c000000) 49 #define PHYSMEM_LIMIT64 UINT64_C(0x200000000) 50 48 51 size_t hardcoded_unmapped_ktext_size = 0; 49 52 size_t hardcoded_unmapped_kdata_size = 0; 50 53 51 static void init_e820_memory(pfn_t minconf, bool low) 54 uintptr_t last_frame = 0; 55 56 static void init_e820_memory(pfn_t minconf) 52 57 { 53 58 unsigned int i; 54 59 55 60 for (i = 0; i < e820counter; i++) { 56 uintptr_t base = (uintptr_t) e820table[i].base_address; 57 size_t size = (size_t) e820table[i].size; 58 59 if (!frame_adjust_zone_bounds(low, &base, &size)) 61 uint64_t base = e820table[i].base_address; 62 uint64_t size = e820table[i].size; 63 64 #ifdef __32_BITS__ 65 /* 66 * XXX FIXME: 67 * 68 * Ignore zones which start above PHYSMEM_LIMIT32 69 * or clip zones which go beyond PHYSMEM_LIMIT32. 70 * 71 * The PHYSMEM_LIMIT32 (2 GB - 64 MB) is a rather 72 * arbitrary constant which allows to have at 73 * least 64 MB in the kernel address space to 74 * map hardware resources. 75 * 76 * The kernel uses fixed 1:1 identity mapping 77 * of the physical memory with 2:2 GB split. 78 * This is a severe limitation of the current 79 * kernel memory management. 80 * 81 */ 82 83 if (base > PHYSMEM_LIMIT32) 60 84 continue; 85 86 if (base + size > PHYSMEM_LIMIT32) 87 size = PHYSMEM_LIMIT32 - base; 88 #endif 89 90 #ifdef __64_BITS__ 91 /* 92 * XXX FIXME: 93 * 94 * Ignore zones which start above PHYSMEM_LIMIT64 95 * or clip zones which go beyond PHYSMEM_LIMIT64. 96 * 97 * The PHYSMEM_LIMIT64 (8 GB) is the size of the 98 * fixed 1:1 identically mapped physical memory 99 * accessible during the bootstrap process. 100 * This is a severe limitation of the current 101 * kernel memory management. 102 * 103 */ 104 105 if (base > PHYSMEM_LIMIT64) 106 continue; 107 108 if (base + size > PHYSMEM_LIMIT64) 109 size = PHYSMEM_LIMIT64 - base; 110 #endif 61 111 62 112 if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) { … … 66 116 FRAME_SIZE); 67 117 118 pfn_t pfn = ADDR2PFN(new_base); 68 119 size_t count = SIZE2FRAMES(new_size); 69 pfn_t pfn = ADDR2PFN(new_base);120 70 121 pfn_t conf; 71 72 if (low) { 73 if ((minconf < pfn) || (minconf >= pfn + count)) 74 conf = pfn; 75 else 76 conf = minconf; 77 zone_create(pfn, count, conf, 78 ZONE_AVAILABLE | ZONE_LOWMEM); 79 } else { 80 conf = zone_external_conf_alloc(count); 81 zone_create(pfn, count, conf, 82 ZONE_AVAILABLE | ZONE_HIGHMEM); 83 } 122 if ((minconf < pfn) || (minconf >= pfn + count)) 123 conf = pfn; 124 else 125 conf = minconf; 126 127 zone_create(pfn, count, conf, ZONE_AVAILABLE); 128 129 // XXX this has to be removed 130 if (last_frame < ALIGN_UP(new_base + new_size, FRAME_SIZE)) 131 last_frame = ALIGN_UP(new_base + new_size, FRAME_SIZE); 84 132 } else if ((e820table[i].type == MEMMAP_MEMORY_ACPI) || 85 133 (e820table[i].type == MEMMAP_MEMORY_NVS)) { … … 131 179 132 180 133 void frame_ low_arch_init(void)181 void frame_arch_init(void) 134 182 { 135 183 pfn_t minconf; … … 144 192 #endif 145 193 146 init_e820_memory(minconf , true);194 init_e820_memory(minconf); 147 195 148 196 /* Reserve frame 0 (BIOS data) */ … … 158 206 } 159 207 160 void frame_high_arch_init(void)161 {162 if (config.cpu_active == 1)163 init_e820_memory(0, false);164 }165 166 208 /** @} 167 209 */
Note:
See TracChangeset
for help on using the changeset viewer.