ReactOS  0.4.15-dev-344-g6808e40
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 
82 #include <pshpack1.h>
83 typedef struct
84 {
85  unsigned long eax;
86  unsigned long ebx;
87  unsigned long ecx;
88  unsigned long edx;
89 
90  unsigned long esi;
91  unsigned long edi;
92  unsigned long ebp;
93 
94  unsigned short ds;
95  unsigned short es;
96  unsigned short fs;
97  unsigned short gs;
98 
99  unsigned long eflags;
100 
101 } DWORDREGS;
102 
103 typedef struct
104 {
105  unsigned short ax, _upper_ax;
106  unsigned short bx, _upper_bx;
107  unsigned short cx, _upper_cx;
108  unsigned short dx, _upper_dx;
109 
110  unsigned short si, _upper_si;
111  unsigned short di, _upper_di;
112  unsigned short bp, _upper_bp;
113 
114  unsigned short ds;
115  unsigned short es;
116  unsigned short fs;
117  unsigned short gs;
118 
119  unsigned short flags, _upper_flags;
120 
121 } WORDREGS;
122 
123 typedef struct
124 {
125  unsigned char al;
126  unsigned char ah;
127  unsigned short _upper_ax;
128  unsigned char bl;
129  unsigned char bh;
130  unsigned short _upper_bx;
131  unsigned char cl;
132  unsigned char ch;
133  unsigned short _upper_cx;
134  unsigned char dl;
135  unsigned char dh;
136  unsigned short _upper_dx;
137 
138  unsigned short si, _upper_si;
139  unsigned short di, _upper_di;
140  unsigned short bp, _upper_bp;
141 
142  unsigned short ds;
143  unsigned short es;
144  unsigned short fs;
145  unsigned short gs;
146 
147  unsigned short flags, _upper_flags;
148 
149 } BYTEREGS;
150 
151 
152 typedef union
153 {
158 } REGS;
159 #include <poppack.h>
160 
161 // Int386()
162 //
163 // Real mode interrupt vector interface
164 //
165 // (E)FLAGS can *only* be returned by this function, not set.
166 // Make sure all memory pointers are in SEG:OFFS format and
167 // not linear addresses, unless the interrupt handler
168 // specifically handles linear addresses.
169 int __cdecl Int386(int ivec, REGS* in, REGS* out);
170 
171 // This macro tests the Carry Flag
172 // If CF is set then the call failed (usually)
173 #define INT386_SUCCESS(regs) ((regs.x.eflags & EFLAGS_CF) == 0)
174 
176  IN UCHAR BootDrive OPTIONAL,
177  IN ULONG BootPartition OPTIONAL);
178 
180  IN REGS* In,
181  IN USHORT StackSegment,
182  IN USHORT StackPointer,
183  IN USHORT CodeSegment,
184  IN USHORT CodePointer);
185 
188 
189 #endif /* ! __ASM__ */
190 
191 /* Layout of the REGS structure */
192 #define REGS_EAX 0
193 #define REGS_EBX 4
194 #define REGS_ECX 8
195 #define REGS_EDX 12
196 #define REGS_ESI 16
197 #define REGS_EDI 20
198 #define REGS_EBP 24
199 #define REGS_DS 28
200 #define REGS_ES 30
201 #define REGS_FS 32
202 #define REGS_GS 34
203 #define REGS_EFLAGS 36
204 #define REGS_SIZE 40
205 
206 #endif /* _PCBIOS_H_ */
unsigned short es
Definition: pcbios.h:95
PHYSICAL_ADDRESS RSDTAddress
Definition: pcbios.h:77
#define IN
Definition: typedefs.h:39
unsigned short dx
Definition: pcbios.h:108
unsigned short _upper_bx
Definition: pcbios.h:130
ULONG ExtendedAttributesAsULONG
Definition: pcbios.h:45
Type
Definition: Type.h:6
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:147
unsigned short fs
Definition: pcbios.h:116
unsigned long eax
Definition: pcbios.h:85
DWORDREGS x
Definition: pcbios.h:154
unsigned long ebx
Definition: pcbios.h:86
unsigned short cx
Definition: pcbios.h:107
unsigned short es
Definition: pcbios.h:115
unsigned short _upper_ax
Definition: pcbios.h:127
unsigned char ah
Definition: pcbios.h:126
unsigned long ebp
Definition: pcbios.h:92
unsigned short gs
Definition: pcbios.h:145
unsigned short fs
Definition: pcbios.h:144
unsigned short bp
Definition: pcbios.h:140
unsigned short es
Definition: pcbios.h:143
unsigned short flags
Definition: pcbios.h:119
unsigned char dh
Definition: pcbios.h:135
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned short gs
Definition: pcbios.h:117
unsigned char dl
Definition: pcbios.h:134
ULONGLONG Count
Definition: pcbios.h:78
unsigned long esi
Definition: pcbios.h:90
ULONGLONG BaseAddress
Definition: pcbios.h:39
VOID DetectHardware(VOID)
unsigned short ds
Definition: pcbios.h:142
struct BIOS_MEMORY_MAP * PBIOS_MEMORY_MAP
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
unsigned short di
Definition: pcbios.h:139
unsigned char bl
Definition: pcbios.h:128
uint64_t ULONGLONG
Definition: typedefs.h:66
ULONG NonVolatile_Deprecated_Reserved
Definition: pcbios.h:55
static FILE * out
Definition: regtests2xml.c:44
struct _ACPI_BIOS_DATA ACPI_BIOS_DATA
unsigned char ch
Definition: pcbios.h:132
BIOS_MEMORY_MAP MemoryMap[1]
Definition: pcbios.h:79
unsigned long edi
Definition: pcbios.h:91
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned char cl
Definition: pcbios.h:131
unsigned short si
Definition: pcbios.h:138
BYTEREGS b
Definition: pcbios.h:157
unsigned long eflags
Definition: pcbios.h:99
unsigned char al
Definition: pcbios.h:125
DWORDREGS d
Definition: pcbios.h:155
unsigned char bh
Definition: pcbios.h:129
unsigned short bp
Definition: pcbios.h:112
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:106
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned short _upper_cx
Definition: pcbios.h:133
unsigned short ax
Definition: pcbios.h:105
unsigned short si
Definition: pcbios.h:110
unsigned short ds
Definition: pcbios.h:114
unsigned short fs
Definition: pcbios.h:96
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:152
unsigned long ecx
Definition: pcbios.h:87
unsigned short _upper_dx
Definition: pcbios.h:136
unsigned long edx
Definition: pcbios.h:88
ULONGLONG Length
Definition: pcbios.h:40
unsigned short gs
Definition: pcbios.h:97
VOID __cdecl ChainLoadBiosBootSectorCode(IN UCHAR BootDrive OPTIONAL, IN ULONG BootPartition OPTIONAL)
Definition: machpc.c:1420
BIOS_MEMORY_TYPE
Definition: pcbios.h:14
ULONG SlowAccess_Deprecated_Reserved
Definition: pcbios.h:59
unsigned short di
Definition: pcbios.h:111
WORDREGS w
Definition: pcbios.h:156
unsigned short ds
Definition: pcbios.h:94
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68