diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-05-29 17:41:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-29 11:41:36 +0200 |
| commit | 67b15f09cfdde0053be16c99ebbf5db20e61c1e5 (patch) | |
| tree | 6a3bbe89cfd172eac56b3bb016f3d807a510970e /wow64/include/wine/compiler.h | |
| parent | a0693590bd9c84844bfa767ffe51d7da916df3d5 (diff) | |
| download | box64-67b15f09cfdde0053be16c99ebbf5db20e61c1e5.tar.gz box64-67b15f09cfdde0053be16c99ebbf5db20e61c1e5.zip | |
[WOW64] Added more missing pieces and the interpreter works (#2682)
* [WOW64] Added more missing pieces and the interpreter works Ported from AndreRH/hangover * review
Diffstat (limited to 'wow64/include/wine/compiler.h')
| -rw-r--r-- | wow64/include/wine/compiler.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/wow64/include/wine/compiler.h b/wow64/include/wine/compiler.h new file mode 100644 index 00000000..f206c40d --- /dev/null +++ b/wow64/include/wine/compiler.h @@ -0,0 +1,71 @@ +#ifndef __COMPILER_H_ +#define __COMPILER_H_ + +#include <stdint.h> + +/* Things missing from mingw64 right now */ +#define ThreadWow64Context (29) +#define WOW64_TLS_CPURESERVED (1) +#define WOW64_TLS_MAX_NUMBER (19) +#define WOW64_CPURESERVED_FLAG_RESET_STATE (1) + +typedef enum _MEMORY_INFORMATION_CLASS { + MemoryBasicInformation, + MemoryWorkingSetInformation, + MemoryMappedFilenameInformation, + MemoryRegionInformation, + MemoryWorkingSetExInformation, + MemorySharedCommitInformation, + MemoryImageInformation, + MemoryRegionInformationEx, + MemoryPrivilegedBasicInformation, + MemoryEnclaveImageInformation, + MemoryBasicInformationCapped, + MemoryPhysicalContiguityInformation, + MemoryBadInformation, + MemoryBadInformationAllProcesses, +} MEMORY_INFORMATION_CLASS; + +typedef struct _WOW64_CPURESERVED { + USHORT Flags; + USHORT Machine; +} WOW64_CPURESERVED; + +typedef struct _XMM_SAVE_AREA32 { + WORD ControlWord; + WORD StatusWord; + BYTE TagWord; + BYTE Reserved1; + WORD ErrorOpcode; + DWORD ErrorOffset; + WORD ErrorSelector; + WORD Reserved2; + DWORD DataOffset; + WORD DataSelector; + WORD Reserved3; + DWORD MxCsr; + DWORD MxCsr_Mask; + M128A FloatRegisters[8]; + M128A XmmRegisters[16]; + BYTE Reserved4[96]; +} XMM_SAVE_AREA32; + +#define NtCurrentProcess() ((HANDLE)(LONG_PTR) - 1) + +NTSTATUS WINAPI RtlWow64GetCurrentCpuArea(USHORT*, void**, void**); +NTSTATUS WINAPI Wow64SystemServiceEx(UINT, UINT*); +NTSYSAPI NTSTATUS WINAPI LdrGetDllHandle(LPCWSTR, ULONG, const UNICODE_STRING*, HMODULE*); +NTSYSAPI NTSTATUS WINAPI NtContinue(PCONTEXT, BOOLEAN); +NTSYSAPI NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE, LPCVOID, MEMORY_INFORMATION_CLASS, PVOID, SIZE_T, SIZE_T*); +NTSYSAPI void* WINAPI RtlFindExportedRoutineByName(HMODULE, const char*); +NTSYSAPI void DECLSPEC_NORETURN WINAPI RtlRaiseStatus(NTSTATUS); +NTSYSAPI void WINAPI RtlRaiseException(EXCEPTION_RECORD*); + +static inline uintptr_t calculate_fs(void) +{ + /* until mingw64 has WowTebOffset in the TEB struct */ + uint8_t* teb = (uint8_t*)NtCurrentTeb(); + return (uintptr_t)(teb + *(int32_t*)(teb + 0x180c)); +} + +#endif //__COMPILER_H_ |