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