Ignore:
Timestamp:
Mar 26, 2014, 6:10:01 PM (10 years ago)
Author:
alain
Message:

Introducing support for IOPIC component.

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
    154#ifndef _CTX_HANDLER_H
    255#define _CTX_HANDLER_H
     
    1063typedef struct static_scheduler_s
    1164{
    12     unsigned int context[15][64];      // at most 15 task contexts
     65    unsigned int context[14][64];      // at most 14 task (including idle_task)
    1366    unsigned int tasks;                // actual number of tasks
    1467    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
    1671} static_scheduler_t;
    1772
     
    2176/////////////////////////////////////////////////////////////////////////////////
    2277
    23 #define IDLE_TASK_INDEX        14
     78#define IDLE_TASK_INDEX        13
    2479
    2580/////////////////////////////////////////////////////////////////////////////////
     
    2782/////////////////////////////////////////////////////////////////////////////////
    2883
    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
    3186
    3287#define CTX_EPC_ID       32  // Exception Program Counter (CP0)
     
    3489#define CTX_SR_ID        34  // Status Register (CP0)
    3590#define CTX_BVAR_ID      35      // Bad Virtual Address Register (CP0)
    36 
    3791#define CTX_PTAB_ID      36  // Page Table Virtual address
    3892#define CTX_LTID_ID      37  // Local  Task Index (in scheduler)
     
    4094#define CTX_PTPR_ID      39  // Page Table Pointer Register (PADDR>>13)
    4195
    42 #define CTX_TTY_ID       40  // global TTY terminal 
     96#define CTX_TTY_ID       40  // global TTY channel  
    4397#define CTX_DMA_ID       41  // local DMA channel
    4498#define CTX_NIC_ID       42  // global NIC channel
     
    48102#define CTX_GTID_ID      46  // Global Task Index
    49103#define CTX_RUN_ID       47  // Boolean: task runable
     104
    50105#define CTX_TRDID_ID     48  // Thread Index in vspace
    51106
Note: See TracChangeset for help on using the changeset viewer.