- Fix most freeldr compilation issues, most notably:
authorStefan Ginsberg <stefanginsberg@gmail.com>
Sat, 25 Jul 2009 20:17:23 +0000 (20:17 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Sat, 25 Jul 2009 20:17:23 +0000 (20:17 +0000)
- Define structure packing correctly for msvc.
- Define Ke386EraseFlags for msvc too.
- Don't return a function returning void in a function returning void.
- VideoFadeIn: Don't rely on some fishy gcc extension for allocating memory from the stack -- just use the heap instead.
- Winldr remains

svn path=/trunk/; revision=42218

12 files changed:
reactos/boot/freeldr/freeldr/arch/i386/i386vid.c
reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c
reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h
reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h
reactos/boot/freeldr/freeldr/include/freeldr.h
reactos/boot/freeldr/freeldr/machine.c
reactos/boot/freeldr/freeldr/reactos/binhive.c
reactos/boot/freeldr/freeldr/reactos/setupldr.c
reactos/boot/freeldr/freeldr/rtl/libsupp.c
reactos/boot/freeldr/freeldr/ui/tui.c
reactos/boot/freeldr/freeldr/video/fade.c

index 15ef3e6..a5a61cb 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
-/* non-standard specifier from windef.h -- please deprecate */
-#undef PACKED
-#ifdef __GNUC__
-#define PACKED __attribute__((packed))
-#endif
-
+#include <pshpack2.h>
 typedef struct
 {
        UCHAR   Signature[4];                           // (ret) signature ("VESA")
@@ -55,7 +50,8 @@ typedef struct
                                                                        // accelerated video modes (list of words terminated with FFFFh)
        UCHAR   Reserved[216];                          // reserved for VBE implementation
        UCHAR   ScratchPad[256];                        // OEM scratchpad (for OEM strings, etc.)
-} PACKED VESA_SVGA_INFO, *PVESA_SVGA_INFO;
+} VESA_SVGA_INFO, *PVESA_SVGA_INFO;
+#include <poppack.h>
 
 // Bitfields for VESA capabilities:
 //
index 1a2d5b9..2316783 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
-/* non-standard specifier from windef.h -- please deprecate */
-#undef PACKED
-#ifdef __GNUC__
-#define PACKED __attribute__((packed))
-#endif
-
+#include <pshpack2.h>
 typedef struct
 {
        UCHAR           PacketSize;                             // 00h - Size of packet (10h or 18h)
@@ -40,7 +35,8 @@ typedef struct
                                                                        //       used if DWORD at 04h is FFFFh:FFFFh
                                                                        //       Commented since some earlier BIOSes refuse to work with
                                                                        //       such extended structure
-} PACKED I386_DISK_ADDRESS_PACKET, *PI386_DISK_ADDRESS_PACKET;
+} I386_DISK_ADDRESS_PACKET, *PI386_DISK_ADDRESS_PACKET;
+#include <poppack.h>
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // FUNCTIONS
index b17d6ee..6e04ea6 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
-/* non-standard specifier from windef.h -- please deprecate */
-#undef PACKED
-#ifdef __GNUC__
-#define PACKED __attribute__((packed))
-#endif
-
 #define VIDEOPORT_PALETTE_READ         0x03C7
 #define VIDEOPORT_PALETTE_WRITE                0x03C8
 #define VIDEOPORT_PALETTE_DATA         0x03C9
@@ -57,6 +51,7 @@
 #define VERTRES_350_SCANLINES          0x01
 #define VERTRES_400_SCANLINES          0x02
 
+#include <pshpack2.h>
 typedef struct
 {
   USHORT ModeAttributes;             /* mode attributes (see #00080) */
@@ -110,7 +105,8 @@ typedef struct
   UCHAR  LinearReservedMaskPosition; /* linear modes:Bit position of reserved mask LSB */
   ULONG MaximumPixelClock;          /* maximum pixel clock for graphics video mode, in Hz */
   UCHAR  Reserved2[190];             /* 190 BYTEs  reserved (0) */
-} PACKED SVGA_MODE_INFORMATION, *PSVGA_MODE_INFORMATION;
+} SVGA_MODE_INFORMATION, *PSVGA_MODE_INFORMATION;
+#include <poppack.h>
 
 static ULONG BiosVideoMode;                              /* Current video mode as known by BIOS */
 static ULONG ScreenWidth = 80;                        /* Screen Width in characters */
index 94b42f6..ff96277 100644 (file)
@@ -29,8 +29,8 @@
 VOID PcMachInit(const char *CmdLine);
 
 VOID PcConsPutChar(int Ch);
-BOOLEAN PcConsKbHit();
-int PcConsGetCh();
+BOOLEAN PcConsKbHit(VOID);
+int PcConsGetCh(VOID);
 
 VOID PcVideoClearScreen(UCHAR Attr);
 VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
