- 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

svn path=/trunk/; revision=42218
This commit is contained in:
Stefan Ginsberg 2009-07-25 20:17:23 +00:00
parent 849236d3ac
commit 45934cfbe5
12 changed files with 41 additions and 40 deletions

View file

@ -22,12 +22,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* non-standard specifier from windef.h -- please deprecate */ #include <pshpack2.h>
#undef PACKED
#ifdef __GNUC__
#define PACKED __attribute__((packed))
#endif
typedef struct typedef struct
{ {
UCHAR Signature[4]; // (ret) signature ("VESA") UCHAR Signature[4]; // (ret) signature ("VESA")
@ -55,7 +50,8 @@ typedef struct
// accelerated video modes (list of words terminated with FFFFh) // accelerated video modes (list of words terminated with FFFFh)
UCHAR Reserved[216]; // reserved for VBE implementation UCHAR Reserved[216]; // reserved for VBE implementation
UCHAR ScratchPad[256]; // OEM scratchpad (for OEM strings, etc.) 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: // Bitfields for VESA capabilities:
// //

View file

@ -22,12 +22,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* non-standard specifier from windef.h -- please deprecate */ #include <pshpack2.h>
#undef PACKED
#ifdef __GNUC__
#define PACKED __attribute__((packed))
#endif
typedef struct typedef struct
{ {
UCHAR PacketSize; // 00h - Size of packet (10h or 18h) UCHAR PacketSize; // 00h - Size of packet (10h or 18h)
@ -40,7 +35,8 @@ typedef struct
// used if DWORD at 04h is FFFFh:FFFFh // used if DWORD at 04h is FFFFh:FFFFh
// Commented since some earlier BIOSes refuse to work with // Commented since some earlier BIOSes refuse to work with
// such extended structure // such extended structure
} PACKED I386_DISK_ADDRESS_PACKET, *PI386_DISK_ADDRESS_PACKET; } I386_DISK_ADDRESS_PACKET, *PI386_DISK_ADDRESS_PACKET;
#include <poppack.h>
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS // FUNCTIONS

View file

@ -22,12 +22,6 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #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_READ 0x03C7
#define VIDEOPORT_PALETTE_WRITE 0x03C8 #define VIDEOPORT_PALETTE_WRITE 0x03C8
#define VIDEOPORT_PALETTE_DATA 0x03C9 #define VIDEOPORT_PALETTE_DATA 0x03C9
@ -57,6 +51,7 @@
#define VERTRES_350_SCANLINES 0x01 #define VERTRES_350_SCANLINES 0x01
#define VERTRES_400_SCANLINES 0x02 #define VERTRES_400_SCANLINES 0x02
#include <pshpack2.h>
typedef struct typedef struct
{ {
USHORT ModeAttributes; /* mode attributes (see #00080) */ USHORT ModeAttributes; /* mode attributes (see #00080) */
@ -110,7 +105,8 @@ typedef struct
UCHAR LinearReservedMaskPosition; /* linear modes:Bit position of reserved mask LSB */ UCHAR LinearReservedMaskPosition; /* linear modes:Bit position of reserved mask LSB */
ULONG MaximumPixelClock; /* maximum pixel clock for graphics video mode, in Hz */ ULONG MaximumPixelClock; /* maximum pixel clock for graphics video mode, in Hz */
UCHAR Reserved2[190]; /* 190 BYTEs reserved (0) */ 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 BiosVideoMode; /* Current video mode as known by BIOS */
static ULONG ScreenWidth = 80; /* Screen Width in characters */ static ULONG ScreenWidth = 80; /* Screen Width in characters */

View file

@ -29,8 +29,8 @@
VOID PcMachInit(const char *CmdLine); VOID PcMachInit(const char *CmdLine);
VOID PcConsPutChar(int Ch); VOID PcConsPutChar(int Ch);
BOOLEAN PcConsKbHit(); BOOLEAN PcConsKbHit(VOID);
int PcConsGetCh(); int PcConsGetCh(VOID);
VOID PcVideoClearScreen(UCHAR Attr); VOID PcVideoClearScreen(UCHAR Attr);
VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);

View file

@ -29,8 +29,8 @@ UCHAR XboxFont8x16[256 * 16];
VOID XboxMachInit(const char *CmdLine); VOID XboxMachInit(const char *CmdLine);
VOID XboxConsPutChar(int Ch); VOID XboxConsPutChar(int Ch);
BOOLEAN XboxConsKbHit(); BOOLEAN XboxConsKbHit(VOID);
int XboxConsGetCh(); int XboxConsGetCh(VOID);
VOID XboxVideoInit(VOID); VOID XboxVideoInit(VOID);
VOID XboxVideoClearScreen(UCHAR Attr); VOID XboxVideoClearScreen(UCHAR Attr);

View file

@ -110,12 +110,22 @@
#include <bytesex.h> #include <bytesex.h>
/* arch defines */ /* arch defines */
#ifdef __GNUC__
#ifdef _X86_ #ifdef _X86_
#define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n") #define Ke386EraseFlags() __asm__ __volatile__("pushl $0 ; popfl\n")
#endif #endif
#ifdef _M_AMD64 #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 #endif
VOID BootMain(LPSTR CmdLine); VOID BootMain(LPSTR CmdLine);

View file

@ -83,7 +83,7 @@ MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
VOID VOID
MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth) MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
{ {
return MachVtbl.VideoGetDisplaySize(Width, Height, Depth); MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
} }
ULONG ULONG
@ -95,7 +95,7 @@ MachVideoGetBufferSize(VOID)
VOID VOID
MachVideoSetTextCursorPosition(ULONG X, ULONG Y) MachVideoSetTextCursorPosition(ULONG X, ULONG Y)
{ {
return MachVtbl.VideoSetTextCursorPosition(X, Y); MachVtbl.VideoSetTextCursorPosition(X, Y);
} }
VOID VOID
@ -125,13 +125,13 @@ MachVideoIsPaletteFixed(VOID)
VOID VOID
MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue) MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
{ {
return MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue); MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue);
} }
VOID VOID
MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue) MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
{ {
return MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue); MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue);
} }
VOID VOID

