Re-apply 14698 - 14762 and fix resulting problem
[reactos.git] / reactos / boot / freeldr / freeldr / machine.c
1 /* $Id$
2 *
3 * FreeLoader
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include "freeldr.h"
21 #include "machine.h"
22
23 #undef MachConsPutChar
24 #undef MachConsKbHit
25 #undef MachConsGetCh
26 #undef MachVideoClearScreen
27 #undef MachVideoSetDisplayMode
28 #undef MachVideoGetDisplaySize
29 #undef MachVideoGetBufferSize
30 #undef MachVideoSetTextCursorPosition
31 #undef MachVideoHideShowTextCursor
32 #undef MachVideoPutChar
33 #undef MachVideoCopyOffScreenBufferToVRAM
34 #undef MachVideoIsPaletteFixed
35 #undef MachVideoSetPaletteColor
36 #undef MachVideoGetPaletteColor
37 #undef MachVideoSync
38 #undef MachVideoPrepareForReactOS
39 #undef MachGetMemoryMap
40 #undef MachDiskGetBootVolume
41 #undef MachDiskGetSystemVolume
42 #undef MachDiskGetBootPath
43 #undef MachDiskGetBootDevice
44 #undef MachDiskBootingFromFloppy
45 #undef MachDiskReadLogicalSectors
46 #undef MachDiskGetPartitionEntry
47 #undef MachDiskGetDriveGeometry
48 #undef MachDiskGetCacheableBlockCount
49 #undef MachRTCGetCurrentDateTime
50 #undef MachHwDetect
51
52 MACHVTBL MachVtbl;
53
54 VOID
55 MachConsPutChar(int Ch)
56 {
57 MachVtbl.ConsPutChar(Ch);
58 }
59
60 BOOL
61 MachConsKbHit()
62 {
63 return MachVtbl.ConsKbHit();
64 }
65
66 int
67 MachConsGetCh()
68 {
69 return MachVtbl.ConsGetCh();
70 }
71
72 VOID
73 MachVideoClearScreen(UCHAR Attr)
74 {
75 MachVtbl.VideoClearScreen(Attr);
76 }
77
78 VIDEODISPLAYMODE
79 MachVideoSetDisplayMode(char *DisplayMode, BOOL Init)
80 {
81 return MachVtbl.VideoSetDisplayMode(DisplayMode, Init);
82 }
83
84 VOID
85 MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
86 {
87 return MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
88 }
89
90 ULONG
91 MachVideoGetBufferSize(VOID)
92 {
93 return MachVtbl.VideoGetBufferSize();
94 }
95
96 VOID
97 MachVideoSetTextCursorPosition(ULONG X, ULONG Y)
98 {
99 return MachVtbl.VideoSetTextCursorPosition(X, Y);
100 }
101
102 VOID
103 MachVideoHideShowTextCursor(BOOL Show)
104 {
105 MachVtbl.VideoHideShowTextCursor(Show);
106 }
107
108 VOID
109 MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
110 {
111 MachVtbl.VideoPutChar(Ch, Attr, X, Y);
112 }
113
114 VOID
115 MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
116 {
117 MachVtbl.VideoCopyOffScreenBufferToVRAM(Buffer);
118 }
119
120 BOOL
121 MachVideoIsPaletteFixed(VOID)
122 {
123 return MachVtbl.VideoIsPaletteFixed();
124 }
125
126 VOID
127 MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
128 {
129 return MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue);
130 }
131
132 VOID
133 MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
134 {
135 return MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue);
136 }
137
138 VOID
139 MachVideoSync(VOID)
140 {
141 MachVtbl.VideoSync();
142 }
143
144 VOID
145 MachVideoPrepareForReactOS(VOID)
146 {
147 MachVtbl.VideoPrepareForReactOS();
148 }
149
150 ULONG
151 MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
152 {
153 return MachVtbl.GetMemoryMap(BiosMemoryMap, MaxMemoryMapSize);
154 }
155
156 BOOL
157 MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
158 {
159 return MachVtbl.DiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType);
160 }
161
162 BOOL
163 MachDiskGetSystemVolume(char *SystemPath,
164 char *RemainingPath,
165 PULONG Device,
166 PULONG DriveNumber,
167 PULONGLONG StartSector,
168 PULONGLONG SectorCount,
169 int *FsType)
170 {
171 return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device,
172 DriveNumber, StartSector, SectorCount,
173 FsType);
174 }
175
176 BOOL
177 MachDiskGetBootPath(char *BootPath, unsigned Size)
178 {
179 return MachVtbl.DiskGetBootPath(BootPath, Size);
180 }
181
182 VOID
183 MachDiskGetBootDevice(PULONG BootDevice)
184 {
185 MachVtbl.DiskGetBootDevice(BootDevice);
186 }
187
188 BOOL
189 MachDiskBootingFromFloppy()
190 {
191 return MachVtbl.DiskBootingFromFloppy();
192 }
193
194 BOOL
195 MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
196 {
197 return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer);
198 }
199
200 BOOL
201 MachDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
202 {
203 return MachVtbl.DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
204 }
205
206 BOOL
207 MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry)
208 {
209 return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry);
210 }
211
212 ULONG
213 MachDiskGetCacheableBlockCount(ULONG DriveNumber)
214 {
215 return MachVtbl.DiskGetCacheableBlockCount(DriveNumber);
216 }
217
218 VOID
219 MachRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second)
220 {
221 MachVtbl.RTCGetCurrentDateTime(Year, Month, Day, Hour, Minute, Second);
222 }
223
224 VOID
225 MachHwDetect(VOID)
226 {
227 MachVtbl.HwDetect();
228 }
229
230 /* EOF */