]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/i386/isa/vector.s
This commit was generated by cvs2svn to compensate for changes in r75584,
[FreeBSD/FreeBSD.git] / sys / i386 / isa / vector.s
1 /*
2  *      from: vector.s, 386BSD 0.1 unknown origin
3  * $FreeBSD$
4  */
5
6 /*
7  * modified for PC98 by Kakefuda
8  */
9
10 #include "opt_auto_eoi.h"
11
12 #include <i386/isa/icu.h>
13 #ifdef PC98
14 #include <pc98/pc98/pc98.h>
15 #else
16 #include <i386/isa/isa.h>
17 #endif
18
19 #include <machine/intrcnt.h>
20                         
21 #define FAST_INTR_HANDLER_USES_ES 1
22 #ifdef FAST_INTR_HANDLER_USES_ES
23 #define ACTUALLY_PUSHED         1
24 #define MAYBE_MOVW_AX_ES        movw    %ax,%es
25 #define MAYBE_POPL_ES           popl    %es
26 #define MAYBE_PUSHL_ES          pushl   %es
27 #else
28 /*
29  * We can usually skip loading %es for fastintr handlers.  %es should
30  * only be used for string instructions, and fastintr handlers shouldn't
31  * do anything slow enough to justify using a string instruction.
32  */
33 #define ACTUALLY_PUSHED         0
34 #define MAYBE_MOVW_AX_ES
35 #define MAYBE_POPL_ES
36 #define MAYBE_PUSHL_ES
37 #endif
38
39         .data
40         ALIGN_DATA
41
42 /*
43  * Interrupt counters and names for export to vmstat(8) and friends.
44  *
45  * XXX this doesn't really belong here; everything except the labels
46  * for the endpointers is almost machine-independent.
47  */
48
49         .globl  intrcnt, eintrcnt
50 intrcnt:
51         .space  INTRCNT_COUNT * 4
52 eintrcnt:
53
54         .globl  intrnames, eintrnames
55 intrnames:
56         .space  INTRCNT_COUNT * 16
57 eintrnames:
58         .text
59
60 /*
61  * Macros for interrupt interrupt entry, call to handler, and exit.
62  *
63  * XXX - the interrupt frame is set up to look like a trap frame.  This is
64  * usually a waste of time.  The only interrupt handlers that want a frame
65  * are the clock handler (it wants a clock frame), the npx handler (it's
66  * easier to do right all in assembler).  The interrupt return routine
67  * needs a trap frame for rare AST's (it could easily convert the frame).
68  * The direct costs of setting up a trap frame are two pushl's (error
69  * code and trap number), an addl to get rid of these, and pushing and
70  * popping the call-saved regs %esi, %edi and %ebp twice,  The indirect
71  * costs are making the driver interface nonuniform so unpending of
72  * interrupts is more complicated and slower (call_driver(unit) would
73  * be easier than ensuring an interrupt frame for all handlers.  Finally,
74  * there are some struct copies in the npx handler and maybe in the clock
75  * handler that could be avoided by working more with pointers to frames
76  * instead of frames.
77  *
78  * XXX - should we do a cld on every system entry to avoid the requirement
79  * for scattered cld's?
80  *
81  * Coding notes for *.s:
82  *
83  * If possible, avoid operations that involve an operand size override.
84  * Word-sized operations might be smaller, but the operand size override
85  * makes them slower on on 486's and no faster on 386's unless perhaps
86  * the instruction pipeline is depleted.  E.g.,
87  *
88  *      Use movl to seg regs instead of the equivalent but more descriptive
89  *      movw - gas generates an irelevant (slower) operand size override.
90  *
91  *      Use movl to ordinary regs in preference to movw and especially
92  *      in preference to movz[bw]l.  Use unsigned (long) variables with the
93  *      top bits clear instead of unsigned short variables to provide more
94  *      opportunities for movl.
95  *
96  * If possible, use byte-sized operations.  They are smaller and no slower.
97  *
98  * Use (%reg) instead of 0(%reg) - gas generates larger code for the latter.
99  *
100  * If the interrupt frame is made more flexible,  INTR can push %eax first
101  * and decide the ipending case with less overhead, e.g., by avoiding
102  * loading segregs.
103  */
104
105 #ifdef APIC_IO
106 #include "i386/isa/apic_vector.s"
107 #else
108 #include "i386/isa/icu_vector.s"
109 #endif  /* APIC_IO */