]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/CpuMpPei/CpuMpPei.c
UefiCpuPkg/CpuMpPei: Load GDT table on BSP
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / CpuMpPei.c
CommitLineData
65e79f93
JF
1/** @file
2 CPU PEI Module installs CPU Multiple Processor PPI.
3
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#include "CpuMpPei.h"
16
f9d30595
JF
17//
18// Global Descriptor Table (GDT)
19//
20GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT mGdtEntries[] = {
21/* selector { Global Segment Descriptor } */
22/* 0x00 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //null descriptor
23/* 0x08 */ {{0xffff, 0, 0, 0x2, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //linear data segment descriptor
24/* 0x10 */ {{0xffff, 0, 0, 0xf, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //linear code segment descriptor
25/* 0x18 */ {{0xffff, 0, 0, 0x3, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system data segment descriptor
26/* 0x20 */ {{0xffff, 0, 0, 0xa, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system code segment descriptor
27/* 0x28 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //spare segment descriptor
28/* 0x30 */ {{0xffff, 0, 0, 0x2, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system data segment descriptor
29/* 0x38 */ {{0xffff, 0, 0, 0xa, 1, 0, 1, 0xf, 0, 1, 0, 1, 0}}, //system code segment descriptor
30/* 0x40 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //spare segment descriptor
31};
32
33//
34// IA32 Gdt register
35//
36GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR mGdt = {
37 sizeof (mGdtEntries) - 1,
38 (UINTN) mGdtEntries
39 };
40
65e79f93
JF
41
42/**
43 The Entry point of the MP CPU PEIM.
44
45 This function will wakeup APs and collect CPU AP count and install the
46 Mp Service Ppi.
47
48 @param FileHandle Handle of the file being invoked.
49 @param PeiServices Describes the list of possible PEI Services.
50
51 @retval EFI_SUCCESS MpServicePpi is installed successfully.
52
53**/
54EFI_STATUS
55EFIAPI
56CpuMpPeimInit (
57 IN EFI_PEI_FILE_HANDLE FileHandle,
58 IN CONST EFI_PEI_SERVICES **PeiServices
59 )
60{
61
62
f9d30595
JF
63 //
64 // Load new GDT table on BSP
65 //
66 AsmInitializeGdt (&mGdt);
65e79f93
JF
67
68 return EFI_SUCCESS;
69}