Changeset 294 for soft/giet_vm/giet_kernel/ctx_handler.h
- Timestamp:
- Mar 26, 2014, 6:10:01 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/ctx_handler.h
r267 r294 1 ///////////////////////////////////////////////////////////////////////////////////////// 2 // File : ctx_handler.h 3 // Date : 01/04/2012 4 // Authors : alain greiner & joel porquet 5 // Copyright (c) UPMC-LIP6 6 ///////////////////////////////////////////////////////////////////////////////////////// 7 // The ctx_handler.h and ctx_handler.c files are part of the GIET-VM nano-kernel. 8 // This code is used to support context switch when several tasks are executing 9 // in time multiplexing on a single processor. 10 // The tasks are statically allocated to a processor in the boot phase, and 11 // there is one private scheduler per processor. Each sheduler occupies 4K bytes, 12 // and contains up to 14 task contexts (task_id is from 0 to 13). 13 // The task context [13] is reserved for the "idle" task that does nothing, and 14 // is launched by the scheduler when there is no other runable task. 15 ///////////////////////////////////////////////////////////////////////////////////////// 16 // A task context is an array of 64 words = 256 bytes. 17 // It contains copies of processor registers (when the task is preempted): 18 // - GPR[i], generally stored in slot (i). $0, $26 & $27 are not saved. 19 // - HI & LO registers 20 // - CP0 registers: EPC, SR, CR, BVAR 21 // - CP2 registers : PTPR 22 // It contains some general informations associated to the task: 23 // - TTY : TTY channel global index 24 // - NIC : NIC channel global index 25 // - CMA : CMA channel global index 26 // - HBA : HBA channel global index 27 // - DMA : DMA channel local index 28 // - TIM : TIM channel local index 29 // - PTAB : page table virtual base address 30 // - LTID : Task local index (in scheduler) 31 // - VSID : Virtual space index 32 // - RUN : Task state (0 => sleeping / 1 => runnable ) 33 // - TRDID : Thread ID index (in vspace) 34 // 35 // ctx[0] <- *** |ctx[8] <- $8 |ctx[16]<- $16 |ctx[24]<- $24 36 // ctx[1] <- $1 |ctx[9] <- $9 |ctx[17]<- $17 |ctx[25]<- $25 37 // ctx[2] <- $2 |ctx[10]<- $10 |ctx[18]<- $18 |ctx[26]<- LO 38 // ctx[3] <- $3 |ctx[11]<- $11 |ctx[19]<- $19 |ctx[27]<- HI 39 // ctx[4] <- $4 |ctx[12]<- $12 |ctx[20]<- $20 |ctx[28]<- $28 40 // ctx[5] <- $5 |ctx[13]<- $13 |ctx[21]<- $21 |ctx[29]<- SP 41 // ctx[6] <- $6 |ctx[14]<- $14 |ctx[22]<- $22 |ctx[30]<- $30 42 // ctx[7] <- $7 |ctx[15]<- $15 |ctx[23]<- $23 |ctx[31]<- RA 43 // 44 // ctx[32]<- EPC |ctx[40]<- TTY |ctx[48]<- TRDID | 45 // ctx[33]<- CR |ctx[41]<- DMA 46 // ctx[34]<- SR |ctx[42]<- NIC 47 // ctx[35]<- BVAR |ctx[43]<- TIM 48 // ctx[36]<- PTAB |ctx[44]<- HBA 49 // ctx[37]<- LTID |ctx[45]<- CMA 50 // ctx[38]<- VSID |ctx[46]<- GTID 51 // ctx[39]<- PTPR |ctx[47]<- RUN 52 ///////////////////////////////////////////////////////////////////////////////////////// 53 1 54 #ifndef _CTX_HANDLER_H 2 55 #define _CTX_HANDLER_H … … 10 63 typedef struct static_scheduler_s 11 64 { 12 unsigned int context[1 5][64]; // at most 15 task contexts65 unsigned int context[14][64]; // at most 14 task (including idle_task) 13 66 unsigned int tasks; // actual number of tasks 14 67 unsigned int current; // current task index 15 unsigned int interrupt_vector[32]; // interrupt vector 68 unsigned int hwi_vector[32]; // hardware interrupt vector 69 unsigned int pti_vector[32]; // timer interrupt vector 70 unsigned int wti_vector[32]; // software interrupt vector 16 71 } static_scheduler_t; 17 72 … … 21 76 ///////////////////////////////////////////////////////////////////////////////// 22 77 23 #define IDLE_TASK_INDEX 1 478 #define IDLE_TASK_INDEX 13 24 79 25 80 ///////////////////////////////////////////////////////////////////////////////// … … 27 82 ///////////////////////////////////////////////////////////////////////////////// 28 83 29 #define CTX_SP_ID 29 30 #define CTX_RA_ID 31 84 #define CTX_SP_ID 29 // Stack Pointer 85 #define CTX_RA_ID 31 // Return Address 31 86 32 87 #define CTX_EPC_ID 32 // Exception Program Counter (CP0) … … 34 89 #define CTX_SR_ID 34 // Status Register (CP0) 35 90 #define CTX_BVAR_ID 35 // Bad Virtual Address Register (CP0) 36 37 91 #define CTX_PTAB_ID 36 // Page Table Virtual address 38 92 #define CTX_LTID_ID 37 // Local Task Index (in scheduler) … … 40 94 #define CTX_PTPR_ID 39 // Page Table Pointer Register (PADDR>>13) 41 95 42 #define CTX_TTY_ID 40 // global TTY terminal96 #define CTX_TTY_ID 40 // global TTY channel 43 97 #define CTX_DMA_ID 41 // local DMA channel 44 98 #define CTX_NIC_ID 42 // global NIC channel … … 48 102 #define CTX_GTID_ID 46 // Global Task Index 49 103 #define CTX_RUN_ID 47 // Boolean: task runable 104 50 105 #define CTX_TRDID_ID 48 // Thread Index in vspace 51 106
Note: See TracChangeset
for help on using the changeset viewer.