Changeset 67a2288 in rtems for c/src/exec/score/cpu/i386/cpu.c


Ignore:
Timestamp:
07/23/98 22:02:34 (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
dbaf51a
Parents:
73452854
Message:

Patch from Eric VALETTE <valette@…>:

Here is a enhanced version of my previous patch. This patch enables
to potentially share the new interrupt management code for all Intel targets
(pc386, go32 and force386) bsp.

Note : this patch is complete only for pc386. It still needs to

be completed for go32 and force386. I carrefully checked
that anything needed is in for force386 (only some function
name changes for IDT manipulation and GDT segment
manipulation). But anyway I will not be able to test any
of theses targets...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/cpu/i386/cpu.c

    r73452854 r67a2288  
    7777}
    7878 
    79 /*PAGE
    80  *
    81  *  _CPU_ISR_install_raw_handler
    82  */
    83  
    84 #if __GO32__
    85 #include <go32.h>
    86 #include <dpmi.h>
    87 #endif /* __GO32__ */
    88 
    89 void _CPU_ISR_install_raw_handler(
    90   unsigned32  vector,
    91   proc_ptr    new_handler,
    92   proc_ptr   *old_handler
    93 )
    94 {
    95 #if __GO32__
    96     _go32_dpmi_seginfo handler_info;
    97  
    98     /* get the address of the old handler */
    99     _go32_dpmi_get_protected_mode_interrupt_vector( vector, &handler_info);
    100  
    101     /* Notice how we're failing to save the pm_segment portion of the */
    102     /* structure here?  That means we might crash the system if we  */
    103     /* try to restore the ISR.  Can't fix this until i386_isr is  */
    104     /* redefined.  XXX [BHC].           */
    105     *old_handler = (proc_ptr *) handler_info.pm_offset;
    106 
    107     handler_info.pm_offset = (u_long) new_handler;
    108     handler_info.pm_selector = _go32_my_cs();
    109 
    110     /* install the IDT entry */
    111     _go32_dpmi_set_protected_mode_interrupt_vector( vector, &handler_info );
    112 #else
    113   i386_IDT_slot idt;
    114   unsigned32    handler;
    115 
    116   *old_handler =  0;    /* XXX not supported */
    117 
    118   handler = (unsigned32) new_handler;
    119 
    120   /* build the IDT entry */
    121   idt.offset_0_15      = handler & 0xffff;
    122   idt.segment_selector = i386_get_cs();
    123   idt.reserved         = 0x00;
    124   idt.p_dpl            = 0x8e;         /* present, ISR */
    125   idt.offset_16_31     = handler >> 16;
    126 
    127   /* install the IDT entry */
    128   i386_Install_idt(
    129     (unsigned32) &idt,
    130     _CPU_Table.interrupt_table_segment,
    131     (unsigned32) _CPU_Table.interrupt_table_offset + (8 * vector)
    132   );
    133 #endif
    134 }
    135 
    136 /*PAGE
    137  *
    138  *  _CPU_ISR_install_vector
    139  *
    140  *  This kernel routine installs the RTEMS handler for the
    141  *  specified vector.
    142  *
    143  *  Input parameters:
    144  *    vector      - interrupt vector number
    145  *    old_handler - former ISR for this vector number
    146  *    new_handler - replacement ISR for this vector number
    147  *
    148  *  Output parameters:  NONE
    149  *
    150  */
    151 
    152 void _ISR_Handler_0(), _ISR_Handler_1();
    153 
    154 #define PER_ISR_ENTRY \
    155     (((unsigned32) _ISR_Handler_1 - (unsigned32) _ISR_Handler_0))
    156 
    157 #define _Interrupt_Handler_entry( _vector ) \
    158    (((unsigned32)_ISR_Handler_0) + ((_vector) * PER_ISR_ENTRY))
    159 
    160 void _CPU_ISR_install_vector(
    161   unsigned32  vector,
    162   proc_ptr    new_handler,
    163   proc_ptr   *old_handler
    164 )
    165 {
    166   proc_ptr      ignored;
    167   unsigned32    unique_handler;
    168 
    169   *old_handler = _ISR_Vector_table[ vector ];
    170 
    171   /* calculate the unique entry point for this vector */
    172   unique_handler = _Interrupt_Handler_entry( vector );
    173 
    174   _CPU_ISR_install_raw_handler( vector, (void *)unique_handler, &ignored );
    175 
    176   _ISR_Vector_table[ vector ] = new_handler;
    177 }
Note: See TracChangeset for help on using the changeset viewer.