[PATCH 4/6 V2] [pcm_dmix assembly] fix the interface for safety (mmx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Frédéric Recoules <frederic.recoules@xxxxxxxxx>

- initialize mm1 with 0s;
- add mm0 and mm1 in the clobber list if the compiler
  is aware of the mmx technology;
- otherwise, add the mmx aliased x87 floating point
  register in the clobbers.

Note: produce exactly the same binary output except
      for mm1 initialization implying address shifts.

Signed-off-by: Frédéric Recoules <frederic.recoules@xxxxxxxxx>
---
 src/pcm/pcm_dmix_i386.h   | 9 ++++++++-
 src/pcm/pcm_dmix_x86_64.h | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h
index 3ea0737d..d9bf8f50 100644
--- a/src/pcm/pcm_dmix_i386.h
+++ b/src/pcm/pcm_dmix_i386.h
@@ -173,8 +173,9 @@ static void MIX_AREAS_16_MMX(unsigned int size,

 		"\tmovl %%ebx, %[old_ebx]\n"	/* ebx is GOT pointer (-fPIC) */
 		/*
-		 *  initialization, load ESI, EDI, EBX registers
+		 *  initialization, load ESI, EDI, EBX registers and clear MM1
 		 */
+		"\tpxor %%mm1, %%mm1\n"
 		"\tmovl %[dst], %%edi\n"
 		"\tmovl %[src], %%esi\n"
 		"\tmovl %[sum], %%ebx\n"
@@ -237,6 +238,12 @@ static void MIX_AREAS_16_MMX(unsigned int size,
 		  [dst_step] "m" (dst_step),  [src_step] "m" (src_step),
 		  [sum_step] "m" (sum_step)
 		: "esi", "edi", "edx", "ecx", "eax", "memory", "cc"
+#               ifdef HAVE_MMX
+		  , "mm0", "mm1"
+#               else
+		  , "st", "st(1)", "st(2)", "st(3)",
+		  "st(4)", "st(5)", "st(6)", "st(7)"
+#               endif
 	);
 }

diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h
index 7f711547..8ad1b2a0 100644
--- a/src/pcm/pcm_dmix_x86_64.h
+++ b/src/pcm/pcm_dmix_x86_64.h
@@ -50,8 +50,9 @@ static void MIX_AREAS_16(unsigned int size,

 		"\tmovq %%rbx, %[old_rbx]\n"
 		/*
-		 *  initialization, load RSI, RDI, RBX registers
+		 *  initialization, load RSI, RDI, RBX registers and clear MM1
 		 */
+		"\tpxor %%mm1, %%mm1\n"
 		"\tmovq %[dst], %%rdi\n"
 		"\tmovq %[src], %%rsi\n"
 		"\tmovq %[sum], %%rbx\n"
@@ -119,6 +120,12 @@ static void MIX_AREAS_16(unsigned int size,
 		  [dst_step] "m" (dst_step),  [src_step] "m" (src_step),
 		  [sum_step] "m" (sum_step)
 		: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
+#               ifdef HAVE_MMX
+		  , "mm0", "mm1"
+#               else
+		  , "st", "st(1)", "st(2)", "st(3)",
+		  "st(4)", "st(5)", "st(6)", "st(7)"
+#               endif
 	);
 }

--
2.17.1



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux