03_stride-segfaults.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 064d11051f477cd2c398e5d4e3cb1301daf683eb Mon Sep 17 00:00:00 2001
  2. From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  3. Date: Tue, 17 Aug 2010 22:30:49 +0200
  4. Subject: [PATCH] fix stride tc on amd64. i386 and powerpc
  5. the stride tc segfauls with
  6. |diff --git a/testsuite/stride.c b/testsuite/stride.c
  7. |index abc521e..debc340 100644
  8. |--- a/testsuite/stride.c
  9. |+++ b/testsuite/stride.c
  10. |@@ -74,8 +74,8 @@ int main (int argc, char *argv[])
  11. | continue;
  12. | }
  13. | oil_test_set_iterations (test, 1);
  14. |- test->n = 1 + oil_rand_u8();
  15. |- test->m = 1 + oil_rand_u8();
  16. |+ test->n = 1;
  17. |+ test->m = 33;
  18. |
  19. | oil_test_check_impl (test, klass->reference_impl);
  20. | for(j=0;j<OIL_ARG_LAST;j++){
  21. as random numers. This was reported as Debian bug #483352.
  22. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  23. ---
  24. liboil/amd64/wavelet.c | 3 +++
  25. liboil/i386/wavelet.c | 2 ++
  26. liboil/powerpc/rgb2bgr.c | 2 ++
  27. 3 files changed, 7 insertions(+), 0 deletions(-)
  28. diff --git a/liboil/amd64/wavelet.c b/liboil/amd64/wavelet.c
  29. index 6b1946a..353471f 100644
  30. --- a/liboil/amd64/wavelet.c
  31. +++ b/liboil/amd64/wavelet.c
  32. @@ -18,6 +18,9 @@ deinterleave2_asm (int16_t *d1, int16_t *d2, int16_t *s_2xn, int n)
  33. n--;
  34. }
  35. + if (!n)
  36. + return;
  37. +
  38. asm volatile ("\n"
  39. " sub $2, %%rcx\n"
  40. "1:\n"
  41. diff --git a/liboil/i386/wavelet.c b/liboil/i386/wavelet.c
  42. index a382a22..d8d61a6 100644
  43. --- a/liboil/i386/wavelet.c
  44. +++ b/liboil/i386/wavelet.c
  45. @@ -117,6 +117,8 @@ deinterleave2_asm (int16_t *d1, int16_t *d2, int16_t *s_2xn, int n)
  46. s_2xn+=2;
  47. n--;
  48. }
  49. + if (!n)
  50. + return;
  51. asm volatile ("\n"
  52. " mov %3, %%ecx\n"
  53. diff --git a/liboil/powerpc/rgb2bgr.c b/liboil/powerpc/rgb2bgr.c
  54. index 8787d66..419b8e1 100644
  55. --- a/liboil/powerpc/rgb2bgr.c
  56. +++ b/liboil/powerpc/rgb2bgr.c
  57. @@ -50,6 +50,8 @@ rgb2bgr_ppc (uint8_t *dest, uint8_t* src, int n)
  58. n /= 4;
  59. dest -= 4;
  60. src -= 4;
  61. + if (!n)
  62. + return ;
  63. asm volatile (
  64. " mtctr %2 \n"
  65. "1: lwzu r10, 4(%1) \n" /* rgbr x */
  66. --
  67. 1.5.6.5