View file

@ -40,7 +40,7 @@ static VOID
NTAPI NTAPI
CmpFree (PVOID Ptr, IN ULONG Quota) CmpFree (PVOID Ptr, IN ULONG Quota)
{ {
return MmHeapFree(Ptr); MmHeapFree(Ptr);
} }
static BOOLEAN static BOOLEAN

View file

@ -60,11 +60,12 @@ VOID LoadReactOSSetup(VOID)
NULL }; NULL };
CHAR FileName[256]; CHAR FileName[256];
HINF InfHandle; HINF InfHandle;
ULONG ErrorLine; ULONG ErrorLine;
INFCONTEXT InfContext; INFCONTEXT InfContext;
PIMAGE_NT_HEADERS NtHeader; PIMAGE_NT_HEADERS NtHeader;
PVOID LoadBase; PVOID LoadBase;
extern BOOLEAN FrLdrBootType;
/* Setup multiboot information structure */ /* Setup multiboot information structure */
LoaderBlock.CommandLine = reactos_kernel_cmdline; LoaderBlock.CommandLine = reactos_kernel_cmdline;
@ -108,8 +109,7 @@ VOID LoadReactOSSetup(VOID)
#endif #endif
UiDrawStatusText(""); UiDrawStatusText("");
extern BOOLEAN FrLdrBootType; FrLdrBootType = TRUE;
FrLdrBootType = TRUE;
/* Detect hardware */ /* Detect hardware */
UiDrawStatusText("Detecting hardware..."); UiDrawStatusText("Detecting hardware...");

View file

@ -42,5 +42,5 @@ NTAPI
RtlpFreeMemory(PVOID Mem, RtlpFreeMemory(PVOID Mem,
ULONG Tag) ULONG Tag)
{ {
return MmHeapFree(Mem); MmHeapFree(Mem);
} }

View file

@ -27,9 +27,9 @@ PVOID TextVideoBuffer = NULL;
*/ */
int TuiPrintf(const char *format, ... ) int TuiPrintf(const char *format, ... )
{ {
char c, *ptr, str[16];
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
char c, *ptr, str[16];
while ((c = *(format++))) while ((c = *(format++)))
{ {

View file

@ -38,7 +38,10 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
{ {
ULONG Index; ULONG Index;
ULONG Color; 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++) for (Index=0; Index<RGB_MAX; Index++)
{ {