source: rtems/c/src/lib/libbsp/i386/go32/startup/setvec.c @ 4ca27cf

4.104.114.84.95
Last change on this file since 4ca27cf was 4ca27cf, checked in by Joel Sherrill <joel.sherrill@…>, on 07/18/95 at 21:19:53

committing for rtems-3.2.01 snapshot

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*  set_vector
2 *
3 *  This routine installs an interrupt vector under go32.
4 *
5 *  INPUT:
6 *    handler - interrupt handler entry point
7 *    vector  - vector number
8 *    type    - 0 indicates raw hardware connect
9 *              1 indicates RTEMS interrupt connect
10 *
11 *  RETURNS:
12 *    address of previous interrupt handler
13 *
14 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
15 *  On-Line Applications Research Corporation (OAR).
16 *  All rights assigned to U.S. Government, 1994.
17 *
18 *  This material may be reproduced by or for the U.S. Government pursuant
19 *  to the copyright license under the clause at DFARS 252.227-7013.  This
20 *  notice must appear in all copies of this file and its derivatives.
21 *
22 *  $Id$
23 */
24
25#include <rtems.h>
26#include <bsp.h>
27
28#include <dpmi.h>
29#include <go32.h>
30
31i386_isr_entry set_vector(                      /* returns old vector */
32  rtems_isr_entry     handler,                  /* isr routine        */
33  rtems_vector_number vector,                   /* vector number      */
34  int                 type                      /* RTEMS or RAW intr  */
35)
36{
37  i386_isr_entry   previous_isr;
38
39  if ( type )  {
40      rtems_interrupt_catch( handler, vector,
41                             (rtems_isr_entry *) &previous_isr );
42  } else {
43      /* Interrupt goes straight to the supplied ISR.  This code is     */
44      /* slightly different than that in _CPU_ISR_install_vector        */
45      /* (which is eventually called by the above) in that this code    */
46      /* returns the raw entry point as the old handler, while the      */
47      /* other version returns the old entry point pointed at by the    */
48      /* rtems ISR table.                                               */
49      _go32_dpmi_seginfo        handler_info;
50
51      /* get the address of the old handler */
52      _go32_dpmi_get_protected_mode_interrupt_vector( vector, &handler_info);
53
54      /* Notice how we're failing to save the pm_segment portion of the */
55      /* structure here?  That means we might crash the system if we    */
56      /* try to restore the ISR.  Can't fix this until i386_isr is      */
57      /* redefined.  XXX [BHC].                                         */
58      previous_isr = (i386_isr_entry) handler_info.pm_offset;
59     
60      /* install the IDT entry */
61      handler_info.pm_offset   = (u_long)handler;
62      handler_info.pm_selector = _go32_my_cs();
63      _go32_dpmi_set_protected_mode_interrupt_vector( vector, &handler_info);
64  }
65  return previous_isr;
66}
67
Note: See TracBrowser for help on using the repository browser.