OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
5.2 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../qemu/qemu-0.9.0-gcc4-hacks.patch
  5. # Copyright (C) 2007 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. 2007-04-12 rediffed for qemu 0.9.0
  17. 2005-10-28 Gwenole Beauchesne <gbeauchesne@mandriva.com>
  18. * Various additional hacks for GCC4.
  19. diff -ruN qemu-0.9.0/cpu-all.h qemu-0.9.0-gcc4-hacks/cpu-all.h
  20. --- qemu-0.9.0/cpu-all.h 2007-02-06 00:01:54.000000000 +0100
  21. +++ qemu-0.9.0-gcc4-hacks/cpu-all.h 2007-04-12 17:20:17.000000000 +0200
  22. @@ -339,7 +339,13 @@
  23. static inline void stq_le_p(void *ptr, uint64_t v)
  24. {
  25. +#if defined(__i386__) && __GNUC__ >= 4
  26. + const union { uint64_t v; uint32_t p[2]; } x = { .v = v };
  27. + ((uint32_t *)ptr)[0] = x.p[0];
  28. + ((uint32_t *)ptr)[1] = x.p[1];
  29. +#else
  30. *(uint64_t *)ptr = v;
  31. +#endif
  32. }
  33. /* float access */
  34. diff -ruN qemu-0.9.0/softmmu_header.h qemu-0.9.0-gcc4-hacks/softmmu_header.h
  35. --- qemu-0.9.0/softmmu_header.h 2007-02-06 00:01:54.000000000 +0100
  36. +++ qemu-0.9.0-gcc4-hacks/softmmu_header.h 2007-04-12 17:20:17.000000000 +0200
  37. @@ -108,7 +108,7 @@
  38. void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, DATA_TYPE v, int is_user);
  39. #if (DATA_SIZE <= 4) && (TARGET_LONG_BITS == 32) && defined(__i386__) && \
  40. - (ACCESS_TYPE <= 1) && defined(ASM_SOFTMMU)
  41. + (ACCESS_TYPE <= 1) && defined(ASM_SOFTMMU) && (__GNUC__ < 4)
  42. #define CPU_TLB_ENTRY_BITS 4
  43. @@ -150,7 +150,7 @@
  44. "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)),
  45. "i" (CPU_MEM_INDEX),
  46. "m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX))
  47. - : "%eax", "%ecx", "%edx", "memory", "cc");
  48. + : "%eax", "%edx", "memory", "cc");
  49. return res;
  50. }
  51. @@ -197,13 +197,14 @@
  52. "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)),
  53. "i" (CPU_MEM_INDEX),
  54. "m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX))
  55. - : "%eax", "%ecx", "%edx", "memory", "cc");
  56. + : "%eax", "%edx", "memory", "cc");
  57. return res;
  58. }
  59. #endif
  60. -static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE v)
  61. +static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE val)
  62. {
  63. + RES_TYPE v = val;
  64. asm volatile ("movl %0, %%edx\n"
  65. "movl %0, %%eax\n"
  66. "shrl %3, %%edx\n"
  67. @@ -240,16 +241,14 @@
  68. "2:\n"
  69. :
  70. : "r" (ptr),
  71. -/* NOTE: 'q' would be needed as constraint, but we could not use it
  72. - with T1 ! */
  73. - "r" (v),
  74. + "q" (v),
  75. "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS),
  76. "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
  77. "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)),
  78. "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_write)),
  79. "i" (CPU_MEM_INDEX),
  80. "m" (*(uint8_t *)&glue(glue(__st, SUFFIX), MMUSUFFIX))
  81. - : "%eax", "%ecx", "%edx", "memory", "cc");
  82. + : "%eax", "%edx", "memory", "cc");
  83. }
  84. #else
  85. diff -ruN qemu-0.9.0/target-i386/helper.c qemu-0.9.0-gcc4-hacks/target-i386/helper.c
  86. --- qemu-0.9.0/target-i386/helper.c 2007-02-06 00:01:54.000000000 +0100
  87. +++ qemu-0.9.0-gcc4-hacks/target-i386/helper.c 2007-04-12 17:20:17.000000000 +0200
  88. @@ -3452,8 +3452,15 @@
  89. nb_xmm_regs = 8 << data64;
  90. addr = ptr + 0xa0;
  91. for(i = 0; i < nb_xmm_regs; i++) {
  92. +#if defined(__i386__) && __GNUC__ >= 4
  93. + env->xmm_regs[i].XMM_L(0) = ldl(addr);
  94. + env->xmm_regs[i].XMM_L(1) = ldl(addr + 4);
  95. + env->xmm_regs[i].XMM_L(2) = ldl(addr + 8);
  96. + env->xmm_regs[i].XMM_L(3) = ldl(addr + 12);
  97. +#else
  98. env->xmm_regs[i].XMM_Q(0) = ldq(addr);
  99. env->xmm_regs[i].XMM_Q(1) = ldq(addr + 8);
  100. +#endif
  101. addr += 16;
  102. }
  103. }
  104. diff -ruN qemu-0.9.0/target-i386/ops_sse.h qemu-0.9.0-gcc4-hacks/target-i386/ops_sse.h
  105. --- qemu-0.9.0/target-i386/ops_sse.h 2007-02-06 00:01:54.000000000 +0100
  106. +++ qemu-0.9.0-gcc4-hacks/target-i386/ops_sse.h 2007-04-12 17:20:17.000000000 +0200
  107. @@ -34,6 +34,12 @@
  108. #define Q(n) XMM_Q(n)
  109. #define SUFFIX _xmm
  110. #endif
  111. +#if defined(__i386__) && __GNUC__ >= 4
  112. +#define RegCopy(d, s) __builtin_memcpy(&(d), &(s), sizeof(d))
  113. +#endif
  114. +#ifndef RegCopy
  115. +#define RegCopy(d, s) d = s
  116. +#endif
  117. void OPPROTO glue(op_psrlw, SUFFIX)(void)
  118. {
  119. @@ -589,7 +595,7 @@
  120. r.W(1) = s->W((order >> 2) & 3);
  121. r.W(2) = s->W((order >> 4) & 3);
  122. r.W(3) = s->W((order >> 6) & 3);
  123. - *d = r;
  124. + RegCopy(*d, r);
  125. }
  126. #else
  127. void OPPROTO op_shufps(void)