From 520dcf77b7783fada812244f414d2684e70ec8d0 Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Tue, 15 Sep 2015 11:07:28 +0000 Subject: [PATCH] [FREELDR] Fix a whole bunch of assumptions about default calling convention being cdecl, mostly in code called from/to assembly. Freeldr now links with /Gz (standard calling convention as stdcall), which is what this is all about svn path=/trunk/; revision=69240 --- .../boot/freeldr/freeldr/arch/i386/i386idt.c | 1 + reactos/boot/freeldr/freeldr/freeldr.c | 2 +- reactos/boot/freeldr/freeldr/fs/pxe.c | 2 +- .../freeldr/freeldr/include/arch/i386/i386.h | 36 +++++++++---------- .../freeldr/include/arch/pc/hardware.h | 8 ++--- .../freeldr/freeldr/include/arch/pc/pcbios.h | 8 ++--- .../boot/freeldr/freeldr/include/freeldr.h | 2 +- reactos/boot/freeldr/freeldr/include/linux.h | 4 +-- 8 files changed, 32 insertions(+), 31 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c b/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c index a4dd2e8b221..f63eb99dcfd 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c @@ -19,6 +19,7 @@ InitIdtVector( } void +__cdecl InitIdt(void) { InitIdtVector(0, i386DivideByZero, 0x8e00); diff --git a/reactos/boot/freeldr/freeldr/freeldr.c b/reactos/boot/freeldr/freeldr/freeldr.c index f1ad520d960..d6bcaa8c6a0 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.c +++ b/reactos/boot/freeldr/freeldr/freeldr.c @@ -26,7 +26,7 @@ DBG_DEFAULT_CHANNEL(WARNING); /* FUNCTIONS ******************************************************************/ -VOID BootMain(LPSTR CmdLine) +VOID __cdecl BootMain(LPSTR CmdLine) { CmdLineParse(CmdLine); MachInit(CmdLine); diff --git a/reactos/boot/freeldr/freeldr/fs/pxe.c b/reactos/boot/freeldr/freeldr/fs/pxe.c index bb1df782f9d..c38417503df 100644 --- a/reactos/boot/freeldr/freeldr/fs/pxe.c +++ b/reactos/boot/freeldr/freeldr/fs/pxe.c @@ -84,7 +84,7 @@ static PPXE GetPxeStructure(VOID) return pPxe; } -extern PXENV_EXIT PxeCallApi(UINT16 Segment, UINT16 Offset, UINT16 Service, VOID *Parameter); +extern PXENV_EXIT __cdecl PxeCallApi(UINT16 Segment, UINT16 Offset, UINT16 Service, VOID *Parameter); BOOLEAN CallPxe(UINT16 Service, PVOID Parameter) { PPXE pxe; diff --git a/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h b/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h index 30378563fb0..16d75420779 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h +++ b/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h @@ -50,23 +50,23 @@ typedef struct _PAGE_DIRECTORY_X86 HARDWARE_PTE Pde[1024]; } PAGE_DIRECTORY_X86, *PPAGE_DIRECTORY_X86; -void i386DivideByZero(void); -void i386DebugException(void); -void i386NMIException(void); -void i386Breakpoint(void); -void i386Overflow(void); -void i386BoundException(void); -void i386InvalidOpcode(void); -void i386FPUNotAvailable(void); -void i386DoubleFault(void); -void i386CoprocessorSegment(void); -void i386InvalidTSS(void); -void i386SegmentNotPresent(void); -void i386StackException(void); -void i386GeneralProtectionFault(void); -void i386PageFault(void); -void i386CoprocessorError(void); -void i386AlignmentCheck(void); -void i386MachineCheck(void); +void __cdecl i386DivideByZero(void); +void __cdecl i386DebugException(void); +void __cdecl i386NMIException(void); +void __cdecl i386Breakpoint(void); +void __cdecl i386Overflow(void); +void __cdecl i386BoundException(void); +void __cdecl i386InvalidOpcode(void); +void __cdecl i386FPUNotAvailable(void); +void __cdecl i386DoubleFault(void); +void __cdecl i386CoprocessorSegment(void); +void __cdecl i386InvalidTSS(void); +void __cdecl i386SegmentNotPresent(void); +void __cdecl i386StackException(void); +void __cdecl i386GeneralProtectionFault(void); +void __cdecl i386PageFault(void); +void __cdecl i386CoprocessorError(void); +void __cdecl i386AlignmentCheck(void); +void __cdecl i386MachineCheck(void); /* EOF */ diff --git a/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h b/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h index 5a7afa38bb1..21e49dc4439 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h +++ b/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h @@ -44,13 +44,13 @@ VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); /* i386pnp.S */ -ULONG_PTR PnpBiosSupported(VOID); -ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize, +ULONG_PTR __cdecl PnpBiosSupported(VOID); +ULONG __cdecl PnpBiosGetDeviceNodeCount(ULONG *NodeSize, ULONG *NodeCount); -ULONG PnpBiosGetDeviceNode(UCHAR *NodeId, +ULONG __cdecl PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer); /* i386pxe.S */ -USHORT PxeCallApi(USHORT Segment, USHORT Offset, USHORT Service, VOID* Parameter); +USHORT __cdecl PxeCallApi(USHORT Segment, USHORT Offset, USHORT Service, VOID* Parameter); /* EOF */ diff --git a/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h b/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h index bee9c0b3261..ecfaf90b2a3 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h +++ b/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h @@ -114,16 +114,16 @@ typedef union // Make sure all memory pointers are in SEG:OFFS format and // not linear addresses, unless the interrupt handler // specifically handles linear addresses. -int Int386(int ivec, REGS* in, REGS* out); +int __cdecl Int386(int ivec, REGS* in, REGS* out); // This macro tests the Carry Flag // If CF is set then the call failed (usually) #define INT386_SUCCESS(regs) ((regs.x.eflags & EFLAGS_CF) == 0) void EnableA20(void); -VOID ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S -VOID Reboot(VOID); // Implemented in boot.S -VOID DetectHardware(VOID); // Implemented in hardware.c +VOID __cdecl ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S +VOID __cdecl Reboot(VOID); // Implemented in boot.S +VOID DetectHardware(VOID); // Implemented in hardware.c #endif /* ! __ASM__ */ diff --git a/reactos/boot/freeldr/freeldr/include/freeldr.h b/reactos/boot/freeldr/freeldr/include/freeldr.h index 57b31aa4f38..d96d4000394 100644 --- a/reactos/boot/freeldr/freeldr/include/freeldr.h +++ b/reactos/boot/freeldr/freeldr/include/freeldr.h @@ -119,7 +119,7 @@ #include #endif -VOID BootMain(LPSTR CmdLine); +VOID __cdecl BootMain(LPSTR CmdLine); VOID LoadOperatingSystem(IN OperatingSystemItem* OperatingSystem); VOID RunLoader(VOID); VOID FrLdrCheckCpuCompatiblity(VOID); diff --git a/reactos/boot/freeldr/freeldr/include/linux.h b/reactos/boot/freeldr/freeldr/include/linux.h index f0f5cc95382..78c16bcb4fc 100644 --- a/reactos/boot/freeldr/freeldr/include/linux.h +++ b/reactos/boot/freeldr/freeldr/include/linux.h @@ -128,8 +128,8 @@ typedef struct } LINUX_SETUPSECTOR, *PLINUX_SETUPSECTOR; #include -VOID BootNewLinuxKernel(VOID); // Implemented in linux.S -VOID BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S +VOID __cdecl BootNewLinuxKernel(VOID); // Implemented in linux.S +VOID __cdecl BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S VOID LoadAndBootLinux(IN OperatingSystemItem* OperatingSystem, -- 2.17.1