2 * from: vector.s, 386BSD 0.1 unknown origin
7 * modified for PC98 by Kakefuda
10 #include "opt_auto_eoi.h"
12 #include <i386/isa/icu.h>
14 #include <pc98/pc98/pc98.h>
16 #include <i386/isa/isa.h>
19 #include <machine/intrcnt.h>
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
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.
33 #define ACTUALLY_PUSHED 0
34 #define MAYBE_MOVW_AX_ES
36 #define MAYBE_PUSHL_ES
43 * Interrupt counters and names for export to vmstat(8) and friends.
45 * XXX this doesn't really belong here; everything except the labels
46 * for the endpointers is almost machine-independent.
49 .globl intrcnt, eintrcnt
51 .space INTRCNT_COUNT * 4
54 .globl intrnames, eintrnames
56 .space INTRCNT_COUNT * 16
61 * Macros for interrupt interrupt entry, call to handler, and exit.
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
78 * XXX - should we do a cld on every system entry to avoid the requirement
79 * for scattered cld's?
81 * Coding notes for *.s:
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.,
88 * Use movl to seg regs instead of the equivalent but more descriptive
89 * movw - gas generates an irelevant (slower) operand size override.
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.
96 * If possible, use byte-sized operations. They are smaller and no slower.
98 * Use (%reg) instead of 0(%reg) - gas generates larger code for the latter.
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
106 #include "i386/isa/apic_vector.s"
108 #include "i386/isa/icu_vector.s"