]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm
UefiCpuPkg/CpuMpPei: Load GDT table on BSP
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / Ia32 / 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 .686p
22 .model flat
23
24 include MpEqu.inc
25 .code
26
27
28 AsmInitializeGdt PROC near C PUBLIC
29 push ebp
30 mov ebp, esp
31 pushad
32 mov edi, [ebp + 8] ; Load GDT register
33
34 mov ax,cs ; Get the selector data from our code image
35 mov es,ax
36 lgdt FWORD PTR es:[edi] ; and update the GDTR
37
38 push PROTECT_MODE_CS
39 lea eax, SetCodeSelectorFarJump
40 push eax
41 retf
42 SetCodeSelectorFarJump:
43 mov ax, PROTECT_MODE_DS ; Update the Base for the new selectors, too
44 mov ds, ax
45 mov es, ax
46 mov fs, ax
47 mov gs, ax
48 mov ss, ax
49
50 popad
51 pop ebp
52 ret
53 AsmInitializeGdt ENDP
54
55 END