1 ;------------------------------------------------------------------------------ ;
2 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
3 ; This program and the accompanying materials
4 ; are licensed and made available under the terms and conditions of the BSD License
5 ; which accompanies this distribution. The full text of the license may be found at
6 ; http://opensource.org/licenses/bsd-license.php.
8 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 ; Functions for relocating SMBASE's for all processors
19 ;-------------------------------------------------------------------------------
21 extern ASM_PFX(SmmInitHandler)
22 extern ASM_PFX(mRebasedFlag)
23 extern ASM_PFX(mSmmRelocationOriginalAddress)
25 global ASM_PFX(gSmmCr3)
26 global ASM_PFX(gSmmCr4)
27 global ASM_PFX(gSmmCr0)
28 global ASM_PFX(gSmmJmpAddr)
29 global ASM_PFX(gSmmInitStack)
30 global ASM_PFX(gcSmiInitGdtr)
31 global ASM_PFX(gcSmmInitSize)
32 global ASM_PFX(gcSmmInitTemplate)
34 %define PROTECT_MODE_CS 0x8
35 %define PROTECT_MODE_DS 0x20
39 ASM_PFX(gcSmiInitGdtr):
43 global ASM_PFX(SmmStartup)
46 ASM_PFX(gSmmCr3): DD 0
49 lgdt [cs:ebp + (ASM_PFX(gcSmiInitGdtr) - ASM_PFX(SmmStartup))]
51 ASM_PFX(gSmmCr4): DD 0
54 ASM_PFX(gSmmCr0): DD 0
55 DB 0xbf, PROTECT_MODE_DS, 0 ; mov di, PROTECT_MODE_DS
57 DB 0x66, 0xea ; jmp far [ptr48]
67 DB 0xbc ; mov esp, imm32
68 ASM_PFX(gSmmInitStack): DD 0
69 call ASM_PFX(SmmInitHandler)
73 ASM_PFX(gcSmmInitTemplate):
74 mov ebp, ASM_PFX(SmmStartup)
78 ASM_PFX(gcSmmInitSize): DW $ - ASM_PFX(gcSmmInitTemplate)
81 global ASM_PFX(SmmRelocationSemaphoreComplete)
82 ASM_PFX(SmmRelocationSemaphoreComplete):
84 mov eax, [ASM_PFX(mRebasedFlag)]
87 jmp [ASM_PFX(mSmmRelocationOriginalAddress)]