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