Skip to content

Commit

Permalink
arch,entry: cleanup: rearrange code
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Aug 27, 2023
1 parent 4b2c6c3 commit d36454b
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions arch/x86/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ ENTRY(asm_interrupt_handler_\sym)
END_FUNC(asm_interrupt_handler_\sym)
.endm

ENTRY(handle_exception)
cld
SAVE_ALL_REGS

mov %_ASM_SP, %_ASM_DI
call do_exception

RESTORE_ALL_REGS

add $8, %_ASM_SP

enter_to_usermode
IRET
END_FUNC(handle_exception)

exception_handler DE X86_EX_DE 0
exception_handler DB X86_EX_DB 0
exception_handler NMI X86_EX_NMI 0
Expand All @@ -115,28 +130,33 @@ exception_handler XM X86_EX_XM 0
exception_handler VE X86_EX_VE 0
exception_handler SE X86_EX_SE 1

ENTRY(handle_exception)
cld
SAVE_ALL_REGS

mov %_ASM_SP, %_ASM_DI
call do_exception

RESTORE_ALL_REGS

add $8, %_ASM_SP

enter_to_usermode
IRET
END_FUNC(handle_exception)

interrupt_handler timer timer_interrupt_handler
interrupt_handler uart uart_interrupt_handler
interrupt_handler keyboard keyboard_interrupt_handler
#ifdef KTF_ACPICA
interrupt_handler acpi acpi_interrupt_handler
#endif

ENTRY(syscall_exit)
POPF

/* Save exit code to return value register (AX) */
mov %_ASM_SI, cpu_regs_ax(%_ASM_SP)
RESTORE_ALL_REGS

ret
END_FUNC(syscall_exit)

ENTRY(terminate_user_task)
SWITCH_STACK
POPF

movl $-EFAULT, cpu_regs_ax(%_ASM_SP)
RESTORE_ALL_REGS

ret
END_FUNC(terminate_user_task)

ENTRY(enter_usermode)
/* FIXME: Add 32-bit support */

Expand Down Expand Up @@ -164,26 +184,6 @@ ENTRY(enter_usermode)
IRET
END_FUNC(enter_usermode)

ENTRY(syscall_exit)
POPF

/* Save exit code to return value register (AX) */
mov %_ASM_SI, cpu_regs_ax(%_ASM_SP)
RESTORE_ALL_REGS

ret
END_FUNC(syscall_exit)

ENTRY(terminate_user_task)
SWITCH_STACK
POPF

movl $-EFAULT, cpu_regs_ax(%_ASM_SP)
RESTORE_ALL_REGS

ret
END_FUNC(terminate_user_task)

.align PAGE_SIZE
ENTRY(syscall_handler_entry)
SAVE_CALLEE_SAVED_REGS
Expand Down

0 comments on commit d36454b

Please sign in to comment.