]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm
UefiCpuPkg/CpuMpPei: Load GDT table on BSP
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / X64 / MpFuncs.asm
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 ; MpFuncs32.asm
14 ;
15 ; Abstract:
16 ;
17 ; This is the assembly code for MP support
18 ;
19 ;-------------------------------------------------------------------------------
20
21 include MpEqu.inc
22 .code
23
24
25 AsmInitializeGdt PROC
26 push rbp
27 mov rbp, rsp
28
29 lgdt fword PTR [rcx] ; update the GDTR
30
31 sub rsp, 0x10
32 lea rax, SetCodeSelectorFarJump
33 mov [rsp], rax
34 mov rdx, LONG_MODE_CS
35 mov [rsp + 4], dx ; get new CS
36 jmp fword ptr [rsp]
37 SetCodeSelectorFarJump:
38 add rsp, 0x10
39
40 mov rax, LONG_MODE_DS ; get new DS
41 mov ds, ax
42 mov es, ax
43 mov fs, ax
44 mov gs, ax
45 mov ss, ax
46
47 pop rbp
48 ret
49 AsmInitializeGdt ENDP
50
51 END