FreeLdr Patch. Now fully loads ntoskrnl using a PE Loader, supports /3gb dynamically...
[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 MachDiskReadLogicalSectors
41 #undef MachDiskGetPartitionEntry
42 #undef MachDiskGetDriveGeometry
43 #undef MachDiskGetCacheableBlockCount
44 #undef MachRTCGetCurrentDateTime
45 #undef MachHwDetect
46
47 MACHVTBL MachVtbl;
48
49 VOID
50 MachConsPutChar(int Ch)
51 {
52 MachVtbl.ConsPutChar(Ch);
53 }
54
55 BOOL
56 MachConsKbHit()
57 {
58 return MachVtbl.ConsKbHit();
59 }
60
61 int
62 MachConsGetCh()
63 {
64 return MachVtbl.ConsGetCh();
65 }
66
67 VOID
68 MachVideoClearScreen(UCHAR Attr)
69 {
70 MachVtbl.VideoClearScreen(Attr);
71 }
72
73 VIDEODISPLAYMODE
74 MachVideoSetDisplayMode(char *DisplayMode, BOOL Init)
75 {
76 return MachVtbl.VideoSetDisplayMode(DisplayMode, Init);
77 }
78
79 VOID
80 MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
81 {
82 return MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
83 }
84
85 ULONG
86 MachVideoGetBufferSize(VOID)
87 {
88 return MachVtbl.VideoGetBufferSize();
89 }
90
91 VOID
92 MachVideoSetTextCursorPosition(ULONG X, ULONG Y)
93 {
94 return MachVtbl.VideoSetTextCursorPosition(X, Y);
95 }
96
97 VOID
98 MachVideoHideShowTextCursor(BOOL Show)
99 {
100 MachVtbl.VideoHideShowTextCursor(Show);
101 }
102
103 VOID
104 MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
105 {
106 MachVtbl.VideoPutChar(Ch, Attr, X, Y);
107 }
108
109 VOID
110 MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
111 {
112 MachVtbl.VideoCopyOffScreenBufferToVRAM(Buffer);
113 }
114
115 BOOL
116 MachVideoIsPaletteFixed(VOID)
117 {
118 return MachVtbl.VideoIsPaletteFixed();
119 }
120
121 VOID
122 MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
123 {
124 return MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue);
125 }
126
127 VOID
128 MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
129 {
130 return MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue);
131 }
132
133 VOID
134 MachVideoSync(VOID)
135 {
136 MachVtbl.VideoSync();
137 }
138
139 VOID
140 MachVideoPrepareForReactOS(VOID)
141 {
142 MachVtbl.VideoPrepareForReactOS();
143 }
144
145 ULONG
146 MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
147 {
148 return MachVtbl.GetMemoryMap(BiosMemoryMap, MaxMemoryMapSize);
149 }
150
151 BOOL
152 MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
153 {
154 return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer);
155 }
156
157 BOOL
158 MachDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
159 {
160 return MachVtbl.DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
161 }
162
163 BOOL
164 MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry)
165 {
166 return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry);
167 }
168
169 ULONG
170 MachDiskGetCacheableBlockCount(ULONG DriveNumber)
171 {
172 return MachVtbl.DiskGetCacheableBlockCount(DriveNumber);
173 }
174
175 VOID
176 MachRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second)
177 {
178 MachVtbl.RTCGetCurrentDateTime(Year, Month, Day, Hour, Minute, Second);
179 }
180
181 VOID
182 MachHwDetect(VOID)
183 {
184 MachVtbl.HwDetect();
185 }
186
187 /* EOF */