mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
[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:
parent
294ab75756
commit
ed2b3728b6
|
@ -81,7 +81,11 @@ add_executable(bootmgfw ${BOOTMGR_BASE_SOURCE} app/bootmgr/bootmgr.rc)
|
||||||
set_target_properties(bootmgfw PROPERTIES SUFFIX ".efi")
|
set_target_properties(bootmgfw PROPERTIES SUFFIX ".efi")
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
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")
|
add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER /FIXED")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
add_target_link_flags(bootmgfw "-Wl,--strip-all,--exclude-all-symbols")
|
add_target_link_flags(bootmgfw "-Wl,--strip-all,--exclude-all-symbols")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -2755,7 +2755,12 @@ BmMain (
|
||||||
RebootOnError = FALSE;
|
RebootOnError = FALSE;
|
||||||
|
|
||||||
/* Save the start/end-of-POST time */
|
/* Save the start/end-of-POST time */
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
ApplicationStartTime = __rdtsc();
|
ApplicationStartTime = __rdtsc();
|
||||||
|
#else
|
||||||
|
EfiPrintf(L"No time source defined for this platform\r\n");
|
||||||
|
ApplicationStartTime = 0;
|
||||||
|
#endif
|
||||||
PostTime = ApplicationStartTime;
|
PostTime = ApplicationStartTime;
|
||||||
|
|
||||||
/* Setup the boot library parameters for this application */
|
/* Setup the boot library parameters for this application */
|
||||||
|
|
|
@ -17,6 +17,7 @@ ULONG IapAllocatedTableEntries;
|
||||||
ULONG IapTableEntries;
|
ULONG IapTableEntries;
|
||||||
PVOID* IapImageTable;
|
PVOID* IapImageTable;
|
||||||
|
|
||||||
|
#ifndef _M_ARM
|
||||||
KDESCRIPTOR GdtRegister;
|
KDESCRIPTOR GdtRegister;
|
||||||
KDESCRIPTOR IdtRegister;
|
KDESCRIPTOR IdtRegister;
|
||||||
KDESCRIPTOR BootAppGdtRegister;
|
KDESCRIPTOR BootAppGdtRegister;
|
||||||
|
@ -24,6 +25,7 @@ KDESCRIPTOR BootAppIdtRegister;
|
||||||
PVOID BootApp32EntryRoutine;
|
PVOID BootApp32EntryRoutine;
|
||||||
PBOOT_APPLICATION_PARAMETER_BLOCK BootApp32Parameters;
|
PBOOT_APPLICATION_PARAMETER_BLOCK BootApp32Parameters;
|
||||||
PVOID BootApp32Stack;
|
PVOID BootApp32Stack;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
@ -1832,6 +1834,7 @@ ImgArchEfiStartBootApplication (
|
||||||
_In_ PBL_RETURN_ARGUMENTS ReturnArguments
|
_In_ PBL_RETURN_ARGUMENTS ReturnArguments
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#ifndef _M_ARM
|
||||||
KDESCRIPTOR Gdt, Idt;
|
KDESCRIPTOR Gdt, Idt;
|
||||||
ULONG BootSizeNeeded;
|
ULONG BootSizeNeeded;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -1916,6 +1919,9 @@ Quickie:
|
||||||
/* Free it */
|
/* Free it */
|
||||||
MmPapFreePages(BootData, BL_MM_INCLUDE_MAPPED_ALLOCATED);
|
MmPapFreePages(BootData, BL_MM_INCLUDE_MAPPED_ALLOCATED);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
EfiPrintf(L"ImgArchEfiStartBootApplication not implemented for this platform.\r\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
|
|
@ -832,6 +832,7 @@ BlUtlCheckSum (
|
||||||
return PartialSum;
|
return PartialSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
Archx86IsCpuidSupported (
|
Archx86IsCpuidSupported (
|
||||||
VOID
|
VOID
|
||||||
|
@ -849,12 +850,14 @@ Archx86IsCpuidSupported (
|
||||||
/* Check if the bit stuck */
|
/* Check if the bit stuck */
|
||||||
return (((CallerFlags ^ Flags) >> 21) & 1) ^ 1;
|
return (((CallerFlags ^ Flags) >> 21) & 1) ^ 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
BlArchIsCpuIdFunctionSupported (
|
BlArchIsCpuIdFunctionSupported (
|
||||||
_In_ ULONG Function
|
_In_ ULONG Function
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
BOOLEAN Supported;
|
BOOLEAN Supported;
|
||||||
INT CpuInfo[4];
|
INT CpuInfo[4];
|
||||||
|
|
||||||
|
@ -887,6 +890,9 @@ BlArchIsCpuIdFunctionSupported (
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
EfiPrintf(L"BlArchIsCpuIdFunctionSupported not implemented for this platform.\r\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Nope */
|
/* Nope */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -897,6 +903,7 @@ BlArchGetPerformanceCounter (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
INT CpuInfo[4];
|
INT CpuInfo[4];
|
||||||
|
|
||||||
/* Serialize with CPUID, if it exists */
|
/* Serialize with CPUID, if it exists */
|
||||||
|
@ -907,6 +914,10 @@ BlArchGetPerformanceCounter (
|
||||||
|
|
||||||
/* Read the TSC */
|
/* Read the TSC */
|
||||||
return __rdtsc();
|
return __rdtsc();
|
||||||
|
#else
|
||||||
|
EfiPrintf(L"BlArchGetPerformanceCounter not implemented for this platform.\r\n");
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -916,6 +927,8 @@ BlArchCpuId (
|
||||||
_Out_ INT* Result
|
_Out_ INT* Result
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
/* Use the intrinsic */
|
/* Use the intrinsic */
|
||||||
__cpuidex(Result, Function, SubFunction);
|
__cpuidex(Result, Function, SubFunction);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ BlpTimeMeasureTscFrequency (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
INT CpuInfo[4];
|
INT CpuInfo[4];
|
||||||
ULONGLONG TimeStamp1, TimeStamp2, Delta;
|
ULONGLONG TimeStamp1, TimeStamp2, Delta;
|
||||||
|
@ -51,6 +52,10 @@ BlpTimeMeasureTscFrequency (
|
||||||
/* Set the frequency based on the two measurements we took */
|
/* Set the frequency based on the two measurements we took */
|
||||||
BlpTimePerformanceFrequency = 125 * (Delta - (TimeStamp2 - TimeStamp1)) & 0x1FFFFFFFFFFFFFF;
|
BlpTimePerformanceFrequency = 125 * (Delta - (TimeStamp2 - TimeStamp1)) & 0x1FFFFFFFFFFFFFF;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
#else
|
||||||
|
EfiPrintf(L"BlpTimeMeasureTscFrequency not implemented for this platform.\r\n");
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -58,6 +63,7 @@ BlpTimeCalibratePerformanceCounter (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
INT CpuInfo[4];
|
INT CpuInfo[4];
|
||||||
|
|
||||||
/* Check if the ISVM bit it set, meaning we're in a hypervisor */
|
/* Check if the ISVM bit it set, meaning we're in a hypervisor */
|
||||||
|
@ -85,6 +91,10 @@ BlpTimeCalibratePerformanceCounter (
|
||||||
|
|
||||||
/* On other systems, compute it */
|
/* On other systems, compute it */
|
||||||
return BlpTimeMeasureTscFrequency();
|
return BlpTimeMeasureTscFrequency();
|
||||||
|
#else
|
||||||
|
EfiPrintf(L"BlpTimeCalibratePerformanceCounter not implemented for this platform.\r\n");
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
|
@ -92,6 +102,7 @@ BlTimeQueryPerformanceCounter (
|
||||||
_Out_opt_ PLARGE_INTEGER Frequency
|
_Out_opt_ PLARGE_INTEGER Frequency
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64)
|
||||||
/* Check if caller wants frequency */
|
/* Check if caller wants frequency */
|
||||||
if (Frequency)
|
if (Frequency)
|
||||||
{
|
{
|
||||||
|
@ -101,4 +112,8 @@ BlTimeQueryPerformanceCounter (
|
||||||
|
|
||||||
/* Return the TSC value */
|
/* Return the TSC value */
|
||||||
return __rdtsc();
|
return __rdtsc();
|
||||||
|
#else
|
||||||
|
EfiPrintf(L"BlTimeQueryPerformanceCounter not implemented for this platform.\r\n");
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -245,7 +245,12 @@ RtlWalkFrameChain(OUT PVOID *Callers,
|
||||||
#elif defined(_M_PPC)
|
#elif defined(_M_PPC)
|
||||||
__asm__("mr %0,1" : "=r" (Stack) : );
|
__asm__("mr %0,1" : "=r" (Stack) : );
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
|
#if defined __GNUC__
|
||||||
__asm__("mov sp, %0" : "=r"(Stack) : );
|
__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
|
#else
|
||||||
#error Unknown architecture
|
#error Unknown architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,7 +33,7 @@ static BOOL arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
case cpu_addr_pc: addr->Offset = ctx->Pc; return TRUE;
|
case cpu_addr_pc: addr->Offset = ctx->Pc; return TRUE;
|
||||||
case cpu_addr_stack: addr->Offset = ctx->Sp; 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
|
#endif
|
||||||
default: addr->Mode = -1;
|
default: addr->Mode = -1;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -116,7 +116,7 @@ static BOOL arm_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CON
|
||||||
/* set frame information */
|
/* set frame information */
|
||||||
frame->AddrStack.Offset = context->Sp;
|
frame->AddrStack.Offset = context->Sp;
|
||||||
frame->AddrReturn.Offset = context->Lr;
|
frame->AddrReturn.Offset = context->Lr;
|
||||||
frame->AddrFrame.Offset = context->Fp;
|
frame->AddrFrame.Offset = context->R11;
|
||||||
frame->AddrPC.Offset = context->Pc;
|
frame->AddrPC.Offset = context->Pc;
|
||||||
|
|
||||||
frame->Far = TRUE;
|
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 + 8: *size = sizeof(ctx->R8); return &ctx->R8;
|
||||||
case CV_ARM_R0 + 9: *size = sizeof(ctx->R9); return &ctx->R9;
|
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 + 10: *size = sizeof(ctx->R10); return &ctx->R10;
|
||||||
case CV_ARM_R0 + 11: *size = sizeof(ctx->Fp); return &ctx->Fp;
|
case CV_ARM_R0 + 11: *size = sizeof(ctx->R11); return &ctx->R11;
|
||||||
case CV_ARM_R0 + 12: *size = sizeof(ctx->Ip); return &ctx->Ip;
|
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_SP: *size = sizeof(ctx->Sp); return &ctx->Sp;
|
||||||
case CV_ARM_LR: *size = sizeof(ctx->Lr); return &ctx->Lr;
|
case CV_ARM_LR: *size = sizeof(ctx->Lr); return &ctx->Lr;
|
||||||
|
|
|
@ -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_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_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 ?_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 ?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 ?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)
|
@ cdecl -arch=arm ?set_terminate@@YAP6AXXZP6AXXZ@Z() MSVCRT_set_terminate # void (__cdecl*__cdecl set_terminate(void (__cdecl*)(void)))(void)
|
||||||
|
|
|
@ -44,7 +44,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#ifndef __REACTOS__
|
||||||
|
// Not actually used
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
|
#endif /* __REACTOS__ */
|
||||||
#include "btrfs.h"
|
#include "btrfs.h"
|
||||||
#include "btrfsioctl.h"
|
#include "btrfsioctl.h"
|
||||||
|
|
||||||
|
|
|
@ -57,3 +57,4 @@ endif()
|
||||||
add_asm_files(ntdllsys_asm ntdll.S)
|
add_asm_files(ntdllsys_asm ntdll.S)
|
||||||
add_library(ntdllsys ${ntdllsys_asm})
|
add_library(ntdllsys ${ntdllsys_asm})
|
||||||
set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
|
set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
|
||||||
|
add_dependencies(ntdllsys asm)
|
|
@ -27,4 +27,7 @@ _Target SETS "|$Target|"
|
||||||
; void __cdecl operator delete[](void *,struct std::nothrow_t const &)
|
; void __cdecl operator delete[](void *,struct std::nothrow_t const &)
|
||||||
DEFINE_ALIAS ??_V@YAXPAXABUnothrow_t@std@@@Z, ??3@YAXPAX@Z
|
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
|
END
|
||||||
|
|
|
@ -34,6 +34,9 @@ extern PfnDliHook __pfnDliFailureHook2Default = NULL;
|
||||||
#elif defined (_M_IA64) || defined (_M_AMD64)
|
#elif defined (_M_IA64) || defined (_M_AMD64)
|
||||||
#pragma comment(linker, "/alternatename:__pfnDliNotifyHook2=__pfnDliNotifyHook2Default")
|
#pragma comment(linker, "/alternatename:__pfnDliNotifyHook2=__pfnDliNotifyHook2Default")
|
||||||
#pragma comment(linker, "/alternatename:__pfnDliFailureHook2=__pfnDliFailureHook2Default")
|
#pragma comment(linker, "/alternatename:__pfnDliFailureHook2=__pfnDliFailureHook2Default")
|
||||||
|
#elif defined (_M_ARM)
|
||||||
|
#pragma comment(linker, "/alternatename:__pfnDliNotifyHook2=__pfnDliNotifyHook2Default")
|
||||||
|
#pragma comment(linker, "/alternatename:__pfnDliFailureHook2=__pfnDliFailureHook2Default")
|
||||||
#else
|
#else
|
||||||
#error Unsupported platform, please find the correct decoration for your arch!
|
#error Unsupported platform, please find the correct decoration for your arch!
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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_asm_files(win32ksys_asm sys-stubs.S)
|
||||||
add_library(win32ksys ${win32ksys_asm})
|
add_library(win32ksys ${win32ksys_asm})
|
||||||
set_target_properties(win32ksys PROPERTIES LINKER_LANGUAGE "C")
|
set_target_properties(win32ksys PROPERTIES LINKER_LANGUAGE "C")
|
||||||
|
add_dependencies(win32ksys asm)
|
Loading…
Reference in a new issue