]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm
UefiCpuPkg/CpuMpPei: Load GDT table on BSP
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / X64 / MpFuncs.nasm
1 ;------------------------------------------------------------------------------ ;
2 ; Copyright (c) 2015, 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.
7 ;
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.
10 ;
11 ; Module Name:
12 ;
13 ; MpFuncs.nasm
14 ;
15 ; Abstract:
16 ;
17 ; This is the assembly code for MP support
18 ;
19 ;-------------------------------------------------------------------------------
20
21 %include "MpEqu.inc"
22 DEFAULT REL
23 SECTION .text
24
25 global ASM_PFX(AsmInitializeGdt)
26 ASM_PFX(AsmInitializeGdt):
27 push rbp
28 mov rbp, rsp
29
30 lgdt [rcx] ; update the GDTR
31
32 sub rsp, 0x10
33 mov rax, ASM_PFX(SetCodeSelectorFarJump)
34 mov [rsp], rax
35 mov rdx, LONG_MODE_CS
36 mov [rsp + 4], dx ; get new CS
37 jmp far dword [rsp] ; far jump with new CS
38 ASM_PFX(SetCodeSelectorFarJump):
39 add rsp, 0x10
40
41 mov rax, LONG_MODE_DS ; get new DS
42 mov ds, ax
43 mov es, ax
44 mov fs, ax
45 mov gs, ax
46 mov ss, ax
47
48 pop rbp
49
50 ret