Since some weeks I keep splitting/cleaning up/rebasing the PowerPC64le patchset from last year: [1] It's a horrible time for rebasing as so many things are changing in Wine right now, so I want to at least send out the easier ones, hoping I could then better concentrate on the harder ones.
What it means is that this patchset alone won't build on PPC64 yet
From: Timothy Pearson tpearson@raptorengineering.com
Signed-off-by: Timothy Pearson tpearson@raptorengineering.com Signed-off-by: André Hentschel nerv@dawncrow.de --- include/basetsd.h | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/include/basetsd.h b/include/basetsd.h index 96ea3f01bc0..b7e5e380d70 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -277,6 +277,14 @@ typedef ULONG_PTR KAFFINITY, *PKAFFINITY; # undef WORDS_BIGENDIAN # undef BITFIELDS_BIGENDIAN # define ALLOW_UNALIGNED_ACCESS +#elif defined(__powerpc64__) && defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN +# define BITFIELDS_BIGENDIAN +# undef ALLOW_UNALIGNED_ACCESS +#elif defined(__powerpc64__) +# undef WORDS_BIGENDIAN +# undef BITFIELDS_BIGENDIAN +# undef ALLOW_UNALIGNED_ACCESS #elif defined(__powerpc__) # define WORDS_BIGENDIAN # define BITFIELDS_BIGENDIAN
Signed-off-by: André Hentschel nerv@dawncrow.de --- include/wine/port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/wine/port.h b/include/wine/port.h index 8514a4a43bf..4db452db39a 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -96,7 +96,7 @@ typedef int ssize_t; #else /* _WIN32 */
#ifndef __int64 -# if defined(__x86_64__) || defined(__aarch64__) || defined(_WIN64) +# if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) || defined(_WIN64) # define __int64 long # else # define __int64 long long
Signed-off-by: André Hentschel nerv@dawncrow.de --- include/rpc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/rpc.h b/include/rpc.h index eb7d0417bd6..e2ff522dde2 100644 --- a/include/rpc.h +++ b/include/rpc.h @@ -25,7 +25,7 @@ #ifndef __WINE_RPC_H #define __WINE_RPC_H
-#if defined(__powerpc__) || defined(_MAC) /* ? */ +#if (defined(__powerpc__) && !defined(__powerpc64__)) || defined(_MAC) /* ? */ # define __RPC_MAC__ /* Also define __RPC_WIN32__ to ensure compatibility */ # define __RPC_WIN32__
Signed-off-by: André Hentschel nerv@dawncrow.de --- include/wine/exception.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/wine/exception.h b/include/wine/exception.h index 4bf4c7e6d95..f349b0e216a 100644 --- a/include/wine/exception.h +++ b/include/wine/exception.h @@ -99,6 +99,8 @@ typedef struct { DECLSPEC_ALIGN(16) struct { unsigned __int64 Part[2]; } reg[16] typedef struct { int reg[28]; } __wine_jmp_buf; #elif defined(__aarch64__) typedef struct { __int64 reg[24]; } __wine_jmp_buf; +#elif defined(__powerpc64__) +typedef struct { __int64 reg[64]; } __wine_jmp_buf; #else typedef struct { int reg; } __wine_jmp_buf; #endif
From: Timothy Pearson tpearson@raptorengineering.com
Signed-off-by: André Hentschel nerv@dawncrow.de --- include/wine/port.h | 2 +- libs/port/interlocked.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/wine/port.h b/include/wine/port.h index 4db452db39a..33392273b74 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -463,7 +463,7 @@ extern void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare ); extern void *interlocked_xchg_ptr( void **dest, void *val ); #endif
-#if defined(__x86_64__) || defined(__aarch64__) || defined(_WIN64) +#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) || defined(_WIN64) extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high, __int64 xchg_low, __int64 *compare ); #endif diff --git a/libs/port/interlocked.c b/libs/port/interlocked.c index 040ab756eba..eab66dcbd1e 100644 --- a/libs/port/interlocked.c +++ b/libs/port/interlocked.c @@ -222,7 +222,7 @@ __ASM_GLOBAL_FUNC(interlocked_cmpxchg128, "ret") #endif
-#elif defined(__powerpc__) +#elif defined(__powerpc__) && !defined(__powerpc64__)
#if !(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && __SIZEOF_POINTER__ == 4) \ && !(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) && __SIZEOF_POINTER__ == 8)
From: Timothy Pearson tpearson@raptorengineering.com
Signed-off-by: André Hentschel nerv@dawncrow.de --- include/msvcrt/corecrt.h | 6 ++++++ include/windef.h | 6 ++++++ 2 files changed, 12 insertions(+)
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index bc93de023f2..fcb95b409bd 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -70,6 +70,9 @@ # define __stdcall __attribute__((pcs("aapcs-vfp"))) # elif defined(__aarch64__) && defined (__GNUC__) # define __stdcall __attribute__((ms_abi)) +# elif defined(__powerpc64__) && defined (__GNUC__) && !defined (__clang__) + /* ppc64 relies on long calls being generated for thunks (r2 save / restore) */ +# define __stdcall __attribute__((__longcall__)) # else /* __i386__ */ # define __stdcall # endif /* __i386__ */ @@ -92,6 +95,9 @@ # define __cdecl __attribute__((pcs("aapcs-vfp"))) # elif defined(__aarch64__) && defined (__GNUC__) # define __cdecl __attribute__((ms_abi)) +# elif defined(__powerpc64__) && defined (__GNUC__) && !defined (__clang__) + /* ppc64 relies on long calls being generated for thunks (r2 save / restore) */ +# define __cdecl __attribute__((__longcall__)) # endif #endif /* __cdecl */
diff --git a/include/windef.h b/include/windef.h index 436ac6afd87..962dcabe6c8 100644 --- a/include/windef.h +++ b/include/windef.h @@ -71,6 +71,9 @@ extern "C" { # define __stdcall __attribute__((pcs("aapcs-vfp"))) # elif defined(__aarch64__) && defined (__GNUC__) # define __stdcall __attribute__((ms_abi)) +# elif defined(__powerpc64__) && defined (__GNUC__) && !defined (__clang__) + /* ppc64 relies on long calls being generated for thunks (r2 save / restore) */ +# define __stdcall __attribute__((__longcall__)) # else /* __i386__ */ # define __stdcall # endif /* __i386__ */ @@ -93,6 +96,9 @@ extern "C" { # define __cdecl __attribute__((pcs("aapcs-vfp"))) # elif defined(__aarch64__) && defined (__GNUC__) # define __cdecl __attribute__((ms_abi)) +# elif defined(__powerpc64__) && defined (__GNUC__) && !defined (__clang__) + /* ppc64 relies on long calls being generated for thunks (r2 save / restore) */ +# define __cdecl __attribute__((__longcall__)) # elif !defined(_MSC_VER) # define __cdecl # endif
From: Timothy Pearson tpearson@raptorengineering.com
Signed-off-by: André Hentschel nerv@dawncrow.de --- tools/widl/widl.c | 38 +++++++++++++++++++++++--------------- tools/widl/widl.h | 2 +- 2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/tools/widl/widl.c b/tools/widl/widl.c index a99eed4e9dd..172537584a3 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -97,6 +97,8 @@ static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSIO enum target_cpu target_cpu = CPU_x86; #elif defined(__x86_64__) enum target_cpu target_cpu = CPU_x86_64; +#elif defined(__powerpc64__) +enum target_cpu target_cpu = CPU_POWERPC64; #elif defined(__powerpc__) enum target_cpu target_cpu = CPU_POWERPC; #elif defined(__arm__) @@ -286,21 +288,23 @@ static void set_target( const char *target ) enum target_cpu cpu; } cpu_names[] = { - { "i386", CPU_x86 }, - { "i486", CPU_x86 }, - { "i586", CPU_x86 }, - { "i686", CPU_x86 }, - { "i786", CPU_x86 }, - { "amd64", CPU_x86_64 }, - { "x86_64", CPU_x86_64 }, - { "powerpc", CPU_POWERPC }, - { "arm", CPU_ARM }, - { "armv5", CPU_ARM }, - { "armv6", CPU_ARM }, - { "armv7", CPU_ARM }, - { "armv7a", CPU_ARM }, - { "arm64", CPU_ARM64 }, - { "aarch64", CPU_ARM64 }, + { "i386", CPU_x86 }, + { "i486", CPU_x86 }, + { "i586", CPU_x86 }, + { "i686", CPU_x86 }, + { "i786", CPU_x86 }, + { "amd64", CPU_x86_64 }, + { "x86_64", CPU_x86_64 }, + { "powerpc", CPU_POWERPC }, + { "powerpc64", CPU_POWERPC64 }, + { "powerpc64le", CPU_POWERPC64 }, + { "arm", CPU_ARM }, + { "armv5", CPU_ARM }, + { "armv6", CPU_ARM }, + { "armv7", CPU_ARM }, + { "armv7a", CPU_ARM }, + { "arm64", CPU_ARM64 }, + { "aarch64", CPU_ARM64 }, };
unsigned int i; @@ -801,6 +805,10 @@ int main(int argc,char *argv[]) if (pointer_size == 4) error( "Cannot build 32-bit code for this CPU\n" ); pointer_size = 8; break; + case CPU_POWERPC64: + if (pointer_size == 4) error( "Cannot build 32-bit code for this CPU\n" ); + pointer_size = 8; + break; default: if (pointer_size == 8) error( "Cannot build 64-bit code for this CPU\n" ); pointer_size = 4; diff --git a/tools/widl/widl.h b/tools/widl/widl.h index 4f4252e3ea3..bc6226c54fe 100644 --- a/tools/widl/widl.h +++ b/tools/widl/widl.h @@ -76,7 +76,7 @@ extern int char_number;
enum target_cpu { - CPU_x86, CPU_x86_64, CPU_POWERPC, CPU_ARM, CPU_ARM64, CPU_LAST = CPU_ARM64 + CPU_x86, CPU_x86_64, CPU_POWERPC, CPU_ARM, CPU_ARM64, CPU_POWERPC64, CPU_LAST = CPU_POWERPC64 };
extern enum target_cpu target_cpu;
From: Timothy Pearson tpearson@raptorengineering.com
Signed-off-by: André Hentschel nerv@dawncrow.de --- tools/wrc/wrc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c index 6c1887a788f..030a1d82fac 100644 --- a/tools/wrc/wrc.c +++ b/tools/wrc/wrc.c @@ -329,7 +329,8 @@ static void set_target( const char *target ) if (!(p = strchr( cpu, '-' ))) error( "Invalid target specification '%s'\n", target ); *p = 0; if (!strcmp( cpu, "amd64" ) || !strcmp( cpu, "x86_64" ) || - !strcmp( cpu, "ia64" ) || !strcmp( cpu, "aarch64" )) + !strcmp( cpu, "ia64" ) || !strcmp( cpu, "aarch64" ) || + !strcmp( cpu, "ppc64" ) || strcmp( cpu, "ppc64le" )) pointer_size = 8; else pointer_size = 4;
André Hentschel nerv@dawncrow.de wrote:
if (!strcmp( cpu, "amd64" ) || !strcmp( cpu, "x86_64" ) ||
!strcmp( cpu, "ia64" ) || !strcmp( cpu, "aarch64" ))
!strcmp( cpu, "ia64" ) || !strcmp( cpu, "aarch64" ) ||
!strcmp( cpu, "ppc64" ) || strcmp( cpu, "ppc64le" ))
A typo? (Missing '!' in front of strcmp)
Am 27.04.20 um 04:06 schrieb Dmitry Timoshkov:
André Hentschel nerv@dawncrow.de wrote:
if (!strcmp( cpu, "amd64" ) || !strcmp( cpu, "x86_64" ) ||
!strcmp( cpu, "ia64" ) || !strcmp( cpu, "aarch64" ))
!strcmp( cpu, "ia64" ) || !strcmp( cpu, "aarch64" ) ||
!strcmp( cpu, "ppc64" ) || strcmp( cpu, "ppc64le" ))
A typo? (Missing '!' in front of strcmp)
Well spotted, thanks!
Signed-off-by: André Hentschel nerv@dawncrow.de --- dlls/setupapi/devinst.c | 2 ++ dlls/setupapi/fakedll.c | 4 ++++ include/winnt.h | 2 ++ 3 files changed, 8 insertions(+)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 5bd2b88a023..3fbe6c41d32 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -61,6 +61,8 @@ static const WCHAR NtPlatformExtension[] = {'.','N','T','a','m','d','6','4',0}; static const WCHAR NtPlatformExtension[] = {'.','N','T','a','r','m',0}; #elif defined(__aarch64__) static const WCHAR NtPlatformExtension[] = {'.','N','T','a','r','m','6','4',0}; +#elif defined(__powerpc64__) +static const WCHAR NtPlatformExtension[] = {'.','N','T','p','p','c','6','4',0}; #endif static const WCHAR Signature[] = {'S','i','g','n','a','t','u','r','e',0}; static const WCHAR Version[] = {'V','e','r','s','i','o','n',0}; diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c index 8cb80a9ef18..09f044694e8 100644 --- a/dlls/setupapi/fakedll.c +++ b/dlls/setupapi/fakedll.c @@ -280,6 +280,8 @@ static BOOL build_fake_dll( HANDLE file, const WCHAR *name ) nt->FileHeader.Machine = IMAGE_FILE_MACHINE_ARM64; #elif defined __arm__ nt->FileHeader.Machine = IMAGE_FILE_MACHINE_ARMNT; +#elif defined __powerpc64__ + nt->FileHeader.Machine = IMAGE_FILE_MACHINE_POWERPC64; #elif defined __powerpc__ nt->FileHeader.Machine = IMAGE_FILE_MACHINE_POWERPC; #else @@ -722,6 +724,8 @@ static BOOL CALLBACK register_manifest( HMODULE module, const WCHAR *type, WCHAR static const char current_arch[] = "arm"; #elif defined __aarch64__ static const char current_arch[] = "arm64"; +#elif defined __powerpc64__ + static const char current_arch[] = "ppc64"; #else static const char current_arch[] = "none"; #endif diff --git a/include/winnt.h b/include/winnt.h index c90e9052de2..e2a12f8e05b 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -688,6 +688,7 @@ typedef DWORD FLONG; #define PROCESSOR_ARCHITECTURE_ARM64 12 #define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13 #define PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 14 +#define PROCESSOR_ARCHITECTURE_PPC64 200 /* Wine extension */ #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
/* dwProcessorType */ @@ -2907,6 +2908,7 @@ typedef struct _IMAGE_VXD_HEADER { #define IMAGE_FILE_MACHINE_AM33 0x01d3 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 +#define IMAGE_FILE_MACHINE_POWERPC64 0x01fa #define IMAGE_FILE_MACHINE_IA64 0x0200 #define IMAGE_FILE_MACHINE_MIPS16 0x0266 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
André Hentschel nerv@dawncrow.de writes:
Since some weeks I keep splitting/cleaning up/rebasing the PowerPC64le patchset from last year: [1] It's a horrible time for rebasing as so many things are changing in Wine right now, so I want to at least send out the easier ones, hoping I could then better concentrate on the harder ones.
Is there a real use case for this, besides running winecfg?
Otherwise I'd rather wait. Merging it now may be less work for you, but it's more work for me, and it's hard to restructure things for an architecture that I can't test.