Changeset 232 for soft/giet_vm/sys
- Timestamp:
- Mar 5, 2013, 4:00:09 PM (12 years ago)
- Location:
- soft/giet_vm/sys
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/common.c
r231 r232 375 375 376 376 //////////////////////////////////////////////////////////////////////////// 377 // _get_ current_task_id()377 // _get_proc_task_id() 378 378 // This function returns the index of the currently running task. 379 379 //////////////////////////////////////////////////////////////////////////// 380 unsigned int _get_ current_task_id() {380 unsigned int _get_proc_task_id() { 381 381 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 382 382 return _physical_read_access(&(psched->current)); … … 385 385 386 386 //////////////////////////////////////////////////////////////////////////// 387 // _set_ current_task_id()387 // _set_proc_task_id() 388 388 // This function returns the index of the currently running task. 389 389 //////////////////////////////////////////////////////////////////////////// 390 void _set_ current_task_id(unsigned int value) {390 void _set_proc_task_id(unsigned int value) { 391 391 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 392 392 _physical_write_access(&(psched->current), value); 393 } 394 395 396 //////////////////////////////////////////////////////////////////////////// 397 // _get_global_task_id() 398 // This function returns the global index of the running task. 399 //////////////////////////////////////////////////////////////////////////// 400 unsigned int _get_global_task_id() { 401 return _get_context_slot(_get_proc_task_id(), CTX_GTID_ID); 393 402 } 394 403 -
soft/giet_vm/sys/common.h
r231 r232 60 60 unsigned int _get_interrupt_vector_entry(unsigned int index); 61 61 62 unsigned int _get_current_task_id(void); 63 void _set_current_task_id(unsigned int value); 62 unsigned int _get_proc_task_id(void); 63 void _set_proc_task_id(unsigned int value); 64 65 unsigned int _get_global_task_id(void); 66 64 67 65 68 unsigned int _get_tasks_number(void); -
soft/giet_vm/sys/ctx_handler.c
r231 r232 76 76 77 77 // get current task index 78 unsigned int curr_task_id = _get_ current_task_id();78 unsigned int curr_task_id = _get_proc_task_id(); 79 79 80 80 // select the next task using a round-robin policy … … 103 103 unsigned int * next_ctx_paddr = &(psched->context[next_task_id][0]); 104 104 105 _set_ current_task_id(next_task_id);105 _set_proc_task_id(next_task_id); 106 106 //_timer_reset_irq_cpt(cluster_id, local_id); // commented until not properly supported in soclib 107 107 // (the function is not yet present in drivers.c) -
soft/giet_vm/sys/ctx_handler.h
r231 r232 5 5 6 6 ///////////////////////////////////////////////////////////////////////////////// 7 // 7 // Definition of the scheduler structure 8 8 ///////////////////////////////////////////////////////////////////////////////// 9 9 10 typedef struct static_scheduler_s 11 { 12 unsigned int context[15][64]; // at most 15 task contexts 13 unsigned int tasks; // actual number of tasks 14 unsigned int current; // current task index 15 unsigned int interrupt_vector[32]; // interrupt vector 10 typedef struct static_scheduler_s { 11 unsigned int context[15][64]; // at most 15 task contexts 12 unsigned int tasks; // actual number of tasks 13 unsigned int current; // current task index 14 unsigned int interrupt_vector[32]; // interrupt vector 16 15 } static_scheduler_t; 17 16 … … 21 20 ///////////////////////////////////////////////////////////////////////////////// 22 21 23 #define IDLE_TASK_INDEX 22 #define IDLE_TASK_INDEX 14 24 23 25 24 ///////////////////////////////////////////////////////////////////////////////// 26 // 25 // Definition of the task context slots indexes 27 26 ///////////////////////////////////////////////////////////////////////////////// 28 27 29 #define CTX_SP_ID 30 #define CTX_RA_ID 28 #define CTX_SP_ID 29 29 #define CTX_RA_ID 31 31 30 32 #define CTX_EPC_ID 33 #define CTX_CR_ID 34 #define CTX_SR_ID 35 #define CTX_BVAR_ID 31 #define CTX_EPC_ID 32 32 #define CTX_CR_ID 33 33 #define CTX_SR_ID 34 34 #define CTX_BVAR_ID 35 36 35 37 #define CTX_PTPR_ID 36 #define CTX_PTPR_ID 39 38 37 39 #define CTX_TTY_ID 40 // Integer : global TTY terminal index 40 #define CTX_DMA_ID 41 // Integer : global DMA channel index 41 #define CTX_NIC_ID 42 // Integer : global NIC channel index 42 #define CTX_TIMER_ID 43 // Integer : user level timer index / UNUSED 43 #define CTX_PTAB_ID 44 // Pointer : page table virtual base adress 44 #define CTX_LTID_ID 45 // Integer : local task index (in scheduler) / UNUSED 45 #define CTX_VSID_ID 46 // Integer : vspace index 46 #define CTX_RUN_ID 47 // Boolean : task runable 38 #define CTX_TTY_ID 40 // Integer : global TTY terminal index 39 #define CTX_DMA_ID 41 // Integer : global DMA channel index 40 #define CTX_NIC_ID 42 // Integer : global NIC channel index 41 #define CTX_TIMER_ID 43 // Integer : user level timer index / UNUSED 42 #define CTX_PTAB_ID 44 // Pointer : page table virtual base adress 43 #define CTX_LTID_ID 45 // Integer : local task index (in scheduler) / UNUSED 44 #define CTX_VSID_ID 46 // Integer : vspace index 45 #define CTX_RUN_ID 47 // Boolean : task runable 46 #define CTX_GTID_ID 48 // Integer : Global task id 47 47 48 48 ////////////////////////////////////////////////////////////////////////////////// 49 // 49 // Prototype of the context switch function 50 50 ////////////////////////////////////////////////////////////////////////////////// 51 51 -
soft/giet_vm/sys/drivers.c
r228 r232 120 120 #if (NB_TIMERS_MAX > 0) 121 121 in_unckdata volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIMERS_MAX] 122 = { [0 ... ((NB_CLUSTERS * NB_TIMERS_MAX) - 1)] = 0 };122 = { [0 ... ((NB_CLUSTERS * NB_TIMERS_MAX) - 1)] = 0 }; 123 123 #endif 124 124 … … 205 205 bloup++; // to avoid a warning 206 206 #else 207 unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base +207 unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base + 208 208 (cluster_id * CLUSTER_SIZE)); 209 209 … … 213 213 return 0; 214 214 } 215 216 217 //////////////////////////////////////////////// 218 // _timer_reset_irq_cpt() 219 //////////////////////////////////////////////// 220 //unsigned int _timer_reset_irq_cpt(unsigned int cluster_id, unsigned int local_id) { 221 // // parameters checking 222 // if ( cluster_id >= NB_CLUSTERS) return 1; 223 // if ( local_id >= NB_TIMERS_MAX ) return 2; 224 // 225 //#if USE_XICU 226 //#error // not implemented 227 //#else 228 // unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base + (cluster_id * CLUSTER_SIZE)); 229 // 230 // timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 1; 231 //#endif 232 // 233 // return 0; 234 //} 215 235 216 236 … … 264 284 unsigned int _tty_write(const char * buffer, unsigned int length) { 265 285 unsigned int nwritten; 266 unsigned int task_id = _get_ current_task_id();286 unsigned int task_id = _get_proc_task_id(); 267 287 unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID); 268 288 … … 300 320 ////////////////////////////////////////////////////////////////////////////// 301 321 unsigned int _tty_read(char * buffer, unsigned int length) { 302 unsigned int task_id = _get_ current_task_id();322 unsigned int task_id = _get_proc_task_id(); 303 323 unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID); 304 324 … … 567 587 568 588 // get user space page table virtual address 569 unsigned int task_id = _get_ current_task_id();589 unsigned int task_id = _get_proc_task_id(); 570 590 unsigned int user_pt_vbase = _get_context_slot(task_id, CTX_PTAB_ID); 571 591 … … 877 897 878 898 // get DMA channel and compute DMA vbase address 879 unsigned int task_id = _get_ current_task_id();899 unsigned int task_id = _get_proc_task_id(); 880 900 unsigned int dma_id = _get_context_slot(task_id, CTX_DMA_ID); 881 901 unsigned int cluster_id = dma_id / NB_DMAS_MAX; … … 1012 1032 unsigned int _dma_completed() { 1013 1033 #if NB_DMAS_MAX > 0 1014 unsigned int task_id = _get_ current_task_id();1034 unsigned int task_id = _get_proc_task_id(); 1015 1035 unsigned int dma_id = _get_context_slot(task_id, CTX_DMA_ID); 1016 1036 unsigned int dma_ret; … … 1246 1266 } 1247 1267 1268 /////////////////////////////////////////////////////////////////////////////////// 1269 // _heap_info() 1270 // This function returns the information associated to a heap (size and vaddr) 1271 // It uses the global task id (CTX_GTID_ID, unique for each giet task) and the 1272 // vspace id (CTX_VSID_ID) defined in the context 1273 /////////////////////////////////////////////////////////////////////////////////// 1274 unsigned int _heap_info(unsigned int * vaddr, unsigned int * size) { 1275 mapping_header_t * header = (mapping_header_t *) (&seg_mapping_base); 1276 mapping_task_t * tasks = _get_task_base(header); 1277 mapping_vobj_t * vobjs = _get_vobj_base(header); 1278 mapping_vspace_t * vspaces = _get_vspace_base(header); 1279 unsigned int taskid = _get_context_slot(_get_proc_task_id(), CTX_GTID_ID); 1280 unsigned int vspaceid = _get_context_slot(_get_proc_task_id(), CTX_VSID_ID); 1281 int heap_local_vobjid = tasks[taskid].heap_vobjid; 1282 if (heap_local_vobjid != -1) { 1283 unsigned int vobjheapid = heap_local_vobjid + vspaces[vspaceid].vobj_offset; 1284 *vaddr = vobjs[vobjheapid].vaddr; 1285 *size = vobjs[vobjheapid].length; 1286 return 0; 1287 } 1288 else { 1289 *vaddr = 0; 1290 *size = 0; 1291 return 0; 1292 } 1293 } 1294 1248 1295 // Local Variables: 1249 1296 // tab-width: 4 -
soft/giet_vm/sys/drivers.h
r228 r232 113 113 114 114 115 /////////////////////////////////////////////////////////////////////////////////// 116 // Heap related function(s) 117 /////////////////////////////////////////////////////////////////////////////////// 118 119 unsigned int _heap_info(unsigned int * vaddr, unsigned int * size); 120 121 115 122 #endif 116 123 -
soft/giet_vm/sys/exc_handler.c
r228 r232 70 70 _get_lock(&_tty_put_lock); 71 71 _puts("\n[GIET] Exception for task "); 72 _putd(_get_ current_task_id());72 _putd(_get_proc_task_id()); 73 73 _puts(" on processor "); 74 74 _putd(_procid()); … … 86 86 87 87 // goes to sleeping state 88 unsigned int task_id = _get_ current_task_id();88 unsigned int task_id = _get_proc_task_id(); 89 89 _set_context_slot( task_id, CTX_RUN_ID, 0); 90 90 -
soft/giet_vm/sys/sys_handler.c
r231 r232 30 30 &_gcd_write, /* 0x06 */ 31 31 &_gcd_read, /* 0x07 */ 32 &_ sys_ukn,/* 0x08 */33 &_get_ current_task_id,/* 0x09 */34 &_ sys_ukn, /* 0x0A */32 &_heap_info, /* 0x08 */ 33 &_get_proc_task_id, /* 0x09 */ 34 &_get_global_task_id, /* 0x0A */ 35 35 &_sys_ukn, /* 0x0B */ 36 36 &_sys_ukn, /* 0x0C */ … … 77 77 unsigned int date = _proctime(); 78 78 unsigned int proc_id = _procid(); 79 unsigned int task_id = _get_ current_task_id();79 unsigned int task_id = _get_proc_task_id(); 80 80 81 81 // print death message
Note: See TracChangeset
for help on using the changeset viewer.