index a1bc397..6a56587 100644 (file)
@@ -29,8 +29,8 @@ UCHAR XboxFont8x16[256 * 16];
 VOID XboxMachInit(const char *CmdLine);
 
 VOID XboxConsPutChar(int Ch);
-BOOLEAN XboxConsKbHit();
-int XboxConsGetCh();
+BOOLEAN XboxConsKbHit(VOID);
+int XboxConsGetCh(VOID);
 
 VOID XboxVideoInit(VOID);
 VOID XboxVideoClearScreen(UCHAR Attr);
index a001b9b..e8e7af4 100644 (file)
 #include <bytesex.h>
 
 /* arch defines */
+#ifdef __GNUC__
 #ifdef _X86_
-#define Ke386EraseFlags(x)     __asm__ __volatile__("pushl $0 ; popfl\n")
+#define Ke386EraseFlags()     __asm__ __volatile__("pushl $0 ; popfl\n")
 #endif
 
 #ifdef _M_AMD64
-#define KeAmd64EraseFlags(x)     __asm__ __volatile__("pushq $0 ; popfq\n")
+#define KeAmd64EraseFlags()     __asm__ __volatile__("pushq $0 ; popfq\n")
+#endif
+#else
+#ifdef _X86_
+#define Ke386EraseFlags() __asm push 0; __asm popf;
+#endif
+
+#ifdef _M_AMD64
+#error FIXME
+#endif
 #endif
 
 VOID BootMain(LPSTR CmdLine);
index 5d0eb25..2bdc605 100644 (file)
@@ -83,7 +83,7 @@ MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
 VOID
 MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
 {
-  return MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
+  MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
 }
 
 ULONG
@@ -95,7 +95,7 @@ MachVideoGetBufferSize(VOID)
 VOID
 MachVideoSetTextCursorPosition(ULONG X, ULONG Y)
 {
-  return MachVtbl.VideoSetTextCursorPosition(X, Y);
+  MachVtbl.VideoSetTextCursorPosition(X, Y);
 }
 
 VOID
@@ -125,13 +125,13 @@ MachVideoIsPaletteFixed(VOID)
 VOID
 MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 {
-  return MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue);
+  MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue);
 }
 
 VOID
 MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
 {
-  return MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue);
+  MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue);
 }
 
 VOID
index 3270bd3..40c9277 100644 (file)
@@ -40,7 +40,7 @@ static VOID
 NTAPI
 CmpFree (PVOID Ptr, IN ULONG Quota)
 {
-  return MmHeapFree(Ptr);
+  MmHeapFree(Ptr);
 }
 
 static BOOLEAN
index 5f6cd33..2cea745 100644 (file)
@@ -60,11 +60,12 @@ VOID LoadReactOSSetup(VOID)
       NULL };
     CHAR FileName[256];
 
-  HINF InfHandle;
-  ULONG ErrorLine;
-  INFCONTEXT InfContext;
+    HINF InfHandle;
+    ULONG ErrorLine;
+    INFCONTEXT InfContext;
     PIMAGE_NT_HEADERS NtHeader;
     PVOID LoadBase;
+    extern BOOLEAN FrLdrBootType;
 
   /* Setup multiboot information structure */
   LoaderBlock.CommandLine = reactos_kernel_cmdline;
@@ -108,8 +109,7 @@ VOID LoadReactOSSetup(VOID)
 #endif
   UiDrawStatusText("");
 
-    extern BOOLEAN FrLdrBootType;
-    FrLdrBootType = TRUE;
+  FrLdrBootType = TRUE;
 
   /* Detect hardware */
   UiDrawStatusText("Detecting hardware...");
index fafba51..84acfdc 100644 (file)
@@ -42,5 +42,5 @@ NTAPI
 RtlpFreeMemory(PVOID Mem,
                ULONG Tag)
 {
-       return MmHeapFree(Mem);
+       MmHeapFree(Mem);
 }
index cf69a5d..38081d5 100644 (file)
@@ -27,9 +27,9 @@ PVOID TextVideoBuffer = NULL;
  */
 int TuiPrintf(const char *format, ... )
 {
+       char c, *ptr, str[16];
        va_list ap;
        va_start(ap,format);
-       char c, *ptr, str[16];
 
        while ((c = *(format++)))
        {
index 14cedf9..3f4bbe0 100644 (file)
@@ -38,7 +38,10 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
 {
        ULONG                           Index;
        ULONG                           Color;
-       PALETTE_ENTRY   PaletteColors[ColorCount];
+       PPALETTE_ENTRY  PaletteColors;
+
+       PaletteColors = MmHeapAlloc(sizeof(PALETTE_ENTRY) * ColorCount);
+       if (!PaletteColors) return;
 
        for (Index=0; Index<RGB_MAX; Index++)
        {