hw_x86_64: Prepare interrupt stack frame in mode transition buffer

Setup an IA-32e interrupt stack frame in the mode transition buffer region.
It will be used to perform the mode switch to userspace using the iret
instruction.

For detailed information about the IA-32e interrupt stack frame refer to
Intel SDM Vol. 3A, figure 6-8.
This commit is contained in:
Adrian-Ken Rueegsegger 2015-02-18 00:26:33 +01:00 committed by Christian Helmuth
parent 4b7a5ced3b
commit 40862a81eb
1 changed files with 10 additions and 0 deletions

View File

@ -75,6 +75,16 @@
.global _mt_user_entry_pic
_mt_user_entry_pic:
/* Prepare stack frame in mt buffer (Intel SDM Vol. 3A, figure 6-8) */
mov _mt_client_context_ptr, %rax
mov $_mt_buffer+BUFFER_SIZE, %rsp
pushq $0x23
pushq SP_OFFSET(%rax)
pushq $0x3000 /* XXX: Set Interrupt Enable flag */
pushq $0x1b
pushq (%rax)
1: jmp 1b
/* end of the mode transition code */