diff options
Diffstat (limited to 'MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32')
| -rw-r--r-- | MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm | 124 | ||||
| -rw-r--r-- | MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c | 112 |
2 files changed, 118 insertions, 118 deletions
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm index e121cc937b..1f7c1f585b 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm @@ -1,62 +1,62 @@ -;; @file
-; This is the assembly code for transferring to control to OS S3 waking vector
-; for IA32 platform
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-;
-; SPDX-License-Identifier: BSD-2-Clause-Patent
-;
-;;
- SECTION .text
-
-global ASM_PFX(AsmFixAddress16)
-global ASM_PFX(AsmJmpAddr32)
-
-;-----------------------------------------
-;VOID
-;AsmTransferControl (
-; IN UINT32 S3WakingVector,
-; IN UINT32 AcpiLowMemoryBase
-; );
-;-----------------------------------------
-
-global ASM_PFX(AsmTransferControl)
-ASM_PFX(AsmTransferControl):
- ; S3WakingVector :DWORD
- ; AcpiLowMemoryBase :DWORD
- push ebp
- mov ebp, esp
- lea eax, [.0]
- push 0x28 ; CS
- push eax
- mov ecx, [ebp + 8]
- shrd ebx, ecx, 20
- and ecx, 0xf
- mov bx, cx
- mov [@jmp_addr + 1], ebx
- retf
-
-BITS 16
-.0:
- mov ax, 0x30
-o32 mov ds, eax
-o32 mov es, eax
-o32 mov fs, eax
-o32 mov gs, eax
-o32 mov ss, eax
- mov eax, cr0 ; Get control register 0
- and eax, 0x0fffffffe ; Clear PE bit (bit #0)
- mov cr0, eax ; Activate real mode
-@jmp_addr:
- jmp 0x0:0x0
-
-global ASM_PFX(AsmTransferControl32)
-ASM_PFX(AsmTransferControl32):
- jmp ASM_PFX(AsmTransferControl)
-
-; dummy
-global ASM_PFX(AsmTransferControl16)
-ASM_PFX(AsmTransferControl16):
-ASM_PFX(AsmFixAddress16): DD 0
-ASM_PFX(AsmJmpAddr32): DD 0
-
+;; @file +; This is the assembly code for transferring to control to OS S3 waking vector +; for IA32 platform +; +; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> +; +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;; + SECTION .text + +global ASM_PFX(AsmFixAddress16) +global ASM_PFX(AsmJmpAddr32) + +;----------------------------------------- +;VOID +;AsmTransferControl ( +; IN UINT32 S3WakingVector, +; IN UINT32 AcpiLowMemoryBase +; ); +;----------------------------------------- + +global ASM_PFX(AsmTransferControl) +ASM_PFX(AsmTransferControl): + ; S3WakingVector :DWORD + ; AcpiLowMemoryBase :DWORD + push ebp + mov ebp, esp + lea eax, [.0] + push 0x28 ; CS + push eax + mov ecx, [ebp + 8] + shrd ebx, ecx, 20 + and ecx, 0xf + mov bx, cx + mov [@jmp_addr + 1], ebx + retf + +BITS 16 +.0: + mov ax, 0x30 +o32 mov ds, eax +o32 mov es, eax +o32 mov fs, eax +o32 mov gs, eax +o32 mov ss, eax + mov eax, cr0 ; Get control register 0 + and eax, 0x0fffffffe ; Clear PE bit (bit #0) + mov cr0, eax ; Activate real mode +@jmp_addr: + jmp 0x0:0x0 + +global ASM_PFX(AsmTransferControl32) +ASM_PFX(AsmTransferControl32): + jmp ASM_PFX(AsmTransferControl) + +; dummy +global ASM_PFX(AsmTransferControl16) +ASM_PFX(AsmTransferControl16): +ASM_PFX(AsmFixAddress16): DD 0 +ASM_PFX(AsmJmpAddr32): DD 0 + diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c index 8f535af26a..7736ba9f45 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c @@ -1,56 +1,56 @@ -/** @file
- Set a IDT entry for debug purpose
-
- Set a IDT entry for interrupt vector 3 for debug purpose for IA32 platform
-
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-#include "ScriptExecute.h"
-
-/**
- Set a IDT entry for interrupt vector 3 for debug purpose.
-
- @param AcpiS3Context a pointer to a structure of ACPI_S3_CONTEXT
-
-**/
-VOID
-SetIdtEntry (
- IN ACPI_S3_CONTEXT *AcpiS3Context
- )
-{
- IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
- IA32_DESCRIPTOR *IdtDescriptor;
- UINTN S3DebugBuffer;
- EFI_STATUS Status;
-
- //
- // Restore IDT for debug
- //
- IdtDescriptor = (IA32_DESCRIPTOR *)(UINTN)(AcpiS3Context->IdtrProfile);
- AsmWriteIdtr (IdtDescriptor);
-
- //
- // Setup the default CPU exception handlers
- //
- Status = InitializeCpuExceptionHandlers (NULL);
- ASSERT_EFI_ERROR (Status);
-
- DEBUG_CODE_BEGIN ();
- //
- // Update IDT entry INT3 if the instruction is valid in it
- //
- S3DebugBuffer = (UINTN)(AcpiS3Context->S3DebugBufferAddress);
- if (*(UINTN *)S3DebugBuffer != (UINTN)-1) {
- IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
- IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
- IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
- IdtEntry->Bits.Reserved_0 = 0;
- IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
- IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
- }
-
- DEBUG_CODE_END ();
-}
+/** @file + Set a IDT entry for debug purpose + + Set a IDT entry for interrupt vector 3 for debug purpose for IA32 platform + +Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#include "ScriptExecute.h" + +/** + Set a IDT entry for interrupt vector 3 for debug purpose. + + @param AcpiS3Context a pointer to a structure of ACPI_S3_CONTEXT + +**/ +VOID +SetIdtEntry ( + IN ACPI_S3_CONTEXT *AcpiS3Context + ) +{ + IA32_IDT_GATE_DESCRIPTOR *IdtEntry; + IA32_DESCRIPTOR *IdtDescriptor; + UINTN S3DebugBuffer; + EFI_STATUS Status; + + // + // Restore IDT for debug + // + IdtDescriptor = (IA32_DESCRIPTOR *)(UINTN)(AcpiS3Context->IdtrProfile); + AsmWriteIdtr (IdtDescriptor); + + // + // Setup the default CPU exception handlers + // + Status = InitializeCpuExceptionHandlers (NULL); + ASSERT_EFI_ERROR (Status); + + DEBUG_CODE_BEGIN (); + // + // Update IDT entry INT3 if the instruction is valid in it + // + S3DebugBuffer = (UINTN)(AcpiS3Context->S3DebugBufferAddress); + if (*(UINTN *)S3DebugBuffer != (UINTN)-1) { + IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR))); + IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer; + IdtEntry->Bits.Selector = (UINT16)AsmReadCs (); + IdtEntry->Bits.Reserved_0 = 0; + IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32; + IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16); + } + + DEBUG_CODE_END (); +} |
