Skip to content

Commit

Permalink
arch,entry: fix error_code and vector storing for 32bit mode
Browse files Browse the repository at this point in the history
In 64bit mode push 64bit 0 value on the stack as the aligning error
code and overwrite upper 32 bits of it with vector value.

In 32bit mode push 32bit 0 value on the stack as the aligning error
code and push vector value additionally.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Aug 27, 2023
1 parent e8aed89 commit 2d10a23
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions arch/x86/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ ENTRY(entry_\sym)
push $0
.endif

#if defined(__x86_64__)
movl $\vec, cpu_exc_vector(%_ASM_SP)
#else
push $\vec
#endif

jmp handle_exception
END_FUNC(entry_\sym)
.endm
Expand Down Expand Up @@ -119,11 +124,7 @@ ENTRY(handle_exception)

RESTORE_ALL_REGS

#if defined(__x86_64__)
add $8, %_ASM_SP
#else
add $4, %_ASM_SP
#endif

enter_to_usermode
IRET
Expand Down

0 comments on commit 2d10a23

Please sign in to comment.