[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.

svn path=/trunk/; revision=75403
This commit is contained in:
David Quintana 2017-07-25 17:30:21 +00:00
parent 294ab75756
commit ed2b3728b6
13 changed files with 65 additions and 6 deletions

View file

@ -81,7 +81,11 @@ add_executable(bootmgfw ${BOOTMGR_BASE_SOURCE} app/bootmgr/bootmgr.rc)
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()

View file

@ -2755,7 +2755,12 @@ BmMain (
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 */

View file

@ -17,6 +17,7 @@ ULONG IapAllocatedTableEntries;
ULONG IapTableEntries;
PVOID* IapImageTable;
#ifndef _M_ARM
KDESCRIPTOR GdtRegister;
KDESCRIPTOR IdtRegister;
KDESCRIPTOR BootAppGdtRegister;
@ -24,6 +25,7 @@ KDESCRIPTOR BootAppIdtRegister;
PVOID BootApp32EntryRoutine;
PBOOT_APPLICATION_PARAMETER_BLOCK BootApp32Parameters;
PVOID BootApp32Stack;
#endif
/* FUNCTIONS *****************************************************************/
@ -1832,6 +1834,7 @@ ImgArchEfiStartBootApplication (
_In_ PBL_RETURN_ARGUMENTS ReturnArguments
)
{
#ifndef _M_ARM
KDESCRIPTOR Gdt, Idt;
ULONG BootSizeNeeded;
NTSTATUS Status;
@ -1916,6 +1919,9 @@ Quickie:
/* 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;

View file

@ -832,6 +832,7 @@ BlUtlCheckSum (
return PartialSum;
}
#if defined(_M_IX86) || defined(_M_X64)
BOOLEAN
Archx86IsCpuidSupported (
VOID
@ -849,12 +850,14 @@ Archx86IsCpuidSupported (
/* 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 @@ BlArchIsCpuIdFunctionSupported (
{
return TRUE;
}
#else
EfiPrintf(L"BlArchIsCpuIdFunctionSupported not implemented for this platform.\r\n");
#endif
/* Nope */
return FALSE;
@ -897,6 +903,7 @@ BlArchGetPerformanceCounter (
VOID
)
{
#if defined(_M_IX86) || defined(_M_X64)
INT CpuInfo[4];
/* Serialize with CPUID, if it exists */
@ -907,6 +914,10 @@ BlArchGetPerformanceCounter (
/* Read the TSC */
return __rdtsc();
#else
EfiPrintf(L"BlArchGetPerformanceCounter not implemented for this platform.\r\n");
return 0;
#endif
}
VOID
@ -916,6 +927,8 @@ BlArchCpuId (
_Out_ INT* Result
)
{
#if defined(_M_IX86) || defined(_M_X64)
/* Use the intrinsic */
__cpuidex(Result, Function, SubFunction);
#endif
}

View file

@ -21,6 +21,7 @@ BlpTimeMeasureTscFrequency (
VOID
)
{
#if defined(_M_IX86) || defined(_M_X64)
ULONG Count;
INT CpuInfo[4];
ULONGLONG TimeStamp1, TimeStamp2, Delta;
@ -51,6 +52,10 @@ BlpTimeMeasureTscFrequency (
/* 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 @@ BlpTimeCalibratePerformanceCounter (
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 @@ BlpTimeCalibratePerformanceCounter (
/* 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 @@ BlTimeQueryPerformanceCounter (
_Out_opt_ PLARGE_INTEGER Frequency
)
{
#if defined(_M_IX86) || defined(_M_X64)
/* Check if caller wants frequency */
if (Frequency)
{
@ -101,4 +112,8 @@ BlTimeQueryPerformanceCounter (
/* Return the TSC value */
return __rdtsc();
#else
EfiPrintf(L"BlTimeQueryPerformanceCounter not implemented for this platform.\r\n");
return 0;
#endif
};

View file

@ -245,7 +245,12 @@ RtlWalkFrameChain(OUT PVOID *Callers,
#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

View file

@ -33,7 +33,7 @@ static BOOL arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
#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 @@ static BOOL arm_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CON
/* 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 @@ static void* arm_fetch_context_reg(CONTEXT* ctx, unsigned regno, unsigned* size)
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;

View file

@ -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)

View file

@ -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"

View file

@ -57,3 +57,4 @@ endif()
add_asm_files(ntdllsys_asm ntdll.S)
add_library(ntdllsys ${ntdllsys_asm})
set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
add_dependencies(ntdllsys asm)

View file

@ -27,4 +27,7 @@ _Target SETS "|$Target|"
; 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

View file

@ -34,6 +34,9 @@ extern PfnDliHook __pfnDliFailureHook2Default = NULL;
#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
#error Unsupported platform, please find the correct decoration for your arch!
#endif

View file

@ -246,3 +246,4 @@ set_source_files_properties(sys-stubs.S PROPERTIES OBJECT_DEPENDS ${CMAKE_CURREN
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)