[git commit branch/1_27_stable] tls: fix pstm asm constraint problem

Denys Vlasenko vda.linux at googlemail.com
Fri Aug 4 00:18:00 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=0a53eadea528673a813c5f9312b1f53130429f7c
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_27_stable

function                                             old     new   delta
pstm_sqr_comba                                       551     475     -76

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/tls.h                | 4 +---
 networking/tls_pstm_mul_comba.c | 3 ++-
 networking/tls_pstm_sqr_comba.c | 6 ++++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/networking/tls.h b/networking/tls.h
index b80cc64..d487f38 100644
--- a/networking/tls.h
+++ b/networking/tls.h
@@ -26,10 +26,8 @@
 #undef  USE_SEED
 /* pstm: multiprecision numbers */
 #undef  DISABLE_PSTM
-#if defined(__GNUC__) && defined(__i386__) && ENABLE_STATIC
+#if defined(__GNUC__) && defined(__i386__)
   /* PSTM_X86 works correctly. +25 bytes. */
-  /* Only enabled on static build since tls_pstm_mul_comba.c::MULADD
-   * and tls_pstm_sqr_comba.c::SQRADD2 need too many registers, choke when ebx is not available */
 # define PSTM_32BIT
 # define PSTM_X86
 #endif
diff --git a/networking/tls_pstm_mul_comba.c b/networking/tls_pstm_mul_comba.c
index 47cbb96..845ab95 100644
--- a/networking/tls_pstm_mul_comba.c
+++ b/networking/tls_pstm_mul_comba.c
@@ -85,7 +85,8 @@ asm(                                                      \
 	 "addl  %%eax,%0     \n\t"                            \
 	 "adcl  %%edx,%1     \n\t"                            \
 	 "adcl  $0,%2        \n\t"                            \
-	 :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+	 :"=rm"(c0), "=rm"(c1), "=rm"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+	//bbox: ^^^ replaced "=r" with "=rm": %ebx is not available on shared build
 
 /******************************************************************************/
 #elif defined(PSTM_X86_64)
diff --git a/networking/tls_pstm_sqr_comba.c b/networking/tls_pstm_sqr_comba.c
index 36cb9ea..4fcfcf9 100644
--- a/networking/tls_pstm_sqr_comba.c
+++ b/networking/tls_pstm_sqr_comba.c
@@ -78,7 +78,8 @@ asm(                                            \
 	 "addl  %%eax,%0     \n\t"                            \
 	 "adcl  %%edx,%1     \n\t"                            \
 	 "adcl  $0,%2        \n\t"                            \
-	 :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i) :"%eax","%edx","%cc");
+	 :"=rm"(c0), "=rm"(c1), "=rm"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i) :"%eax","%edx","%cc");
+	//bbox: ^^^ replaced "=r" with "=rm": %ebx is not available on shared build
 
 #define SQRADD2(i, j)                                     \
 asm(                                            \
@@ -90,7 +91,8 @@ asm(                                            \
 	 "addl  %%eax,%0     \n\t"                            \
 	 "adcl  %%edx,%1     \n\t"                            \
 	 "adcl  $0,%2        \n\t"                            \
-	 :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+	 :"=rm"(c0), "=rm"(c1), "=rm"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+	//bbox: ^^^ replaced "=r" with "=rm": %ebx is not available on shared build
 
 #define SQRADDSC(i, j)                                    \
 asm(                                                     \


More information about the busybox-cvs mailing list