diff --git a/Clover.dsc b/Clover.dsc index 247b7aa62..07bce0413 100644 --- a/Clover.dsc +++ b/Clover.dsc @@ -682,7 +682,7 @@ DEFINE EXIT_USBKB_FLAG = -DEXIT_USBKB DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(LODEPNG_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG) #MSFT:*_*_*_CC_FLAGS = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS) - MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline + MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline /Zi XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Wno-msvc-include -Os $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG) GCC:*_*_*_CC_FLAGS = $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG) diff --git a/MdePkg/Include/IndustryStandard/SmBios.h b/MdePkg/Include/IndustryStandard/SmBios.h index f3b6f1870..b472232c3 100644 --- a/MdePkg/Include/IndustryStandard/SmBios.h +++ b/MdePkg/Include/IndustryStandard/SmBios.h @@ -1765,7 +1765,7 @@ typedef struct { UINT16 TotalWidth; UINT16 DataWidth; UINT16 Size; - UINT8 FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR. + MEMORY_FORM_FACTOR FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR. UINT8 DeviceSet; SMBIOS_TABLE_STRING DeviceLocator; SMBIOS_TABLE_STRING BankLocator; diff --git a/rEFIt_UEFI/Platform/BootOptions.cpp b/rEFIt_UEFI/Platform/BootOptions.cpp index 07ff867b1..b959b5a9e 100644 --- a/rEFIt_UEFI/Platform/BootOptions.cpp +++ b/rEFIt_UEFI/Platform/BootOptions.cpp @@ -371,7 +371,7 @@ GetBootOrder ( // // Get gEfiGlobalVariableGuid:BootOrder and it's length // - *BootOrder = (UINT16*)GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize); + *BootOrder = (__typeof_am__(*BootOrder))GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize); if (*BootOrder == NULL) { DBG(" EFI_NOT_FOUND\n"); return EFI_NOT_FOUND; diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp index 6a99c1fe5..c7f33d4cb 100755 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp @@ -483,7 +483,6 @@ UINT8 darwin[] = }; -UINT8 ClassFix[] = { 0x00, 0x00, 0x03, 0x00 }; BOOLEAN CmpNum(UINT8 *dsdt, INT32 i, BOOLEAN Sure) { diff --git a/rEFIt_UEFI/Platform/gma.cpp b/rEFIt_UEFI/Platform/gma.cpp old mode 100644 new mode 100755 index ef7ce94b0..f380381c3 --- a/rEFIt_UEFI/Platform/gma.cpp +++ b/rEFIt_UEFI/Platform/gma.cpp @@ -81,7 +81,7 @@ CONST CHAR16 *CFLFBPath = L"/System/Library/Extensions/AppleIntelCFLGraphicsFramebuffer.kext"; extern CHAR8* gDeviceProperties; -extern CHAR8 ClassFix[]; +CONST UINT8 ClassFix[] = { 0x00, 0x00, 0x03, 0x00 }; UINT8 common_vals[3][4] = { diff --git a/rEFIt_UEFI/Platform/sound.cpp b/rEFIt_UEFI/Platform/sound.cpp old mode 100644 new mode 100755 index 3a11ec192..f0a992d02 --- a/rEFIt_UEFI/Platform/sound.cpp +++ b/rEFIt_UEFI/Platform/sound.cpp @@ -1,3 +1,4 @@ +#include UINT8 EmbeddedSound[] = { 0x52, 0x49, 0x46, 0x46, 0x24, 0x64, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6d, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, diff --git a/rEFIt_UEFI/cpp_util/XStringW.cpp b/rEFIt_UEFI/cpp_util/XStringW.cpp index e5294696d..29e7948d1 100755 --- a/rEFIt_UEFI/cpp_util/XStringW.cpp +++ b/rEFIt_UEFI/cpp_util/XStringW.cpp @@ -16,9 +16,9 @@ extern "C" { #include #include - #include "Platform/Platform.h" - #include "refit/IO.h" } +#include "Platform/Platform.h" +#include "refit/IO.h" UINTN XStringWGrowByDefault = 1024; //const XStringW NullXStringW; @@ -51,13 +51,13 @@ XStringW::XStringW(const XStringW &aString) { DBG("Constructor(const XStringW &aString) : %s\n", aString.data()); Init(aString.length()); - XStringW::StrnCpy((const CHAR16*)aString.data(), aString.length()); + StrnCpy(aString.data(), aString.length()); } XStringW::XStringW(const wchar_t *S) { DBG("Constructor(const wchar_t *S) : %s, StrLen(S)=%d\n", S, StrLen(S)); - Init(StrLen((const CHAR16*)S)); + Init(StrLen(S)); if ( S ) StrCpy(S); } @@ -65,7 +65,7 @@ XStringW::XStringW(const wchar_t *S, UINTN count) { DBG("Constructor(const wchar_t *S, UINTN count) : %s, %d\n", S, count); Init(count); - XStringW::StrnCpy(S, count); + StrnCpy(S, count); } XStringW::XStringW(const wchar_t aChar) diff --git a/rEFIt_UEFI/cpp_util/globals_ctor.cpp b/rEFIt_UEFI/cpp_util/globals_ctor.cpp index adff891d5..097a84393 100644 --- a/rEFIt_UEFI/cpp_util/globals_ctor.cpp +++ b/rEFIt_UEFI/cpp_util/globals_ctor.cpp @@ -15,7 +15,7 @@ extern "C" { #include } - +#include "globals_ctor.h" #include @@ -93,4 +93,10 @@ void construct_globals_objects() { #elif defined(_MSC_VER) +void construct_globals_objects() +{ + DBG("Work in progress\n"); +} + + #endif diff --git a/rEFIt_UEFI/cpp_util/globals_dtor.cpp b/rEFIt_UEFI/cpp_util/globals_dtor.cpp old mode 100644 new mode 100755 index 621d36797..3f1238bed --- a/rEFIt_UEFI/cpp_util/globals_dtor.cpp +++ b/rEFIt_UEFI/cpp_util/globals_dtor.cpp @@ -12,6 +12,9 @@ typedef void (destructor_func_t)(); #elif defined(__GNUC__) typedef void (destructor_func_t)(void*); +#elif defined(_MSC_VER) +typedef void (__cdecl destructor_func_t)(void); +extern "C" int _fltused = 0; // it should be a single underscore since the double one is the mangled name #else # error compiler not supported #endif @@ -46,8 +49,14 @@ extern "C" int __cxa_atexit(destructor_func_ptr_t destructor_func, void *objptr, { DBG("atexit(%p, %p, %p, %d)\n", destructor_func, objptr, dso, sizeof(atexit_func_entry_t)); -#endif +#elif defined(_MSC_VER) +extern "C" int atexit(void(__cdecl *)(void)); +extern "C" int atexit(void(__cdecl *destructor_func)(void)) +{ + DBG("atexit(%p, %p, %p, %d)\n", destructor_func, objptr, dso, sizeof(atexit_func_entry_t)); + +#endif if ( !atexit_func_entry_array ) { DBG("atexit : allocate\n"); diff --git a/rEFIt_UEFI/cpp_util/memory.cpp b/rEFIt_UEFI/cpp_util/memory.cpp old mode 100644 new mode 100755 index 2b38b1403..4dc307a82 --- a/rEFIt_UEFI/cpp_util/memory.cpp +++ b/rEFIt_UEFI/cpp_util/memory.cpp @@ -7,6 +7,7 @@ extern "C" { * memset and memcpy has to be provided for clang */ +#if !defined(_MSC_VER) void* memset(void* dst, int ch, UINT64 count) __attribute__ ((used)); void* memcpy(void* dst, const void* src, UINT64 count) __attribute__ ((used)); @@ -22,6 +23,7 @@ void* memcpy(void* dst, const void* src, UINT64 count) CopyMem(dst, src, count); return dst; } +#endif } // extern "C" diff --git a/rEFIt_UEFI/cpp_util/operatorNewDelete.cpp b/rEFIt_UEFI/cpp_util/operatorNewDelete.cpp old mode 100644 new mode 100755 index 77e33bb77..de9d47d83 --- a/rEFIt_UEFI/cpp_util/operatorNewDelete.cpp +++ b/rEFIt_UEFI/cpp_util/operatorNewDelete.cpp @@ -6,8 +6,11 @@ #define DBG(...) #endif - -void* operator new ( unsigned long count ) +#if defined(_MSC_VER) +void* operator new (size_t count) +#else +void* operator new (unsigned long count) +#endif { void* ptr = AllocatePool(count); if ( !ptr ) { diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index 2c01bdab1..5d50f0645 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -319,4 +319,4 @@ XCODE:*_*_*_CC_FLAGS = -fsigned-char -O2 -fno-omit-frame-pointer -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-writable-strings -Wno-unused-const-variable -DJCONST=const GCC:*_*_*_CC_FLAGS = -std=c99 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args GCC:*_*_*_CXX_FLAGS = -std=c++11 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-write-strings -Wno-unused-const-variable -Wno-pointer-arith -DJCONST=const - MSFT:*_*_*_CC_FLAGS = /Os /wd4201 + MSFT:*_*_*_CC_FLAGS = /Os /wd4201 /D JCONST=const diff --git a/rEFIt_UEFI/refit/lib.cpp b/rEFIt_UEFI/refit/lib.cpp index b9ac1b170..9f8dd3a7d 100644 --- a/rEFIt_UEFI/refit/lib.cpp +++ b/rEFIt_UEFI/refit/lib.cpp @@ -1014,7 +1014,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) { VOID *Instance; if (!EFI_ERROR (gBS->HandleProtocol(Volume->DeviceHandle, &gEfiPartTypeSystemPartGuid, &Instance))) { - Volume->VolName = EfiStrDuplicate(L"EFI"); \ + Volume->VolName = L"EFI"; \ } } if (!Volume->VolName) { diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 0d414314c..8539a8212 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -40,8 +40,6 @@ //#include "../Platform/Platform.h" #include "../cpp_util/XStringW.h" -#include "../cpp_util/globals_ctor.h" -#include "../cpp_util/globals_dtor.h" #include "Version.h" //#include "colors.h"