;*****************************************************************************\r
;*\r
-;* Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+;* Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
;* This program and the accompanying materials \r
;* are licensed and made available under the terms and conditions of the BSD License \r
;* which accompanies this distribution. The full text of the license may be found at \r
\r
.code\r
\r
+STACK_PARAM_SIZE EQU 16\r
+\r
IA32_REGS STRUC 4t\r
_EDI DD ?\r
_ESI DD ?\r
push sizeof (IA32_REGS) / 4\r
pop rcx\r
rep movsd\r
+\r
+ ; copy eflags to stack frame\r
+ mov rax, (IA32_REGS ptr [rsi - sizeof(IA32_REGS)])._RFLAGS\r
+ mov [rdi - sizeof(IA32_REGS) - STACK_PARAM_SIZE - 8], rax\r
+\r
pop rbx ; rbx <- 16-bit stack offset\r
lea eax, @F ; return offset\r
stosd\r
DB 7 ; pop es\r
pop fs\r
pop gs\r
+ sub esp, (sizeof(IA32_REGS) - 16) + STACK_PARAM_SIZE + 8\r
\r
- add esp, 8 ; skip RFLAGS\r
- DB 67h, 0f7h, 44h, 24h, 0eh, 1, 0 ; test [esp + 0eh], 1\r
+ DB 66h, 9Dh ; popfd\r
+ add esp, 4 ; skip high part of RFLAGS\r
+ DB 67h, 0f7h, 44h, 24h ; test (_STK16 ptr [esp + STACK_PARAM_SIZE + sizeof(IA32_REGS)]).ThunkFlags, 1\r
+ DB (STACK_PARAM_SIZE + sizeof(IA32_REGS) + 6)\r
+ DB 1, 0\r
jz @F\r
- pushfq ; pushf, actually\r
+ pushfq ; pushf, actually, when it's INT#\r
@@:\r
DB 0eh ; push cs\r
DB 68h ; push /iw\r
DW @FarCallRet - _Code16Addr\r
jz @F\r
DB 66h\r
- jmp fword ptr [esp + 6]\r
+ jmp fword ptr [esp + 6 + STACK_PARAM_SIZE + sizeof(IA32_REGS) - 8]\r
@@:\r
DB 66h\r
- jmp fword ptr [esp + 4]\r
+ jmp fword ptr [esp + 4 + STACK_PARAM_SIZE + sizeof(IA32_REGS) - 8]\r
@FarCallRet:\r
+ add esp, (sizeof(IA32_REGS) - 16) + STACK_PARAM_SIZE + 8\r
DB 66h\r
push 0 ; push a dword of zero\r
pushf ; pushfd, actually\r