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