Changeset deaa22f in mainline
- Timestamp:
- 2006-08-02T00:42:30Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bf78569
- Parents:
- adf7f9c
- Location:
- kernel
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/mm/page.c
radf7f9c rdeaa22f 100 100 * because some are needed for init ) 101 101 */ 102 for (cur = PA2KA_CODE(0); cur < config.base +config.kernel_size; cur += FRAME_SIZE) {102 for (cur = PA2KA_CODE(0); cur < config.base + config.kernel_size; cur += FRAME_SIZE) 103 103 page_mapping_insert(AS_KERNEL, cur, KA2PA(cur), identity_flags); 104 } 105 for (i=0; i < init.cnt; i++) { 106 for (cur=init.tasks[i].addr;cur < init.tasks[i].size; cur += FRAME_SIZE) { 104 105 for (cur = config.stack_base; cur < config.stack_base + config.stack_size; cur += FRAME_SIZE) 106 page_mapping_insert(AS_KERNEL, cur, KA2PA(cur), identity_flags); 107 108 for (i = 0; i < init.cnt; i++) { 109 for (cur = init.tasks[i].addr; cur < init.tasks[i].addr + init.tasks[i].size; cur += FRAME_SIZE) 107 110 page_mapping_insert(AS_KERNEL, PA2KA_CODE(KA2PA(cur)), KA2PA(cur), identity_flags); 108 }109 111 } 110 112 -
kernel/arch/xen32/src/xen32.c
radf7f9c rdeaa22f 34 34 35 35 #include <arch.h> 36 #include <main/main.h> 36 37 37 38 #include <arch/types.h> -
kernel/generic/include/config.h
radf7f9c rdeaa22f 63 63 size_t memory_size; /**< Size of detected memory in bytes. */ 64 64 size_t kernel_size; /**< Size of memory in bytes taken by kernel and stack */ 65 66 uintptr_t stack_base; /**< Base adddress of initial stack */ 67 size_t stack_size; /**< Size of initial stack */ 65 68 } config_t; 66 69 -
kernel/generic/src/main/main.c
radf7f9c rdeaa22f 106 106 size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */ 107 107 108 uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */ 109 108 110 void main_bsp(void); 109 111 void main_ap(void); … … 133 135 void main_bsp(void) 134 136 { 135 uintptr_t stackaddr;136 137 137 config.cpu_count = 1; 138 138 config.cpu_active = 1; … … 142 142 143 143 config.kernel_size = ALIGN_UP(hardcoded_ktext_size + hardcoded_kdata_size, PAGE_SIZE); 144 stackaddr = config.base + config.kernel_size; 145 146 /* Avoid placing kernel on top of init */ 144 config.stack_size = CONFIG_STACK_SIZE; 145 146 /* Initialy the stack is placed just after the kernel */ 147 config.stack_base = config.base + config.kernel_size; 148 149 /* Avoid placing stack on top of init */ 147 150 count_t i; 148 bool overlap = false; 149 for (i = 0; i < init.cnt; i++) 150 if (PA_overlaps(stackaddr, CONFIG_STACK_SIZE, init.tasks[i].addr, init.tasks[i].size)) { 151 stackaddr = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, CONFIG_STACK_SIZE); 152 init.tasks[i].size = ALIGN_UP(init.tasks[i].size, CONFIG_STACK_SIZE) + CONFIG_STACK_SIZE; 153 overlap = true; 154 } 155 156 if (!overlap) 157 config.kernel_size += CONFIG_STACK_SIZE; 151 for (i = 0; i < init.cnt; i++) { 152 if (PA_overlaps(config.stack_base, config.stack_size, init.tasks[i].addr, init.tasks[i].size)) 153 config.stack_base = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, config.stack_size); 154 } 155 156 if (config.stack_base < stack_safe) 157 config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE); 158 158 159 159 context_save(&ctx); 160 context_set(&ctx, FADDR(main_bsp_separated_stack), stackaddr, THREAD_STACK_SIZE);160 context_set(&ctx, FADDR(main_bsp_separated_stack), config.stack_base, THREAD_STACK_SIZE); 161 161 context_restore(&ctx); 162 162 /* not reached */ … … 203 203 204 204 version_print(); 205 printf("%.*p: hardcoded_ktext_size=%zdK, hardcoded_kdata_size=%zdK\n", sizeof(uintptr_t) * 2, config.base, hardcoded_ktext_size >> 10, hardcoded_kdata_size >> 10); 205 printf("kernel: %.*p hardcoded_ktext_size=%zdK, hardcoded_kdata_size=%zdK\n", sizeof(uintptr_t) * 2, config.base, hardcoded_ktext_size >> 10, hardcoded_kdata_size >> 10); 206 printf("stack: %.*p size=%zdK\n", sizeof(uintptr_t) * 2, config.stack_base, config.stack_size >> 10); 206 207 207 208 arch_pre_smp_init(); -
kernel/generic/src/mm/frame.c
radf7f9c rdeaa22f 864 864 addr = PFN2ADDR(confframe); 865 865 if (overlaps(addr, PFN2ADDR(confcount), KA2PA(config.base), config.kernel_size)) 866 continue; 867 868 if (overlaps(addr, PFN2ADDR(confcount), KA2PA(config.stack_base), config.stack_size)) 866 869 continue; 867 870 … … 1069 1072 frame_arch_init(); 1070 1073 if (config.cpu_active == 1) { 1071 pfn_t firstframe = ADDR2PFN(KA2PA(config.base)); 1072 pfn_t lastframe = ADDR2PFN(KA2PA(config.base+config.kernel_size)); 1073 frame_mark_unavailable(firstframe,lastframe-firstframe+1); 1074 frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)), SIZE2FRAMES(config.kernel_size)); 1075 frame_mark_unavailable(ADDR2PFN(KA2PA(config.stack_base)), SIZE2FRAMES(config.stack_size)); 1074 1076 1075 1077 count_t i;
Note:
See TracChangeset
for help on using the changeset viewer.