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) )
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.