Changeset 391 for soft/giet_vm
- Timestamp:
- Aug 11, 2014, 9:19:06 PM (10 years ago)
- Location:
- soft/giet_vm/giet_kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/ctx_handler.c
r330 r391 103 103 void _idle_task() 104 104 { 105 unsigned int gpid = _get_procid(); 106 unsigned int cluster_xy = gpid / NB_PROCS_MAX; 107 unsigned int lpid = gpid % NB_PROCS_MAX; 108 unsigned int x = cluster_xy >> Y_WIDTH; 109 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 110 105 111 while(1) 106 112 { 113 // initialize counter 107 114 unsigned int count = GIET_IDLE_TASK_PERIOD; 108 115 … … 119 126 120 127 // warning message 121 unsigned int gpid = _get_procid();122 unsigned int cluster_xy = gpid / NB_PROCS_MAX;123 unsigned int lpid = gpid % NB_PROCS_MAX;124 unsigned int x = cluster_xy >> Y_WIDTH;125 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);126 127 128 _printf("\n[GIET WARNING] Processor[%d,%d,%d] still idle at cycle %d\n", 128 129 x, y, lpid, _get_proctime() ); 129 130 130 } 131 131 } // end ctx_idle() -
soft/giet_vm/giet_kernel/ctx_handler.h
r310 r391 70 70 unsigned int wti_vector[32]; // software interrupt vector 71 71 unsigned int reserved[30]; // padding to 4 Kbytes 72 unsigned int idle_stack[1024]; // private stack for idle stack (4Kbytes) 72 73 } static_scheduler_t; 73 74 74 75 75 76 ///////////////////////////////////////////////////////////////////////////////// 76 // "idle" task index definition77 // "idle" task index and stack size definition 77 78 ///////////////////////////////////////////////////////////////////////////////// 78 79 79 80 #define IDLE_TASK_INDEX 13 81 #define IDLE_TASK_STACK 0x1000 80 82 81 83 ///////////////////////////////////////////////////////////////////////////////// … … 107 109 108 110 ////////////////////////////////////////////////////////////////////////////////// 109 // Prototype of the context switch function111 // context switch functions 110 112 ////////////////////////////////////////////////////////////////////////////////// 111 113 -
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.