popl %eax
.endm
+ // As above, but get calling function from stack.
+ .macro ENTRY_ST
+ cli
+ cld
+ pushl %ecx
+ pushl %edx
+ pushw %es
+ pushw %ds
+ movw %ss, %cx // Move %ss to %ds
+ movw %cx, %ds
+ pushl %esp // Backup %esp, then clear high bits
+ movzwl %sp, %esp
+ movl 16(%esp), %ecx // Get calling function
+ movl %eax, 16(%esp) // Save %eax
+ calll *%ecx
+ popl %esp // Restore %esp (including high bits)
+ popw %ds // Restore registers saved above
+ popw %es
+ popl %edx
+ popl %ecx
+ popl %eax
+ .endm
+
// Call a C function with current register list as an
// argument. This backs up the registers and sets %eax
// to point to the backup. On return, the registers are
popl %eax
.endm
- // As above, but don't mangle %esp
+ // As above, but get calling function from stack.
+ .macro ENTRY_ARG_ST
+ cli
+ cld
+ pushl %ecx
+ pushl %edx
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ pushw %es
+ pushw %ds
+ movw %ss, %cx // Move %ss to %ds
+ movw %cx, %ds
+ movl %esp, %ebx // Backup %esp, then zero high bits
+ movzwl %sp, %esp
+ movl 24(%esp), %ecx // Get calling function
+ movl %eax, 24(%esp) // Save %eax
+ movl %esp, %eax // First arg is pointer to struct bregs
+ calll *%ecx
+ movl %ebx, %esp // Restore %esp (including high bits)
+ popw %ds // Restore registers (from struct bregs)
+ popw %es
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %edx
+ popl %ecx
+ popl %eax
+ .endm
+
+ // Same as ENTRY_ARG, but don't mangle %esp
.macro ENTRY_ARG_ESP cfunc
cli
cld
.section .text.asm.\func
.global \func
.endm
-
- // Define an entry point for an interrupt (no args passed).
- .macro IRQ_ENTRY num
- .global entry_\num
- entry_\num :
- ENTRY handle_\num
- iretw
- .endm
-
- // Define an entry point for an interrupt (can read/modify args).
- .macro IRQ_ENTRY_ARG num
- .global entry_\num
- entry_\num :
- ENTRY_ARG handle_\num
- iretw
- .endm
-
- // Macros that put each handler into its own section
- .macro DECL_IRQ_ENTRY num
- .section .text.asm.entry_\num
- IRQ_ENTRY \num
- .endm
- .macro DECL_IRQ_ENTRY_ARG num
- .section .text.asm.entry_\num
- IRQ_ENTRY_ARG \num
- .endm
// Initialize software handlers.
set_irq(0x02, entry_02);
set_irq(0x10, entry_10);
- set_irq(0x11, entry_11_official);
- set_irq(0x12, entry_12_official);
+ set_irq(0x11, entry_11);
+ set_irq(0x12, entry_12);
set_irq(0x13, entry_13_official);
set_irq(0x14, entry_14);
set_irq(0x15, entry_15);
* Interrupt entry points
****************************************************************/
+ // Define an entry point for an interrupt (no args passed).
+ .macro IRQ_ENTRY num
+ .global entry_\num
+ entry_\num :
+ pushl $ handle_\num
+ jmp irqentry
+ .endm
+
+ // Define an entry point for an interrupt (can read/modify args).
+ .macro IRQ_ENTRY_ARG num
+ .global entry_\num
+ entry_\num :
+ pushl $ handle_\num
+ jmp irqentryarg
+ .endm
+
+ // Macros that put each handler into its own section
+ .macro DECL_IRQ_ENTRY num
+ DECLFUNC entry_\num
+ IRQ_ENTRY \num
+ .endm
+ .macro DECL_IRQ_ENTRY_ARG num
+ DECLFUNC entry_\num
+ IRQ_ENTRY_ARG \num
+ .endm
+
+ // Main entry point for interrupts without args
+ DECLFUNC irqentry
+irqentry:
+ ENTRY_ST
+ iretw
+
+ // Main entry point for interrupts with args
+ DECLFUNC irqentry
+irqentryarg:
+ ENTRY_ARG_ST
+ iretw
+
DECL_IRQ_ENTRY_ARG 13
- DECL_IRQ_ENTRY_ARG 12
- DECL_IRQ_ENTRY_ARG 11
DECL_IRQ_ENTRY 76
DECL_IRQ_ENTRY 70
DECL_IRQ_ENTRY 74
// 0xf0a4 - VideoParams in misc.c
ORG 0xf841
- .global entry_12_official
-entry_12_official:
- jmp entry_12
+ IRQ_ENTRY_ARG 12
ORG 0xf84d
- .global entry_11_official
-entry_11_official:
- jmp entry_11
+ IRQ_ENTRY_ARG 11
ORG 0xf859
IRQ_ENTRY_ARG 15