Changes in kernel/arch/ppc32/src/mm/frame.c [4872160:720db0c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/mm/frame.c
r4872160 r720db0c 45 45 void physmem_print(void) 46 46 { 47 unsigned int i;47 printf("[base ] [size ]\n"); 48 48 49 printf("Base Size\n"); 50 printf("---------- ----------\n"); 51 49 size_t i; 52 50 for (i = 0; i < memmap.cnt; i++) { 53 51 printf("%#10x %#10x\n", memmap.zones[i].start, 54 52 memmap.zones[i].size); 55 53 } 56 54 } … … 60 58 pfn_t minconf = 2; 61 59 size_t i; 62 pfn_t start, conf;63 size_t size;64 60 65 61 for (i = 0; i < memmap.cnt; i++) { 66 start = ADDR2PFN(ALIGN_UP((uintptr_t) memmap.zones[i].start, FRAME_SIZE)); 67 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); 68 67 69 if ((minconf < start) || (minconf >= start + size)) 70 conf = start; 68 pfn_t pfn = ADDR2PFN(new_start); 69 size_t count = SIZE2FRAMES(new_size); 70 71 pfn_t conf; 72 if ((minconf < pfn) || (minconf >= pfn + count)) 73 conf = pfn; 71 74 else 72 75 conf = minconf; 73 76 74 zone_create(start, size, conf, 0); 75 if (last_frame < ALIGN_UP((uintptr_t) memmap.zones[i].start + memmap.zones[i].size, FRAME_SIZE)) 76 last_frame = ALIGN_UP((uintptr_t) memmap.zones[i].start + 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 … … 82 86 83 87 /* Mark the Page Hash Table frames as unavailable */ 84 uint32_t sdr1; 85 asm volatile ( 86 "mfsdr1 %0\n" 87 : "=r" (sdr1) 88 ); 89 frame_mark_unavailable(ADDR2PFN(sdr1 & 0xffff000), 16); // FIXME 88 uint32_t sdr1 = sdr1_get(); 89 90 // FIXME: compute size of PHT exactly 91 frame_mark_unavailable(ADDR2PFN(sdr1 & 0xffff000), 16); 90 92 } 91 93
Note:
See TracChangeset
for help on using the changeset viewer.