mirror of
https://github.com/reactos/reactos.git
synced 2025-04-30 02:58:48 +00:00
[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@reactos.org> Reviewed-by: Stanislav Motylkov <x86corez@gmail.com>
This commit is contained in:
parent
3464df8c28
commit
4363e74ddc
21 changed files with 529 additions and 17 deletions
|
@ -1756,8 +1756,8 @@
|
||||||
@ cdecl -arch=i386 _CIpow()
|
@ cdecl -arch=i386 _CIpow()
|
||||||
@ cdecl -arch=i386 _CIsin()
|
@ cdecl -arch=i386 _CIsin()
|
||||||
@ cdecl -arch=i386 _CIsqrt()
|
@ cdecl -arch=i386 _CIsqrt()
|
||||||
@ cdecl -arch=x86_64,arm __C_specific_handler(ptr long ptr ptr)
|
@ cdecl -arch=x86_64,arm,arm64 __C_specific_handler(ptr long ptr ptr)
|
||||||
@ cdecl -arch=x86_64,arm __chkstk()
|
@ cdecl -arch=x86_64,arm,arm64 __chkstk()
|
||||||
@ cdecl __isascii(long)
|
@ cdecl __isascii(long)
|
||||||
@ cdecl __iscsym(long)
|
@ cdecl __iscsym(long)
|
||||||
@ cdecl __iscsymf(long)
|
@ cdecl __iscsymf(long)
|
||||||
|
|
|
@ -1224,15 +1224,15 @@
|
||||||
@ stdcall WriteProfileStringW(wstr wstr wstr)
|
@ stdcall WriteProfileStringW(wstr wstr wstr)
|
||||||
@ stdcall WriteTapemark(ptr long long long)
|
@ stdcall WriteTapemark(ptr long long long)
|
||||||
@ stdcall ZombifyActCtx(ptr)
|
@ stdcall ZombifyActCtx(ptr)
|
||||||
@ stdcall -arch=x86_64 __C_specific_handler() ntdll.__C_specific_handler
|
@ stdcall -arch=x86_64,arm64 __C_specific_handler() ntdll.__C_specific_handler
|
||||||
@ stdcall -arch=x86_64 __chkstk() ntdll.__chkstk
|
@ stdcall -arch=x86_64,arm64 __chkstk() ntdll.__chkstk
|
||||||
;@ stdcall -arch=x86_64 __misaligned_access() ntdll.__misaligned_access
|
;@ stdcall -arch=x86_64 __misaligned_access() ntdll.__misaligned_access
|
||||||
@ stdcall _hread(long ptr long)
|
@ stdcall _hread(long ptr long)
|
||||||
@ stdcall _hwrite(long ptr long)
|
@ stdcall _hwrite(long ptr long)
|
||||||
@ stdcall _lclose(long)
|
@ stdcall _lclose(long)
|
||||||
@ stdcall _lcreat(str long)
|
@ stdcall _lcreat(str long)
|
||||||
@ stdcall _llseek(long long 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 _lopen(str long)
|
||||||
@ stdcall _lread(long ptr long) _hread
|
@ stdcall _lread(long ptr long) _hread
|
||||||
@ stdcall _lwrite(long ptr long) _hwrite
|
@ stdcall _lwrite(long ptr long) _hwrite
|
||||||
|
|
|
@ -252,7 +252,7 @@ function(set_subsystem MODULE SUBSYSTEM)
|
||||||
elseif(ARCH STREQUAL "arm")
|
elseif(ARCH STREQUAL "arm")
|
||||||
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.02")
|
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.02")
|
||||||
elseif(ARCH STREQUAL "arm64")
|
elseif(ARCH STREQUAL "arm64")
|
||||||
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.04")
|
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.02")
|
||||||
else()
|
else()
|
||||||
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},5.01")
|
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},5.01")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -16,6 +16,8 @@ elseif(ARCH STREQUAL "amd64")
|
||||||
set(_filename ksamd64.inc)
|
set(_filename ksamd64.inc)
|
||||||
elseif(ARCH STREQUAL "arm")
|
elseif(ARCH STREQUAL "arm")
|
||||||
set(_filename ksarm.h)
|
set(_filename ksarm.h)
|
||||||
|
elseif(ARCH STREQUAL "arm64")
|
||||||
|
set(_filename ksarm64.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
|
|
@ -67,6 +67,8 @@ ASMGENDATA Table[] =
|
||||||
#include "ksamd64.template.h"
|
#include "ksamd64.template.h"
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
#include "ksarm.template.h"
|
#include "ksarm.template.h"
|
||||||
|
#elif defined(_M_ARM64)
|
||||||
|
#include "ksarm64.template.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PORTABLE CONSTANTS ********************************************************/
|
/* PORTABLE CONSTANTS ********************************************************/
|
||||||
|
|
8
sdk/include/asm/ksarm64.template.h
Normal file
8
sdk/include/asm/ksarm64.template.h
Normal file
|
@ -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)
|
|
@ -332,7 +332,7 @@ CONSTANT(DBG_STATUS_CONTROL_C),
|
||||||
//CONSTANT(KI_SLIST_FAULT_COUNT_MAXIMUM), // i386
|
//CONSTANT(KI_SLIST_FAULT_COUNT_MAXIMUM), // i386
|
||||||
//CONSTANTUSER_CALLBACK_FILTER),
|
//CONSTANTUSER_CALLBACK_FILTER),
|
||||||
|
|
||||||
#ifndef _M_ARM
|
#if !defined(_M_ARM) && !defined(_M_ARM64)
|
||||||
CONSTANT(MAXIMUM_IDTVECTOR),
|
CONSTANT(MAXIMUM_IDTVECTOR),
|
||||||
//CONSTANT(MAXIMUM_PRIMARY_VECTOR),
|
//CONSTANT(MAXIMUM_PRIMARY_VECTOR),
|
||||||
CONSTANT(PRIMARY_VECTOR_BASE),
|
CONSTANT(PRIMARY_VECTOR_BASE),
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef enum _EXCEPTION_DISPOSITION
|
||||||
_Inout_ struct _DISPATCHER_CONTEXT *_DispatcherContext,
|
_Inout_ struct _DISPATCHER_CONTEXT *_DispatcherContext,
|
||||||
_In_ unsigned __int64 _GlobalPointer);
|
_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 _EXCEPTION_RECORD;
|
||||||
struct _CONTEXT;
|
struct _CONTEXT;
|
||||||
|
|
|
@ -310,7 +310,7 @@ extern "C" {
|
||||||
|
|
||||||
#if(defined(_X86_) && !defined(__x86_64))
|
#if(defined(_X86_) && !defined(__x86_64))
|
||||||
#define _ALLOCA_S_MARKER_SIZE 8
|
#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
|
#define _ALLOCA_S_MARKER_SIZE 16
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
#define _ALLOCA_S_MARKER_SIZE 8
|
#define _ALLOCA_S_MARKER_SIZE 8
|
||||||
|
|
|
@ -30,6 +30,8 @@ Author:
|
||||||
#include <powerpc/ketypes.h>
|
#include <powerpc/ketypes.h>
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
#include <arm/ketypes.h>
|
#include <arm/ketypes.h>
|
||||||
|
#elif defined(_M_ARM64)
|
||||||
|
#include <arm64/ketypes.h>
|
||||||
#else
|
#else
|
||||||
#error "Unknown processor"
|
#error "Unknown processor"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,8 @@ Author:
|
||||||
#include <arm/mmtypes.h>
|
#include <arm/mmtypes.h>
|
||||||
#elif defined(_M_AMD64)
|
#elif defined(_M_AMD64)
|
||||||
#include <amd64/mmtypes.h>
|
#include <amd64/mmtypes.h>
|
||||||
|
#elif defined(_M_ARM64)
|
||||||
|
#include <arm64/mmtypes.h>
|
||||||
#else
|
#else
|
||||||
#error "Unknown processor"
|
#error "Unknown processor"
|
||||||
#endif
|
#endif
|
||||||
|
|
293
sdk/include/ndk/arm64/ketypes.h
Normal file
293
sdk/include/ndk/arm64/ketypes.h
Normal file
|
@ -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
|
151
sdk/include/ndk/arm64/mmtypes.h
Normal file
151
sdk/include/ndk/arm64/mmtypes.h
Normal file
|
@ -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
|
|
@ -1213,7 +1213,7 @@ typedef struct _KTHREAD
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
KSPIN_LOCK ApcQueueLock;
|
KSPIN_LOCK ApcQueueLock;
|
||||||
#ifndef _M_AMD64 // [
|
#if !defined(_M_AMD64) && !defined(_M_ARM64) // [
|
||||||
ULONG ContextSwitches;
|
ULONG ContextSwitches;
|
||||||
volatile UCHAR State;
|
volatile UCHAR State;
|
||||||
UCHAR NpxState;
|
UCHAR NpxState;
|
||||||
|
@ -1263,7 +1263,7 @@ typedef struct _KTHREAD
|
||||||
SINGLE_LIST_ENTRY SwapListEntry;
|
SINGLE_LIST_ENTRY SwapListEntry;
|
||||||
};
|
};
|
||||||
PKQUEUE Queue;
|
PKQUEUE Queue;
|
||||||
#ifndef _M_AMD64 // [
|
#if !defined(_M_AMD64) && !defined(_M_ARM64) // [
|
||||||
ULONG WaitTime;
|
ULONG WaitTime;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
|
@ -1797,6 +1797,8 @@ typedef struct _STACK_TRACE_DATABASE
|
||||||
#ifndef NTOS_MODE_USER
|
#ifndef NTOS_MODE_USER
|
||||||
#if defined(_M_AMD64)
|
#if defined(_M_AMD64)
|
||||||
C_ASSERT(sizeof(ERESOURCE) <= 0x68);
|
C_ASSERT(sizeof(ERESOURCE) <= 0x68);
|
||||||
|
#elif defined(_M_ARM64)
|
||||||
|
C_ASSERT(sizeof(ERESOURCE) <= 0x68);
|
||||||
#else
|
#else
|
||||||
C_ASSERT(sizeof(ERESOURCE) <= 56);
|
C_ASSERT(sizeof(ERESOURCE) <= 56);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -266,6 +266,13 @@ typedef struct _ARM_DBGKD_CONTROL_SET
|
||||||
ULONG CurrentSymbolEnd;
|
ULONG CurrentSymbolEnd;
|
||||||
} ARM_DBGKD_CONTROL_SET, *PARM_DBGKD_CONTROL_SET;
|
} 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
|
typedef struct _DBGKD_ANY_CONTROL_SET
|
||||||
{
|
{
|
||||||
union
|
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;
|
typedef AMD64_DBGKD_CONTROL_SET DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
typedef ARM_DBGKD_CONTROL_SET DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
|
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
|
#else
|
||||||
#error Unsupported Architecture
|
#error Unsupported Architecture
|
||||||
#endif
|
#endif
|
||||||
|
@ -354,6 +363,14 @@ typedef struct _ARM_DBGKD_CONTROL_REPORT
|
||||||
UCHAR InstructionStream[DBGKD_MAXSTREAM];
|
UCHAR InstructionStream[DBGKD_MAXSTREAM];
|
||||||
} ARM_DBGKD_CONTROL_REPORT, *PARM_DBGKD_CONTROL_REPORT;
|
} 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
|
typedef struct _DBGKD_ANY_CONTROL_REPORT
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
|
@ -363,6 +380,7 @@ typedef struct _DBGKD_ANY_CONTROL_REPORT
|
||||||
IA64_DBGKD_CONTROL_REPORT IA64ControlReport;
|
IA64_DBGKD_CONTROL_REPORT IA64ControlReport;
|
||||||
AMD64_DBGKD_CONTROL_REPORT Amd64ControlReport;
|
AMD64_DBGKD_CONTROL_REPORT Amd64ControlReport;
|
||||||
ARM_DBGKD_CONTROL_REPORT ARMControlReport;
|
ARM_DBGKD_CONTROL_REPORT ARMControlReport;
|
||||||
|
ARM64_DBGKD_CONTROL_REPORT ARM64ControlReport;
|
||||||
};
|
};
|
||||||
} DBGKD_ANY_CONTROL_REPORT, *PDBGKD_ANY_CONTROL_REPORT;
|
} 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;
|
typedef AMD64_DBGKD_CONTROL_REPORT DBGKD_CONTROL_REPORT, *PDBGKD_CONTROL_REPORT;
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
typedef ARM_DBGKD_CONTROL_REPORT DBGKD_CONTROL_REPORT, *PDBGKD_CONTROL_REPORT;
|
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
|
#else
|
||||||
#error Unsupported Architecture
|
#error Unsupported Architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,6 +13,23 @@ $if (_WDMDDK_)
|
||||||
#define PROFILE_LEVEL 15
|
#define PROFILE_LEVEL 15
|
||||||
#define HIGH_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
|
NTSYSAPI
|
||||||
PKTHREAD
|
PKTHREAD
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -4383,6 +4383,17 @@ FORCEINLINE PVOID GetCurrentFiber(VOID)
|
||||||
return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->FiberData;
|
return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->FiberData;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#elif defined (_M_ARM64)
|
||||||
|
FORCEINLINE struct _TEB * NtCurrentTeb(void)
|
||||||
|
{
|
||||||
|
//UNIMPLEMENTED;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
FORCEINLINE PVOID GetCurrentFiber(VOID)
|
||||||
|
{
|
||||||
|
//UNIMPLEMENTED;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#elif defined(_M_PPC)
|
#elif defined(_M_PPC)
|
||||||
FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset)
|
FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset)
|
||||||
{
|
{
|
||||||
|
@ -4478,6 +4489,8 @@ DbgRaiseAssertionFailure(VOID)
|
||||||
#define YieldProcessor() __asm__ __volatile__("nop");
|
#define YieldProcessor() __asm__ __volatile__("nop");
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
#define YieldProcessor __yield
|
#define YieldProcessor __yield
|
||||||
|
#elif defined(_M_ARM64)
|
||||||
|
#define YieldProcessor __yield
|
||||||
#else
|
#else
|
||||||
#error Unknown architecture
|
#error Unknown architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#if defined(_M_IX86)
|
#if defined(_M_IX86)
|
||||||
#pragma comment(linker, "/alternatename:__RTC_Initialize=__RTC_NoInitialize")
|
#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")
|
#pragma comment(linker, "/alternatename:_RTC_Initialize=_RTC_NoInitialize")
|
||||||
#else
|
#else
|
||||||
#error Unsupported platform
|
#error Unsupported platform
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#if defined(_M_IX86)
|
#if defined(_M_IX86)
|
||||||
#pragma comment(linker, "/alternatename:__CRT_RTC_INITW=__CRT_RTC_INITW0")
|
#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")
|
#pragma comment(linker, "/alternatename:_CRT_RTC_INITW=_CRT_RTC_INITW0")
|
||||||
#else
|
#else
|
||||||
#error Unsupported platform
|
#error Unsupported platform
|
||||||
|
|
|
@ -372,8 +372,8 @@
|
||||||
369 stdcall GetWindowDC(long) NtUserGetWindowDC
|
369 stdcall GetWindowDC(long) NtUserGetWindowDC
|
||||||
370 stdcall GetWindowInfo(long ptr)
|
370 stdcall GetWindowInfo(long ptr)
|
||||||
371 stdcall GetWindowLongA(long long)
|
371 stdcall GetWindowLongA(long long)
|
||||||
@ stdcall -arch=x86_64 GetWindowLongPtrA(ptr long)
|
@ stdcall -arch=x86_64,arm64 GetWindowLongPtrA(ptr long)
|
||||||
@ stdcall -arch=x86_64 GetWindowLongPtrW(ptr long)
|
@ stdcall -arch=x86_64,arm64 GetWindowLongPtrW(ptr long)
|
||||||
372 stdcall GetWindowLongW(long long)
|
372 stdcall GetWindowLongW(long long)
|
||||||
373 stdcall GetWindowModuleFileName(long ptr long) GetWindowModuleFileNameA
|
373 stdcall GetWindowModuleFileName(long ptr long) GetWindowModuleFileNameA
|
||||||
374 stdcall GetWindowModuleFileNameA(long ptr long)
|
374 stdcall GetWindowModuleFileNameA(long ptr long)
|
||||||
|
@ -654,8 +654,8 @@
|
||||||
647 stdcall SetWinEventHook(long long long ptr long long long)
|
647 stdcall SetWinEventHook(long long long ptr long long long)
|
||||||
648 stdcall SetWindowContextHelpId(long long)
|
648 stdcall SetWindowContextHelpId(long long)
|
||||||
649 stdcall SetWindowLongA(long long long)
|
649 stdcall SetWindowLongA(long long long)
|
||||||
@ stdcall -arch=x86_64 SetWindowLongPtrA(ptr long ptr)
|
@ stdcall -arch=x86_64,arm64 SetWindowLongPtrA(ptr long ptr)
|
||||||
@ stdcall -arch=x86_64 SetWindowLongPtrW(ptr long ptr)
|
@ stdcall -arch=x86_64,arm64 SetWindowLongPtrW(ptr long ptr)
|
||||||
650 stdcall SetWindowLongW(long long long)
|
650 stdcall SetWindowLongW(long long long)
|
||||||
651 stdcall SetWindowPlacement(long ptr) NtUserSetWindowPlacement
|
651 stdcall SetWindowPlacement(long ptr) NtUserSetWindowPlacement
|
||||||
652 stdcall SetWindowPos(long long long long long long long) NtUserSetWindowPos
|
652 stdcall SetWindowPos(long long long long long long long) NtUserSetWindowPos
|
||||||
|
|
Loading…
Reference in a new issue