1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
4 ; This program and the accompanying materials
5 ; are licensed and made available under the terms and conditions of the BSD License
6 ; which accompanies this distribution. The full text of the license may be found at
7 ; http://opensource.org/licenses/bsd-license.php.
9 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 ; Implementation of _LongJump() on IA-32.
20 ;------------------------------------------------------------------------------
26 extern ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask))
28 ;------------------------------------------------------------------------------
32 ; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
35 ;------------------------------------------------------------------------------
36 global ASM_PFX(InternalLongJump)
37 ASM_PFX(InternalLongJump):
39 mov eax, [ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask))]
43 bt eax, 23 ; check if CET is enabled
46 mov edx, [esp + 4] ; edx = JumpBuffer
47 mov edx, [edx + 24] ; edx = target SSP
49 sub edx, eax ; edx = delta
50 mov eax, edx ; eax = delta
52 shr eax, 2 ; eax = delta/sizeof(UINT32)
57 pop eax ; skip return address
58 pop edx ; edx <- JumpBuffer
59 pop eax ; eax <- Value
65 jmp dword [edx + 20] ; restore "eip"