Changeset 15519cb in rtems


Ignore:
Timestamp:
Jun 29, 2010, 12:38:13 AM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
5a0b7914
Parents:
11e8bc5
Message:

2010-06-28 Joel Sherrill <joel.sherrill@…>

PR 1573/cpukit

  • shared/irq/irq.c, shared/irq/irq_asm.S: Add a per cpu data structure which contains the information required by RTEMS for each CPU core. This encapsulates information such as thread executing, heir, idle and dispatch needed.
Location:
c/src/lib/libbsp/i386
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/ChangeLog

    r11e8bc5 r15519cb  
     12010-06-28      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        PR 1573/cpukit
     4        * shared/irq/irq.c, shared/irq/irq_asm.S: Add a per cpu data structure
     5        which contains the information required by RTEMS for each CPU core.
     6        This encapsulates information such as thread executing, heir, idle
     7        and dispatch needed.
     8
    192010-06-21      Joel Sherrill <joel.sherrill@oarcorp.com>
    210
  • c/src/lib/libbsp/i386/shared/irq/irq.c

    r11e8bc5 r15519cb  
    250250  bsp_interrupt_handler_dispatch(vector);
    251251}
    252 
    253 void _ThreadProcessSignalsFromIrq (void)
    254 {
    255   /*
    256    * Process pending signals that have not already been
    257    * processed by _Thread_Displatch. This happens quite
    258    * unfrequently : the ISR must have posted an action
    259    * to the current running thread.
    260    */
    261   if ( _Thread_Do_post_task_switch_extension ||
    262        _Thread_Executing->do_post_task_switch_extension ) {
    263     _Thread_Executing->do_post_task_switch_extension = false;
    264     _API_extensions_Run_postswitch();
    265   }
    266   /*
    267    * I plan to process other thread related events here.
    268    * This will include DEBUG session requested from keyboard...
    269    */
    270 }
  • c/src/lib/libbsp/i386/shared/irq/irq_asm.S

    r11e8bc5 r15519cb  
    1313
    1414#include <rtems/asm.h>
     15#include <bspopts.h>
    1516#include <bsp/irq_asm.h>
    1617#include <rtems/score/cpu.h>
     18#include <rtems/score/percpu.h>
    1719
    1820#ifndef CPU_STACK_ALIGNMENT
     
    2325#define ARG_OFF 0
    2426#define MSK_OFF 4
    25 #define EBP_OFF 8        /* code restoring ebp/esp relies on */
    26 #define ESP_OFF 12       /* esp being on top of ebp!         */
     27#define EBX_OFF 8        /* ebx                              */
     28#define EBP_OFF 12       /* code restoring ebp/esp relies on */
     29#define ESP_OFF 16       /* esp being on top of ebp!         */
    2730#ifdef __SSE__
    28 #define FRM_SIZ (16+512)
    29 #define SSE_OFF 16
     31#define FRM_SIZ (20+512)
     32#define SSE_OFF 20
    3033#else
    31 #define FRM_SIZ 16
     34#define FRM_SIZ 20
    3235#endif
    3336
     
    6568        /*
    6669         * Establish an aligned stack frame
    67          *   original-sp
    68          *   saved-bp
    69          *   saved-irq-mask
    70          *   vector-arg-to-C_dispatch_isr   <- aligned SP
     70         *   original sp
     71         *   saved ebx
     72         *   saved ebp
     73         *   saved irq mask
     74         *   vector arg to C_dispatch_isr   <- aligned SP
    7175         */
    7276        movl      esp, eax
    7377        subl      $FRM_SIZ, esp
    7478        andl      $ - CPU_STACK_ALIGNMENT, esp
     79        movl      ebx, EBX_OFF(esp)
    7580        movl      eax, ESP_OFF(esp)
    7681        movl      ebp, EBP_OFF(esp)
     
    8388
    8489        /* We save SSE here (on the task stack) because we possibly
    85          * call other C-code (besides the ISR, namely _Thread_Dispatch()
    86          * or _ThreadProcessSignalsFromIrq()).
     90         * call other C-code (besides the ISR, namely _Thread_Dispatch())
    8791         */
    8892    /*  don't wait here; a possible exception condition will eventually be
     
    96100#endif
    97101
     102        /* Do not disable any 8259 interrupts if this isn't from one */
     103        cmp       ecx, 16               /* is this a PIC IRQ? */
     104        jge       .check_stack_switch
    98105
    99106        /*
    100107         * acknowledge the interrupt
    101          *
    102          */
    103         movw      SYM (i8259s_cache), ax /* move current i8259 interrupt mask in ax */
     108         */
     109        movw      SYM (i8259s_cache), ax /* save current i8259 interrupt mask */
    104110        movl      eax, MSK_OFF(esp)      /* save in stack frame */
     111
    105112        /*
    106113         * compute the new PIC mask:
     
    130137         */
    131138
     139PUBLIC (ISR_STOP)
     140ISR_STOP:
    132141.check_stack_switch:
    133142        movl      esp, ebp                  /* ebp = previous stack pointer */
    134         cmpl      $0, SYM (_ISR_Nest_level) /* is this the outermost interrupt? */
     143
     144        movl      $SYM(rtems_per_cpu_info), ebx
     145
     146        /* is this the outermost interrupt? */
     147        cmpl      $0, PER_CPU_ISR_NEST_LEVEL(ebx)
    135148        jne       nested                    /* No, then continue */
    136         movl      SYM (_CPU_Interrupt_stack_high), esp
     149        movl      PER_CPU_INTERRUPT_STACK_HIGH(ebx), esp
    137150
    138151        /*
     
    143156
    144157nested:
    145         incl      SYM (_ISR_Nest_level)     /* one nest level deeper */
     158        incl      PER_CPU_ISR_NEST_LEVEL(ebx)  /* one nest level deeper */
    146159        incl      SYM (_Thread_Dispatch_disable_level) /* disable multitasking */
    147160
     
    152165        sti
    153166
    154     /*
     167        /*
    155168         *  ECX is preloaded with the vector number; store as arg
    156169         *  on top of stack. Note that _CPU_Interrupt_stack_high
     
    167180        cli
    168181
     182        movl      ARG_OFF(esp), ecx     /* grab vector arg from stack */
     183
    169184        /*
    170185         * Restore stack. This moves back to the task stack
     
    176191         * restore the original i8259 masks
    177192         */
     193        /* Do not touch 8259 interrupts if this isn't from one */
     194        cmp       ecx, 16               /* is this a PIC IRQ? */
     195        jge       .dont_restore_i8259
     196
    178197        movl      MSK_OFF(esp), eax
    179198        movw      ax, SYM (i8259s_cache)
     
    182201        outb      $PIC_SLAVE_IMR_IO_PORT
    183202
    184         decl      SYM (_ISR_Nest_level)     /* one less ISR nest level */
     203.dont_restore_i8259:
     204        decl      PER_CPU_ISR_NEST_LEVEL(ebx)  /* one less ISR nest level */
    185205                                            /* If interrupts are nested, */
    186206                                            /*   then dispatching is disabled */
     
    191211        jne       .exit                     /* Yes, then exit */
    192212
    193         cmpb      $0, SYM (_Context_Switch_necessary)
     213        cmpb      $0, PER_CPU_DISPATCH_NEEDED(ebx)
    194214                                            /* Is task switch necessary? */
    195215        jne       .schedule                 /* Yes, then call the scheduler */
    196 
    197         cmpb      $0, SYM (_ISR_Signals_to_thread_executing)
    198                                             /* signals sent to Run_thread */
    199                                             /*   while in interrupt handler? */
    200         je        .exit                     /* No, exit */
    201 
    202 .bframe:
    203         movb      $0, SYM (_ISR_Signals_to_thread_executing)
    204         /*
    205          * This code is the less critical path. In order to have a single
    206          * Thread Context, we take the same frame than the one pushed on
    207          * exceptions. This makes sense because Signal is a software
    208          * exception.
    209          */
    210         call      _ThreadProcessSignalsFromIrq
    211 
    212         jmp       .exit
     216        jmp       .exit                     /* No, exit */
    213217
    214218.schedule:
     
    230234#endif
    231235
    232         /* restore ebp and original esp */
    233         addl      $EBP_OFF, esp
     236        /* restore ebx, ebp and original esp */
     237        addl      $EBX_OFF, esp
     238        popl      ebx
    234239        popl      ebp
    235240        popl      esp
     241
    236242        /*
    237243         * BEGINNING OF DE-ESTABLISH SEGMENTS
     
    278284DISTINCT_INTERRUPT_ENTRY(14)
    279285DISTINCT_INTERRUPT_ENTRY(15)
     286DISTINCT_INTERRUPT_ENTRY(16)
    280287
    281288        /*
Note: See TracChangeset for help on using the changeset viewer.