From c83d7bdcb60859f232e0fa6994ffba01509aba2e Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sat, 15 Jan 2022 16:11:30 -0600 Subject: arch: i386: simplify IDT setup Simplify the interrupt descriptor table setup and frame assembly. Signed-off-by: Danny Holman --- arch/i386/boot/isr.s | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'arch/i386/boot/isr.s') diff --git a/arch/i386/boot/isr.s b/arch/i386/boot/isr.s index b5f8be5..76afa9f 100644 --- a/arch/i386/boot/isr.s +++ b/arch/i386/boot/isr.s @@ -4,6 +4,7 @@ .global isr_stub_\num .type isr_stub_\num, @function isr_stub_\num: + cli pushl $\num jmp isr_frame_asm .endm @@ -11,18 +12,32 @@ isr_stub_\num: .global isr_stub_\num .type isr_stub_\num, @function isr_stub_\num: + cli pushl $0 pushl $\num jmp isr_frame_asm .endm +.macro irq_stub num +.global irq_stub_\num +.type irq_stub_\num, @function +irq_stub_\num: + cli + pushl $0 + pushl $\num + jmp isr_frame_asm +.endm + +.global syscall_stub +syscall_stub: + pushl $0 + pushl $0x80 + jmp isr_frame_asm + isr_frame_asm: - pushl %ebp - movl %esp, %ebp pushl %eax pushl %ebx pushl %ecx - pushl %ecx pushl %edx pushl %esi pushl %edi @@ -36,22 +51,9 @@ isr_frame_asm: movl %cr4, %eax pushl %eax - movw %ds, %ax - pushl %eax - pushl $0 - movw $0x10, %ax - movw %ax, %ds - movw %ax, %es - movw %ax, %ss - - lea 0xC(%esp), %edi + lea -8(%esp), %edi pushl %edi - call exception_handler - - popl %eax - popl %eax - movw %ax, %ds - movw %ax, %es + call interrupt_handler popl %eax movl %eax, %cr4 @@ -69,8 +71,7 @@ isr_frame_asm: popl %ebx popl %eax - popl %ebp - add $0x10, %esp + addl $4, %esp iret isr_no_err_stub 0 @@ -94,7 +95,7 @@ isr_err_stub 17 isr_no_err_stub 18 isr_no_err_stub 19 isr_no_err_stub 20 -isr_no_err_stub 21 +isr_err_stub 21 isr_no_err_stub 22 isr_no_err_stub 23 isr_no_err_stub 24 @@ -102,6 +103,6 @@ isr_no_err_stub 25 isr_no_err_stub 26 isr_no_err_stub 27 isr_no_err_stub 28 -isr_no_err_stub 29 +isr_err_stub 29 isr_err_stub 30 isr_no_err_stub 31 -- cgit v1.2.3