- Merge the remaining portion of the wlan-bringup branch
[reactos.git] / reactos / boot / freeldr / freeldr / include / arch / pc / pcbios.h
1 #ifndef __ASM__
2
3 typedef enum
4 {
5 BiosMemoryUsable=1,
6 BiosMemoryReserved,
7 BiosMemoryAcpiReclaim,
8 BiosMemoryAcpiNvs
9 } BIOS_MEMORY_TYPE;
10
11 typedef struct
12 {
13 ULONGLONG BaseAddress;
14 ULONGLONG Length;
15 ULONG Type;
16 ULONG Reserved;
17 } BIOS_MEMORY_MAP, *PBIOS_MEMORY_MAP;
18
19 /* FIXME: Should be moved to NDK, and respective ACPI header files */
20 typedef struct _ACPI_BIOS_DATA
21 {
22 PHYSICAL_ADDRESS RSDTAddress;
23 ULONGLONG Count;
24 BIOS_MEMORY_MAP MemoryMap[1]; /* Count of BIOS memory map entries */
25 } ACPI_BIOS_DATA, *PACPI_BIOS_DATA;
26
27 #include <pshpack1.h>
28 typedef struct
29 {
30 unsigned long eax;
31 unsigned long ebx;
32 unsigned long ecx;
33 unsigned long edx;
34
35 unsigned long esi;
36 unsigned long edi;
37 unsigned long ebp;
38
39 unsigned short ds;
40 unsigned short es;
41 unsigned short fs;
42 unsigned short gs;
43
44 unsigned long eflags;
45
46 } DWORDREGS;
47
48 typedef struct
49 {
50 unsigned short ax, _upper_ax;
51 unsigned short bx, _upper_bx;
52 unsigned short cx, _upper_cx;
53 unsigned short dx, _upper_dx;
54
55 unsigned short si, _upper_si;
56 unsigned short di, _upper_di;
57 unsigned short bp, _upper_bp;
58
59 unsigned short ds;
60 unsigned short es;
61 unsigned short fs;
62 unsigned short gs;
63
64 unsigned short flags, _upper_flags;
65
66 } WORDREGS;
67
68 typedef struct
69 {
70 unsigned char al;
71 unsigned char ah;
72 unsigned short _upper_ax;
73 unsigned char bl;
74 unsigned char bh;
75 unsigned short _upper_bx;
76 unsigned char cl;
77 unsigned char ch;
78 unsigned short _upper_cx;
79 unsigned char dl;
80 unsigned char dh;
81 unsigned short _upper_dx;
82
83 unsigned short si, _upper_si;
84 unsigned short di, _upper_di;
85 unsigned short bp, _upper_bp;
86
87 unsigned short ds;
88 unsigned short es;
89 unsigned short fs;
90 unsigned short gs;
91
92 unsigned short flags, _upper_flags;
93
94 } BYTEREGS;
95
96
97 typedef union
98 {
99 DWORDREGS x;
100 DWORDREGS d;
101 WORDREGS w;
102 BYTEREGS b;
103 } REGS;
104 #include <poppack.h>
105
106 // Int386()
107 //
108 // Real mode interrupt vector interface
109 //
110 // (E)FLAGS can *only* be returned by this function, not set.
111 // Make sure all memory pointers are in SEG:OFFS format and
112 // not linear addresses, unless the interrupt handler
113 // specifically handles linear addresses.
114 int Int386(int ivec, REGS* in, REGS* out);
115
116 // This macro tests the Carry Flag
117 // If CF is set then the call failed (usually)
118 #define INT386_SUCCESS(regs) ((regs.x.eflags & EFLAGS_CF) == 0)
119
120 void EnableA20(void);
121 VOID ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S
122 VOID SoftReboot(VOID); // Implemented in boot.S
123 VOID DetectHardware(VOID); // Implemented in hardware.c
124
125 #endif /* ! __ASM__ */
126
127 /* Layout of the REGS structure */
128 #define REGS_EAX 0
129 #define REGS_EBX 4
130 #define REGS_ECX 8
131 #define REGS_EDX 12
132 #define REGS_ESI 16
133 #define REGS_EDI 20
134 #define REGS_EBP 24
135 #define REGS_DS 28
136 #define REGS_ES 30
137 #define REGS_FS 32
138 #define REGS_GS 34
139 #define REGS_EFLAGS 36
140 #define REGS_SIZE 40
141