https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4363e74ddcb26a528c272…
commit 4363e74ddcb26a528c2723ab0afe5af3443bde6f
Author: Justin Miller <justinmiller100(a)gmail.com>
AuthorDate: Wed May 25 07:06:32 2022 -0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed May 25 17:06:32 2022 +0300
[REACTOS] Finally get some ARM64 applications building (#4517)
- Add some missing ARM64 exports to ntdll, kernel32 and user32
- Create mmtypes header file based on WoA debug symbols
- Get the remaining headers in order, so we can build ARM64 apps
- Adjust subsystem version for binaries so they can run on WoA host
- Get calc, notepad and more base apps to build for ARM64 platform
CORE-17518
Reviewed-by: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
Reviewed-by: Stanislav Motylkov <x86corez(a)gmail.com>
---
dll/ntdll/def/ntdll.spec | 4 +-
dll/win32/kernel32/kernel32.spec | 6 +-
sdk/cmake/msvc.cmake | 2 +-
sdk/include/asm/CMakeLists.txt | 2 +
sdk/include/asm/genincdata.c | 2 +
sdk/include/asm/ksarm64.template.h | 8 +
sdk/include/asm/ksx.template.h | 2 +-
sdk/include/crt/excpt.h | 2 +-
sdk/include/crt/malloc.h | 2 +-
sdk/include/ndk/arch/ketypes.h | 2 +
sdk/include/ndk/arch/mmtypes.h | 2 +
sdk/include/ndk/arm64/ketypes.h | 293 +++++++++++++++++++++++++++++++++++++
sdk/include/ndk/arm64/mmtypes.h | 151 +++++++++++++++++++
sdk/include/ndk/ketypes.h | 4 +-
sdk/include/ndk/rtltypes.h | 2 +
sdk/include/reactos/windbgkd.h | 20 +++
sdk/include/xdk/arm64/ke.h | 17 +++
sdk/include/xdk/winnt_old.h | 13 ++
sdk/lib/crt/startup/mscmain.c | 2 +-
sdk/lib/runtmchk/rtcapi.c | 2 +-
win32ss/user/user32/user32.spec | 8 +-
21 files changed, 529 insertions(+), 17 deletions(-)
diff --git a/dll/ntdll/def/ntdll.spec b/dll/ntdll/def/ntdll.spec
index ef7b4f90ed4..57ba0653d7c 100644
--- a/dll/ntdll/def/ntdll.spec
+++ b/dll/ntdll/def/ntdll.spec
@@ -1756,8 +1756,8 @@
@ cdecl -arch=i386 _CIpow()
@ cdecl -arch=i386 _CIsin()
@ cdecl -arch=i386 _CIsqrt()
-@ cdecl -arch=x86_64,arm __C_specific_handler(ptr long ptr ptr)
-@ cdecl -arch=x86_64,arm __chkstk()
+@ cdecl -arch=x86_64,arm,arm64 __C_specific_handler(ptr long ptr ptr)
+@ cdecl -arch=x86_64,arm,arm64 __chkstk()
@ cdecl __isascii(long)
@ cdecl __iscsym(long)
@ cdecl __iscsymf(long)
diff --git a/dll/win32/kernel32/kernel32.spec b/dll/win32/kernel32/kernel32.spec
index 14050c9447d..5286c2a3e26 100644
--- a/dll/win32/kernel32/kernel32.spec
+++ b/dll/win32/kernel32/kernel32.spec
@@ -1224,15 +1224,15 @@
@ stdcall WriteProfileStringW(wstr wstr wstr)
@ stdcall WriteTapemark(ptr long long long)
@ stdcall ZombifyActCtx(ptr)
-@ stdcall -arch=x86_64 __C_specific_handler() ntdll.__C_specific_handler
-@ stdcall -arch=x86_64 __chkstk() ntdll.__chkstk
+@ stdcall -arch=x86_64,arm64 __C_specific_handler() ntdll.__C_specific_handler
+@ stdcall -arch=x86_64,arm64 __chkstk() ntdll.__chkstk
;@ stdcall -arch=x86_64 __misaligned_access() ntdll.__misaligned_access
@ stdcall _hread(long ptr long)
@ stdcall _hwrite(long ptr long)
@ stdcall _lclose(long)
@ stdcall _lcreat(str long)
@ stdcall _llseek(long long long)
-@ stdcall -arch=x86_64 _local_unwind() ntdll._local_unwind
+@ stdcall -arch=x86_64,arm64 _local_unwind() ntdll._local_unwind
@ stdcall _lopen(str long)
@ stdcall _lread(long ptr long) _hread
@ stdcall _lwrite(long ptr long) _hwrite
diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake
index cfd852211f6..2d482227730 100644
--- a/sdk/cmake/msvc.cmake
+++ b/sdk/cmake/msvc.cmake
@@ -252,7 +252,7 @@ function(set_subsystem MODULE SUBSYSTEM)
elseif(ARCH STREQUAL "arm")
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.02")
elseif(ARCH STREQUAL "arm64")
- target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.04")
+ target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.02")
else()
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},5.01")
endif()
diff --git a/sdk/include/asm/CMakeLists.txt b/sdk/include/asm/CMakeLists.txt
index dd3ad312565..9daa2f7721d 100644
--- a/sdk/include/asm/CMakeLists.txt
+++ b/sdk/include/asm/CMakeLists.txt
@@ -16,6 +16,8 @@ elseif(ARCH STREQUAL "amd64")
set(_filename ksamd64.inc)
elseif(ARCH STREQUAL "arm")
set(_filename ksarm.h)
+elseif(ARCH STREQUAL "arm64")
+ set(_filename ksarm64.h)
endif()
add_custom_command(
diff --git a/sdk/include/asm/genincdata.c b/sdk/include/asm/genincdata.c
index ec4c364edb7..de21836bed6 100644
--- a/sdk/include/asm/genincdata.c
+++ b/sdk/include/asm/genincdata.c
@@ -67,6 +67,8 @@ ASMGENDATA Table[] =
#include "ksamd64.template.h"
#elif defined(_M_ARM)
#include "ksarm.template.h"
+#elif defined(_M_ARM64)
+#include "ksarm64.template.h"
#endif
/* PORTABLE CONSTANTS ********************************************************/
diff --git a/sdk/include/asm/ksarm64.template.h b/sdk/include/asm/ksarm64.template.h
new file mode 100644
index 00000000000..0919d3379f9
--- /dev/null
+++ b/sdk/include/asm/ksarm64.template.h
@@ -0,0 +1,8 @@
+
+#define CONTEXT_ARM64 0x00400000L
+#define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x1L)
+#define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x2L)
+#define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x4L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x8L)
+#define CONTEXT_X18 (CONTEXT_ARM64 | 0x10L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
diff --git a/sdk/include/asm/ksx.template.h b/sdk/include/asm/ksx.template.h
index 9cf895d3fd2..b434717f382 100644
--- a/sdk/include/asm/ksx.template.h
+++ b/sdk/include/asm/ksx.template.h
@@ -332,7 +332,7 @@ CONSTANT(DBG_STATUS_CONTROL_C),
//CONSTANT(KI_SLIST_FAULT_COUNT_MAXIMUM), // i386
//CONSTANTUSER_CALLBACK_FILTER),
-#ifndef _M_ARM
+#if !defined(_M_ARM) && !defined(_M_ARM64)
CONSTANT(MAXIMUM_IDTVECTOR),
//CONSTANT(MAXIMUM_PRIMARY_VECTOR),
CONSTANT(PRIMARY_VECTOR_BASE),
diff --git a/sdk/include/crt/excpt.h b/sdk/include/crt/excpt.h
index 8bf543416c1..62841cbda23 100644
--- a/sdk/include/crt/excpt.h
+++ b/sdk/include/crt/excpt.h
@@ -53,7 +53,7 @@ typedef enum _EXCEPTION_DISPOSITION
_Inout_ struct _DISPATCHER_CONTEXT *_DispatcherContext,
_In_ unsigned __int64 _GlobalPointer);
-#elif defined(__x86_64) || defined(_M_ARM)
+#elif defined(__x86_64) || defined(_M_ARM) || defined(_M_ARM64)
struct _EXCEPTION_RECORD;
struct _CONTEXT;
diff --git a/sdk/include/crt/malloc.h b/sdk/include/crt/malloc.h
index 553032edfb7..77854f3b7c7 100644
--- a/sdk/include/crt/malloc.h
+++ b/sdk/include/crt/malloc.h
@@ -310,7 +310,7 @@ extern "C" {
#if(defined(_X86_) && !defined(__x86_64))
#define _ALLOCA_S_MARKER_SIZE 8
-#elif defined(__ia64__) || defined(__x86_64)
+#elif defined(__ia64__) || defined(__x86_64) || defined(__arm64__)
#define _ALLOCA_S_MARKER_SIZE 16
#elif defined(__arm__)
#define _ALLOCA_S_MARKER_SIZE 8
diff --git a/sdk/include/ndk/arch/ketypes.h b/sdk/include/ndk/arch/ketypes.h
index 1d6394144c5..5eb1ee14a83 100644
--- a/sdk/include/ndk/arch/ketypes.h
+++ b/sdk/include/ndk/arch/ketypes.h
@@ -30,6 +30,8 @@ Author:
#include <powerpc/ketypes.h>
#elif defined(_M_ARM)
#include <arm/ketypes.h>
+#elif defined(_M_ARM64)
+#include <arm64/ketypes.h>
#else
#error "Unknown processor"
#endif
diff --git a/sdk/include/ndk/arch/mmtypes.h b/sdk/include/ndk/arch/mmtypes.h
index e83c9579e64..d8744c52b68 100644
--- a/sdk/include/ndk/arch/mmtypes.h
+++ b/sdk/include/ndk/arch/mmtypes.h
@@ -30,6 +30,8 @@ Author:
#include <arm/mmtypes.h>
#elif defined(_M_AMD64)
#include <amd64/mmtypes.h>
+#elif defined(_M_ARM64)
+#include <arm64/mmtypes.h>
#else
#error "Unknown processor"
#endif
diff --git a/sdk/include/ndk/arm64/ketypes.h b/sdk/include/ndk/arm64/ketypes.h
new file mode 100644
index 00000000000..2536ecc6c74
--- /dev/null
+++ b/sdk/include/ndk/arm64/ketypes.h
@@ -0,0 +1,293 @@
+
+
+#ifndef _ARM64_KETYPES_H
+#define _ARM64_KETYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Interrupt request levels */
+#define PASSIVE_LEVEL 0
+#define LOW_LEVEL 0
+#define APC_LEVEL 1
+#define DISPATCH_LEVEL 2
+#define CMCI_LEVEL 5
+#define CLOCK_LEVEL 13
+#define IPI_LEVEL 14
+#define DRS_LEVEL 14
+#define POWER_LEVEL 14
+#define PROFILE_LEVEL 15
+#define HIGH_LEVEL 15
+
+//
+// IPI Types
+//
+#define IPI_APC 1
+#define IPI_DPC 2
+#define IPI_FREEZE 4
+#define IPI_PACKET_READY 6
+#define IPI_SYNCH_REQUEST 16
+
+//
+// PRCB Flags
+//
+#define PRCB_MAJOR_VERSION 1
+#define PRCB_BUILD_DEBUG 1
+#define PRCB_BUILD_UNIPROCESSOR 2
+
+//
+// No LDTs on ARM64
+//
+#define LDT_ENTRY ULONG
+
+
+//
+// HAL Variables
+//
+#define INITIAL_STALL_COUNT 100
+#define MM_HAL_VA_START 0xFFFFFFFFFFC00000ULL
+#define MM_HAL_VA_END 0xFFFFFFFFFFFFFFFFULL
+
+//
+// Structure for CPUID info
+//
+typedef union _CPU_INFO
+{
+ ULONG dummy;
+} CPU_INFO, *PCPU_INFO;
+
+typedef struct _KTRAP_FRAME
+{
+ UCHAR ExceptionActive;
+ UCHAR ContextFromKFramesUnwound;
+ UCHAR DebugRegistersValid;
+ union
+ {
+ struct
+ {
+ CHAR PreviousMode;
+ UCHAR PreviousIrql;
+ };
+ };
+ ULONG Reserved;
+ union
+ {
+ struct
+ {
+ ULONG64 FaultAddress;
+ ULONG64 TrapFrame;
+ };
+ };
+ //struct PKARM64_VFP_STATE VfpState;
+ ULONG VfpState;
+ ULONG Bcr[8];
+ ULONG64 Bvr[8];
+ ULONG Wcr[2];
+ ULONG64 Wvr[2];
+ ULONG Spsr;
+ ULONG Esr;
+ ULONG64 Sp;
+ union
+ {
+ ULONG64 X[19];
+ struct
+ {
+ ULONG64 X0;
+ ULONG64 X1;
+ ULONG64 X2;
+ ULONG64 X3;
+ ULONG64 X4;
+ ULONG64 X5;
+ ULONG64 X6;
+ ULONG64 X7;
+ ULONG64 X8;
+ ULONG64 X9;
+ ULONG64 X10;
+ ULONG64 X11;
+ ULONG64 X12;
+ ULONG64 X13;
+ ULONG64 X14;
+ ULONG64 X15;
+ ULONG64 X16;
+ ULONG64 X17;
+ ULONG64 X18;
+ };
+ };
+ ULONG64 Lr;
+ ULONG64 Fp;
+ ULONG64 Pc;
+} KTRAP_FRAME, *PKTRAP_FRAME;
+
+typedef struct _KEXCEPTION_FRAME
+{
+ ULONG dummy;
+} KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
+
+#ifndef NTOS_MODE_USER
+
+typedef struct _TRAPFRAME_LOG_ENTRY
+{
+ ULONG64 Thread;
+ UCHAR CpuNumber;
+ UCHAR TrapType;
+ USHORT Padding;
+ ULONG Cpsrl;
+ ULONG64 X0;
+ ULONG64 X1;
+ ULONG64 X2;
+ ULONG64 X3;
+ ULONG64 X4;
+ ULONG64 X5;
+ ULONG64 X6;
+ ULONG64 X7;
+ ULONG64 Fp;
+ ULONG64 Lr;
+ ULONG64 Sp;
+ ULONG64 Pc;
+ ULONG64 Far;
+ ULONG Esr;
+ ULONG Reserved1;
+} TRAPFRAME_LOG_ENTRY, *PTRAPFRAME_LOG_ENTRY;
+
+//
+// Processor Region Control Block
+// Based on WoA
+//
+typedef struct _KPRCB
+{
+ ULONG dummy;
+} KPRCB, *PKPRCB;
+
+//
+// Processor Control Region
+// Based on WoA
+//
+typedef struct _KIPCR
+{
+ union
+ {
+ struct
+ {
+ ULONG TibPad0[2];
+ PVOID Spare1;
+ struct _KPCR *Self;
+ PVOID PcrReserved0;
+ struct _KSPIN_LOCK_QUEUE* LockArray;
+ PVOID Used_Self;
+ };
+ };
+ KIRQL CurrentIrql;
+ UCHAR SecondLevelCacheAssociativity;
+ UCHAR Pad1[2];
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ ULONG StallScaleFactor;
+ ULONG SecondLevelCacheSize;
+ struct
+ {
+ UCHAR ApcInterrupt;
+ UCHAR DispatchInterrupt;
+ };
+ USHORT InterruptPad;
+ UCHAR BtiMitigation;
+ struct
+ {
+ UCHAR SsbMitigationFirmware:1;
+ UCHAR SsbMitigationDynamic:1;
+ UCHAR SsbMitigationKernel:1;
+ UCHAR SsbMitigationUser:1;
+ UCHAR SsbMitigationReserved:4;
+ };
+ UCHAR Pad2[2];
+ ULONG64 PanicStorage[6];
+ PVOID KdVersionBlock;
+ PVOID HalReserved[134];
+ PVOID KvaUserModeTtbr1;
+
+ /* Private members, not in ntddk.h */
+ PVOID Idt[256];
+ PVOID* IdtExt;
+ PVOID PcrAlign[15];
+ KPRCB Prcb;
+} KIPCR, *PKIPCR;
+
+//
+// Special Registers Structure (outside of CONTEXT)
+// Based on WoA symbols
+//
+typedef struct _KSPECIAL_REGISTERS
+{
+ ULONG64 Elr_El1;
+ UINT32 Spsr_El1;
+ ULONG64 Tpidr_El0;
+ ULONG64 Tpidrro_El0;
+ ULONG64 Tpidr_El1;
+ ULONG64 KernelBvr[8];
+ ULONG KernelBcr[8];
+ ULONG64 KernelWvr[2];
+ ULONG KernelWcr[2];
+} KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS;
+
+//
+// ARM64 Architecture State
+// Based on WoA symbols
+//
+typedef struct _KARM64_ARCH_STATE
+{
+ ULONG64 Midr_El1;
+ ULONG64 Sctlr_El1;
+ ULONG64 Actlr_El1;
+ ULONG64 Cpacr_El1;
+ ULONG64 Tcr_El1;
+ ULONG64 Ttbr0_El1;
+ ULONG64 Ttbr1_El1;
+ ULONG64 Esr_El1;
+ ULONG64 Far_El1;
+ ULONG64 Pmcr_El0;
+ ULONG64 Pmcntenset_El0;
+ ULONG64 Pmccntr_El0;
+ ULONG64 Pmxevcntr_El0[31];
+ ULONG64 Pmxevtyper_El0[31];
+ ULONG64 Pmovsclr_El0;
+ ULONG64 Pmselr_El0;
+ ULONG64 Pmuserenr_El0;
+ ULONG64 Mair_El1;
+ ULONG64 Vbar_El1;
+} KARM64_ARCH_STATE, *PKARM64_ARCH_STATE;
+
+typedef struct _KPROCESSOR_STATE
+{
+ KSPECIAL_REGISTERS SpecialRegisters; // 0
+ KARM64_ARCH_STATE ArchState; // 160
+ CONTEXT ContextFrame; // 800
+} KPROCESSOR_STATE, *PKPROCESSOR_STATE;
+
+//
+// Macro to get current KPRCB
+//
+FORCEINLINE
+struct _KPRCB *
+KeGetCurrentPrcb(VOID)
+{
+ //UNIMPLEMENTED;
+ return 0;
+}
+
+//
+// Just read it from the PCR
+//
+#define KeGetCurrentIrql() KeGetPcr()->CurrentIrql
+#define _KeGetCurrentThread() KeGetCurrentPrcb()->CurrentThread
+#define _KeGetPreviousMode()
KeGetCurrentPrcb()->CurrentThread->PreviousMode
+#define _KeIsExecutingDpc() (KeGetCurrentPrcb()->DpcRoutineActive != 0)
+#define KeGetCurrentThread() _KeGetCurrentThread()
+#define KeGetPreviousMode() _KeGetPreviousMode()
+
+#endif // !NTOS_MODE_USER
+
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
+#endif // !_ARM64_KETYPES_H
diff --git a/sdk/include/ndk/arm64/mmtypes.h b/sdk/include/ndk/arm64/mmtypes.h
new file mode 100644
index 00000000000..96235a3d3b9
--- /dev/null
+++ b/sdk/include/ndk/arm64/mmtypes.h
@@ -0,0 +1,151 @@
+
+#ifndef _ARM64_MMTYPES_H
+#define _ARM64_MMTYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// Page-related Macros
+//
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 0x1000
+#endif
+#define PAGE_SHIFT 12L
+#define MM_ALLOCATION_GRANULARITY 0x10000
+#define MM_ALLOCATION_GRANULARITY_SHIFT 16L
+#define MM_PAGE_FRAME_NUMBER_SIZE 20
+
+/* Following structs are based on WoA symbols */
+typedef struct _HARDWARE_PTE
+{
+ /* 8 Byte struct */
+ ULONG64 Valid:1;
+ ULONG64 NotLargePage:1;
+ ULONG64 CacheType:2;
+ ULONG64 OsAvailable2:1;
+ ULONG64 NonSecure:1;
+ ULONG64 Owner:1;
+ ULONG64 NotDirty:1;
+ ULONG64 Shareability:2;
+ ULONG64 Accessed:1;
+ ULONG64 NonGlobal:1;
+ ULONG64 PageFrameNumber:36;
+ ULONG64 RsvdZ1:4;
+ ULONG64 ContigousBit:1;
+ ULONG64 PrivilegedNoExecute:1;
+ ULONG64 UserNoExecute:1;
+ ULONG64 Writable:1;
+ ULONG64 CopyOnWrite:1;
+ ULONG64 OsAvailable:2;
+ ULONG64 PxnTable:1;
+ ULONG64 UxnTable:1;
+ ULONG64 ApTable:2;
+ ULONG64 NsTable:1;
+} HARDWARE_PTE, *PHARDWARE_PTE;
+
+typedef struct _MMPTE_SOFTWARE
+{
+ /* 8 Byte struct */
+ ULONG64 Valid:1;
+ ULONG64 Protection:5;
+ ULONG64 PageFileLow:4;
+ ULONG64 Prototype:1;
+ ULONG64 Transition:1;
+ ULONG64 PageFileReserved:1;
+ ULONG64 PageFileAllocated:1;
+ ULONG64 UsedPageTableEntries:10;
+ ULONG64 ColdPage:1;
+ ULONG64 OnStandbyLookaside:1;
+ ULONG64 RsvdZ1:6;
+ ULONG64 PageFileHigh:32;
+} MMPTE_SOFTWARE;
+
+typedef struct _MMPTE_TRANSITION
+{
+ /* 8 Byte struct */
+ ULONG64 Valid:1;
+ ULONG64 Protection:5;
+ ULONG64 Spare:2;
+ ULONG64 OnStandbyLookaside:1;
+ ULONG64 IoTracker:1;
+ ULONG64 Prototype:1;
+ ULONG64 Transition:1;
+ ULONG64 PageFrameNumber:40;
+ ULONG64 RsvdZ1:12;
+} MMPTE_TRANSITION;
+
+typedef struct _MMPTE_PROTOTYPE
+{
+ /* 8 Byte struct */
+ ULONG64 Valid:1;
+ ULONG64 Protection:5;
+ ULONG64 HiberVerifyConverted:1;
+ ULONG64 Unused1:1;
+ ULONG64 ReadOnly:1;
+ ULONG64 Combined:1;
+ ULONG64 Prototype:1;
+ ULONG64 DemandFillProto:1;
+ ULONG64 RsvdZ1:4;
+ ULONG64 ProtoAddress:48;
+} MMPTE_PROTOTYPE;
+
+typedef struct _MMPTE_SUBSECTION
+{
+ /* 8 Byte struct */
+ ULONG64 Valid:1;
+ ULONG64 Protection:5;
+ ULONG64 OnStandbyLookaside:1;
+ ULONG64 RsvdZ1:3;
+ ULONG64 Prototype:1;
+ ULONG64 ColdPage:1;
+ ULONG64 RsvdZ2:4;
+ ULONG64 SubsectionAddress:48;
+} MMPTE_SUBSECTION;
+
+typedef struct _MMPTE_TIMESTAMP
+{
+ /* 8 Byte struct */
+ ULONG64 MustBeZero:1;
+ ULONG64 Protection:5;
+ ULONG64 PageFileLow:4;
+ ULONG64 Prototype:1;
+ ULONG64 Transition:1;
+ ULONG64 RsvdZ1:20;
+ ULONG64 GlobalTimeStamp:32;
+} MMPTE_TIMESTAMP;
+
+typedef struct _MMPTE_LIST
+{
+ /* 8 Byte struct */
+ ULONG64 Valid:1;
+ ULONG64 Protection:5;
+ ULONG64 OneEntry:1;
+ ULONG64 RsvdZ1:3;
+ ULONG64 Prototype:1;
+ ULONG64 Transition:1;
+ ULONG64 RsvdZ2:16;
+ ULONG64 NextEntry:36;
+} MMPTE_LIST;
+
+typedef struct _MMPTE
+{
+ union
+ {
+ ULONG_PTR Long;
+ HARDWARE_PTE Flush;
+ HARDWARE_PTE Hard;
+ MMPTE_PROTOTYPE Proto;
+ MMPTE_SOFTWARE Soft;
+ MMPTE_TRANSITION Trans;
+ MMPTE_SUBSECTION Subsect;
+ MMPTE_LIST List;
+ } u;
+} MMPTE, *PMMPTE;
+
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
+#endif
diff --git a/sdk/include/ndk/ketypes.h b/sdk/include/ndk/ketypes.h
index 255ba53a1c9..6556de0d737 100644
--- a/sdk/include/ndk/ketypes.h
+++ b/sdk/include/ndk/ketypes.h
@@ -1213,7 +1213,7 @@ typedef struct _KTHREAD
};
};
KSPIN_LOCK ApcQueueLock;
-#ifndef _M_AMD64 // [
+#if !defined(_M_AMD64) && !defined(_M_ARM64) // [
ULONG ContextSwitches;
volatile UCHAR State;
UCHAR NpxState;
@@ -1263,7 +1263,7 @@ typedef struct _KTHREAD
SINGLE_LIST_ENTRY SwapListEntry;
};
PKQUEUE Queue;
-#ifndef _M_AMD64 // [
+#if !defined(_M_AMD64) && !defined(_M_ARM64) // [
ULONG WaitTime;
union
{
diff --git a/sdk/include/ndk/rtltypes.h b/sdk/include/ndk/rtltypes.h
index 62bca65bee1..03ac5156214 100644
--- a/sdk/include/ndk/rtltypes.h
+++ b/sdk/include/ndk/rtltypes.h
@@ -1797,6 +1797,8 @@ typedef struct _STACK_TRACE_DATABASE
#ifndef NTOS_MODE_USER
#if defined(_M_AMD64)
C_ASSERT(sizeof(ERESOURCE) <= 0x68);
+#elif defined(_M_ARM64)
+C_ASSERT(sizeof(ERESOURCE) <= 0x68);
#else
C_ASSERT(sizeof(ERESOURCE) <= 56);
#endif
diff --git a/sdk/include/reactos/windbgkd.h b/sdk/include/reactos/windbgkd.h
index 1f928b041a0..8c0784cabaf 100644
--- a/sdk/include/reactos/windbgkd.h
+++ b/sdk/include/reactos/windbgkd.h
@@ -266,6 +266,13 @@ typedef struct _ARM_DBGKD_CONTROL_SET
ULONG CurrentSymbolEnd;
} ARM_DBGKD_CONTROL_SET, *PARM_DBGKD_CONTROL_SET;
+typedef struct _ARM64_DBGKD_CONTROL_SET
+{
+ ULONG Continue;
+ ULONG CurrentSymbolStart;
+ ULONG CurrentSymbolEnd;
+} ARM64_DBGKD_CONTROL_SET, *PARM64_DBGKD_CONTROL_SET;
+
typedef struct _DBGKD_ANY_CONTROL_SET
{
union
@@ -285,6 +292,8 @@ typedef X86_DBGKD_CONTROL_SET DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
typedef AMD64_DBGKD_CONTROL_SET DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
#elif defined(_M_ARM)
typedef ARM_DBGKD_CONTROL_SET DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
+#elif defined(_M_ARM64)
+typedef ARM64_DBGKD_CONTROL_SET DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
#else
#error Unsupported Architecture
#endif
@@ -354,6 +363,14 @@ typedef struct _ARM_DBGKD_CONTROL_REPORT
UCHAR InstructionStream[DBGKD_MAXSTREAM];
} ARM_DBGKD_CONTROL_REPORT, *PARM_DBGKD_CONTROL_REPORT;
+typedef struct _ARM64_DBGKD_CONTROL_REPORT
+{
+ ULONG64 Bvr;
+ ULONG64 Wvr;
+ ULONG InstructionCount;
+ UCHAR InstructionStream[DBGKD_MAXSTREAM];
+} ARM64_DBGKD_CONTROL_REPORT, *PARM64_DBGKD_CONTROL_REPORT;
+
typedef struct _DBGKD_ANY_CONTROL_REPORT
{
union
@@ -363,6 +380,7 @@ typedef struct _DBGKD_ANY_CONTROL_REPORT
IA64_DBGKD_CONTROL_REPORT IA64ControlReport;
AMD64_DBGKD_CONTROL_REPORT Amd64ControlReport;
ARM_DBGKD_CONTROL_REPORT ARMControlReport;
+ ARM64_DBGKD_CONTROL_REPORT ARM64ControlReport;
};
} DBGKD_ANY_CONTROL_REPORT, *PDBGKD_ANY_CONTROL_REPORT;
@@ -372,6 +390,8 @@ typedef X86_DBGKD_CONTROL_REPORT DBGKD_CONTROL_REPORT,
*PDBGKD_CONTROL_REPORT;
typedef AMD64_DBGKD_CONTROL_REPORT DBGKD_CONTROL_REPORT, *PDBGKD_CONTROL_REPORT;
#elif defined(_M_ARM)
typedef ARM_DBGKD_CONTROL_REPORT DBGKD_CONTROL_REPORT, *PDBGKD_CONTROL_REPORT;
+#elif defined(_M_ARM64)
+typedef ARM64_DBGKD_CONTROL_REPORT DBGKD_CONTROL_REPORT, *PDBGKD_CONTROL_REPORT;
#else
#error Unsupported Architecture
#endif
diff --git a/sdk/include/xdk/arm64/ke.h b/sdk/include/xdk/arm64/ke.h
index 6fca07e5e56..9b123794e12 100644
--- a/sdk/include/xdk/arm64/ke.h
+++ b/sdk/include/xdk/arm64/ke.h
@@ -13,6 +13,23 @@ $if (_WDMDDK_)
#define PROFILE_LEVEL 15
#define HIGH_LEVEL 15
+#define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
+
+#define PAGE_SIZE 0x1000
+#define PAGE_SHIFT 12L
+
+#define PAUSE_PROCESSOR YieldProcessor();
+
+/* FIXME: Based on AMD64 but needed to compile apps */
+#define KERNEL_STACK_SIZE 12288
+#define KERNEL_LARGE_STACK_SIZE 61440
+#define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
+/* FIXME End */
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
+
NTSYSAPI
PKTHREAD
NTAPI
diff --git a/sdk/include/xdk/winnt_old.h b/sdk/include/xdk/winnt_old.h
index c62c462b294..8e0de26a3da 100644
--- a/sdk/include/xdk/winnt_old.h
+++ b/sdk/include/xdk/winnt_old.h
@@ -4383,6 +4383,17 @@ FORCEINLINE PVOID GetCurrentFiber(VOID)
return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->FiberData;
#endif
}
+#elif defined (_M_ARM64)
+FORCEINLINE struct _TEB * NtCurrentTeb(void)
+{
+ //UNIMPLEMENTED;
+ return 0;
+}
+FORCEINLINE PVOID GetCurrentFiber(VOID)
+{
+ //UNIMPLEMENTED;
+ return 0;
+}
#elif defined(_M_PPC)
FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset)
{
@@ -4478,6 +4489,8 @@ DbgRaiseAssertionFailure(VOID)
#define YieldProcessor() __asm__ __volatile__("nop");
#elif defined(_M_ARM)
#define YieldProcessor __yield
+#elif defined(_M_ARM64)
+#define YieldProcessor __yield
#else
#error Unknown architecture
#endif
diff --git a/sdk/lib/crt/startup/mscmain.c b/sdk/lib/crt/startup/mscmain.c
index cffeb0ab4f9..1a0a91c439f 100644
--- a/sdk/lib/crt/startup/mscmain.c
+++ b/sdk/lib/crt/startup/mscmain.c
@@ -14,7 +14,7 @@
#if defined(_M_IX86)
#pragma comment(linker, "/alternatename:__RTC_Initialize=__RTC_NoInitialize")
-#elif defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
+#elif defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64)
#pragma comment(linker, "/alternatename:_RTC_Initialize=_RTC_NoInitialize")
#else
#error Unsupported platform
diff --git a/sdk/lib/runtmchk/rtcapi.c b/sdk/lib/runtmchk/rtcapi.c
index 20e3a5b4b3b..e246fbc0bb5 100644
--- a/sdk/lib/runtmchk/rtcapi.c
+++ b/sdk/lib/runtmchk/rtcapi.c
@@ -9,7 +9,7 @@
#if defined(_M_IX86)
#pragma comment(linker, "/alternatename:__CRT_RTC_INITW=__CRT_RTC_INITW0")
-#elif defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
+#elif defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64)
#pragma comment(linker, "/alternatename:_CRT_RTC_INITW=_CRT_RTC_INITW0")
#else
#error Unsupported platform
diff --git a/win32ss/user/user32/user32.spec b/win32ss/user/user32/user32.spec
index c026984892a..c7097cc662b 100644
--- a/win32ss/user/user32/user32.spec
+++ b/win32ss/user/user32/user32.spec
@@ -372,8 +372,8 @@
369 stdcall GetWindowDC(long) NtUserGetWindowDC
370 stdcall GetWindowInfo(long ptr)
371 stdcall GetWindowLongA(long long)
-@ stdcall -arch=x86_64 GetWindowLongPtrA(ptr long)
-@ stdcall -arch=x86_64 GetWindowLongPtrW(ptr long)
+@ stdcall -arch=x86_64,arm64 GetWindowLongPtrA(ptr long)
+@ stdcall -arch=x86_64,arm64 GetWindowLongPtrW(ptr long)
372 stdcall GetWindowLongW(long long)
373 stdcall GetWindowModuleFileName(long ptr long) GetWindowModuleFileNameA
374 stdcall GetWindowModuleFileNameA(long ptr long)
@@ -654,8 +654,8 @@
647 stdcall SetWinEventHook(long long long ptr long long long)
648 stdcall SetWindowContextHelpId(long long)
649 stdcall SetWindowLongA(long long long)
-@ stdcall -arch=x86_64 SetWindowLongPtrA(ptr long ptr)
-@ stdcall -arch=x86_64 SetWindowLongPtrW(ptr long ptr)
+@ stdcall -arch=x86_64,arm64 SetWindowLongPtrA(ptr long ptr)
+@ stdcall -arch=x86_64,arm64 SetWindowLongPtrW(ptr long ptr)
650 stdcall SetWindowLongW(long long long)
651 stdcall SetWindowPlacement(long ptr) NtUserSetWindowPlacement
652 stdcall SetWindowPos(long long long long long long long) NtUserSetWindowPos