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