ReactOS  0.4.15-dev-5618-g8866b9d
pcbios.h
Go to the documentation of this file.
1 #ifndef _PCBIOS_H_
2 #define _PCBIOS_H_
3 
4 #ifdef __ASM__
5 #define EFLAGS_CF HEX(01)
6 #define EFLAGS_ZF HEX(40)
7 #define EFLAGS_SF HEX(80)
8 #endif
9 
10 #ifndef __ASM__
11 
12 #define MAX_BIOS_DESCRIPTORS 80
13 
14 typedef enum
15 {
16  // ACPI 1.0.
21  // ACPI 3.0.
23  // ACPI 4.0.
25  // ACPI 6.0.
32  // BiosMemoryUndefinedNN = 13-0xEFFFFFFF
33  // BiosMemoryOemDefinedNN = 0xF0000000-0xFFFFFFFF
35 
36 typedef struct
37 {
38  // ACPI 1.0.
41  ULONG Type;
42  // ACPI 3.0.
43  union
44  {
46 
47  struct
48  {
49  // Bit 0. ACPI 3.0.
50  // As of ACPI 4.0, became "Reserved -> must be 1".
52  // Bit 1. ACPI 3.0.
53  // As of ACPI 6.1, became "Unimplemented -> Deprecated".
54  // As of ACPI 6.3, became "Reserved -> must be 0".
56  // Bit 2. ACPI 4.0.
57  // As of ACPI 6.1, became "Unimplemented -> Deprecated".
58  // As of ACPI 6.3, became "Reserved -> must be 0".
60  // Bit 3. ACPI 4.0.
61  // ACPI 5.0-A added "Used only on PC-AT BIOS" (not UEFI).
63  // Bits 4-31. ACPI 3.0.
64  ULONG Reserved : 28;
65  } ExtendedAttributes;
66  };
68 
69 /* Int 15h AX=E820h Entry minimal size. */
70 C_ASSERT(FIELD_OFFSET(BIOS_MEMORY_MAP, ExtendedAttributes) == 20);
71 /* Int 15h AX=E820h Entry maximal size. */
72 C_ASSERT(sizeof(BIOS_MEMORY_MAP) == 24);
73 
74 /* FIXME: Should be moved to NDK, and respective ACPI header files */
75 typedef struct _ACPI_BIOS_DATA
76 {
79  BIOS_MEMORY_MAP MemoryMap[1]; /* Count of BIOS memory map entries */
81 
83 {
87 
88 #include <pshpack1.h>
89 typedef struct
90 {
91  unsigned long eax;
92  unsigned long ebx;
93  unsigned long ecx;
94  unsigned long edx;
95 
96  unsigned long esi;
97  unsigned long edi;
98  unsigned long ebp;
99 
100  unsigned short ds;
101  unsigned short es;
102  unsigned short fs;
103  unsigned short gs;
104 
105  unsigned long eflags;
106 
107 } DWORDREGS;
108 
109 typedef struct
110 {
111  unsigned short ax, _upper_ax;
112  unsigned short bx, _upper_bx;
113  unsigned short cx, _upper_cx;
114  unsigned short dx, _upper_dx;
115 
116  unsigned short si, _upper_si;
117  unsigned short di, _upper_di;
118  unsigned short bp, _upper_bp;
119 
120  unsigned short ds;
121  unsigned short es;
122  unsigned short fs;
123  unsigned short gs;
124 
125  unsigned short flags, _upper_flags;
126 
127 } WORDREGS;
128 
129 typedef struct
130 {
131  unsigned char al;
132  unsigned char ah;
133  unsigned short _upper_ax;
134  unsigned char bl;
135  unsigned char bh;
136  unsigned short _upper_bx;
137  unsigned char cl;
138  unsigned char ch;
139  unsigned short _upper_cx;
140  unsigned char dl;
141  unsigned char dh;
142  unsigned short _upper_dx;
143 
144  unsigned short si, _upper_si;
145  unsigned short di, _upper_di;
146  unsigned short bp, _upper_bp;
147 
148  unsigned short ds;
149  unsigned short es;
150  unsigned short fs;
151  unsigned short gs;
152 
153  unsigned short flags, _upper_flags;
154 
155 } BYTEREGS;
156 
157 
158 typedef union
159 {
164 } REGS;
165 #include <poppack.h>
166 
167 // Int386()
168 //
169 // Real mode interrupt vector interface
170 //
171 // (E)FLAGS can *only* be returned by this function, not set.
172 // Make sure all memory pointers are in SEG:OFFS format and
173 // not linear addresses, unless the interrupt handler
174 // specifically handles linear addresses.
175 int __cdecl Int386(int ivec, REGS* in, REGS* out);
176 
177 // This macro tests the Carry Flag
178 // If CF is set then the call failed (usually)
179 #define INT386_SUCCESS(regs) ((regs.x.eflags & EFLAGS_CF) == 0)
180 
182  IN UCHAR BootDrive OPTIONAL,
183  IN ULONG BootPartition OPTIONAL);
184 
186  IN REGS* In,
187  IN USHORT StackSegment,
188  IN USHORT StackPointer,
189  IN USHORT CodeSegment,
190  IN USHORT CodePointer);
191 
194 
195 #endif /* ! __ASM__ */
196 
197 /* Layout of the REGS structure */
198 #define REGS_EAX 0
199 #define REGS_EBX 4
200 #define REGS_ECX 8
201 #define REGS_EDX 12
202 #define REGS_ESI 16
203 #define REGS_EDI 20
204 #define REGS_EBP 24
205 #define REGS_DS 28
206 #define REGS_ES 30
207 #define REGS_FS 32
208 #define REGS_GS 34
209 #define REGS_EFLAGS 36
210 #define REGS_SIZE 40
211 
212 #endif /* _PCBIOS_H_ */
unsigned short es
Definition: pcbios.h:101
PHYSICAL_ADDRESS RSDTAddress
Definition: pcbios.h:77
#define IN
Definition: typedefs.h:39
unsigned short dx
Definition: pcbios.h:114
unsigned short _upper_bx
Definition: pcbios.h:136
ULONG ExtendedAttributesAsULONG
Definition: pcbios.h:45
ULONG ErrorLog
Definition: pcbios.h:62
#define __cdecl
Definition: accygwin.h:79
struct _ACPI_BIOS_DATA * PACPI_BIOS_DATA
unsigned short flags
Definition: pcbios.h:153
unsigned short fs
Definition: pcbios.h:122
unsigned long eax
Definition: pcbios.h:91
DWORDREGS x
Definition: pcbios.h:160
unsigned long ebx
Definition: pcbios.h:92
unsigned short cx
Definition: pcbios.h:113
unsigned short es
Definition: pcbios.h:121
unsigned short _upper_ax
Definition: pcbios.h:133
unsigned char ah
Definition: pcbios.h:132
unsigned long ebp
Definition: pcbios.h:98
unsigned short gs
Definition: pcbios.h:151
unsigned short fs
Definition: pcbios.h:150
unsigned short bp
Definition: pcbios.h:146
unsigned short es
Definition: pcbios.h:149
unsigned short flags
Definition: pcbios.h:125
unsigned char dh
Definition: pcbios.h:141
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned short gs
Definition: pcbios.h:123
unsigned char dl
Definition: pcbios.h:140
ULONGLONG Count
Definition: pcbios.h:78
unsigned long esi
Definition: pcbios.h:96
ULONGLONG BaseAddress
Definition: pcbios.h:39
VOID DetectHardware(VOID)
unsigned short ds
Definition: pcbios.h:148
struct BIOS_MEMORY_MAP * PBIOS_MEMORY_MAP
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
struct _DOCKING_STATE_INFORMATION * PDOCKING_STATE_INFORMATION
struct _DOCKING_STATE_INFORMATION DOCKING_STATE_INFORMATION
unsigned short di
Definition: pcbios.h:145
unsigned char bl
Definition: pcbios.h:134
uint64_t ULONGLONG
Definition: typedefs.h:67
ULONG NonVolatile_Deprecated_Reserved
Definition: pcbios.h:55
static FILE * out
Definition: regtests2xml.c:44
Type
Definition: Type.h:6
struct _ACPI_BIOS_DATA ACPI_BIOS_DATA
unsigned char ch
Definition: pcbios.h:138
BIOS_MEMORY_MAP MemoryMap[1]
Definition: pcbios.h:79
unsigned long edi
Definition: pcbios.h:97
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned char cl
Definition: pcbios.h:137
unsigned short si
Definition: pcbios.h:144
BYTEREGS b
Definition: pcbios.h:163
unsigned long eflags
Definition: pcbios.h:105
unsigned char al
Definition: pcbios.h:131
DWORDREGS d
Definition: pcbios.h:161
unsigned char bh
Definition: pcbios.h:135
unsigned short bp
Definition: pcbios.h:118
GLuint in
Definition: glext.h:9616
unsigned short USHORT
Definition: pedump.c:61
VOID __cdecl Relocator16Boot(IN REGS *In, IN USHORT StackSegment, IN USHORT StackPointer, IN USHORT CodeSegment, IN USHORT CodePointer)
unsigned short bx
Definition: pcbios.h:112
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned short _upper_cx
Definition: pcbios.h:139
unsigned short ax
Definition: pcbios.h:111
unsigned short si
Definition: pcbios.h:116
unsigned short ds
Definition: pcbios.h:120
unsigned short fs
Definition: pcbios.h:102
VOID __cdecl Reboot(VOID)
Definition: hardware.h:37
ULONG Enabled_Reserved
Definition: pcbios.h:51
C_ASSERT(FIELD_OFFSET(BIOS_MEMORY_MAP, ExtendedAttributes)==20)
unsigned int ULONG
Definition: retypes.h:1
Definition: pcbios.h:158
unsigned long ecx
Definition: pcbios.h:93
unsigned short _upper_dx
Definition: pcbios.h:142
unsigned long edx
Definition: pcbios.h:94
ULONGLONG Length
Definition: pcbios.h:40
unsigned short gs
Definition: pcbios.h:103
VOID __cdecl ChainLoadBiosBootSectorCode(IN UCHAR BootDrive OPTIONAL, IN ULONG BootPartition OPTIONAL)
Definition: machpc.c:1482
BIOS_MEMORY_TYPE
Definition: pcbios.h:14
ULONG SlowAccess_Deprecated_Reserved
Definition: pcbios.h:59
unsigned short di
Definition: pcbios.h:117
WORDREGS w
Definition: pcbios.h:162
unsigned short ds
Definition: pcbios.h:100
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68