Author: hbelusca
Date: Fri Jan 27 14:43:41 2017
New Revision: 73606
URL:
http://svn.reactos.org/svn/reactos?rev=73606&view=rev
Log:
[FREELDR]
- Use 'DiskReadBufferSize' instead of hardcoded values in hwdisk.c
- Transform reactos_arc_disk_info into a ARC_DISK_SIGNATURE_EX structure, so that its
conversion into a ARC list in winldr.c becomes a bit simpler.
- In winldr.c:
* In case we fail to either open the SYSTEM hive or scan it, bail out with an error
message, instead of trying to continue loading ROS.
* Fix an old comment related to ACPI;
- In memory.c/h: Do some cleanup (in particular, just use the MachXXX macros instead of
also defining functions with the same names as the macros, and which just redirect into
the virtual table).
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/archwsup.c
trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
trunk/reactos/boot/freeldr/freeldr/include/machine.h
trunk/reactos/boot/freeldr/freeldr/machine.c
trunk/reactos/boot/freeldr/freeldr/ntldr/winldr.c
trunk/reactos/boot/freeldr/freeldr/ntldr/wlregistry.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/archwsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/archwsup.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/archwsup.c [iso-8859-1] Fri Jan 27 14:43:41
2017
@@ -17,9 +17,8 @@
PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
// ARC Disk Information
-ARC_DISK_SIGNATURE reactos_arc_disk_info[32];
ULONG reactos_disk_count = 0;
-CHAR reactos_arc_strings[32][256];
+ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[32];
/* FUNCTIONS ******************************************************************/
@@ -30,11 +29,8 @@
NTAPI
FldrpHwHeapAlloc(IN SIZE_T Size)
{
- PVOID Buffer;
-
/* Allocate memory from generic bootloader heap */
- Buffer = FrLdrHeapAlloc(Size, 'pHwH');
- return Buffer;
+ return FrLdrHeapAlloc(Size, 'pHwH');
}
static VOID
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Fri Jan 27 14:43:41
2017
@@ -30,8 +30,7 @@
ULONG SecondLevelIcacheFillSize;
extern ULONG reactos_disk_count;
-extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
-extern CHAR reactos_arc_strings[32][256];
+extern ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[];
ULONG SizeBits[] =
{
@@ -144,11 +143,11 @@
RamDiskInitialize();
/* Fill out the ARC disk block */
- reactos_arc_disk_info[reactos_disk_count].Signature = 0xBADAB00F;
- reactos_arc_disk_info[reactos_disk_count].CheckSum = 0xDEADBABE;
- strcpy(reactos_arc_strings[reactos_disk_count], "ramdisk(0)");
- reactos_arc_disk_info[reactos_disk_count].ArcName =
- reactos_arc_strings[reactos_disk_count];
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.Signature = 0xBADAB00F;
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.CheckSum = 0xDEADBABE;
+ strcpy(reactos_arc_disk_info[reactos_disk_count].ArcName, "ramdisk(0)");
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.ArcName =
+ reactos_arc_disk_info[reactos_disk_count].ArcName;
reactos_disk_count++;
ASSERT(reactos_disk_count == 1);
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] Fri Jan 27 14:43:41
2017
@@ -36,8 +36,7 @@
} DISKCONTEXT;
extern ULONG reactos_disk_count;
-extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
-extern CHAR reactos_arc_strings[32][256];
+extern ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[];
static CHAR Hex[] = "0123456789abcdef";
UCHAR PcBiosDiskCount = 0;
@@ -190,11 +189,11 @@
UCHAR DriveNumber)
{
PMASTER_BOOT_RECORD Mbr;
- ULONG *Buffer;
+ PULONG Buffer;
ULONG i;
ULONG Checksum;
ULONG Signature;
- CHAR ArcName[256];
+ CHAR ArcName[MAX_PATH];
PARTITION_TABLE_ENTRY PartitionTableEntry;
PCHAR Identifier = PcDiskIdentifier[DriveNumber - 0x80];
@@ -208,12 +207,12 @@
Buffer = (ULONG*)DiskReadBuffer;
Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
- Signature = Mbr->Signature;
+ Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
- for (i = 0; i < 128; i++)
+ for (i = 0; i < 512 / sizeof(ULONG); i++)
{
Checksum += Buffer[i];
}
@@ -221,12 +220,12 @@
TRACE("Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
- reactos_arc_disk_info[reactos_disk_count].Signature = Signature;
- reactos_arc_disk_info[reactos_disk_count].CheckSum = Checksum;
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.Signature = Signature;
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.CheckSum = Checksum;
sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)", reactos_disk_count);
- strcpy(reactos_arc_strings[reactos_disk_count], ArcName);
- reactos_arc_disk_info[reactos_disk_count].ArcName =
- reactos_arc_strings[reactos_disk_count];
+ strcpy(reactos_arc_disk_info[reactos_disk_count].ArcName, ArcName);
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.ArcName =
+ reactos_arc_disk_info[reactos_disk_count].ArcName;
reactos_disk_count++;
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber -
0x80);
@@ -277,36 +276,39 @@
UCHAR DiskCount, DriveNumber;
ULONG i;
BOOLEAN Changed;
- CHAR BootPath[512];
BOOLEAN BootDriveReported = FALSE;
+ CHAR BootPath[MAX_PATH];
/* Count the number of visible drives */
DiskReportError(FALSE);
DiskCount = 0;
DriveNumber = 0x80;
- /* There are some really broken BIOSes out there. There are even BIOSes
- * that happily report success when you ask them to read from non-existent
- * harddisks. So, we set the buffer to known contents first, then try to
- * read. If the BIOS reports success but the buffer contents haven't
- * changed then we fail anyway */
- memset(DiskReadBuffer, 0xcd, 512);
+ /*
+ * There are some really broken BIOSes out there. There are even BIOSes
+ * that happily report success when you ask them to read from non-existent
+ * harddisks. So, we set the buffer to known contents first, then try to
+ * read. If the BIOS reports success but the buffer contents haven't
+ * changed then we fail anyway.
+ */
+ memset(DiskReadBuffer, 0xcd, DiskReadBufferSize);
while (MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, DiskReadBuffer))
{
Changed = FALSE;
- for (i = 0; ! Changed && i < 512; i++)
+ for (i = 0; !Changed && i < DiskReadBufferSize; i++)
{
Changed = ((PUCHAR)DiskReadBuffer)[i] != 0xcd;
}
- if (! Changed)
+ if (!Changed)
{
TRACE("BIOS reports success for disk %d but data didn't
change\n",
- (int)DiskCount);
+ (int)DiskCount);
break;
}
GetHarddiskInformation(DriveNumber);
+ /* Check if we have seen the boot drive */
if (FrldrBootDrive == DriveNumber)
BootDriveReported = TRUE;
@@ -323,18 +325,25 @@
if ((FrldrBootDrive >= 0x80 && !BootDriveReported) ||
DiskIsDriveRemovable(FrldrBootDrive))
{
- /* TODO: Check if it's really a cdrom drive */
- ULONG* Buffer;
+ /* TODO: Check if it's really a CDROM drive */
+
+ PMASTER_BOOT_RECORD Mbr;
+ PULONG Buffer;
ULONG Checksum = 0;
+ ULONG Signature;
/* Read the MBR */
if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, DiskReadBuffer))
{
- ERR("Reading MBR failed\n");
- return FALSE;
+ ERR("Reading MBR failed\n");
+ return FALSE;
}
Buffer = (ULONG*)DiskReadBuffer;
+ Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
+
+ Signature = Mbr->Signature;
+ TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
for (i = 0; i < 2048 / sizeof(ULONG); i++) Checksum += Buffer[i];
@@ -342,10 +351,11 @@
TRACE("Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
- reactos_arc_disk_info[reactos_disk_count].CheckSum = Checksum;
- strcpy(reactos_arc_strings[reactos_disk_count], BootPath);
- reactos_arc_disk_info[reactos_disk_count].ArcName =
- reactos_arc_strings[reactos_disk_count];
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.Signature = Signature;
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.CheckSum = Checksum;
+ strcpy(reactos_arc_disk_info[reactos_disk_count].ArcName, BootPath);
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.ArcName =
+ reactos_arc_disk_info[reactos_disk_count].ArcName;
reactos_disk_count++;
FsRegisterDevice(BootPath, &DiskVtbl);
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Fri Jan 27 14:43:41
2017
@@ -27,8 +27,7 @@
//static unsigned int delay_count = 1;
extern ULONG reactos_disk_count;
-extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
-extern CHAR reactos_arc_strings[32][256];
+extern ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[];
static
PCM_PARTIAL_RESOURCE_LIST
@@ -249,11 +248,11 @@
UCHAR DriveNumber)
{
PMASTER_BOOT_RECORD Mbr;
- ULONG *Buffer;
+ PULONG Buffer;
ULONG i;
ULONG Checksum;
ULONG Signature;
- CHAR ArcName[256];
+ CHAR ArcName[MAX_PATH];
PARTITION_TABLE_ENTRY PartitionTableEntry;
/* Read the MBR */
@@ -266,12 +265,12 @@
Buffer = (ULONG*)DiskReadBuffer;
Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
- Signature = Mbr->Signature;
+ Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
- for (i = 0; i < 128; i++)
+ for (i = 0; i < 512 / sizeof(ULONG); i++)
{
Checksum += Buffer[i];
}
@@ -279,12 +278,12 @@
TRACE("Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
- reactos_arc_disk_info[reactos_disk_count].Signature = Signature;
- reactos_arc_disk_info[reactos_disk_count].CheckSum = Checksum;
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.Signature = Signature;
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.CheckSum = Checksum;
sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)", reactos_disk_count);
- strcpy(reactos_arc_strings[reactos_disk_count], ArcName);
- reactos_arc_disk_info[reactos_disk_count].ArcName =
- reactos_arc_strings[reactos_disk_count];
+ strcpy(reactos_arc_disk_info[reactos_disk_count].ArcName, ArcName);
+ reactos_arc_disk_info[reactos_disk_count].DiskSignature.ArcName =
+ reactos_arc_disk_info[reactos_disk_count].ArcName;
reactos_disk_count++;
sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber -
0x80);
Modified: trunk/reactos/boot/freeldr/freeldr/include/machine.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] Fri Jan 27 14:43:41
2017
@@ -32,100 +32,103 @@
typedef enum tagVIDEODISPLAYMODE
{
- VideoTextMode,
- VideoGraphicsMode
+ VideoTextMode,
+ VideoGraphicsMode
} VIDEODISPLAYMODE, *PVIDEODISPLAYMODE;
typedef struct tagMACHVTBL
{
- VOID (*ConsPutChar)(int Ch);
- BOOLEAN (*ConsKbHit)(VOID);
- int (*ConsGetCh)(VOID);
+ VOID (*ConsPutChar)(int Ch);
+ BOOLEAN (*ConsKbHit)(VOID);
+ int (*ConsGetCh)(VOID);
- VOID (*VideoClearScreen)(UCHAR Attr);
- VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init);
- VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
- ULONG (*VideoGetBufferSize)(VOID);
- VOID (*VideoSetTextCursorPosition)(UCHAR X, UCHAR Y);
- VOID (*VideoHideShowTextCursor)(BOOLEAN Show);
- VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
- VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
- BOOLEAN (*VideoIsPaletteFixed)(VOID);
- VOID (*VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
- VOID (*VideoGetPaletteColor)(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
- VOID (*VideoSync)(VOID);
- VOID (*Beep)(VOID);
- VOID (*PrepareForReactOS)(IN BOOLEAN Setup);
+ VOID (*VideoClearScreen)(UCHAR Attr);
+ VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init);
+ VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
+ ULONG (*VideoGetBufferSize)(VOID);
+ VOID (*VideoSetTextCursorPosition)(UCHAR X, UCHAR Y);
+ VOID (*VideoHideShowTextCursor)(BOOLEAN Show);
+ VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
+ VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
+ BOOLEAN (*VideoIsPaletteFixed)(VOID);
+ VOID (*VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
+ VOID (*VideoGetPaletteColor)(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
+ VOID (*VideoSync)(VOID);
+ VOID (*Beep)(VOID);
+ VOID (*PrepareForReactOS)(IN BOOLEAN Setup);
- FREELDR_MEMORY_DESCRIPTOR* (*GetMemoryDescriptor)(FREELDR_MEMORY_DESCRIPTOR* Current);
- PFREELDR_MEMORY_DESCRIPTOR (*GetMemoryMap)(PULONG MaxMemoryMapSize);
+ // NOTE: Not in the machine.c ...
+ FREELDR_MEMORY_DESCRIPTOR* (*GetMemoryDescriptor)(FREELDR_MEMORY_DESCRIPTOR*
Current);
+ PFREELDR_MEMORY_DESCRIPTOR (*GetMemoryMap)(PULONG MaxMemoryMapSize);
- BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
- BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG
SectorCount, PVOID Buffer);
- BOOLEAN (*DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
- ULONG (*DiskGetCacheableBlockCount)(UCHAR DriveNumber);
+ BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
+ BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG
SectorCount, PVOID Buffer);
+ BOOLEAN (*DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
+ ULONG (*DiskGetCacheableBlockCount)(UCHAR DriveNumber);
- TIMEINFO* (*GetTime)(VOID);
- ULONG (*GetRelativeTime)(VOID);
+ // NOTE: In the machine.c under the name of "ArcGetXXXTime"
+ TIMEINFO* (*GetTime)(VOID);
+ ULONG (*GetRelativeTime)(VOID);
- BOOLEAN (*InitializeBootDevices)(VOID);
- PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
- VOID (*HwIdle)(VOID);
+ // NOTE: Not in the machine.c ...
+ BOOLEAN (*InitializeBootDevices)(VOID);
+ PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
+ VOID (*HwIdle)(VOID);
} MACHVTBL, *PMACHVTBL;
-
-VOID MachInit(const char *CmdLine);
extern MACHVTBL MachVtbl;
-VOID MachConsPutChar(int Ch);
-BOOLEAN MachConsKbHit(VOID);
-int MachConsGetCh(VOID);
-VOID MachVideoClearScreen(UCHAR Attr);
-VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
-VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
-ULONG MachVideoGetBufferSize(VOID);
-VOID MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y);
-VOID MachVideoHideShowTextCursor(BOOLEAN Show);
-VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
-VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
-BOOLEAN MachVideoIsPaletteFixed(VOID);
-VOID MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
-VOID MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue);
-VOID MachVideoSync(VOID);
-VOID MachBeep(VOID);
-BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size);
-BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size);
-BOOLEAN MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG
SectorCount, PVOID Buffer);
-BOOLEAN MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
-ULONG MachDiskGetCacheableBlockCount(UCHAR DriveNumber);
-VOID MachPrepareForReactOS(IN BOOLEAN Setup);
-VOID MachHwIdle(VOID);
+/* NOTE: Implemented by each architecture */
+VOID MachInit(const char *CmdLine);
-#define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch)
-#define MachConsKbHit() MachVtbl.ConsKbHit()
-#define MachConsGetCh() MachVtbl.ConsGetCh()
-#define MachVideoClearScreen(Attr) MachVtbl.VideoClearScreen(Attr)
-#define MachVideoSetDisplayMode(Mode, Init) MachVtbl.VideoSetDisplayMode((Mode),
(Init))
-#define MachVideoGetDisplaySize(W, H, D) MachVtbl.VideoGetDisplaySize((W), (H), (D))
-#define MachVideoGetBufferSize() MachVtbl.VideoGetBufferSize()
-#define MachVideoSetTextCursorPosition(X, Y) MachVtbl.VideoSetTextCursorPosition((X),
(Y))
-#define MachVideoHideShowTextCursor(Show) MachVtbl.VideoHideShowTextCursor(Show)
-#define MachVideoPutChar(Ch, Attr, X, Y) MachVtbl.VideoPutChar((Ch), (Attr), (X),
(Y))
-#define MachVideoCopyOffScreenBufferToVRAM(Buf)
MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
-#define MachVideoIsPaletteFixed() MachVtbl.VideoIsPaletteFixed()
-#define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col),
(R), (G), (B))
-#define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col),
(R), (G), (B))
-#define MachVideoSync() MachVtbl.VideoSync()
-#define MachBeep() MachVtbl.Beep()
-#define MachPrepareForReactOS(a) MachVtbl.PrepareForReactOS(a)
-#define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
-#define MachDiskNormalizeSystemPath(Path, Size)
MachVtbl.DiskNormalizeSystemPath((Path), (Size))
-#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
-#define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive),
(Geom))
-#define MachDiskGetCacheableBlockCount(Drive)
MachVtbl.DiskGetCacheableBlockCount(Drive)
-#define MachInitializeBootDevices() MachVtbl.InitializeBootDevices()
-#define MachHwDetect() MachVtbl.HwDetect()
-#define MachHwIdle() MachVtbl.HwIdle()
+#define MachConsPutChar(Ch) \
+ MachVtbl.ConsPutChar(Ch)
+#define MachConsKbHit() \
+ MachVtbl.ConsKbHit()
+#define MachConsGetCh() \
+ MachVtbl.ConsGetCh()
+#define MachVideoClearScreen(Attr) \
+ MachVtbl.VideoClearScreen(Attr)
+#define MachVideoSetDisplayMode(Mode, Init) \
+ MachVtbl.VideoSetDisplayMode((Mode), (Init))
+#define MachVideoGetDisplaySize(W, H, D) \
+ MachVtbl.VideoGetDisplaySize((W), (H), (D))
+#define MachVideoGetBufferSize() \
+ MachVtbl.VideoGetBufferSize()
+#define MachVideoSetTextCursorPosition(X, Y) \
+ MachVtbl.VideoSetTextCursorPosition((X), (Y))
+#define MachVideoHideShowTextCursor(Show) \
+ MachVtbl.VideoHideShowTextCursor(Show)
+#define MachVideoPutChar(Ch, Attr, X, Y) \
+ MachVtbl.VideoPutChar((Ch), (Attr), (X), (Y))
+#define MachVideoCopyOffScreenBufferToVRAM(Buf) \
+ MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
+#define MachVideoIsPaletteFixed() \
+ MachVtbl.VideoIsPaletteFixed()
+#define MachVideoSetPaletteColor(Col, R, G, B) \
+ MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
+#define MachVideoGetPaletteColor(Col, R, G, B) \
+ MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
+#define MachVideoSync() \
+ MachVtbl.VideoSync()
+#define MachBeep() \
+ MachVtbl.Beep()
+#define MachPrepareForReactOS(Setup) \
+ MachVtbl.PrepareForReactOS(Setup)
+#define MachDiskGetBootPath(Path, Size) \
+ MachVtbl.DiskGetBootPath((Path), (Size))
+#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) \
+ MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
+#define MachDiskGetDriveGeometry(Drive, Geom) \
+ MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
+#define MachDiskGetCacheableBlockCount(Drive) \
+ MachVtbl.DiskGetCacheableBlockCount(Drive)
+
+#define MachInitializeBootDevices() \
+ MachVtbl.InitializeBootDevices()
+
+#define MachHwDetect() MachVtbl.HwDetect()
+#define MachHwIdle() MachVtbl.HwIdle()
/* ARC FUNCTIONS **************************************************************/
Modified: trunk/reactos/boot/freeldr/freeldr/machine.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/machi…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] Fri Jan 27 14:43:41 2017
@@ -18,155 +18,7 @@
#include <freeldr.h>
-#undef MachConsPutChar
-#undef MachConsKbHit
-#undef MachConsGetCh
-#undef MachVideoClearScreen
-#undef MachVideoSetDisplayMode
-#undef MachVideoGetDisplaySize
-#undef MachVideoGetBufferSize
-#undef MachVideoSetTextCursorPosition
-#undef MachVideoHideShowTextCursor
-#undef MachVideoPutChar
-#undef MachVideoCopyOffScreenBufferToVRAM
-#undef MachVideoIsPaletteFixed
-#undef MachVideoSetPaletteColor
-#undef MachVideoGetPaletteColor
-#undef MachVideoSync
-#undef MachBeep
-#undef MachPrepareForReactOS
-#undef MachDiskGetBootPath
-#undef MachDiskReadLogicalSectors
-#undef MachDiskGetDriveGeometry
-#undef MachDiskGetCacheableBlockCount
-
MACHVTBL MachVtbl;
-
-VOID
-MachConsPutChar(int Ch)
-{
- MachVtbl.ConsPutChar(Ch);
-}
-
-BOOLEAN
-MachConsKbHit(VOID)
-{
- return MachVtbl.ConsKbHit();
-}
-
-int
-MachConsGetCh(VOID)
-{
- return MachVtbl.ConsGetCh();
-}
-
-VOID
-MachVideoClearScreen(UCHAR Attr)
-{
- MachVtbl.VideoClearScreen(Attr);
-}
-
-VIDEODISPLAYMODE
-MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
-{
- return MachVtbl.VideoSetDisplayMode(DisplayMode, Init);
-}
-
-VOID
-MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
-{
- MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
-}
-
-ULONG
-MachVideoGetBufferSize(VOID)
-{
- return MachVtbl.VideoGetBufferSize();
-}
-
-VOID
-MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
-{
- MachVtbl.VideoSetTextCursorPosition(X, Y);
-}
-
-VOID
-MachVideoHideShowTextCursor(BOOLEAN Show)
-{
- MachVtbl.VideoHideShowTextCursor(Show);
-}
-
-VOID
-MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
-{
- MachVtbl.VideoPutChar(Ch, Attr, X, Y);
-}
-
-VOID
-MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
-{
- MachVtbl.VideoCopyOffScreenBufferToVRAM(Buffer);
-}
-
-BOOLEAN
-MachVideoIsPaletteFixed(VOID)
-{
- return MachVtbl.VideoIsPaletteFixed();
-}
-
-VOID
-MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
-{
- MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue);
-}
-
-VOID
-MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
-{
- MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue);
-}
-
-VOID
-MachVideoSync(VOID)
-{
- MachVtbl.VideoSync();
-}
-
-VOID
-MachBeep(VOID)
-{
- MachVtbl.Beep();
-}
-
-VOID
-MachPrepareForReactOS(IN BOOLEAN Setup)
-{
- MachVtbl.PrepareForReactOS(Setup);
-}
-
-BOOLEAN
-MachDiskGetBootPath(char *BootPath, unsigned Size)
-{
- return MachVtbl.DiskGetBootPath(BootPath, Size);
-}
-
-BOOLEAN
-MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount,
PVOID Buffer)
-{
- return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount,
Buffer);
-}
-
-BOOLEAN
-MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
-{
- return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry);
-}
-
-ULONG
-MachDiskGetCacheableBlockCount(UCHAR DriveNumber)
-{
- return MachVtbl.DiskGetCacheableBlockCount(DriveNumber);
-}
/* ARC FUNCTIONS **************************************************************/
Modified: trunk/reactos/boot/freeldr/freeldr/ntldr/winldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ntldr…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ntldr/winldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/ntldr/winldr.c [iso-8859-1] Fri Jan 27 14:43:41
2017
@@ -27,9 +27,9 @@
#include <debug.h>
DBG_DEFAULT_CHANNEL(WINDOWS);
-//FIXME: Find a better way to retrieve ARC disk information
+// FIXME: Find a better way to retrieve ARC disk information
extern ULONG reactos_disk_count;
-extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
+extern ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[];
extern ULONG LoaderPagesSpanned;
extern BOOLEAN AcpiPresent;
@@ -148,14 +148,10 @@
ArcDiskSig = FrLdrHeapAlloc(sizeof(ARC_DISK_SIGNATURE_EX), 'giSD');
/* Copy the data over */
- ArcDiskSig->DiskSignature.Signature = reactos_arc_disk_info[i].Signature;
- ArcDiskSig->DiskSignature.CheckSum = reactos_arc_disk_info[i].CheckSum;
-
- /* Copy the ARC Name */
- strncpy(ArcDiskSig->ArcName, reactos_arc_disk_info[i].ArcName, MAX_PATH);
+ RtlCopyMemory(ArcDiskSig, &reactos_arc_disk_info[i],
sizeof(ARC_DISK_SIGNATURE_EX));
+
+ /* Set the ARC Name pointer and mark the partition table as valid */
ArcDiskSig->DiskSignature.ArcName = PaToVa(ArcDiskSig->ArcName);
-
- /* Mark partition table as valid */
ArcDiskSig->DiskSignature.ValidPartitionTable = TRUE;
/* Insert into the list */
@@ -176,8 +172,7 @@
/* Convert all DTE into virtual addresses */
List_PaToVa(&LoaderBlock->LoadOrderListHead);
- /* this one will be converted right before switching to
- virtual paging mode */
+ /* This one will be converted right before switching to virtual paging mode */
//List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
/* Convert list of boot drivers */
@@ -190,11 +185,12 @@
Extension->MinorVersion = VersionToBoot & 0xFF;
Extension->Profile.Status = 2;
- /* Check if ACPI is present */
+ /* Check if FreeLdr detected a ACPI table */
if (AcpiPresent)
{
- /* See KiRosFrldrLpbToNtLpb for details */
+ /* Set the pointer to something for compatibility */
Extension->AcpiTable = (PVOID)1;
+ // FIXME: Extension->AcpiTableSize;
}
#ifdef _M_IX86
@@ -700,10 +696,16 @@
UiDrawProgressBarCenter(15, 100, "Loading system hive...");
Success = WinLdrInitSystemHive(LoaderBlock, BootPath);
TRACE("SYSTEM hive %s\n", (Success ? "loaded" : "not
loaded"));
+ /* Bail out if failure */
+ if (!Success)
+ return;
/* Load NLS data, OEM font, and prepare boot drivers list */
Success = WinLdrScanSystemHive(LoaderBlock, BootPath);
TRACE("SYSTEM hive %s\n", (Success ? "scanned" : "not
scanned"));
+ /* Bail out if failure */
+ if (!Success)
+ return;
/* Finish loading */
LoadAndBootWindowsCommon(OperatingSystemVersion,
Modified: trunk/reactos/boot/freeldr/freeldr/ntldr/wlregistry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ntldr…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ntldr/wlregistry.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/ntldr/wlregistry.c [iso-8859-1] Fri Jan 27 14:43:41
2017
@@ -178,7 +178,6 @@
TRACE("NLS data loading %s\n", Success ? "successful" :
"failed");
/* TODO: Load OEM HAL font */
-
return TRUE;
}