[PATCH] support for the x32 architecture
Mattia Rizzolo <[email protected]> Fri, 23 Jun 2017 17:48:07 +0200
| Newsgroups | gmane.comp.video.xine.devel |
|---|---|
| Message-ID | <[email protected]> |
xine currently fails to build in x32 (i.e. x86-64 with 32-bit ABI). The following patch (actually against version 1.2.6, as that's more easily testable in Debian where that's the version packaged) fixes the build. Credits go to James Clarke <[email protected]>. --- a/configure.ac +++ b/configure.ac @@ -677,6 +677,11 @@ case "$host_or_hostalias" in AC_DEFINE([ARCH_SPARC], [], [Define this if you're running SPARC architecture]) ;; + x86_64-*-gnux32) + arch_x86=64_x32 + AC_DEFINE([ARCH_X86_64_X32], [], [Define this if you're running x86 architecture 64 bits, 32 bit ABI]) + ;; + x86_64-*) arch_x86=64 AC_DEFINE([ARCH_X86_64], [], [Define this if you're running x86 architecture 64 bits]) @@ -856,6 +861,7 @@ AM_CONDITIONAL([ARCH_PPC], test x"$arch_ AM_CONDITIONAL([ARCH_X86], test x"$arch_x86" != x"no") AM_CONDITIONAL([ARCH_X86_32], test x"$arch_x86" = x"32") AM_CONDITIONAL([ARCH_X86_64], test x"$arch_x86" = x"64") +AM_CONDITIONAL([ARCH_X86_64_X32], test _x32x"$arch_x86" = x"64_x32") AM_CONDITIONAL([HAVE_MMX], test x"$arch_x86" != x"no") AM_CONDITIONAL([HOST_OS_DARWIN], test x"$HOST_OS_DARWIN" = x"1") --- a/src/post/goom/mmx.h +++ b/src/post/goom/mmx.h @@ -75,7 +75,7 @@ mm_support(void) 13 if AMD Extended MMX, &3dNow supported 0 if hardware does not support any of these */ -#ifdef ARCH_X86_64 +#if defined(ARCH_X86_64) || defined(ARCH_X86_64_X32) return 13; #else register int rval = 0; --- a/src/xine-engine/ffmpeg_bswap.h +++ b/src/xine-engine/ffmpeg_bswap.h @@ -62,7 +62,7 @@ static always_inline uint32_t bswap_32(u static inline uint64_t bswap_64(uint64_t x) { -#ifdef ARCH_X86_64 +#if defined(ARCH_X86_64) || defined(ARCH_X86_64_X32) __asm("bswap %0": "=r" (x) : "0" (x)); --- a/src/xine-utils/monitor.c +++ b/src/xine-utils/monitor.c @@ -59,7 +59,7 @@ int xine_profiler_allocate_slot (const c } -#if defined(ARCH_X86_32) +#if defined(ARCH_X86_32) || defined(ARCH_X86_64_X32) static __inline__ uint64_t rdtsc(void) { unsigned long long int x; --- a/src/post/deinterlace/plugins/greedyh.asm +++ b/src/post/deinterlace/plugins/greedyh.asm @@ -144,10 +144,18 @@ static void FUNCT_NAME(uint8_t *output, "movq (%%"XSI"), %%mm0\n\t" // L2 - the newest weave pixel value "movq (%%"XAX"), %%mm1\n\t" // L1 - the top pixel +#ifdef ARCH_X86_64_X32 + "pushq %%rdx \n\t" +#else PUSHX" %%"XDX "\n\t" +#endif MOVX" "asmtemp", %%"XDX"\n\t" "movq (%%"XDX"), %%mm2\n\t" // L2P - the prev weave pixel +#ifdef ARCH_X86_64_X32 + "popq %%rdx \n\t" +#else POPX" %%"XDX "\n\t" +#endif "movq (%%"XAX", %%"XCX"), %%mm3\n\t" // L3, next odd row "movq %%mm1, %%mm6\n\t" // L1 - get simple single pixel interp // pavgb mm6, mm3 // use macro below --- a/src/post/deinterlace/plugins/x86-64_macros.inc +++ b/src/post/deinterlace/plugins/x86-64_macros.inc @@ -45,8 +45,15 @@ #define MOVX "movl" #define LEAX "leal" #define DECX "decl" -#define PUSHX "pushl" -#define POPX "popl" +/* + * Have to use 64-bit push/pop on x32; defining PUSHX as pushq would be + * confusing, as you can't use the register macros defined above with it since + * they're the wrong width. + */ +# ifndef ARCH_X86_64_X32 +# define PUSHX "pushl" +# define POPX "popl" +# endif #define CMPX "cmpl" #define ADDX "addl" #define SHLX "shll" --- a/src/post/deinterlace/plugins/greedy2frame_template_sse2.c +++ b/src/post/deinterlace/plugins/greedy2frame_template_sse2.c @@ -174,8 +174,13 @@ static void DeinterlaceGreedy2Frame_SSE2 */ "movdqa (%2), %%xmm1 \n\t" /* xmm1 = T1 */ "movdqa (%3), %%xmm0 \n\t" /* xmm0 = T0 */ +#ifdef ARCH_X86_64 "movdqa (%q4,%2), %%xmm3 \n\t" /* xmm3 = B1 */ "movdqa (%q4,%3), %%xmm2 \n\t" /* xmm2 = B0 */ +#else + "movdqa (%4,%2), %%xmm3 \n\t" /* xmm3 = B1 */ + "movdqa (%4,%3), %%xmm2 \n\t" /* xmm2 = B0 */ +#endif /* calculate |T1-T0| keep T1 put result in xmm5 */ "movdqa %%xmm1, %%xmm5 \n\t" @@ -192,8 +197,13 @@ static void DeinterlaceGreedy2Frame_SSE2 "pcmpgtb %0, %%xmm5 \n\t" "pcmpeqd %%xmm7, %%xmm5 \n\t" +#ifdef ARCH_X86_64 "prefetcht0 64(%q4,%2) \n\t" "prefetcht0 64(%q4,%3) \n\t" +#else + "prefetcht0 64(%4,%2) \n\t" + "prefetcht0 64(%4,%3) \n\t" +#endif : : "m" (GreedyTwoFrameThreshold128), "m" (*Destc), "r" (T1), "r" (T0), "r" (Pitch) ); -- regards, Mattia Rizzolo GPG Key: 66AE 2B4A FCCF 3F52 DA18 4D18 4B04 3FCD B944 4540 .''`. more about me: https://mapreri.org : :' : Launchpad user: https://launchpad.net/~mapreri `. `'` Debian QA page: https://qa.debian.org/developer.php?login=mattia `- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ xine-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xine-devel
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEi3hoeGwz5cZMTQpICBa54Yx2K60FAllNODIACgkQCBa54Yx2 K63D9xAAped+MEEBg5pybPN7oqTKbLzzmf+hC9lKNzVU1kRf4RsQ/eALFJOV/cq4 yh7P+yMTYc+TZqA9ab4yVgV58YhisV1mSDvCZJqPrCHCmVVSzQZxlhsStHOIycJe eutMeItNXG8DLGed+RUoJ/vWCxLeLHmzsZyqRFUZTQy8JtWs4KQkrIUcFb91FITR I7sufqURJ37gvhEFmUPwZYraDUJSowb5CoESwxC6Gx2UvVYg/f8vRttKC/p+3npl O3zmmUpPgl1e/ilNFkYxuIEtABF931MKLo90VvwFYwxJoitIxOHBKTje1P38TbeA A+u/OisIcCYKt8dTHwE5y2HRNU82sINT8+QLYzKAjCPi6OrgarR1sFwA8u0AStzs 91iA7jJFOiGGf8ZxODmvCB6eiQyKDBGvRMUft4+XITqK5wFNCeuf4ZIN5Rv+QBCF QtqmZzxGc1OhzGNeHaxlLUImgcTSCp7UCYBNPi8JEaRqP3seor50ofPDPRXJMDjK boWS+klu1caK1A5eScfuN4SosLFtZEJ7+8LZJB4fblWQ5/UgggD1EldRl2oYWhJK 3Jzvzp9Vc6uKqzEWDdhcNYC7kp3Kc7wcuj//TwbXQMkcA5vFV4yEJhnWLqtY7ykt 2rNFUpJ515qyB0Qg7fQ5MlAjPksXmxjgmPq1yMl7+NTQ5oBKUpg= =r5NB -----END PGP SIGNATURE-----