Author: sginsberg
Date: Sat Jul 25 22:17:23 2009
New Revision: 42218

URL: http://svn.reactos.org/svn/reactos?rev=42218&view=rev
Log:
- Fix most freeldr compilation issues, most notably:
- 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

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

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c [iso-8859-1] Sat Jul 
25 22:17:23 2009
@@ -22,12 +22,7 @@
 #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 @@
                                                                        // 
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:
 //

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] Sat Jul 
25 22:17:23 2009
@@ -22,12 +22,7 @@
 #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 @@
                                                                        //      
 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

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c [iso-8859-1] Sat Jul 
25 22:17:23 2009
@@ -22,12 +22,6 @@
 #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 @@
   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 */

Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h [iso-8859-1] 
Sat Jul 25 22:17:23 2009
@@ -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);

Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h 
[iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h 
[iso-8859-1] Sat Jul 25 22:17:23 2009
@@ -29,8 +29,8 @@
 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);

Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/freeldr.h?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/freeldr.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/freeldr.h [iso-8859-1] Sat Jul 
25 22:17:23 2009
@@ -110,12 +110,22 @@
 #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);

Modified: trunk/reactos/boot/freeldr/freeldr/machine.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/machine.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] Sat Jul 25 
22:17:23 2009
@@ -83,7 +83,7 @@
 VOID
 MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
 {
-  return MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
+  MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
 }
 
 ULONG
@@ -95,7 +95,7 @@
 VOID
 MachVideoSetTextCursorPosition(ULONG X, ULONG Y)
 {
-  return MachVtbl.VideoSetTextCursorPosition(X, Y);
+  MachVtbl.VideoSetTextCursorPosition(X, Y);
 }
 
 VOID
@@ -125,13 +125,13 @@
 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

Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c [iso-8859-1] Sat Jul 
25 22:17:23 2009
@@ -40,7 +40,7 @@
 NTAPI
 CmpFree (PVOID Ptr, IN ULONG Quota)
 {
-  return MmHeapFree(Ptr);
+  MmHeapFree(Ptr);
 }
 
 static BOOLEAN

Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c [iso-8859-1] Sat Jul 
25 22:17:23 2009
@@ -60,11 +60,12 @@
       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 @@
 #endif
   UiDrawStatusText("");
 
-    extern BOOLEAN FrLdrBootType;
-    FrLdrBootType = TRUE;
+  FrLdrBootType = TRUE;
 
   /* Detect hardware */
   UiDrawStatusText("Detecting hardware...");

Modified: trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c [iso-8859-1] Sat Jul 25 
22:17:23 2009
@@ -42,5 +42,5 @@
 RtlpFreeMemory(PVOID Mem,
                ULONG Tag)
 {
-       return MmHeapFree(Mem);
+       MmHeapFree(Mem);
 }

Modified: trunk/reactos/boot/freeldr/freeldr/ui/tui.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tui.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] Sat Jul 25 
22:17:23 2009
@@ -27,9 +27,9 @@
  */
 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++)))
        {

Modified: trunk/reactos/boot/freeldr/freeldr/video/fade.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/video/fade.c?rev=42218&r1=42217&r2=42218&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/video/fade.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/video/fade.c [iso-8859-1] Sat Jul 25 
22:17:23 2009
@@ -38,7 +38,10 @@
 {
        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++)
        {


Reply via email to