Changeset 231 for soft


Ignore:
Timestamp:
Mar 5, 2013, 1:42:57 PM (12 years ago)
Author:
joannou
Message:
  • Bugfix in Interruption mechanism :
    • _it_mask() and _it_restore() functions now share a global array indexed by the proc_id (used a simple global variable before => problem with multiproc)
    • added 2 new fuctions _it_enable() and _it_disable() that only affect the IE bit of the status register in COP0
    • replaced interrupt masking/restoring arround _ctx_switch() in sys_handler by a simple interrupt disabling before the call to _ctx_switch (restoring after a _ctx_switch wouldn't restore the correct task's status register)
    • replaced the use of _ctx_switch in _exit() by a call to _context_switch() (this function actually does the interrupt disabling)
  • Added some comments in the ctx_handler.h
  • Added the delay reset in the idle task (ctx_handler.c)
  • Added a new irq type (PTI)
    • Modifications in xml_parser.c to accept PTI irq type (now used in xml mappings)
    • Added the test on the irq type in the _irq_demux() function. This leads to a different argument passed to the ISR (i.e. either channel_id or irq_id (aka icuid) )
Location:
soft/giet_vm
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sys/common.c

    r228 r231  
    2323
    2424// SR save (used by _it_mask() / it_restore()
    25 unsigned int _status_register_save;
     25unsigned int _status_register_save[NB_CLUSTERS*NB_PROCS_MAX];
    2626
    2727///////////////////////////////////////////////////////////////////////////////////
     
    103103//    _it_mask()
    104104// Access CP0 and mask IRQs
     105// This function uses a global _status_register_save array
     106// This function is NOT USED and NOT TESTED
    105107///////////////////////////////////////////////////////////////////////////////////
    106108inline void _it_mask() {
    107109    unsigned int sr_value;
     110    unsigned int proc_id;
    108111    asm volatile(
    109112            "li      $3,        0xFFFFFFFE    \n"
     
    111114            "and     $3,        $3, %0        \n"
    112115            "mtc0    $3,        $12           \n"
    113             : "=r"(sr_value)
     116            "mfc0    %1,        $15, 1        \n"
     117            : "=r"(sr_value), "=r"(proc_id)
    114118            :
    115119            : "$3");
    116     _status_register_save = sr_value;
     120    _status_register_save[proc_id] = sr_value;
    117121}
    118122
     
    121125//    _it_restore()
    122126// Access CP0 and enable IRQs
     127// This function uses a global _status_register_save array
     128// This function is NOT USED and NOT TESTED
    123129///////////////////////////////////////////////////////////////////////////////////
    124130inline void _it_restore() {
    125     unsigned int sr_value = _status_register_save;
    126     asm volatile(
    127             "mtc0  %0,        $12            \n"
    128             :
    129             : "r"(sr_value));
     131    unsigned int proc_id;
     132    // get the processor id to index the _status_register_save table
     133    asm volatile("mfc0 %0, $15, 1" : "=r" (proc_id));
     134    // restore the saved value into the status register
     135    asm volatile("mtc0  %0, $12" : : "r" (_status_register_save[proc_id]));
     136}
     137
     138///////////////////////////////////////////////////////////////////////////////////
     139//    _it_disable()
     140// Access CP0 and disables IRQs
     141///////////////////////////////////////////////////////////////////////////////////
     142inline void _it_disable() {
     143    asm volatile(
     144            "li      $3,        0xFFFFFFFE    \n"
     145            "mfc0    $4,        $12           \n"
     146            "and     $3,        $3, $4        \n"
     147            "mtc0    $3,        $12           \n"
     148            ::: "$3", "$4");
     149}
     150
     151///////////////////////////////////////////////////////////////////////////////////
     152//    _it_enable()
     153// Access CP0 and enables IRQs
     154///////////////////////////////////////////////////////////////////////////////////
     155inline void _it_enable() {
     156    asm volatile(
     157            "li      $3,        0x00000001    \n"
     158            "mfc0    $4,        $12           \n"
     159            "or      $3,        $3, $4        \n"
     160            "mtc0    $3,        $12           \n"
     161            ::: "$3", "$4");
    130162}
    131163
  • soft/giet_vm/sys/common.h

    r228 r231  
    1010
    1111#include <mapping_info.h>
     12#include <giet_config.h>
    1213
    1314///////////////////////////////////////////////////////////////////////////////////
     
    4546void _it_mask(void);
    4647void _it_restore(void);
     48void _it_disable(void);
     49void _it_enable(void);
    4750
    4851unsigned int _get_epc(void);
  • soft/giet_vm/sys/ctx_handler.c

    r228 r231  
    155155        _release_lock(&_tty_put_lock);
    156156
     157        delay = 1000000;
    157158    }
    158159} // end ctx_idle()
  • soft/giet_vm/sys/ctx_handler.h

    r218 r231  
    3737#define CTX_PTPR_ID             39
    3838
    39 #define CTX_TTY_ID              40
    40 #define CTX_DMA_ID          41
    41 #define CTX_NIC_ID          42
    42 #define CTX_TIMER_ID    43
    43 #define CTX_PTAB_ID             44
    44 #define CTX_LTID_ID             45
    45 #define CTX_VSID_ID             46
    46 #define CTX_RUN_ID              47
     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
    4747
    4848//////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/sys/irq_handler.c

    r228 r231  
    5757        unsigned int entry = _get_interrupt_vector_entry(irq_id);
    5858        unsigned int isr_id = entry & 0x000000FF;
     59        unsigned int type_id = (entry >> 8) & 0x000000FF;
    5960        unsigned int channel_id = (entry >> 16) & 0x0000FFFF;
    60         if      ( isr_id == ISR_SWITCH) _isr_switch( channel_id);
    61         else if ( isr_id == ISR_IOC   ) _isr_ioc();
    62         else if ( isr_id == ISR_DMA   ) _isr_dma(channel_id);
    63         else if ( isr_id == ISR_TTY   ) _isr_tty(channel_id);
    64         else if ( isr_id == ISR_TIMER ) _isr_timer(channel_id);
    65         else                            _isr_default();
     61        if(type_id == 0) // HARD irq type
     62        {
     63            if      ( isr_id == ISR_SWITCH) _isr_switch(channel_id);
     64            else if ( isr_id == ISR_IOC   ) _isr_ioc();
     65            else if ( isr_id == ISR_DMA   ) _isr_dma(channel_id);
     66            else if ( isr_id == ISR_TTY   ) _isr_tty(channel_id);
     67            else if ( isr_id == ISR_TIMER ) _isr_timer(channel_id);
     68            else                            _isr_default();
     69        }
     70        else // PTI irq type
     71        {
     72            if      ( isr_id == ISR_SWITCH) _isr_switch(irq_id);
     73            else if ( isr_id == ISR_TIMER ) _isr_timer(irq_id);
     74        }
    6675    }
    6776}
  • soft/giet_vm/sys/sys_handler.c

    r230 r231  
    9494
    9595    // deschedule
    96     _ctx_switch();
     96    _context_switch();
    9797}
    9898
     
    232232////////////////////////////////////////////////////////////////
    233233void _context_switch() {
    234     _it_mask();
     234    _it_disable();
    235235    _ctx_switch();
    236     _it_restore();
    237236}
    238237
  • soft/giet_vm/xml/xml_parser.c

    r230 r231  
    12391239            irq[irq_index]->type = 0;
    12401240        }
    1241         else if (strcmp(str, "SOFT") == 0 ) {
     1241        else {
    12421242            irq[irq_index]->type = 1;
    12431243        }
    1244         else {
    1245             printf("[XML ERROR] undefined IRQ  <type> for processor %d in cluster %d\n",
    1246                     cluster_index, proc_loc_index);
    1247             exit(1);
    1248         }
    1249     } 
     1244    }
    12501245    else {
    12511246        printf("[XML ERROR] missing IRQ <type> for processor %d in cluster %d\n",
Note: See TracChangeset for help on using the changeset viewer.