Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / arch / i386-pc / exec / traps.h
blob23d22e3b4417cb53c4878bda08ef80cddf686c8b
1 #ifndef _TRAPS_H
2 #define _TRAPS_H
4 #include <asm/irq.h>
5 #include <asm/linkage.h>
7 /* Here are some macros used to build trap table in core file. */
9 #define TRAP_NAME2(nr) nr##_trap(void)
10 #define TRAP_NAME(nr) TRAP_NAME2(TRAP##nr)
12 # define _stringify(x) #x
13 # define stringify(x) _stringify(x)
15 #define BUILD_COMMON_TRAP() \
16 __asm__( \
17 "\n"__ALIGN_STR"\n" \
18 "common_trap:\n\t" \
19 SAVE_REGS \
20 "call "SYMBOL_NAME_STR(printException)"\n\t" \
21 RESTORE_REGS \
22 "popl %eax\n\t" \
23 "movl 12(%esp),%esp\n\t" /* Get and use user stack */ \
24 "pushl %eax\n\t" /* Exception number */ \
25 "pushl $0\n\t" /* "Return address" */ \
26 "movl %esp,%ebx\n\t" /* Hold the esp value before pushing! */ \
27 "pushl $" stringify(USER_DS) "\n\t" /* User SS */ \
28 "pushl %ebx\n\t" /* Stack frame */ \
29 "pushl $0x3002\n\t" /* IOPL:3 */ \
30 "pushl $" stringify(USER_CS) "\n\t" \
31 "pushl $" SYMBOL_NAME_STR(handleException) "\n\t" \
32 "iret\n");
34 #define BUILD_TRAP(nr) \
35 asmlinkage void TRAP_NAME(nr); \
36 __asm__( \
37 "\n"__ALIGN_STR"\n" \
38 SYMBOL_NAME_STR(TRAP) #nr "_trap:\n\t" \
39 "pushl $"#nr"\n\t" \
40 "jmp common_trap");
42 void set_intr_gate(unsigned int n, void *addr);
43 void set_system_gate(unsigned int n, void *addr);
45 void Init_Traps(void);
47 #endif /* _TRAPS_H */