Changeset 391 for soft/giet_vm/giet_kernel/kernel_init.c
- Timestamp:
- Aug 11, 2014, 9:19:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/kernel_init.c
r385 r391 14 14 // and where there is one physical memory bank per cluster. 15 15 // 16 // The kernel_init() function is executed in parallel by all procesors,17 // andcompletes the system initialisation that has been started by processor[0,0,0]16 // The kernel_init() function is executed sequencially by all procesors. 17 // It completes the system initialisation that has been started by processor[0,0,0] 18 18 // in the boot_init() function. It makes the following assuptions, regarding the work 19 19 // bone by the boot code: … … 100 100 101 101 #if !defined(IDLE_TASK_INDEX) 102 # error: You must define IDLE_TASK_INDEX in the giet_config.h file 102 # error: You must define IDLE_TASK_INDEX in the ctx_handler.h file 103 #endif 104 105 #if !defined(IDLE_TASK_STACK) 106 # error: You must define IDLE_TASK_STACK in the ctx_handler.h file 103 107 #endif 104 108 … … 129 133 130 134 //////////////////////////////////////////////////////////////////////////////////// 131 // stacks for the "idle" tasks (64 bytes for each processor) 132 //////////////////////////////////////////////////////////////////////////////////// 133 134 __attribute__((section (".kdata"))) 135 volatile unsigned int _idle_stack[X_SIZE * Y_SIZE * NB_PROCS_MAX * 16 ]; 136 137 //////////////////////////////////////////////////////////////////////////////////// 138 // Synchonisation Barrier before jumping to user code 135 // Synchonisation barrier before jumping to user code 139 136 //////////////////////////////////////////////////////////////////////////////////// 140 137 … … 155 152 while( pid != _init_barrier ) asm volatile ( "nop" ); 156 153 157 // Step 1 : each processor get its scheduler virtual address 154 // Step 1 : each processor get its scheduler virtual address from CP0 register 158 155 // and contribute to initialise the _schedulers[] array 159 156 … … 290 287 291 288 // step 6 : each processor updates the idle_task context: 292 // ( onlyCTX_SP, CTX_RA, CTX_EPC).293 // The stack size is 512 bytes, reserved in seg_kdata.289 // (CTX_SP, CTX_RA, CTX_EPC). 290 // The 4 Kbytes idle stack is implemented in the scheduler. 294 291 // The PTPR register, the CTX_PTPR and CTX_PTAB slots 295 292 // have been initialised in boot code. 296 293 297 unsigned int p = ((x * Y_SIZE) + y) * NB_PROCS_MAX + lpid; 298 299 unsigned int stack = (unsigned int)_idle_stack + ((p + 1) * 64); 300 301 _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_SP_ID, stack); 294 unsigned int pstack = ((unsigned int)psched) + 0x2000; 295 296 _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_SP_ID, pstack); 302 297 _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_RA_ID, (unsigned int) &_ctx_eret); 303 298 _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_EPC_ID, (unsigned int) &_idle_task); 304 299 305 300 #if GIET_DEBUG_INIT 306 _printf("\n[GIET DEBUG INIT] Processor[%d,%d,%d] initializes IDLE task\n", 307 x, y, lpid ); 301 _printf("\n[GIET DEBUG INIT] Processor[%d,%d,%d] initializes IDLE task\n" 302 " - stack_base = %x\n" 303 " - stack_size = 0x1000\n", 304 x, y, lpid, pstack - 0x1000 ); 308 305 #endif 309 306 … … 341 338 // busy waiting until all processors synchronized 342 339 while ( _init_barrier != NB_TOTAL_PROCS ); 340 341 #if GIET_DEBUG_INIT 342 _printf("\n[GIET DEBUG INIT] Processor[%d,%d,%d] initializes registers at cycle %d\n" 343 " - sp = %x\n" 344 " - sr = %x\n" 345 " - ptpr = %x\n" 346 " - epc = %x\n", 347 x, y, lpid, _get_proctime(), 348 sp_value, sr_value, ptpr_value, epc_value ); 349 #endif 343 350 344 351 // set registers and jump to user code
Note: See TracChangeset
for help on using the changeset viewer.