Changeset 720db0c in mainline
- Timestamp:
- 2010-06-26T23:00:54Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 68667ce
- Parents:
- cae5404
- Location:
- kernel/arch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/mm/frame.c
rcae5404 r720db0c 47 47 #include <print.h> 48 48 49 #define PHYSMEM_LIMIT 0x7C000000 49 #define PHYSMEM_LIMIT 0x7C000000ull 50 50 51 51 size_t hardcoded_unmapped_ktext_size = 0; … … 88 88 #endif 89 89 90 pfn_t pfn;91 size_t count;92 93 90 if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) { 94 /* To be safe, make available zone possibly smaller */ 95 pfn = ADDR2PFN(ALIGN_UP(base, FRAME_SIZE)); 96 count = SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)); 91 /* To be safe, make the available zone possibly smaller */ 92 uint64_t new_base = ALIGN_UP(base, FRAME_SIZE); 93 uint64_t new_size = ALIGN_DOWN(size - (new_base - base), 94 FRAME_SIZE); 95 96 pfn_t pfn = ADDR2PFN(new_base); 97 size_t count = SIZE2FRAMES(new_size); 97 98 98 99 pfn_t conf; … … 105 106 106 107 // XXX this has to be removed 107 if (last_frame < ALIGN_UP( base +size, FRAME_SIZE))108 last_frame = ALIGN_UP( base +size, FRAME_SIZE);108 if (last_frame < ALIGN_UP(new_base + new_size, FRAME_SIZE)) 109 last_frame = ALIGN_UP(new_base + new_size, FRAME_SIZE); 109 110 } 110 111 111 112 if (e820table[i].type == MEMMAP_MEMORY_RESERVED) { 112 /* To be safe, make reserved zone possibly larger */ 113 pfn = ADDR2PFN(ALIGN_DOWN(base, FRAME_SIZE)); 114 count = SIZE2FRAMES(ALIGN_UP(size, FRAME_SIZE)); 113 /* To be safe, make the reserved zone possibly larger */ 114 uint64_t new_base = ALIGN_DOWN(base, FRAME_SIZE); 115 uint64_t new_size = ALIGN_UP(size + (base - new_base), 116 FRAME_SIZE); 115 117 116 zone_create(pfn, count, 0, ZONE_RESERVED); 118 zone_create(ADDR2PFN(new_base), SIZE2FRAMES(new_size), 0, 119 ZONE_RESERVED); 117 120 } 118 121 119 122 if (e820table[i].type == MEMMAP_MEMORY_ACPI) { 120 /* To be safe, make firmware zone possibly larger */ 121 pfn = ADDR2PFN(ALIGN_DOWN(base, (uintptr_t) FRAME_SIZE)); 122 count = SIZE2FRAMES(ALIGN_UP(size, (uintptr_t) FRAME_SIZE)); 123 /* To be safe, make the firmware zone possibly larger */ 124 uint64_t new_base = ALIGN_DOWN(base, FRAME_SIZE); 125 uint64_t new_size = ALIGN_UP(size + (base - new_base), 126 FRAME_SIZE); 123 127 124 zone_create(pfn, count, 0, ZONE_FIRMWARE); 128 zone_create(ADDR2PFN(new_base), SIZE2FRAMES(new_size), 0, 129 ZONE_FIRMWARE); 125 130 } 126 131 } -
kernel/arch/ppc32/src/mm/frame.c
rcae5404 r720db0c 60 60 61 61 for (i = 0; i < memmap.cnt; i++) { 62 pfn_t start = ADDR2PFN(ALIGN_UP((uintptr_t) memmap.zones[i].start, 63 FRAME_SIZE)); 64 size_t size = SIZE2FRAMES(ALIGN_DOWN(memmap.zones[i].size, FRAME_SIZE)); 62 /* To be safe, make the available zone possibly smaller */ 63 uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start, 64 FRAME_SIZE); 65 size_t new_size = ALIGN_DOWN(memmap.zones[i].size - 66 (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE); 67 68 pfn_t pfn = ADDR2PFN(new_start); 69 size_t count = SIZE2FRAMES(new_size); 65 70 66 71 pfn_t conf; 67 if ((minconf < start) || (minconf >= start + size))68 conf = start;72 if ((minconf < pfn) || (minconf >= pfn + count)) 73 conf = pfn; 69 74 else 70 75 conf = minconf; 71 76 72 zone_create(start, size, conf, 0); 73 if (last_frame < ALIGN_UP((uintptr_t) memmap.zones[i].start 74 + memmap.zones[i].size, FRAME_SIZE)) 75 last_frame = ALIGN_UP((uintptr_t) memmap.zones[i].start 76 + memmap.zones[i].size, FRAME_SIZE); 77 zone_create(pfn, count, conf, 0); 78 79 if (last_frame < ALIGN_UP(new_start + new_size, FRAME_SIZE)) 80 last_frame = ALIGN_UP(new_start + new_size, FRAME_SIZE); 77 81 } 78 82 -
kernel/arch/sparc64/src/mm/sun4u/frame.c
rcae5404 r720db0c 49 49 void frame_arch_init(void) 50 50 { 51 unsigned int i;52 pfn_t confdata;53 54 51 if (config.cpu_active == 1) { 52 unsigned int i; 53 55 54 for (i = 0; i < memmap.cnt; i++) { 56 uintptr_t start = (uintptr_t) memmap.zones[i].start; 57 size_t size = memmap.zones[i].size; 58 55 /* To be safe, make the available zone possibly smaller */ 56 uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start, 57 FRAME_SIZE); 58 size_t new_size = ALIGN_DOWN(memmap.zones[i].size - 59 (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE); 60 59 61 /* 60 62 * The memmap is created by HelenOS boot loader. 61 63 * It already contains no holes. 62 64 */ 63 64 confdata = ADDR2PFN(start); 65 66 pfn_t confdata = ADDR2PFN(new_start); 67 65 68 if (confdata == ADDR2PFN(KA2PA(PFN2ADDR(0)))) 66 69 confdata = ADDR2PFN(KA2PA(PFN2ADDR(2))); 67 zone_create(ADDR2PFN(start),68 SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)),70 71 zone_create(ADDR2PFN(new_start), SIZE2FRAMES(new_size), 69 72 confdata, 0); 70 last_frame = max(last_frame, start + ALIGN_UP(size,71 FRAME_SIZE));73 74 last_frame = max(last_frame, new_start + new_size); 72 75 } 73 76 74 77 /* 75 78 * On sparc64, physical memory can start on a non-zero address. … … 80 83 frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1); 81 84 } 82 85 83 86 end_of_identity = PA2KA(last_frame); 84 87 } -
kernel/arch/sparc64/src/mm/sun4v/frame.c
rcae5404 r720db0c 47 47 void frame_arch_init(void) 48 48 { 49 unsigned int i;50 pfn_t confdata;51 52 49 if (config.cpu_active == 1) { 50 unsigned int i; 51 53 52 for (i = 0; i < memmap.cnt; i++) { 54 uintptr_t start = (uintptr_t) memmap.zones[i].start; 55 size_t size = memmap.zones[i].size; 56 53 /* To be safe, make the available zone possibly smaller */ 54 uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start, 55 FRAME_SIZE); 56 size_t new_size = ALIGN_DOWN(memmap.zones[i].size - 57 (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE); 58 57 59 /* 58 60 * The memmap is created by HelenOS boot loader. 59 61 * It already contains no holes. 60 62 */ 61 62 confdata = ADDR2PFN(start); 63 64 pfn_t confdata = ADDR2PFN(new_start); 65 63 66 if (confdata == ADDR2PFN(KA2PA(PFN2ADDR(0)))) 64 67 confdata = ADDR2PFN(KA2PA(PFN2ADDR(2))); 65 zone_create(ADDR2PFN(start),66 SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)),68 69 zone_create(ADDR2PFN(new_start), SIZE2FRAMES(new_size), 67 70 confdata, 0); 68 71 } 69 72 70 73 /* 71 74 * On sparc64, physical memory can start on a non-zero address.
Note:
See TracChangeset
for help on using the changeset viewer.