Ia32/WriteCr0.c | MSFT\r
Ia32/WriteMsr64.c | MSFT\r
Ia32/SwapBytes64.c | MSFT\r
- Ia32/SetJump.c | MSFT\r
Ia32/RRotU64.c | MSFT\r
Ia32/RShiftU64.c | MSFT\r
Ia32/ReadPmc.c | MSFT\r
Ia32/MultU64x32.c | MSFT\r
Ia32/LShiftU64.c | MSFT\r
Ia32/LRotU64.c | MSFT\r
- Ia32/LongJump.c | MSFT\r
Ia32/Invd.c | MSFT\r
Ia32/FxRestore.c | MSFT\r
Ia32/FxSave.c | MSFT\r
Ia32/WriteCr0.nasm| INTEL\r
Ia32/WriteMsr64.nasm| INTEL\r
Ia32/SwapBytes64.nasm| INTEL\r
- Ia32/SetJump.nasm| INTEL\r
Ia32/RRotU64.nasm| INTEL\r
Ia32/RShiftU64.nasm| INTEL\r
Ia32/ReadPmc.nasm| INTEL\r
Ia32/MultU64x32.nasm| INTEL\r
Ia32/LShiftU64.nasm| INTEL\r
Ia32/LRotU64.nasm| INTEL\r
- Ia32/LongJump.nasm| INTEL\r
Ia32/Invd.nasm| INTEL\r
Ia32/FxRestore.nasm| INTEL\r
Ia32/FxSave.nasm| INTEL\r
Ia32/Monitor.nasm| GCC\r
Ia32/CpuIdEx.nasm| GCC\r
Ia32/CpuId.nasm| GCC\r
- Ia32/LongJump.nasm| GCC\r
- Ia32/SetJump.nasm| GCC\r
+ Ia32/LongJump.nasm\r
+ Ia32/SetJump.nasm\r
Ia32/SwapBytes64.nasm| GCC\r
Ia32/DivU64x64Remainder.nasm| GCC\r
Ia32/DivU64x32Remainder.nasm| GCC\r
+++ /dev/null
-/** @file\r
- Implementation of _LongJump() on IA-32.\r
-\r
- Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-\r
-#include "BaseLibInternals.h"\r
-\r
-\r
-/**\r
- Restores the CPU context that was saved with SetJump().\r
-\r
- Restores the CPU context from the buffer specified by JumpBuffer.\r
- This function never returns to the caller.\r
- Instead is resumes execution based on the state of JumpBuffer.\r
-\r
- @param JumpBuffer A pointer to CPU context buffer.\r
- @param Value The value to return when the SetJump() context is restored.\r
-\r
-**/\r
-__declspec (naked)\r
-VOID\r
-EFIAPI\r
-InternalLongJump (\r
- IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r
- IN UINTN Value\r
- )\r
-{\r
- _asm {\r
- mov eax, [PcdGet32 (PcdControlFlowEnforcementPropertyMask)]\r
- test eax, eax\r
- jz CetDone\r
- _emit 0x0F\r
- _emit 0x20\r
- _emit 0xE0 ; mov eax, cr4\r
- bt eax, 23 ; check if CET is enabled\r
- jnc CetDone\r
-\r
- mov edx, [esp + 4] ; edx = JumpBuffer\r
- mov edx, [edx + 24] ; edx = target SSP\r
- _emit 0xF3\r
- _emit 0x0F\r
- _emit 0x1E\r
- _emit 0xC8 ; READSSP EAX\r
- sub edx, eax ; edx = delta\r
- mov eax, edx ; eax = delta\r
-\r
- shr eax, 2 ; eax = delta/sizeof(UINT32)\r
- _emit 0xF3\r
- _emit 0x0F\r
- _emit 0xAE\r
- _emit 0xE8 ; INCSSP EAX\r
-\r
-CetDone:\r
-\r
- pop eax ; skip return address\r
- pop edx ; edx <- JumpBuffer\r
- pop eax ; eax <- Value\r
- mov ebx, [edx]\r
- mov esi, [edx + 4]\r
- mov edi, [edx + 8]\r
- mov ebp, [edx + 12]\r
- mov esp, [edx + 16]\r
- jmp dword ptr [edx + 20]\r
- }\r
-}\r
-\r
+++ /dev/null
-/** @file\r
- Implementation of SetJump() on IA-32.\r
-\r
- Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-\r
-#include "BaseLibInternals.h"\r
-\r
-/**\r
- Worker function that checks ASSERT condition for JumpBuffer\r
-\r
- Checks ASSERT condition for JumpBuffer.\r
-\r
- If JumpBuffer is NULL, then ASSERT().\r
- For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r
-\r
- @param JumpBuffer A pointer to CPU context buffer.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-InternalAssertJumpBuffer (\r
- IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r
- );\r
-\r
-/**\r
- Saves the current CPU context that can be restored with a call to LongJump()\r
- and returns 0.\r
-\r
- Saves the current CPU context in the buffer specified by JumpBuffer and\r
- returns 0. The initial call to SetJump() must always return 0. Subsequent\r
- calls to LongJump() cause a non-zero value to be returned by SetJump().\r
-\r
- If JumpBuffer is NULL, then ASSERT().\r
- For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r
-\r
- @param JumpBuffer A pointer to CPU context buffer.\r
-\r
- @retval 0 Indicates a return from SetJump().\r
-\r
-**/\r
-_declspec (naked)\r
-RETURNS_TWICE\r
-UINTN\r
-EFIAPI\r
-SetJump (\r
- OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r
- )\r
-{\r
- _asm {\r
- push [esp + 4]\r
- call InternalAssertJumpBuffer\r
- pop ecx\r
- pop ecx\r
- mov edx, [esp]\r
-\r
- xor eax, eax\r
- mov [edx + 24], eax ; save 0 to SSP\r
-\r
- mov eax, [PcdGet32 (PcdControlFlowEnforcementPropertyMask)]\r
- test eax, eax\r
- jz CetDone\r
- _emit 0x0F\r
- _emit 0x20\r
- _emit 0xE0 ; mov eax, cr4\r
- bt eax, 23 ; check if CET is enabled\r
- jnc CetDone\r
-\r
- mov eax, 1\r
- _emit 0xF3\r
- _emit 0x0F\r
- _emit 0xAE\r
- _emit 0xE8 ; INCSSP EAX to read original SSP\r
- _emit 0xF3\r
- _emit 0x0F\r
- _emit 0x1E\r
- _emit 0xC8 ; READSSP EAX\r
- mov [edx + 0x24], eax ; save SSP\r
-\r
-CetDone:\r
-\r
- mov [edx], ebx\r
- mov [edx + 4], esi\r
- mov [edx + 8], edi\r
- mov [edx + 12], ebp\r
- mov [edx + 16], esp\r
- mov [edx + 20], ecx\r
- xor eax, eax\r
- jmp ecx\r
- }\r
-}\r
-\r