Author: dquintana
Date: Tue Jul 25 17:30:21 2017
New Revision: 75403
URL:
http://svn.reactos.org/svn/reactos?rev=75403&view=rev
Log:
[BOOTLIB]
[BOOTMGR]
Disabled x86-specific code when building ARM.
[LIBSUPP]
Use a hack to replace inline asm which is not supported by MSVC ARM.
[DBGHELP]
Fix ARM register access from context struct.
[MSVCRT]
Fix typo in spec file.
[NTOSKRNL]
[WIN32SS]
Add asm dependency to *sys modules.
[CPPRT]
Add one of the missing constructor aliases. There's more, but my brain is fried at
this point.
[BTRFS]
Define-away an include for x86-specific intrinsics.
This is the first batch of fixes for building reactos using the MSVC ARM toolchain. A lot
more work is needed to get a full build including rostests and rosapps.
Modified:
trunk/reactos/boot/environ/CMakeLists.txt
trunk/reactos/boot/environ/app/bootmgr/bootmgr.c
trunk/reactos/boot/environ/lib/misc/image.c
trunk/reactos/boot/environ/lib/misc/util.c
trunk/reactos/boot/environ/lib/platform/time.c
trunk/reactos/dll/ntdll/rtl/libsupp.c
trunk/reactos/dll/win32/dbghelp/cpu_arm.c
trunk/reactos/dll/win32/msvcrt/msvcrt.spec
trunk/reactos/drivers/filesystems/btrfs/btrfs_drv.h
trunk/reactos/ntoskrnl/CMakeLists.txt
trunk/reactos/sdk/lib/cpprt/arm/cpprt.s
trunk/reactos/sdk/lib/delayimp/delayimp.c
trunk/reactos/win32ss/CMakeLists.txt
Modified: trunk/reactos/boot/environ/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/CMakeLists.tx…
==============================================================================
--- trunk/reactos/boot/environ/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/CMakeLists.txt [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -81,7 +81,11 @@
set_target_properties(bootmgfw PROPERTIES SUFFIX ".efi")
if(MSVC)
- add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER /FIXED")
+ if (ARCH STREQUAL "arm")
+ add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER")
+ else()
+ add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER
/FIXED")
+ endif()
else()
add_target_link_flags(bootmgfw "-Wl,--strip-all,--exclude-all-symbols")
endif()
Modified: trunk/reactos/boot/environ/app/bootmgr/bootmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/bootmgr/b…
==============================================================================
--- trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] Tue Jul 25 17:30:21
2017
@@ -2755,7 +2755,12 @@
RebootOnError = FALSE;
/* Save the start/end-of-POST time */
+#if defined(_M_IX86) || defined(_M_X64)
ApplicationStartTime = __rdtsc();
+#else
+ EfiPrintf(L"No time source defined for this platform\r\n");
+ ApplicationStartTime = 0;
+#endif
PostTime = ApplicationStartTime;
/* Setup the boot library parameters for this application */
Modified: trunk/reactos/boot/environ/lib/misc/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/imag…
==============================================================================
--- trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -17,6 +17,7 @@
ULONG IapTableEntries;
PVOID* IapImageTable;
+#ifndef _M_ARM
KDESCRIPTOR GdtRegister;
KDESCRIPTOR IdtRegister;
KDESCRIPTOR BootAppGdtRegister;
@@ -24,6 +25,7 @@
PVOID BootApp32EntryRoutine;
PBOOT_APPLICATION_PARAMETER_BLOCK BootApp32Parameters;
PVOID BootApp32Stack;
+#endif
/* FUNCTIONS *****************************************************************/
@@ -1832,6 +1834,7 @@
_In_ PBL_RETURN_ARGUMENTS ReturnArguments
)
{
+#ifndef _M_ARM
KDESCRIPTOR Gdt, Idt;
ULONG BootSizeNeeded;
NTSTATUS Status;
@@ -1916,6 +1919,9 @@
/* Free it */
MmPapFreePages(BootData, BL_MM_INCLUDE_MAPPED_ALLOCATED);
}
+#else
+ EfiPrintf(L"ImgArchEfiStartBootApplication not implemented for this
platform.\r\n");
+#endif
/* All done */
return STATUS_NOT_IMPLEMENTED;
Modified: trunk/reactos/boot/environ/lib/misc/util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/util…
==============================================================================
--- trunk/reactos/boot/environ/lib/misc/util.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/misc/util.c [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -832,6 +832,7 @@
return PartialSum;
}
+#if defined(_M_IX86) || defined(_M_X64)
BOOLEAN
Archx86IsCpuidSupported (
VOID
@@ -849,12 +850,14 @@
/* Check if the bit stuck */
return (((CallerFlags ^ Flags) >> 21) & 1) ^ 1;
}
+#endif
BOOLEAN
BlArchIsCpuIdFunctionSupported (
_In_ ULONG Function
)
{
+#if defined(_M_IX86) || defined(_M_X64)
BOOLEAN Supported;
INT CpuInfo[4];
@@ -887,6 +890,9 @@
{
return TRUE;
}
+#else
+ EfiPrintf(L"BlArchIsCpuIdFunctionSupported not implemented for this
platform.\r\n");
+#endif
/* Nope */
return FALSE;
@@ -897,6 +903,7 @@
VOID
)
{
+#if defined(_M_IX86) || defined(_M_X64)
INT CpuInfo[4];
/* Serialize with CPUID, if it exists */
@@ -907,6 +914,10 @@
/* Read the TSC */
return __rdtsc();
+#else
+ EfiPrintf(L"BlArchGetPerformanceCounter not implemented for this
platform.\r\n");
+ return 0;
+#endif
}
VOID
@@ -916,6 +927,8 @@
_Out_ INT* Result
)
{
+#if defined(_M_IX86) || defined(_M_X64)
/* Use the intrinsic */
__cpuidex(Result, Function, SubFunction);
-}
+#endif
+}
Modified: trunk/reactos/boot/environ/lib/platform/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/platform/…
==============================================================================
--- trunk/reactos/boot/environ/lib/platform/time.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/platform/time.c [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -21,6 +21,7 @@
VOID
)
{
+#if defined(_M_IX86) || defined(_M_X64)
ULONG Count;
INT CpuInfo[4];
ULONGLONG TimeStamp1, TimeStamp2, Delta;
@@ -51,6 +52,10 @@
/* Set the frequency based on the two measurements we took */
BlpTimePerformanceFrequency = 125 * (Delta - (TimeStamp2 - TimeStamp1)) &
0x1FFFFFFFFFFFFFF;
return STATUS_SUCCESS;
+#else
+ EfiPrintf(L"BlpTimeMeasureTscFrequency not implemented for this
platform.\r\n");
+ return STATUS_NOT_IMPLEMENTED;
+#endif
}
NTSTATUS
@@ -58,6 +63,7 @@
VOID
)
{
+#if defined(_M_IX86) || defined(_M_X64)
INT CpuInfo[4];
/* Check if the ISVM bit it set, meaning we're in a hypervisor */
@@ -85,6 +91,10 @@
/* On other systems, compute it */
return BlpTimeMeasureTscFrequency();
+#else
+ EfiPrintf(L"BlpTimeCalibratePerformanceCounter not implemented for this
platform.\r\n");
+ return STATUS_NOT_IMPLEMENTED;
+#endif
}
ULONGLONG
@@ -92,6 +102,7 @@
_Out_opt_ PLARGE_INTEGER Frequency
)
{
+#if defined(_M_IX86) || defined(_M_X64)
/* Check if caller wants frequency */
if (Frequency)
{
@@ -101,4 +112,8 @@
/* Return the TSC value */
return __rdtsc();
+#else
+ EfiPrintf(L"BlTimeQueryPerformanceCounter not implemented for this
platform.\r\n");
+ return 0;
+#endif
};
Modified: trunk/reactos/dll/ntdll/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/rtl/libsupp.c?re…
==============================================================================
--- trunk/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -245,7 +245,12 @@
#elif defined(_M_PPC)
__asm__("mr %0,1" : "=r" (Stack) : );
#elif defined(_M_ARM)
+#if defined __GNUC__
__asm__("mov sp, %0" : "=r"(Stack) : );
+#elif defined(_MSC_VER)
+ // FIXME: Hack. Probably won't work if this ever actually manages to run
someday.
+ Stack = (ULONG_PTR)&Stack;
+#endif
#else
#error Unknown architecture
#endif
Modified: trunk/reactos/dll/win32/dbghelp/cpu_arm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dbghelp/cpu_arm.…
==============================================================================
--- trunk/reactos/dll/win32/dbghelp/cpu_arm.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/dbghelp/cpu_arm.c [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -33,7 +33,7 @@
#ifdef __arm__
case cpu_addr_pc: addr->Offset = ctx->Pc; return TRUE;
case cpu_addr_stack: addr->Offset = ctx->Sp; return TRUE;
- case cpu_addr_frame: addr->Offset = ctx->Fp; return TRUE;
+ case cpu_addr_frame: addr->Offset = ctx->R11; return TRUE;
#endif
default: addr->Mode = -1;
return FALSE;
@@ -116,7 +116,7 @@
/* set frame information */
frame->AddrStack.Offset = context->Sp;
frame->AddrReturn.Offset = context->Lr;
- frame->AddrFrame.Offset = context->Fp;
+ frame->AddrFrame.Offset = context->R11;
frame->AddrPC.Offset = context->Pc;
frame->Far = TRUE;
@@ -169,8 +169,8 @@
case CV_ARM_R0 + 8: *size = sizeof(ctx->R8); return &ctx->R8;
case CV_ARM_R0 + 9: *size = sizeof(ctx->R9); return &ctx->R9;
case CV_ARM_R0 + 10: *size = sizeof(ctx->R10); return &ctx->R10;
- case CV_ARM_R0 + 11: *size = sizeof(ctx->Fp); return &ctx->Fp;
- case CV_ARM_R0 + 12: *size = sizeof(ctx->Ip); return &ctx->Ip;
+ case CV_ARM_R0 + 11: *size = sizeof(ctx->R11); return &ctx->R11;
+ case CV_ARM_R0 + 12: *size = sizeof(ctx->R12); return &ctx->R12;
case CV_ARM_SP: *size = sizeof(ctx->Sp); return &ctx->Sp;
case CV_ARM_LR: *size = sizeof(ctx->Lr); return &ctx->Lr;
Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/msvcrt.sp…
==============================================================================
--- trunk/reactos/dll/win32/msvcrt/msvcrt.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msvcrt/msvcrt.spec [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -163,7 +163,7 @@
@ cdecl -arch=arm ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z() MSVCRT__set_new_handler # int
(__cdecl*__cdecl _set_new_handler(int (__cdecl*)(unsigned int)))(unsigned int)
@ cdecl -arch=arm ?_set_new_mode@@YAHH@Z() MSVCRT__set_new_mode # int __cdecl
_set_new_mode(int)
@ cdecl -arch=arm ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z()
MSVCRT__set_se_translator # void (__cdecl*__cdecl _set_se_translator(void
(__cdecl*)(unsigned int,struct _EXCEPTION_POINTERS *)))(unsigned int,struct
_EXCEPTION_POINTERS *)
-@ cdecl -arch=arm ?before@type_info@@QBAHABV1@@Z() MSVCRT_type_info_before# public: int
__cdecl type_info::before(class type_info const &)const
+@ cdecl -arch=arm ?before@type_info@@QBAHABV1@@Z() MSVCRT_type_info_before # public: int
__cdecl type_info::before(class type_info const &)const
@ cdecl -arch=arm ?name@type_info@@QBAPBDXZ() MSVCRT_type_info_name # public: char const
* __cdecl type_info::name(void)const
@ cdecl -arch=arm ?raw_name@type_info@@QBAPBDXZ() MSVCRT_type_info_raw_name # public:
char const * __cdecl type_info::raw_name(void)const
@ cdecl -arch=arm ?set_terminate@@YAP6AXXZP6AXXZ@Z() MSVCRT_set_terminate # void
(__cdecl*__cdecl set_terminate(void (__cdecl*)(void)))(void)
Modified: trunk/reactos/drivers/filesystems/btrfs/btrfs_drv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/btrfs/…
==============================================================================
--- trunk/reactos/drivers/filesystems/btrfs/btrfs_drv.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/btrfs/btrfs_drv.h [iso-8859-1] Tue Jul 25 17:30:21
2017
@@ -44,7 +44,10 @@
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
+#ifndef __REACTOS__
+// Not actually used
#include <emmintrin.h>
+#endif /* __REACTOS__ */
#include "btrfs.h"
#include "btrfsioctl.h"
Modified: trunk/reactos/ntoskrnl/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/CMakeLists.txt?re…
==============================================================================
--- trunk/reactos/ntoskrnl/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/CMakeLists.txt [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -57,3 +57,4 @@
add_asm_files(ntdllsys_asm ntdll.S)
add_library(ntdllsys ${ntdllsys_asm})
set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
+add_dependencies(ntdllsys asm)
Modified: trunk/reactos/sdk/lib/cpprt/arm/cpprt.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/cpprt/arm/cpprt.s?…
==============================================================================
--- trunk/reactos/sdk/lib/cpprt/arm/cpprt.s [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/cpprt/arm/cpprt.s [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -27,4 +27,7 @@
; void __cdecl operator delete[](void *,struct std::nothrow_t const &)
DEFINE_ALIAS ??_V@YAXPAXABUnothrow_t@std@@@Z, ??3@YAXPAX@Z
+ ; void __cdecl operator delete(void *,unsigned int)
+ DEFINE_ALIAS ??3@YAXPAXI@Z, ??3@YAXPAX@Z
+
END
Modified: trunk/reactos/sdk/lib/delayimp/delayimp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/delayimp/delayimp.…
==============================================================================
--- trunk/reactos/sdk/lib/delayimp/delayimp.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/delayimp/delayimp.c [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -32,6 +32,9 @@
#pragma comment(linker,
"/alternatename:___pfnDliNotifyHook2=___pfnDliNotifyHook2Default")
#pragma comment(linker,
"/alternatename:___pfnDliFailureHook2=___pfnDliFailureHook2Default")
#elif defined (_M_IA64) || defined (_M_AMD64)
+#pragma comment(linker,
"/alternatename:__pfnDliNotifyHook2=__pfnDliNotifyHook2Default")
+#pragma comment(linker,
"/alternatename:__pfnDliFailureHook2=__pfnDliFailureHook2Default")
+#elif defined (_M_ARM)
#pragma comment(linker,
"/alternatename:__pfnDliNotifyHook2=__pfnDliNotifyHook2Default")
#pragma comment(linker,
"/alternatename:__pfnDliFailureHook2=__pfnDliFailureHook2Default")
#else
Modified: trunk/reactos/win32ss/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/CMakeLists.txt?rev…
==============================================================================
--- trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] Tue Jul 25 17:30:21 2017
@@ -246,3 +246,4 @@
add_asm_files(win32ksys_asm sys-stubs.S)
add_library(win32ksys ${win32ksys_asm})
set_target_properties(win32ksys PROPERTIES LINKER_LANGUAGE "C")
+add_dependencies(win32ksys asm)