mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-08 07:23:33 +00:00
So far I haven't found any way to run native Arm64 code on Windows Arm64 without using MSVC. When I build a PE binary from scratch that should be a valid Windows Arm64 program, the OS refuses to run it. Possibly due to requiring additional content like XML manifests or relocation or control flow integrity data that isn't normally required on x64. I've also tried using VirtualAlloc2() to JIT an Arm64 native function, but VirtualAlloc2 always fails with invalid parameter. I tried using MSVC to create an ARM DLL that my x64 emulated program can link at runtime, to pass a function pointer with ARM code, but LoadLibrary() rejects ARM DLLs as invalid exe The only option left, is likely to write a new program like ape/ape-m1.c which can be compiled by MSVC to load and run an AARCH64 ELF executable. The emulated x64 binary would detect emulation using IsWow64Process2 and then drop the loader executable in a temporary folder, and re-launch the original executable, using the Arm64 segments of the cosmocc fat binary.
29 lines
985 B
C
29 lines
985 B
C
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_PAGEFLAGS_H_
|
|
#define COSMOPOLITAN_LIBC_NT_ENUM_PAGEFLAGS_H_
|
|
|
|
/* Pick One */
|
|
#define kNtPageNoaccess 0x001
|
|
#define kNtPageReadonly 0x002
|
|
#define kNtPageReadwrite 0x004
|
|
#define kNtPageWritecopy 0x008
|
|
#define kNtPageExecute 0x010
|
|
#define kNtPageExecuteRead 0x020
|
|
#define kNtPageExecuteReadwrite 0x040
|
|
#define kNtPageExecuteWritecopy 0x080
|
|
#define kNtPageGuard 0x100
|
|
#define kNtPageNocache 0x200
|
|
#define kNtPageWritecombine 0x400
|
|
|
|
/* These may be OR'd */
|
|
#define kNtSecReserve 0x04000000
|
|
#define kNtSecCommit 0x08000000 /* default */
|
|
#define kNtSecImageNoExecute 0x11000000
|
|
#define kNtSecImage 0x01000000
|
|
#define kNtSecNocache 0x10000000
|
|
#define kNtSecLargePages 0x80000000
|
|
#define kNtSecWritecombine 0x40000000
|
|
|
|
#define kNtPageTargetsInvalid 0x40000000
|
|
#define kNtPageTargetsNoUpdate 0x40000000
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_PAGEFLAGS_H_ */
|