Commit 2b62947f authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit 22.0.1 upon wine-7.7

parent 505d59ee
......@@ -193,22 +193,6 @@ static void spin_wait(int *counter)
}
}
#ifdef _WIN64
static size_t InterlockedIncrementSizeT(size_t volatile *dest)
{
size_t v;
do
{
v = *dest;
} while(InterlockedCompareExchange64((LONGLONG*)dest, v+1, v) != v);
return v+1;
}
#else
#define InterlockedIncrementSizeT(dest) InterlockedIncrement((LONG*)dest)
#endif
static void CALLBACK queue_push_finally(BOOL normal, void *ctx)
{
threadsafe_queue *queue = ctx;
......
......@@ -150,6 +150,10 @@ LPWSTR WINAPI KERNELBASE_lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
INT WINAPI KERNELBASE_lstrlenA( LPCSTR str )
{
INT ret;
/* CX HACK 21207: Avoid exceptions with lstrlen(NULL) */
if (!str) return 0;
__TRY
{
ret = strlen(str);
......@@ -166,6 +170,10 @@ INT WINAPI KERNELBASE_lstrlenA( LPCSTR str )
INT WINAPI KERNELBASE_lstrlenW( LPCWSTR str )
{
INT ret;
/* CX HACK 21207: Avoid exceptions with lstrlen(NULL) */
if (!str) return 0;
__TRY
{
ret = wcslen(str);
......
......@@ -207,22 +207,6 @@ static void spin_wait(int *counter)
}
}
#ifdef _WIN64
static size_t InterlockedIncrementSizeT(size_t volatile *dest)
{
size_t v;
do
{
v = *dest;
} while(InterlockedCompareExchange64((LONGLONG*)dest, v+1, v) != v);
return v+1;
}
#else
#define InterlockedIncrementSizeT(dest) InterlockedIncrement((LONG*)dest)
#endif
static void CALLBACK queue_push_finally(BOOL normal, void *ctx)
{
threadsafe_queue *queue = ctx;
......
......@@ -4953,6 +4953,56 @@ NTSTATUS WINAPI NtReadVirtualMemory( HANDLE process, const void *addr, void *buf
return status;
}
#ifdef __APPLE__
static int is_apple_silicon(void)
{
static int apple_silicon_status, did_check = 0;
if (!did_check)
{
/* returns 0 for native process or on error, 1 for translated */
int ret = 0;
size_t size = sizeof(ret);
if (sysctlbyname( "sysctl.proc_translated", &ret, &size, NULL, 0 ) == -1)
apple_silicon_status = 0;
else
apple_silicon_status = ret;
did_check = 1;
}
return apple_silicon_status;
}
/* CW HACK 18947
* If mach_vm_write() is used to modify code cross-process (which is how we implement
* NtWriteVirtualMemory), Rosetta won't notice the change and will execute the "old" code.
*
* To work around this, after the write completes,
* toggle the executable bit (from inside the target process) on/off for any executable
* pages that were modified, to force Rosetta to re-translate it.
*/
static void toggle_executable_pages_for_rosetta( HANDLE process, void *addr, SIZE_T size )
{
MEMORY_BASIC_INFORMATION info;
NTSTATUS status;
SIZE_T ret;
if (!is_apple_silicon())
return;
status = NtQueryVirtualMemory( process, addr, MemoryBasicInformation, &info, sizeof(info), &ret );
if (!status && (info.AllocationProtect & 0xf0))
{
DWORD origprot, noexec;
noexec = info.AllocationProtect & ~0xf0;
if (!noexec) noexec = PAGE_NOACCESS;
NtProtectVirtualMemory( process, &addr, &size, noexec, &origprot );
NtProtectVirtualMemory( process, &addr, &size, origprot, &noexec );
}
}
#endif
/***********************************************************************
* NtWriteVirtualMemory (NTDLL.@)
......@@ -4973,6 +5023,10 @@ NTSTATUS WINAPI NtWriteVirtualMemory( HANDLE process, void *addr, const void *bu
if ((status = wine_server_call( req ))) size = 0;
}
SERVER_END_REQ;
#ifdef __APPLE__
toggle_executable_pages_for_rosetta( process, addr, size );
#endif
}
else
{
......
......@@ -564,10 +564,9 @@ static int get_default_bpp(void)
static BOOL display_mode_is_supported(CGDisplayModeRef display_mode)
{
uint32_t io_flags = CGDisplayModeGetIOFlags(display_mode);
/* CrossOver Hack #18576: don't check for kDisplayModeSafeFlag for builtin display on Apple Silicon. */
/* CrossOver Hack #18576: don't check for kDisplayModeSafeFlag on Apple Silicon. */
return (io_flags & kDisplayModeValidFlag) &&
((io_flags & kDisplayModeSafeFlag) ||
(is_apple_silicon() && CGDisplayIsBuiltin(CGMainDisplayID())));
((io_flags & kDisplayModeSafeFlag) || is_apple_silicon());
}
......
......@@ -2084,8 +2084,9 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter, LPPRINTER_DEFAU
}
/* CrossOver hack for bug 21116 */
if (!wcsncmp(lpPrinterName, L"progeCAD PDF Virtual Printer", 28) ||
!wcsncmp(lpPrinterName, L"progeCAD Image Virtual Printer", 30))
if (lpPrinterName &&
(!wcsncmp(lpPrinterName, L"progeCAD PDF Virtual Printer", 28) ||
!wcsncmp(lpPrinterName, L"progeCAD Image Virtual Printer", 30)))
{
TRACE("Crossover hack: Return error for %s printer\n", debugstr_w(lpPrinterName));
*phPrinter = NULL;
......
......@@ -737,15 +737,12 @@ NTSTATUS WINAPI Wow64SystemServiceEx( UINT num, UINT *args )
}
static void cpu_simulate(void);
/**********************************************************************
* simulate_filter
*/
static LONG CALLBACK simulate_filter( EXCEPTION_POINTERS *ptrs )
{
Wow64PassExceptionToGuest( ptrs );
cpu_simulate(); /* re-enter simulation to run the exception dispatcher */
return EXCEPTION_EXECUTE_HANDLER;
}
......
......@@ -6272,19 +6272,24 @@ typedef enum _PROCESS_MITIGATION_POLICY
#define BitScanReverse _BitScanReverse
#define InterlockedAdd _InlineInterlockedAdd
#define InterlockedAnd _InterlockedAnd
#define InterlockedAnd64 _InterlockedAnd64
#define InterlockedCompareExchange _InterlockedCompareExchange
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
#define InterlockedDecrement _InterlockedDecrement
#define InterlockedDecrement16 _InterlockedDecrement16
#define InterlockedDecrement64 _InterlockedDecrement64
#define InterlockedExchange _InterlockedExchange
#define InterlockedExchangeAdd _InterlockedExchangeAdd
#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
#define InterlockedExchangePointer _InterlockedExchangePointer
#define InterlockedIncrement _InterlockedIncrement
#define InterlockedIncrement16 _InterlockedIncrement16
#define InterlockedIncrement64 _InterlockedIncrement64
#define InterlockedOr _InterlockedOr
#define InterlockedOr64 _InterlockedOr64
#define InterlockedXor _InterlockedXor
#define InterlockedXor64 _InterlockedXor64
#ifdef _MSC_VER
......@@ -6316,33 +6321,88 @@ short _InterlockedIncrement16(short volatile*);
long _InterlockedOr(long volatile *,long);
long _InterlockedXor(long volatile *,long);
static FORCEINLINE long InterlockedAdd( long volatile *dest, long val )
{
return InterlockedExchangeAdd( dest, val ) + val;
}
#if !defined(__i386__) || _MSC_VER >= 1600
#ifndef __i386__
#pragma intrinsic(_InterlockedAnd64)
#pragma intrinsic(_InterlockedCompareExchangePointer)
#pragma intrinsic(_InterlockedDecrement64)
#pragma intrinsic(_InterlockedExchangeAdd64)
#pragma intrinsic(_InterlockedExchangePointer)
void *_InterlockedCompareExchangePointer(void *volatile*,void*,void*);
void *_InterlockedExchangePointer(void *volatile*,void*);
#pragma intrinsic(_InterlockedIncrement64)
#pragma intrinsic(_InterlockedOr64)
#pragma intrinsic(_InterlockedXor64)
__int64 _InterlockedAnd64(__int64 volatile *, __int64);
void * _InterlockedCompareExchangePointer(void *volatile*,void*,void*);
__int64 _InterlockedDecrement64(__int64 volatile *);
__int64 _InterlockedExchangeAdd64(__int64 volatile *, __int64);
void * _InterlockedExchangePointer(void *volatile*,void*);
__int64 _InterlockedIncrement64(__int64 volatile *);
__int64 _InterlockedOr64(__int64 volatile *, __int64);
__int64 _InterlockedXor64(__int64 volatile *, __int64);
#else
static FORCEINLINE __int64 InterlockedAnd64( __int64 volatile *dest, __int64 val )
{
__int64 prev;
do prev = *dest; while (InterlockedCompareExchange64( dest, prev & val, prev ) != prev);
return prev;
}
static FORCEINLINE void * WINAPI InterlockedCompareExchangePointer( void *volatile *dest, void *xchg, void *compare )
{
return (void *)_InterlockedCompareExchange( (long volatile*)dest, (long)xchg, (long)compare );
}
static FORCEINLINE __int64 InterlockedExchangeAdd64( __int64 volatile *dest, __int64 val )
{
__int64 prev;
do prev = *dest; while (InterlockedCompareExchange64( dest, prev + val, prev ) != prev);
return prev;
}
static FORCEINLINE void * WINAPI InterlockedExchangePointer( void *volatile *dest, void *val )
{
return (void *)_InterlockedExchange( (long volatile*)dest, (long)val );
}
static FORCEINLINE __int64 InterlockedIncrement64( __int64 volatile *dest )
{
return InterlockedExchangeAdd64( dest, 1 ) + 1;
}
static FORCEINLINE __int64 InterlockedDecrement64( __int64 volatile *dest )
{
return InterlockedExchangeAdd64( dest, -1 ) - 1;
}
static FORCEINLINE __int64 InterlockedOr64( __int64 volatile *dest, __int64 val )
{
__int64 prev;
do prev = *dest; while (InterlockedCompareExchange64( dest, prev | val, prev ) != prev);
return prev;
}
static FORCEINLINE __int64 InterlockedXor64( __int64 volatile *dest, __int64 val )
{
__int64 prev;
do prev = *dest; while (InterlockedCompareExchange64( dest, prev ^ val, prev ) != prev);
return prev;
}
#endif /* __i386__ */
static FORCEINLINE long InterlockedAdd( long volatile *dest, long val )
{
return InterlockedExchangeAdd( dest, val ) + val;
}
static FORCEINLINE __int64 InterlockedAdd64( __int64 volatile *dest, __int64 val )
{
return InterlockedExchangeAdd64( dest, val ) + val;
}
#ifdef __i386__
static FORCEINLINE void MemoryBarrier(void)
......@@ -6353,10 +6413,7 @@ static FORCEINLINE void MemoryBarrier(void)
#elif defined(__x86_64__)
#pragma intrinsic(_InterlockedExchangeAdd64)
#pragma intrinsic(__faststorefence)
long long _InterlockedExchangeAdd64(long long volatile *, long long);
void __faststorefence(void);
static FORCEINLINE void MemoryBarrier(void)
......@@ -6399,11 +6456,21 @@ static FORCEINLINE LONG WINAPI InterlockedAdd( LONG volatile *dest, LONG val )
return __sync_add_and_fetch( dest, val );
}
static FORCEINLINE LONGLONG WINAPI InterlockedAdd64( LONGLONG volatile *dest, LONGLONG val )
{
return __sync_add_and_fetch( dest, val );
}
static FORCEINLINE LONG WINAPI InterlockedAnd( LONG volatile *dest, LONG val )
{
return __sync_fetch_and_and( dest, val );
}
static FORCEINLINE LONGLONG WINAPI InterlockedAnd64( LONGLONG volatile *dest, LONGLONG val )
{
return __sync_fetch_and_and( dest, val );
}
static FORCEINLINE LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
{
return __sync_val_compare_and_swap( dest, compare, xchg );
......@@ -6453,6 +6520,11 @@ static FORCEINLINE short WINAPI InterlockedIncrement16( short volatile *dest )
return __sync_add_and_fetch( dest, 1 );
}
static FORCEINLINE LONGLONG WINAPI InterlockedIncrement64( LONGLONG volatile *dest )
{
return __sync_add_and_fetch( dest, 1 );
}
static FORCEINLINE LONG WINAPI InterlockedDecrement( LONG volatile * HOSTPTR dest )
{
return __sync_add_and_fetch( dest, -1 );
......@@ -6463,6 +6535,11 @@ static FORCEINLINE short WINAPI InterlockedDecrement16( short volatile *dest )
return __sync_add_and_fetch( dest, -1 );
}
static FORCEINLINE LONGLONG WINAPI InterlockedDecrement64( LONGLONG volatile *dest )
{
return __sync_add_and_fetch( dest, -1 );
}
static FORCEINLINE void * WINAPI InterlockedExchangePointer( void *volatile *dest, void *val )
{
void *ret;
......@@ -6485,11 +6562,21 @@ static FORCEINLINE LONG WINAPI InterlockedOr( LONG volatile *dest, LONG val )
return __sync_fetch_and_or( dest, val );
}
static FORCEINLINE LONGLONG WINAPI InterlockedOr64( LONGLONG volatile *dest, LONGLONG val )
{
return __sync_fetch_and_or( dest, val );
}
static FORCEINLINE LONG WINAPI InterlockedXor( LONG volatile *dest, LONG val )
{
return __sync_fetch_and_xor( dest, val );
}
static FORCEINLINE LONGLONG WINAPI InterlockedXor64( LONGLONG volatile *dest, LONGLONG val )
{
return __sync_fetch_and_xor( dest, val );
}
static FORCEINLINE void MemoryBarrier(void)
{
__sync_synchronize();
......@@ -6525,11 +6612,15 @@ static FORCEINLINE unsigned char InterlockedCompareExchange128( volatile __int64
#endif
#define InterlockedDecrementSizeT(a) InterlockeDecrement64((LONGLONG *)(a))
#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)(a), (b))
#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)(a))
#else /* _WIN64 */
#define InterlockedDecrementSizeT(a) InterlockeDecrement((LONG *)(a))
#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)(a), (b))
#define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)(a))
#endif /* _WIN64 */
......
......@@ -5,8 +5,10 @@ Atharva Nimbalkar
Biswapriyo Nath
Chip Davis
Conor McCarthy
David Gow
Derek Lesho
Francisco Casas
Francois Gouget
Giovanni Mascellani
Hans-Kristian Arntzen
Henri Verbeet
......
#define PACKAGE_NAME "vkd3d"
#define PACKAGE_STRING "vkd3d 1.3"
#define PACKAGE_VERSION "1.3"
#define PACKAGE_STRING "vkd3d 1.4"
#define PACKAGE_VERSION "1.4"
#define PATH_MAX 1024
#define SONAME_LIBVULKAN "vulkan-1.dll"
......@@ -27,6 +27,7 @@
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#ifdef _MSC_VER
#include <intrin.h>
......@@ -210,6 +211,10 @@ static inline LONG InterlockedIncrement(LONG volatile *x)
{
return __sync_add_and_fetch(x, 1);
}
static inline LONG64 InterlockedIncrement64(LONG64 volatile *x)
{
return __sync_add_and_fetch(x, 1);
}
static inline LONG InterlockedAdd(LONG volatile *x, LONG val)
{
return __sync_add_and_fetch(x, val);
......@@ -242,4 +247,74 @@ static inline void vkd3d_parse_version(const char *version, int *major, int *min
HRESULT hresult_from_vkd3d_result(int vkd3d_result);
#ifdef _WIN32
static inline void *vkd3d_dlopen(const char *name)
{
return LoadLibraryA(name);
}
static inline void *vkd3d_dlsym(void *handle, const char *symbol)
{
return GetProcAddress(handle, symbol);
}
static inline int vkd3d_dlclose(void *handle)
{
return FreeLibrary(handle);
}
static inline const char *vkd3d_dlerror(void)
{
unsigned int error = GetLastError();
static char message[256];
if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, message, sizeof(message), NULL))
return message;
sprintf(message, "Unknown error %u.\n", error);
return message;
}
#elif defined(HAVE_DLFCN_H)
#include <dlfcn.h>
static inline void *vkd3d_dlopen(const char *name)
{
return dlopen(name, RTLD_NOW);
}
static inline void *vkd3d_dlsym(void *handle, const char *symbol)
{
return dlsym(handle, symbol);
}
static inline int vkd3d_dlclose(void *handle)
{
return dlclose(handle);
}
static inline const char *vkd3d_dlerror(void)
{
return dlerror();
}
#else
static inline void *vkd3d_dlopen(const char *name)
{
return NULL;
}
static inline void *vkd3d_dlsym(void *handle, const char *symbol)
{
return NULL;
}
static inline int vkd3d_dlclose(void *handle)
{
return 0;
}
static inline const char *vkd3d_dlerror(void)
{
return "Not implemented for this platform.\n";
}
#endif
#endif /* __VKD3D_COMMON_H */
......@@ -47,6 +47,7 @@ enum vkd3d_dbg_level
enum vkd3d_dbg_level vkd3d_dbg_get_level(void);
void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, const char *fmt, ...) VKD3D_PRINTF_FUNC(3, 4);
void vkd3d_dbg_set_log_callback(PFN_vkd3d_log callback);
const char *vkd3d_dbg_sprintf(const char *fmt, ...) VKD3D_PRINTF_FUNC(1, 2);
const char *vkd3d_dbg_vsprintf(const char *fmt, va_list args);
......
#define VKD3D_VCS_ID " (git d773dc05c687)"
#define VKD3D_VCS_ID " (git 9d4df5e70468)"
......@@ -60,6 +60,7 @@ enum vkd3d_api_version
VKD3D_API_VERSION_1_1,
VKD3D_API_VERSION_1_2,
VKD3D_API_VERSION_1_3,
VKD3D_API_VERSION_1_4,
};
typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event);
......@@ -212,6 +213,20 @@ VKD3D_API HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED
VKD3D_API HRESULT vkd3d_create_versioned_root_signature_deserializer(const void *data, SIZE_T data_size,
REFIID iid, void **deserializer);
/**
* Set a callback to be called when vkd3d outputs debug logging.
*
* If NULL, or if this function has not been called, libvkd3d will print all
* enabled log output to stderr.
*
* Calling this function will also set the log callback for libvkd3d-shader.
*
* \param callback Callback function to set.
*
* \since 1.4
*/
VKD3D_API void vkd3d_set_log_callback(PFN_vkd3d_log callback);
#endif /* VKD3D_NO_PROTOTYPES */
/*
......@@ -255,6 +270,9 @@ typedef HRESULT (*PFN_vkd3d_serialize_versioned_root_signature)(const D3D12_VERS
typedef HRESULT (*PFN_vkd3d_create_versioned_root_signature_deserializer)(const void *data, SIZE_T data_size,
REFIID iid, void **deserializer);
/** Type of vkd3d_set_log_callback(). \since 1.4 */
typedef void (*PFN_vkd3d_set_log_callback)(PFN_vkd3d_log callback);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -45,6 +45,7 @@ enum vkd3d_shader_api_version
VKD3D_SHADER_API_VERSION_1_1,
VKD3D_SHADER_API_VERSION_1_2,
VKD3D_SHADER_API_VERSION_1_3,
VKD3D_SHADER_API_VERSION_1_4,
};
/** The type of a chained structure. */
......@@ -1806,6 +1807,18 @@ VKD3D_SHADER_API void vkd3d_shader_free_shader_signature(struct vkd3d_shader_sig
VKD3D_SHADER_API int vkd3d_shader_preprocess(const struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_code *out, char **messages);
/**
* Set a callback to be called when vkd3d-shader outputs debug logging.
*
* If NULL, or if this function has not been called, libvkd3d-shader will print
* all enabled log output to stderr.
*
* \param callback Callback function to set.
*
* \since 1.4
*/
VKD3D_SHADER_API void vkd3d_shader_set_log_callback(PFN_vkd3d_log callback);
#endif /* VKD3D_SHADER_NO_PROTOTYPES */
/** Type of vkd3d_shader_get_version(). */
......@@ -1859,6 +1872,9 @@ typedef void (*PFN_vkd3d_shader_free_shader_signature)(struct vkd3d_shader_signa
typedef void (*PFN_vkd3d_shader_preprocess)(struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_code *out, char **messages);
/** Type of vkd3d_shader_set_log_callback(). \since 1.4 */
typedef void (*PFN_vkd3d_shader_set_log_callback)(PFN_vkd3d_log callback);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -19,6 +19,8 @@
#ifndef __VKD3D_TYPES_H
#define __VKD3D_TYPES_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
......@@ -53,6 +55,8 @@ enum vkd3d_result
VKD3D_FORCE_32_BIT_ENUM(VKD3D_RESULT),
};
typedef void (*PFN_vkd3d_log)(const char *format, va_list args);
#ifdef _WIN32
# define VKD3D_IMPORT
# define VKD3D_EXPORT
......
......@@ -68,6 +68,25 @@ enum vkd3d_dbg_level vkd3d_dbg_get_level(void)
return level;
}
static PFN_vkd3d_log log_callback;
static void vkd3d_dbg_voutput(const char *fmt, va_list args)
{
if (log_callback)
log_callback(fmt, args);
else
vfprintf(stderr, fmt, args);
}
static void vkd3d_dbg_output(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vkd3d_dbg_voutput(fmt, args);
va_end(args);
}
void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, const char *fmt, ...)
{
va_list args;
......@@ -77,12 +96,17 @@ void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, const ch
assert(level < ARRAY_SIZE(debug_level_names));
fprintf(stderr, "%s:%s: ", debug_level_names[level], function);
vkd3d_dbg_output("%s:%s ", debug_level_names[level], function);
va_start(args, fmt);
vfprintf(stderr, fmt, args);
vkd3d_dbg_voutput(fmt, args);
va_end(args);
}
void vkd3d_dbg_set_log_callback(PFN_vkd3d_log callback)
{
log_callback = callback;
}
static char *get_buffer(void)
{
static char buffers[VKD3D_DEBUG_BUFFER_COUNT][VKD3D_DEBUG_BUFFER_SIZE];
......
......@@ -837,6 +837,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] =
{VKD3D_SM5_OP_DDIV, VKD3DSIH_DDIV, "d", "dd"},
{VKD3D_SM5_OP_DFMA, VKD3DSIH_DFMA, "d", "ddd"},
{VKD3D_SM5_OP_DRCP, VKD3DSIH_DRCP, "d", "d"},
{VKD3D_SM5_OP_MSAD, VKD3DSIH_MSAD, "u", "uuu"},
{VKD3D_SM5_OP_DTOI, VKD3DSIH_DTOI, "i", "d"},
{VKD3D_SM5_OP_DTOU, VKD3DSIH_DTOU, "u", "d"},
{VKD3D_SM5_OP_ITOD, VKD3DSIH_ITOD, "d", "i"},
......
......@@ -202,6 +202,13 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
}
}
/* Returns the size of a type, considered as part of an array of that type.
* As such it includes padding after the type. */
unsigned int hlsl_type_get_array_element_reg_size(const struct hlsl_type *type)
{
return align(type->reg_size, 4);
}
static struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, enum hlsl_type_class type_class,
enum hlsl_base_type base_type, unsigned dimx, unsigned dimy)
{
......@@ -225,6 +232,85 @@ static struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, e
return type;
}
/* Returns the register offset of a given component within a type, given its index.
* *comp_type will be set to the type of the component. */
unsigned int hlsl_compute_component_offset(struct hlsl_ctx *ctx, struct hlsl_type *type,
unsigned int idx, struct hlsl_type **comp_type)
{
switch (type->type)
{
case HLSL_CLASS_SCALAR:
case HLSL_CLASS_VECTOR:
{
assert(idx < type->dimx * type->dimy);
*comp_type = hlsl_get_scalar_type(ctx, type->base_type);
return idx;
}
case HLSL_CLASS_MATRIX:
{
unsigned int minor, major, x = idx % type->dimx, y = idx / type->dimx;
assert(idx < type->dimx * type->dimy);
if (hlsl_type_is_row_major(type))
{
minor = x;
major = y;
}
else
{
minor = y;
major = x;
}
*comp_type = hlsl_get_scalar_type(ctx, type->base_type);
return 4 * major + minor;
}
case HLSL_CLASS_ARRAY:
{
unsigned int elem_comp_count = hlsl_type_component_count(type->e.array.type);
unsigned int array_idx = idx / elem_comp_count;
unsigned int idx_in_elem = idx % elem_comp_count;
assert(array_idx < type->e.array.elements_count);
return array_idx * hlsl_type_get_array_element_reg_size(type->e.array.type) +
hlsl_compute_component_offset(ctx, type->e.array.type, idx_in_elem, comp_type);
}
case HLSL_CLASS_STRUCT:
{
struct hlsl_struct_field *field;
LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry)
{
unsigned int elem_comp_count = hlsl_type_component_count(field->type);
if (idx < elem_comp_count)
{
return field->reg_offset +
hlsl_compute_component_offset(ctx, field->type, idx, comp_type);
}
idx -= elem_comp_count;
}
assert(0);
return 0;
}
case HLSL_CLASS_OBJECT:
{
assert(idx == 0);
*comp_type = type;
return 0;
}
}
assert(0);
return 0;
}
struct hlsl_type *hlsl_new_array_type(struct hlsl_ctx *ctx, struct hlsl_type *basic_type, unsigned int array_size)
{
struct hlsl_type *type;
......@@ -556,27 +642,44 @@ struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir
return hlsl_new_store(ctx, lhs, NULL, rhs, 0, rhs->loc);
}
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
const struct vkd3d_shader_location loc)
struct hlsl_ir_constant *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_type *type,
const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_constant *c;
assert(type->type <= HLSL_CLASS_VECTOR);
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
return NULL;
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_INT), loc);
init_node(&c->node, HLSL_IR_CONSTANT, type, *loc);
return c;
}
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_constant *c;
c = hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, HLSL_TYPE_INT), loc);
if (c)
c->value[0].i = n;
return c;
}
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
const struct vkd3d_shader_location loc)
const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_constant *c;
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
return NULL;
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), loc);
c = hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), loc);
if (c)
c->value[0].u = n;
return c;
}
......@@ -1144,7 +1247,7 @@ static void dump_ir_constant(struct vkd3d_string_buffer *buffer, const struct hl
switch (type->base_type)
{
case HLSL_TYPE_BOOL:
vkd3d_string_buffer_printf(buffer, "%s ", value->b ? "true" : "false");
vkd3d_string_buffer_printf(buffer, "%s ", value->u ? "true" : "false");
break;
case HLSL_TYPE_DOUBLE:
......
......@@ -152,6 +152,7 @@ struct hlsl_struct_field
struct hlsl_type *type;
const char *name;
struct hlsl_semantic semantic;
unsigned int modifiers;
unsigned int reg_offset;
size_t name_bytecode_offset;
......@@ -415,7 +416,6 @@ struct hlsl_ir_constant
int32_t i;
float f;
double d;
bool b;
} value[4];
struct hlsl_reg reg;
};
......@@ -733,12 +733,14 @@ struct hlsl_buffer *hlsl_new_buffer(struct hlsl_ctx *ctx, enum hlsl_buffer_type
const struct hlsl_reg_reservation *reservation, struct vkd3d_shader_location loc);
struct hlsl_ir_expr *hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, struct hlsl_type *type,
const struct vkd3d_shader_location *loc);
struct hlsl_ir_constant *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_type *type,
const struct vkd3d_shader_location *loc);
struct hlsl_ir_expr *hlsl_new_copy(struct hlsl_ctx *ctx, struct hlsl_ir_node *node);
struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type,
struct list *parameters, const struct hlsl_semantic *semantic, struct vkd3d_shader_location loc);
struct hlsl_ir_if *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, struct vkd3d_shader_location loc);
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
const struct vkd3d_shader_location loc);
const struct vkd3d_shader_location *loc);
struct hlsl_ir_jump *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc);
struct hlsl_ir_load *hlsl_new_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct hlsl_ir_node *offset,
struct hlsl_type *type, struct vkd3d_shader_location loc);
......@@ -757,7 +759,7 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *nam
const struct vkd3d_shader_location loc);
struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format);
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
const struct vkd3d_shader_location loc);
const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg,
struct vkd3d_shader_location loc);
struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
......@@ -783,6 +785,9 @@ bool hlsl_scope_add_type(struct hlsl_scope *scope, struct hlsl_type *type);
struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
unsigned int default_majority, unsigned int modifiers);
unsigned int hlsl_type_component_count(struct hlsl_type *type);
unsigned int hlsl_type_get_array_element_reg_size(const struct hlsl_type *type);
unsigned int hlsl_compute_component_offset(struct hlsl_ctx *ctx, struct hlsl_type *type,
unsigned int idx, struct hlsl_type **comp_type);
unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int offset);
bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2);
......@@ -793,8 +798,7 @@ unsigned int hlsl_swizzle_from_writemask(unsigned int writemask);
bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *offset);
unsigned int hlsl_offset_from_deref_safe(struct hlsl_ctx *ctx, const struct hlsl_deref *deref);
struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref,
const struct hlsl_type *type);
struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref);
bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context);
......
......@@ -197,15 +197,15 @@ row_major {return KW_ROW_MAJOR; }
return C_FLOAT;
}
0x[0-9a-fA-F]+ {
sscanf(yytext, "0x%x", &yylval->intval);
yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER;
}
0[0-7]+ {
sscanf(yytext, "0%o", &yylval->intval);
yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER;
}
[0-9]+ {
yylval->intval = (atoi(yytext));
yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER;
}
......
......@@ -663,7 +663,7 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
static void write_sm1_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_node *instr)
{
const struct hlsl_ir_load *load = hlsl_ir_load(instr);
const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &load->src, instr->data_type);
const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &load->src);
struct sm1_instruction sm1_instr =
{
.opcode = D3DSIO_MOV,
......@@ -707,7 +707,7 @@ static void write_sm1_store(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
{
const struct hlsl_ir_store *store = hlsl_ir_store(instr);
const struct hlsl_ir_node *rhs = store->rhs.node;
const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &store->lhs, rhs->data_type);
const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &store->lhs);
struct sm1_instruction sm1_instr =
{
.opcode = D3DSIO_MOV,
......@@ -790,7 +790,7 @@ static void write_sm1_instructions(struct hlsl_ctx *ctx, struct vkd3d_bytecode_b
}
else if (instr->data_type->type == HLSL_CLASS_OBJECT)
{
hlsl_fixme(ctx, &instr->loc, "Object copy.\n");
hlsl_fixme(ctx, &instr->loc, "Object copy.");
break;
}
......
......@@ -579,6 +579,9 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
if (ctx->current_directive)
return return_token(token, lval, text);
if (isspace(text[0]))
vkd3d_string_buffer_printf(&ctx->buffer, "%s", text);
else
vkd3d_string_buffer_printf(&ctx->buffer, "%s ", text);
break;
}
......
......@@ -165,38 +165,6 @@ static bool preproc_push_if(struct preproc_ctx *ctx, bool condition)
return true;
}
static int char_to_int(char c)
{
if ('0' <= c && c <= '9')
return c - '0';
if ('A' <= c && c <= 'F')
return c - 'A' + 10;
if ('a' <= c && c <= 'f')
return c - 'a' + 10;
return -1;
}
static uint32_t preproc_parse_integer(const char *s)
{
uint32_t base = 10, ret = 0;
int digit;
if (*s == '0')
{
base = 8;
++s;
if (*s == 'x' || *s == 'X')
{
base = 16;
++s;
}
}
while ((digit = char_to_int(*s++)) >= 0)
ret = ret * base + (uint32_t)digit;
return ret;
}
static int default_open_include(const char *filename, bool local,
const char *parent_data, void *context, struct vkd3d_shader_code *out)
{
......@@ -691,7 +659,7 @@ directive
primary_expr
: T_INTEGER
{
$$ = preproc_parse_integer($1);
$$ = vkd3d_parse_integer($1);
vkd3d_free($1);
}
| T_IDENTIFIER
......
......@@ -350,6 +350,7 @@ enum vkd3d_sm4_opcode
VKD3D_SM5_OP_DDIV = 0xd2,
VKD3D_SM5_OP_DFMA = 0xd3,
VKD3D_SM5_OP_DRCP = 0xd4,
VKD3D_SM5_OP_MSAD = 0xd5,
VKD3D_SM5_OP_DTOI = 0xd6,
VKD3D_SM5_OP_DTOU = 0xd7,
VKD3D_SM5_OP_ITOD = 0xd8,
......
/*
* Copyright 2017 Józef Kucia for CodeWeavers
* Copyright 2021 Conor McCarthy for Codeweavers
* Copyright 2021 Conor McCarthy for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -206,7 +206,7 @@ static enum vkd3d_shader_input_sysval_semantic vkd3d_siv_from_sysval(enum vkd3d_
#define VKD3D_SPIRV_VERSION 0x00010000
#define VKD3D_SPIRV_GENERATOR_ID 18
#define VKD3D_SPIRV_GENERATOR_VERSION 3
#define VKD3D_SPIRV_GENERATOR_VERSION 4
#define VKD3D_SPIRV_GENERATOR_MAGIC vkd3d_make_u32(VKD3D_SPIRV_GENERATOR_VERSION, VKD3D_SPIRV_GENERATOR_ID)
struct vkd3d_spirv_stream
......@@ -2376,6 +2376,8 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader
default:
WARN("Ignoring unrecognised option %#x with value %#x.\n", option->name, option->value);
case VKD3D_SHADER_COMPILE_OPTION_API_VERSION:
break;
}
}
......@@ -7425,7 +7427,7 @@ static void vkd3d_dxbc_compiler_emit_f16tof32(struct vkd3d_dxbc_compiler *compil
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, 2);
scalar_type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, 1);
/* FIXME: Consider a single UnpackHalf2x16 intruction per 2 components. */
/* FIXME: Consider a single UnpackHalf2x16 instruction per 2 components. */
assert(dst->write_mask & VKD3DSP_WRITEMASK_ALL);
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
{
......@@ -7459,7 +7461,7 @@ static void vkd3d_dxbc_compiler_emit_f32tof16(struct vkd3d_dxbc_compiler *compil
scalar_type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_UINT, 1);
zero_id = vkd3d_dxbc_compiler_get_constant_float(compiler, 0.0f);
/* FIXME: Consider a single PackHalf2x16 intruction per 2 components. */
/* FIXME: Consider a single PackHalf2x16 instruction per 2 components. */
assert(dst->write_mask & VKD3DSP_WRITEMASK_ALL);
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
{
......@@ -7802,7 +7804,7 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
/* The OpSwitch instruction is inserted when the endswitch
* instruction is processed because we do not know the number
* of case statments in advance.*/
* of case statements in advance.*/
vkd3d_spirv_begin_function_stream_insertion(builder, cf_info->u.switch_.stream_location);
vkd3d_spirv_build_op_switch(builder, cf_info->u.switch_.selector_id,
cf_info->u.switch_.default_block_id, cf_info->u.switch_.case_blocks,
......@@ -8336,10 +8338,10 @@ static void vkd3d_dxbc_compiler_emit_sample(struct vkd3d_dxbc_compiler *compiler
static void vkd3d_dxbc_compiler_emit_sample_c(struct vkd3d_dxbc_compiler *compiler,
const struct vkd3d_shader_instruction *instruction)
{
uint32_t sampled_type_id, coordinate_id, dref_id, val_id, type_id;
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
const struct vkd3d_shader_dst_param *dst = instruction->dst;
const struct vkd3d_shader_src_param *src = instruction->src;
uint32_t sampled_type_id, coordinate_id, dref_id, val_id;
SpvImageOperandsMask operands_mask = 0;
unsigned int image_operand_count = 0;
struct vkd3d_shader_image image;
......@@ -8371,10 +8373,6 @@ static void vkd3d_dxbc_compiler_emit_sample_c(struct vkd3d_dxbc_compiler *compil
sampled_type_id = vkd3d_spirv_get_type_id(builder, image.sampled_type, 1);
coordinate_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_ALL);
dref_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[3], VKD3DSP_WRITEMASK_0);
/* XXX: Nvidia is broken and expects that the D_ref is packed together with coordinates. */
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE);
coordinate_id = vkd3d_spirv_build_op_composite_insert1(builder,
type_id, dref_id, coordinate_id, image.resource_type_info->coordinate_component_count);
val_id = vkd3d_spirv_build_op_image_sample_dref(builder, op, sampled_type_id,
image.sampled_image_id, coordinate_id, dref_id, operands_mask,
image_operands, image_operand_count);
......
......@@ -225,6 +225,7 @@ static const char * const shader_opcode_names[] =
[VKD3DSIH_MOV ] = "mov",
[VKD3DSIH_MOVA ] = "mova",
[VKD3DSIH_MOVC ] = "movc",
[VKD3DSIH_MSAD ] = "msad",
[VKD3DSIH_MUL ] = "mul",
[VKD3DSIH_NE ] = "ne",
[VKD3DSIH_NOP ] = "nop",
......
......@@ -22,6 +22,38 @@
#include <stdio.h>
#include <math.h>
static inline int char_to_int(char c)
{
if ('0' <= c && c <= '9')
return c - '0';
if ('A' <= c && c <= 'F')
return c - 'A' + 10;
if ('a' <= c && c <= 'f')
return c - 'a' + 10;
return -1;
}
uint32_t vkd3d_parse_integer(const char *s)
{
uint32_t base = 10, ret = 0;
int digit;
if (*s == '0')
{
base = 8;
++s;
if (*s == 'x' || *s == 'X')
{
base = 16;
++s;
}
}
while ((digit = char_to_int(*s++)) >= 0)
ret = ret * base + (uint32_t)digit;
return ret;
}
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer)
{
buffer->buffer_size = 16;
......@@ -1516,3 +1548,8 @@ int vkd3d_shader_preprocess(const struct vkd3d_shader_compile_info *compile_info
vkd3d_shader_message_context_cleanup(&message_context);
return ret;
}
void vkd3d_shader_set_log_callback(PFN_vkd3d_log callback)
{
vkd3d_dbg_set_log_callback(callback);
}
......@@ -117,8 +117,10 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_HLSL_INVALID_TEXEL_OFFSET = 5018,
VKD3D_SHADER_ERROR_HLSL_OFFSET_OUT_OF_BOUNDS = 5019,
VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE = 5020,
VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO = 5021,
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300,
VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO = 5301,
VKD3D_SHADER_ERROR_GLSL_INTERNAL = 6000,
......@@ -328,6 +330,7 @@ enum vkd3d_shader_opcode
VKD3DSIH_MOV,
VKD3DSIH_MOVA,
VKD3DSIH_MOVC,
VKD3DSIH_MSAD,
VKD3DSIH_MUL,
VKD3DSIH_NE,
VKD3DSIH_NOP,
......@@ -1032,6 +1035,8 @@ static inline size_t bytecode_get_size(struct vkd3d_bytecode_buffer *buffer)
return buffer->size;
}
uint32_t vkd3d_parse_integer(const char *s);
struct vkd3d_shader_message_context
{
enum vkd3d_shader_log_level log_level;
......
......@@ -510,3 +510,9 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN
}
return hr;
}
void vkd3d_set_log_callback(PFN_vkd3d_log callback)
{
vkd3d_shader_set_log_callback(callback);
vkd3d_dbg_set_log_callback(callback);
}
......@@ -195,6 +195,11 @@ VK_DEVICE_EXT_PFN(vkGetDescriptorSetLayoutSupportKHR)
/* VK_KHR_push_descriptor */
VK_DEVICE_EXT_PFN(vkCmdPushDescriptorSetKHR)
/* VK_KHR_timeline_semaphore */
VK_DEVICE_EXT_PFN(vkGetSemaphoreCounterValueKHR)
VK_DEVICE_EXT_PFN(vkWaitSemaphoresKHR)
VK_DEVICE_EXT_PFN(vkSignalSemaphoreKHR)
/* VK_EXT_calibrated_timestamps */
VK_DEVICE_EXT_PFN(vkGetCalibratedTimestampsEXT)
......
......@@ -48,6 +48,7 @@
#include <mach/thread_act.h>
#include <mach/mach_vm.h>
#include <servers/bootstrap.h>
#include <sys/sysctl.h>
static mach_port_t server_mach_port;
......@@ -151,6 +152,26 @@ void init_thread_context( struct thread *thread )
{
}
/* CX HACK 21217 */
static int is_apple_silicon( void )
{
static int apple_silicon_status, did_check = 0;
if (!did_check)
{
/* returns 0 for native process or on error, 1 for translated */
int ret = 0;
size_t size = sizeof(ret);
if (sysctlbyname( "sysctl.proc_translated", &ret, &size, NULL, 0 ) == -1)
apple_silicon_status = 0;
else
apple_silicon_status = ret;
did_check = 1;
}
return apple_silicon_status;
}
/* retrieve the thread x86 registers */
void get_thread_context( struct thread *thread, context_t *context, unsigned int flags )
{
......@@ -202,6 +223,13 @@ void get_thread_context( struct thread *thread, context_t *context, unsigned int
}
context->flags |= SERVER_CTX_DEBUG_REGISTERS;
}
else if (is_apple_silicon())
{
/* CX HACK 21217: Fake debug registers on Apple Silicon */
fprintf( stderr, "%04x: thread_get_state failed on Apple Silicon - faking zero debug registers\n", thread->id );
memset( &context->debug, 0, sizeof(context->debug) );
context->flags |= SERVER_CTX_DEBUG_REGISTERS;
}
mach_port_deallocate( mach_task_self(), port );
#endif
}
......
......@@ -2147,7 +2147,10 @@ void flush_registry(void)
/* determine if the thread is wow64 (32-bit client running on 64-bit prefix) */
static int is_wow64_thread( struct thread *thread )
{
return (is_machine_64bit( native_machine ) && !is_machine_64bit( thread->process->machine ));
/* CX HACK 21221: Apps in 32-bit prefixes running in Wow64 mode should not
* be subject to Wow6432Node redirections. */
return !wow64_using_32bit_prefix &&
(is_machine_64bit( native_machine ) && !is_machine_64bit( thread->process->machine ));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment