1 //// @file
2 //
3 // Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 //
5 // This program and the accompanying materials
6 // are licensed and made available under the terms and conditions
7 // of the BSD License which accompanies this distribution.  The
8 // full text of the license may be found at
9 // http://opensource.org/licenses/bsd-license.php
10 //
11 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 //
14 ////
15 
16 #define NUM_REAL_GDT_ENTRIES						3
17 #define LOW_STACK_SIZE								(8*1024)            // 8k?
18 
19 //
20 // Low memory Thunk Structure
21 //
22 #define		Code									0
23 #define		LowReverseThunkStart					Code + 4096
24 #define		GdtDesc									LowReverseThunkStart + 4
25 #define		IdtDesc					 				GdtDesc + 6
26 #define		FlatSs					 				IdtDesc + 6
27 #define		FlatEsp					 				FlatSs + 4
28 #define		LowCodeSelector			 				FlatEsp + 4
29 #define		LowDataSelector			 				LowCodeSelector + 4
30 #define		LowStack			 					LowDataSelector + 4
31 #define		RealModeIdtDesc			 				LowStack + 4
32 #define		RealModeGdt								RealModeIdtDesc + 6
33 #define		RealModeGdtDesc							RealModeGdt + (8 * NUM_REAL_GDT_ENTRIES)
34 #define		RevRealDs								RealModeGdtDesc + 6
35 #define		RevRealSs								RevRealDs + 2
36 #define		RevRealEsp								RevRealSs + 2
37 #define		RevRealIdtDesc							RevRealEsp + 4
38 #define		RevFlatDataSelector						RevRealIdtDesc + 6
39 #define		RevFlatStack							RevFlatDataSelector + 2
40 #define		Stack									RevFlatStack + 4
41 #define		RevThunkStack							Stack + LOW_STACK_SIZE
42 
43 #define		EfiToLegacy16InitTable					RevThunkStack + LOW_STACK_SIZE
44 #define		InitTableBiosLessThan1MB				EfiToLegacy16InitTable
45 #define		InitTableHiPmmMemory					InitTableBiosLessThan1MB + 4
46 #define		InitTablePmmMemorySizeInBytes			InitTableHiPmmMemory + 4
47 #define		InitTableReverseThunkCallSegment		InitTablePmmMemorySizeInBytes + 4
48 #define		InitTableReverseThunkCallOffset			InitTableReverseThunkCallSegment + 2
49 #define		InitTableNumberE820Entries				InitTableReverseThunkCallOffset + 2
50 #define		InitTableOsMemoryAbove1Mb				InitTableNumberE820Entries + 4
51 #define		InitTableThunkStart						InitTableOsMemoryAbove1Mb + 4
52 #define		InitTableThunkSizeInBytes				InitTableThunkStart + 4
53 #define		InitTable16InitTableEnd					InitTableThunkSizeInBytes + 4
54 
55 #define		EfiToLegacy16BootTable					InitTable16InitTableEnd
56 #define		BootTableBiosLessThan1MB				EfiToLegacy16BootTable
57 #define		BootTableHiPmmMemory					BootTableBiosLessThan1MB + 4
58 #define		BootTablePmmMemorySizeInBytes			BootTableHiPmmMemory + 4
59 #define		BootTableReverseThunkCallSegment		BootTablePmmMemorySizeInBytes + 4
60 #define		BootTableReverseThunkCallOffset			BootTableReverseThunkCallSegment + 2
61 #define		BootTableNumberE820Entries				BootTableReverseThunkCallOffset + 2
62 #define		BootTableOsMemoryAbove1Mb				BootTableNumberE820Entries + 4
63 #define		BootTableThunkStart						BootTableOsMemoryAbove1Mb + 4
64 #define		BootTableThunkSizeInBytes				BootTableThunkStart + 4
65 #define		EfiToLegacy16BootTableEnd				BootTableThunkSizeInBytes + 4
66 
67 #define		InterruptRedirectionCode				EfiToLegacy16BootTableEnd
68 #define		PciHandler								InterruptRedirectionCode + 32
69 
70 
71 //
72 // Register Sets (16 Bit)
73 //
74 
75 #define		AX		0
76 #define		BX		2
77 #define		CX		4
78 #define		DX		6
79 #define		SI		8
80 #define		DI		10
81 #define		Flags	12
82 #define		ES		14
83 #define		CS		16
84 #define		SS		18
85 #define		DS		20
86 #define		BP		22
87 
88 
89 
90