aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-02-20 13:40:12 -0500
committerRuss Cox <rsc@golang.org>2015-02-20 18:54:29 +0000
commitc11dadc503dede91677cbaef67fb4a0ce2dc6fa8 (patch)
tree5a0335693d30195a70ff96abf87b71db28324d78
parent9c0c050773355cfa3b9f69193731126814c7cb19 (diff)
downloadgo-c11dadc503dede91677cbaef67fb4a0ce2dc6fa8.tar.gz
go-c11dadc503dede91677cbaef67fb4a0ce2dc6fa8.zip
[dev.cc] crypto/md5, crypto/sha1: restore a few SP references
Applying my post-submit comments from CL 5120. The rewrite there changed the code from writing to the stack frame to writing below the stack frame. Change-Id: Ie7e0563c0c1731fede2bcefeaf3c9d88a0cf4063 Reviewed-on: https://go-review.googlesource.com/5470 Reviewed-by: David Crawshaw <crawshaw@golang.org>
-rw-r--r--src/crypto/md5/md5block_arm.s18
-rw-r--r--src/crypto/sha1/sha1block_arm.s14
2 files changed, 16 insertions, 16 deletions
diff --git a/src/crypto/md5/md5block_arm.s b/src/crypto/md5/md5block_arm.s
index b2bd04e086..f1f0f67e55 100644
--- a/src/crypto/md5/md5block_arm.s
+++ b/src/crypto/md5/md5block_arm.s
@@ -29,31 +29,31 @@
//12(FP) is p.cap
//
// Stack frame
-#define p_end -4 // -4(R13==SP) pointer to the end of data
-#define p_data -8 // -8(R13) current data pointer
-#define buf (-8-4*16) //-72(R13) 16 words temporary buffer
+#define p_end end-4(SP) // pointer to the end of data
+#define p_data data-8(SP) // current data pointer
+#define buf buffer-(8+4*16)(SP) //16 words temporary buffer
// 3 words at 4..12(R13) for called routine parameters
TEXT ·block(SB), NOSPLIT, $84-16
MOVW p+4(FP), Rdata // pointer to the data
MOVW p_len+8(FP), Rt0 // number of bytes
ADD Rdata, Rt0
- MOVW Rt0, p_end(R13) // pointer to end of data
+ MOVW Rt0, p_end // pointer to end of data
loop:
- MOVW Rdata, p_data(R13) // Save Rdata
+ MOVW Rdata, p_data // Save Rdata
AND.S $3, Rdata, Rt0 // TST $3, Rdata not working see issue 5921
BEQ aligned // aligned detected - skip copy
// Copy the unaligned source data into the aligned temporary buffer
// memove(to=4(R13), from=8(R13), n=12(R13)) - Corrupts all registers
- MOVW $buf(R13), Rtable // to
+ MOVW $buf, Rtable // to
MOVW $64, Rc0 // n
MOVM.IB [Rtable,Rdata,Rc0], (R13)
BL runtime·memmove(SB)
// Point to the local aligned copy of the data
- MOVW $buf(R13), Rdata
+ MOVW $buf, Rdata
aligned:
// Point to the table of constants
@@ -217,8 +217,8 @@ aligned:
MOVM.IA [Ra,Rb,Rc,Rd], (Rt0)
- MOVW p_data(R13), Rdata
- MOVW p_end(R13), Rt0
+ MOVW p_data, Rdata
+ MOVW p_end, Rt0
ADD $64, Rdata
CMP Rt0, Rdata
BLO loop
diff --git a/src/crypto/sha1/sha1block_arm.s b/src/crypto/sha1/sha1block_arm.s
index ef0ff5d242..c06d4ba316 100644
--- a/src/crypto/sha1/sha1block_arm.s
+++ b/src/crypto/sha1/sha1block_arm.s
@@ -45,10 +45,10 @@
//12(FP) is p.cap
//
// Stack frame
-#define p_end -4 // -4(SP) pointer to the end of data
-#define p_data (p_end - 4) // -8(SP) current data pointer
-#define w_buf (p_data - 4*80) // -328(SP) 80 words temporary buffer w uint32[80]
-#define saved (w_buf - 4*5) // -348(SP) saved sha1 registers a,b,c,d,e - these must be last
+#define p_end end-4(SP) // pointer to the end of data
+#define p_data data-8(SP) // current data pointer (unused?)
+#define w_buf buf-(8+4*80)(SP) //80 words temporary buffer w uint32[80]
+#define saved abcde-(8+4*80+4*5)(SP) // saved sha1 registers a,b,c,d,e - these must be last (unused?)
// Total size +4 for saved LR is 352
// w[i] = p[j]<<24 | p[j+1]<<16 | p[j+2]<<8 | p[j+3]
@@ -141,7 +141,7 @@ TEXT ·block(SB), 0, $352-16
MOVW p+4(FP), Rdata // pointer to the data
MOVW p_len+8(FP), Rt0 // number of bytes
ADD Rdata, Rt0
- MOVW Rt0, p_end(R13) // pointer to end of data
+ MOVW Rt0, p_end // pointer to end of data
// Load up initial SHA1 accumulator
MOVW dig+0(FP), Rt0
@@ -151,7 +151,7 @@ loop:
// Save registers at SP+4 onwards
MOVM.IB [Ra,Rb,Rc,Rd,Re], (R13)
- MOVW $w_buf(R13), Rw
+ MOVW $w_buf, Rw
MOVW $0x5A827999, Rconst
MOVW $3, Rctr
loop1: ROUND1(Ra, Rb, Rc, Rd, Re)
@@ -206,7 +206,7 @@ loop4: ROUND4(Ra, Rb, Rc, Rd, Re)
ADD Rctr, Rd
ADD Rw, Re
- MOVW p_end(R13), Rt0
+ MOVW p_end, Rt0
CMP Rt0, Rdata
BLO loop