From 57ad1f5f20a5f484dcb9ddad6c5a14170ea22eab Mon Sep 17 00:00:00 2001 From: ReactOS Portable Systems Group Date: Tue, 5 Feb 2008 02:58:28 +0000 Subject: [PATCH] Add basic arm target support to the build system. Reactos-arm.rbuild uses the same settings as the x86 version, but defines _ARM_ and __arm__ instead. _M_ARM is already defined by the compiler. Add ARM system call stub support to ncitool. We are currently using a SWI 0x2E to achieve this. Add ARM support to winnt.h. Add a preliminary intrin_arm.h Add ketypes.h and mmtypes.h for ARM in the NDK. For now these are mostly stubs to allow compiling to work. Add ARM support to winddk.h. Fix some broken x86-only assumptions in the NDK. Add config-arm-template.rbuild. By defauilt we build for armv5te (armv4 and v5 are supported, not v6). Set ROS_ARCH=arm to switch to ARM. Set ROS_PREFIX to an appropriate MinGW-32 ARM PE crosscompiler. svn path=/trunk/; revision=32131 --- reactos/ReactOS-arm.rbuild | 36 +++++ reactos/config-arm.template.rbuild | 81 +++++++++++ reactos/include/ddk/winddk.h | 14 +- reactos/include/ndk/arch/ketypes.h | 2 + reactos/include/ndk/arch/mmtypes.h | 2 + reactos/include/ndk/arm/ketypes.h | 211 +++++++++++++++++++++++++++++ reactos/include/ndk/arm/mmtypes.h | 141 +++++++++++++++++++ reactos/include/ndk/i386/ketypes.h | 11 ++ reactos/include/ndk/ketypes.h | 11 -- reactos/include/ndk/pstypes.h | 2 + reactos/include/psdk/intrin.h | 2 + reactos/include/psdk/intrin_arm.h | 152 +++++++++++++++++++++ reactos/include/psdk/winnt.h | 6 + reactos/tools/nci/ncitool.c | 13 ++ 14 files changed, 672 insertions(+), 12 deletions(-) create mode 100644 reactos/ReactOS-arm.rbuild create mode 100644 reactos/config-arm.template.rbuild create mode 100644 reactos/include/ndk/arm/ketypes.h create mode 100644 reactos/include/ndk/arm/mmtypes.h create mode 100644 reactos/include/psdk/intrin_arm.h diff --git a/reactos/ReactOS-arm.rbuild b/reactos/ReactOS-arm.rbuild new file mode 100644 index 00000000000..e0b9211759e --- /dev/null +++ b/reactos/ReactOS-arm.rbuild @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + -Os + -ftracer + + + -Os + + + -O1 + + + -O2 + + + -O3 + + + -Wno-attributes + -fno-strict-aliasing + diff --git a/reactos/config-arm.template.rbuild b/reactos/config-arm.template.rbuild new file mode 100644 index 00000000000..ee446425109 --- /dev/null +++ b/reactos/config-arm.template.rbuild @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reactos/include/ddk/winddk.h b/reactos/include/ddk/winddk.h index 6dec9174379..757260bba21 100644 --- a/reactos/include/ddk/winddk.h +++ b/reactos/include/ddk/winddk.h @@ -228,7 +228,10 @@ typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; #define ZwCurrentProcess() NtCurrentProcess() #define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 ) #define ZwCurrentThread() NtCurrentThread() + +#if (_M_IX86) #define KIP0PCRADDRESS 0xffdff000 +#endif #define KERNEL_STACK_SIZE 12288 #define KERNEL_LARGE_STACK_SIZE 61440 @@ -5535,6 +5538,8 @@ KeGetCurrentProcessorNumber(VOID) #elif defined(_MIPS_) +#error MIPS Headers are totally incorrect + typedef ULONG PFN_NUMBER, *PPFN_NUMBER; #define PASSIVE_LEVEL 0 @@ -5562,10 +5567,17 @@ KeGetCurrentProcessorNumber(VOID) return 0; } +#elif defined(_M_ARM) + +// +// NT-ARM is not documented, need NDK +// +#include + #else #error Unknown architecture #endif - + #define PAGE_SIZE 0x1000 #define PAGE_SHIFT 12L diff --git a/reactos/include/ndk/arch/ketypes.h b/reactos/include/ndk/arch/ketypes.h index f6bfc05f786..b2d40951a60 100644 --- a/reactos/include/ndk/arch/ketypes.h +++ b/reactos/include/ndk/arch/ketypes.h @@ -26,6 +26,8 @@ Author: #include #elif defined(_M_PPC) #include +#elif defined(_M_ARM) +#include #else #error "Unknown processor" #endif diff --git a/reactos/include/ndk/arch/mmtypes.h b/reactos/include/ndk/arch/mmtypes.h index 4deb294039b..41df8085086 100644 --- a/reactos/include/ndk/arch/mmtypes.h +++ b/reactos/include/ndk/arch/mmtypes.h @@ -26,6 +26,8 @@ Author: #include #elif defined(_M_PPC) #include +#elif defined(_M_ARM) +#include #else #error "Unknown processor" #endif diff --git a/reactos/include/ndk/arm/ketypes.h b/reactos/include/ndk/arm/ketypes.h new file mode 100644 index 00000000000..d374e2a00a2 --- /dev/null +++ b/reactos/include/ndk/arm/ketypes.h @@ -0,0 +1,211 @@ +/*++ NDK Version: 0098 + +Copyright (c) Alex Ionescu. All rights reserved. + +Header Name: + + ketypes.h (ARM) + +Abstract: + + ARM Type definitions for the Kernel services. + +Author: + + Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006 + +--*/ + +#ifndef _ARM_KETYPES_H +#define _ARM_KETYPES_H + +// +// Dependencies +// + +// +// IRQLs +// +#define PASSIVE_LEVEL 0 +#define LOW_LEVEL 0 +#define APC_LEVEL 1 +#define DISPATCH_LEVEL 2 +#define IPI_LEVEL 7 +#define POWER_LEVEL 7 +#define PROFILE_LEVEL 8 +#define HIGH_LEVEL 8 +#define SYNCH_LEVEL (IPI_LEVEL - 1) + +// +// IPI Types +// +#define IPI_APC 1 +#define IPI_DPC 2 +#define IPI_FREEZE 4 +#define IPI_PACKET_READY 8 +#define IPI_SYNCH_REQUEST 16 + +// +// PRCB Flags +// +#define PRCB_MAJOR_VERSION 1 +#define PRCB_BUILD_DEBUG 1 +#define PRCB_BUILD_UNIPROCESSOR 2 + +// +// HAL Variables +// +#define INITIAL_STALL_COUNT 0x64 + +// +// Static Kernel-Mode Address start (use MM_KSEG0_BASE for actual) +// +#define KSEG0_BASE 0x80000000 + +// +// FIXME: mmtypes.h? +// +#define KIPCR 0xFFFFF000 +#define PCR ((volatile KPCR * const)KIPCR) + +// +// Synchronization-level IRQL +// +#define SYNCH_LEVEL DISPATCH_LEVEL + +// +// Trap Frame Definition +// +typedef struct _KTRAP_FRAME +{ + ULONG R0; + ULONG R1; + ULONG R2; + ULONG R3; + ULONG R4; + ULONG R5; + ULONG R6; + ULONG R7; + ULONG R8; + ULONG R9; + ULONG R10; + ULONG R11; + ULONG R12; + ULONG Sp; + ULONG Lr; + ULONG Pc; + ULONG Psr; + UCHAR ExceptionRecord[(sizeof(EXCEPTION_RECORD) + 7) & (~7)]; + UCHAR OldIrql; + UCHAR PreviousMode; + ULONG Fpscr; + ULONG FpExc; + ULONG S[33]; + ULONG FpExtra[8]; +} KTRAP_FRAME, *PKTRAP_FRAME; + +#ifndef NTOS_MODE_USER +// +// Stub +// +typedef struct _KFLOATING_SAVE +{ + ULONG Reserved; +} KFLOATING_SAVE, *PKFLOATING_SAVE; + +// +// Processor Region Control Block +// +typedef struct _KPRCB +{ + USHORT MinorVersion; + USHORT MajorVersion; + struct _KTHREAD *CurrentThread; + struct _KTHREAD *NextThread; + struct _KTHREAD *IdleThread; + UCHAR Number; + // + // TODO + // +} KPRCB, *PKPRCB; + +// +// Processor Control Region +// +typedef struct _KPCR +{ + ULONG MinorVersion; + ULONG MajorVersion; + PKINTERRUPT_ROUTINE InterruptRoutine[64]; + PVOID XcodeDispatch; + ULONG FirstLevelDcacheSize; + ULONG FirstLevelDcacheFillSize; + ULONG FirstLevelIcacheSize; + ULONG FirstLevelIcacheFillSize; + ULONG SecondLevelDcacheSize; + ULONG SecondLevelDcacheFillSize; + ULONG SecondLevelIcacheSize; + ULONG SecondLevelIcacheFillSize; + struct _KPRCB *Prcb; + struct _TEB *Teb; + PVOID TlsArray; + ULONG DcacheFillSize; + ULONG IcacheAlignment; + ULONG IcacheFillSize; + ULONG ProcessorId; + ULONG ProfileInterval; + ULONG ProfileCount; + ULONG StallExecutionCount; + ULONG StallScaleFactor; + CCHAR Number; + PVOID DataBusError; + PVOID InstructionBusError; + ULONG CachePolicy; + UCHAR IrqlMask[64]; + UCHAR IrqlTable[64]; + UCHAR CurrentIrql; + KAFFINITY SetMember; + struct _KTHREAD *CurrentThread; + KAFFINITY NotMember; + ULONG SystemReserved[6]; + ULONG DcacheAlignment; + ULONG HalReserved[64]; + BOOLEAN FirstLevelActive; + BOOLEAN DpcRoutineActive; + ULONG CurrentPid; + BOOLEAN OnInterruptStack; + PVOID SavedInitialStack; + PVOID SavedStackLimit; + PVOID SystemServiceDispatchStart; + PVOID SystemServiceDispatchEnd; + PVOID InterruptStack; + PVOID PanicStack; + PVOID BadVaddr; + PVOID InitialStack; + PVOID StackLimit; + ULONG QuantumEnd; +} KPCR, *PKPCR; + +// +// Macro to get current KPRCB +// +FORCEINLINE +struct _KPRCB * +KeGetCurrentPrcb(VOID) +{ + return PCR->Prcb; +} + +// +// Macro to get current CPU +// +FORCEINLINE +ULONG +DDKAPI +KeGetCurrentProcessorNumber(VOID) +{ + return PCR->Number; +} + +#endif +#endif diff --git a/reactos/include/ndk/arm/mmtypes.h b/reactos/include/ndk/arm/mmtypes.h new file mode 100644 index 00000000000..558f1c1d67a --- /dev/null +++ b/reactos/include/ndk/arm/mmtypes.h @@ -0,0 +1,141 @@ +/*++ NDK Version: 0095 + +Copyright (c) Alex Ionescu. All rights reserved. + +Header Name: + + mmtypes.h (ARM) + +Abstract: + + ARM Type definitions for the Memory Manager + +Author: + + Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004 + +--*/ + +#ifndef _ARM_MMTYPES_H +#define _ARM_MMTYPES_H + +// +// Dependencies +// + +// +// Page-related Macros +// +#define PAGE_SIZE 0x1000 +#define PAGE_SHIFT 12L +#define MM_ALLOCATION_GRANULARITY 0x10000 +#define MM_ALLOCATION_GRANULARITY_SHIFT 16L + +// +// Sanity checks for Paging Macros +// +#ifdef C_ASSERT +C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT)); +C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT)); +C_ASSERT(MM_ALLOCATION_GRANULARITY && + !(MM_ALLOCATION_GRANULARITY & (MM_ALLOCATION_GRANULARITY - 1))); +C_ASSERT(MM_ALLOCATION_GRANULARITY >= PAGE_SIZE); +#endif + +// +// Page Table Entry Definitions +// +typedef struct _HARDWARE_PTE_ARM +{ + ULONG Valid:1; + ULONG Write:1; + ULONG Owner:1; + ULONG WriteThrough:1; + ULONG CacheDisable:1; + ULONG Accessed:1; + ULONG Dirty:1; + ULONG LargePage:1; + ULONG Global:1; + ULONG CopyOnWrite:1; + ULONG Prototype: 1; + ULONG reserved: 1; + ULONG PageFrameNumber:20; +} HARDWARE_PTE_ARM, *PHARDWARE_PTE_ARM; + +typedef struct _MMPTE_SOFTWARE +{ + ULONG Valid:1; + ULONG PageFileLow:4; + ULONG Protection:5; + ULONG Prototype:1; + ULONG Transition:1; + ULONG PageFileHigh:20; +} MMPTE_SOFTWARE; + +typedef struct _MMPTE_TRANSITION +{ + ULONG Valid:1; + ULONG Write:1; + ULONG Owner:1; + ULONG WriteThrough:1; + ULONG CacheDisable:1; + ULONG Protection:5; + ULONG Prototype:1; + ULONG Transition:1; + ULONG PageFrameNumber:20; +} MMPTE_TRANSITION; + +typedef struct _MMPTE_PROTOTYPE +{ + ULONG Valid:1; + ULONG ProtoAddressLow:7; + ULONG ReadOnly:1; + ULONG WhichPool:1; + ULONG Prototype:1; + ULONG ProtoAddressHigh:21; +} MMPTE_PROTOTYPE; + +typedef struct _MMPTE_SUBSECTION +{ + ULONG Valid:1; + ULONG SubsectionAddressLow:4; + ULONG Protection:5; + ULONG Prototype:1; + ULONG SubsectionAddressHigh:20; + ULONG WhichPool:1; +} MMPTE_SUBSECTION; + +typedef struct _MMPTE_LIST +{ + ULONG Valid:1; + ULONG OneEntry:1; + ULONG filler0:8; + ULONG NextEntry:20; + ULONG Prototype:1; + ULONG filler1:1; +} MMPTE_LIST; + +typedef struct _MMPTE_HARDWARE +{ + ULONG Valid:1; + ULONG Write:1; + ULONG Owner:1; + ULONG WriteThrough:1; + ULONG CacheDisable:1; + ULONG Accessed:1; + ULONG Dirty:1; + ULONG LargePage:1; + ULONG Global:1; + ULONG CopyOnWrite:1; + ULONG Prototype:1; + ULONG reserved:1; + ULONG PageFrameNumber:20; +} MMPTE_HARDWARE, *PMMPTE_HARDWARE; + +// +// Use the right PTE structure +// +#define HARDWARE_PTE HARDWARE_PTE_ARM +#define PHARDWARE_PTE PHARDWARE_PTE_ARM + +#endif diff --git a/reactos/include/ndk/i386/ketypes.h b/reactos/include/ndk/i386/ketypes.h index f1549950751..7683b47b58f 100644 --- a/reactos/include/ndk/i386/ketypes.h +++ b/reactos/include/ndk/i386/ketypes.h @@ -23,6 +23,17 @@ Author: // Dependencies // +// +// KPCR Access for non-IA64 builds +// +#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS)) +#define PCR ((volatile KPCR * const)K0IPCR) +#if !defined(CONFIG_SMP) && !defined(NT_BUILD) +#define KeGetPcr() PCR +#else +#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C)) +#endif + // // Machine Types // diff --git a/reactos/include/ndk/ketypes.h b/reactos/include/ndk/ketypes.h index 4ea9161566c..be5c529df34 100644 --- a/reactos/include/ndk/ketypes.h +++ b/reactos/include/ndk/ketypes.h @@ -103,17 +103,6 @@ Author: #define KI_EXCEPTION_INTERNAL 0x10000000 #define KI_EXCEPTION_ACCESS_VIOLATION (KI_EXCEPTION_INTERNAL | 0x04) -// -// KPCR Access for non-IA64 builds -// -#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS)) -#define PCR ((volatile KPCR * const)K0IPCR) -#if !defined(CONFIG_SMP) && !defined(NT_BUILD) -#define KeGetPcr() PCR -#else -#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C)) -#endif - // // Number of dispatch codes supported by KINTERRUPT // diff --git a/reactos/include/ndk/pstypes.h b/reactos/include/ndk/pstypes.h index df7ef853248..0047d2f5dc1 100644 --- a/reactos/include/ndk/pstypes.h +++ b/reactos/include/ndk/pstypes.h @@ -535,12 +535,14 @@ typedef NTSTATUS // // Descriptor Table Entry Definition // +#if (_M_IX86) #define _DESCRIPTOR_TABLE_ENTRY_DEFINED typedef struct _DESCRIPTOR_TABLE_ENTRY { ULONG Selector; LDT_ENTRY Descriptor; } DESCRIPTOR_TABLE_ENTRY, *PDESCRIPTOR_TABLE_ENTRY; +#endif // // PEB Lock Routine diff --git a/reactos/include/psdk/intrin.h b/reactos/include/psdk/intrin.h index 37059d8b946..6908c4f383a 100644 --- a/reactos/include/psdk/intrin.h +++ b/reactos/include/psdk/intrin.h @@ -75,6 +75,8 @@ #include "intrin_ppc.h" #elif defined(_MIPS_) #include "intrin_mips.h" +#elif defined(_M_ARM) +#include "intrin_arm.h" #elif defined(__x86_64__) /* TODO: the x64 architecture shares most of the i386 intrinsics. It should be easy to support */ #include "intrin_x86_64.h" diff --git a/reactos/include/psdk/intrin_arm.h b/reactos/include/psdk/intrin_arm.h new file mode 100644 index 00000000000..d2841602f9a --- /dev/null +++ b/reactos/include/psdk/intrin_arm.h @@ -0,0 +1,152 @@ +/* + Compatibility header for GCC -- GCC equivalents of intrinsic + Microsoft Visual C++ functions. Originally developed for the ReactOS + () and TinyKrnl () + projects. + + Copyright (c) 2006 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef KJK_INTRIN_ARM_H_ +#define KJK_INTRIN_ARM_H_ + +#ifndef __GNUC__ +#error Unsupported compiler +#endif + +#define _ReadWriteBarrier() __sync_synchronize() + +FORCEINLINE char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand) +{ + return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +} + +FORCEINLINE short _InterlockedCompareExchange16(volatile short * const Destination, const short Exchange, const short Comperand) +{ + return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +} + +FORCEINLINE long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand) +{ + return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +} + +FORCEINLINE long long _InterlockedCompareExchange64(volatile long long * const Destination, const long long Exchange, const long long Comperand) +{ + return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +} + +FORCEINLINE void * _InterlockedCompareExchangePointer(void * volatile * const Destination, void * const Exchange, void * const Comperand) +{ + return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +} + +FORCEINLINE long _InterlockedExchange(volatile long * const Target, const long Value) +{ + /* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */ + __sync_synchronize(); + return __sync_lock_test_and_set(Target, Value); +} + +FORCEINLINE void * _InterlockedExchangePointer(void * volatile * const Target, void * const Value) +{ + /* NOTE: ditto */ + __sync_synchronize(); + return __sync_lock_test_and_set(Target, Value); +} + +static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value) +{ + return __sync_fetch_and_add(Addend, Value); +} + +FORCEINLINE long _InterlockedExchangeAdd(volatile long * const Addend, const long Value) +{ + return __sync_fetch_and_add(Addend, Value); +} + +FORCEINLINE char _InterlockedAnd8(volatile char * const value, const char mask) +{ + return __sync_fetch_and_and(value, mask); +} + +FORCEINLINE short _InterlockedAnd16(volatile short * const value, const short mask) +{ + return __sync_fetch_and_and(value, mask); +} + +FORCEINLINE long _InterlockedAnd(volatile long * const value, const long mask) +{ + return __sync_fetch_and_and(value, mask); +} + +FORCEINLINE char _InterlockedOr8(volatile char * const value, const char mask) +{ + return __sync_fetch_and_or(value, mask); +} + +FORCEINLINE short _InterlockedOr16(volatile short * const value, const short mask) +{ + return __sync_fetch_and_or(value, mask); +} + +FORCEINLINE long _InterlockedOr(volatile long * const value, const long mask) +{ + return __sync_fetch_and_or(value, mask); +} + +FORCEINLINE char _InterlockedXor8(volatile char * const value, const char mask) +{ + return __sync_fetch_and_xor(value, mask); +} + +FORCEINLINE short _InterlockedXor16(volatile short * const value, const short mask) +{ + return __sync_fetch_and_xor(value, mask); +} + +FORCEINLINE long _InterlockedXor(volatile long * const value, const long mask) +{ + return __sync_fetch_and_xor(value, mask); +} + +static __inline__ __attribute__((always_inline)) long _InterlockedDecrement(volatile long * const lpAddend) +{ + return _InterlockedExchangeAdd(lpAddend, -1) - 1; +} + +static __inline__ __attribute__((always_inline)) long _InterlockedIncrement(volatile long * const lpAddend) +{ + return _InterlockedExchangeAdd(lpAddend, 1) + 1; +} + +static __inline__ __attribute__((always_inline)) long _InterlockedDecrement16(volatile short * const lpAddend) +{ + return _InterlockedExchangeAdd16(lpAddend, -1) - 1; +} + +static __inline__ __attribute__((always_inline)) long _InterlockedIncrement16(volatile short * const lpAddend) +{ + return _InterlockedExchangeAdd16(lpAddend, 1) + 1; +} + +#endif +/* EOF */ diff --git a/reactos/include/psdk/winnt.h b/reactos/include/psdk/winnt.h index c08975402eb..9835cd6cb61 100644 --- a/reactos/include/psdk/winnt.h +++ b/reactos/include/psdk/winnt.h @@ -4064,6 +4064,8 @@ static __inline__ PVOID GetCurrentFiber(void) ); return ret; } +#elif defined (_M_ARM) + PVOID WINAPI GetCurrentFiber(VOID); #else #if defined(_M_PPC) static __inline__ __attribute__((always_inline)) unsigned long __readfsdword_winnt(const unsigned long Offset) @@ -4101,6 +4103,8 @@ static __inline__ struct _TEB * NtCurrentTeb(void) return ret; } +#elif _M_ARM + struct _TEB* WINAPI NtCurrentTeb(VOID); #else static __inline__ struct _TEB * NtCurrentTeb(void) { @@ -4235,6 +4239,8 @@ BitScanReverse(OUT ULONG *Index, #define YieldProcessor() __asm__ __volatile__("nop"); #elif defined(_M_MIPS) #define YieldProcessor() __asm__ __volatile__("nop"); +#elif defined(_M_ARM) +#define YieldProcessor() #else #error Unknown architecture #endif diff --git a/reactos/tools/nci/ncitool.c b/reactos/tools/nci/ncitool.c index aab45f2f72a..9fbfa6a3128 100644 --- a/reactos/tools/nci/ncitool.c +++ b/reactos/tools/nci/ncitool.c @@ -68,6 +68,13 @@ " j $8\n" \ " nop\n" +// +// For now, only supports 0-4 arguments +// +#define UserModeStub_arm " mov r12, #0x%x\n" \ + " swi #0x2E\n" \ + " bx lr\n\n" + #elif defined(_MSC_VER) #define UserModeStub_x86 " asm { \n" \ " mov eax, %xh\n" \ @@ -97,6 +104,10 @@ #define KernelModeStub_mips " j KiSystemService\n" \ " nop\n" +#define KernelModeStub_arm " mov r12, #0x%x\n" \ + " swi #0x2E\n" \ + " bx lr\n\n" + #elif defined(_MSC_VER) #define KernelModeStub_x86 " asm { \n" \ " mov eax, %xh\n" \ @@ -127,6 +138,8 @@ struct ncitool_data_t ncitool_data[] = { "\t.globl %s\n", "%s:\n" }, { "mips", 4, KernelModeStub_mips, UserModeStub_mips, "\t.globl %s\n", "%s:\n" }, + { "arm", 4, KernelModeStub_arm, UserModeStub_arm, + "\t.globl %s\n", "%s:\n" }, { 0, } }; int arch_sel = 0;