diff options
author | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:52:47 +0000 |
---|---|---|
committer | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:52:47 +0000 |
commit | d02b48c63a58ea4367a0e905979f140b7d090f86 (patch) | |
tree | 504f62ed3d84799f785b9cd9fab255a21b0e1b0e /crypto/bn/asm/x86w32.asm | |
download | openssl-d02b48c63a58ea4367a0e905979f140b7d090f86.tar.gz |
Import of old SSLeay release: SSLeay 0.8.1b
Diffstat (limited to 'crypto/bn/asm/x86w32.asm')
-rw-r--r-- | crypto/bn/asm/x86w32.asm | 303 |
1 files changed, 303 insertions, 0 deletions
diff --git a/crypto/bn/asm/x86w32.asm b/crypto/bn/asm/x86w32.asm new file mode 100644 index 0000000000..0e4452dfa9 --- /dev/null +++ b/crypto/bn/asm/x86w32.asm @@ -0,0 +1,303 @@ +; Static Name Aliases +; + TITLE bn_mulw.c + .386 +F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE' +F_TEXT ENDS +_DATA SEGMENT WORD USE16 PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD USE16 PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD USE16 PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME DS: DGROUP, SS: DGROUP +F_TEXT SEGMENT + ASSUME CS: F_TEXT + PUBLIC _bn_mul_add_word +_bn_mul_add_word PROC FAR +; Line 58 + push bp + push bx + push esi + push di + push ds + push es + mov bp,sp +; w = 28 +; num = 26 +; ap = 22 +; rp = 18 + xor esi,esi ;c=0; + mov di,WORD PTR [bp+18] ; load r + mov ds,WORD PTR [bp+20] ; load r + mov bx,WORD PTR [bp+22] ; load a + mov es,WORD PTR [bp+24] ; load a + mov ecx,DWORD PTR [bp+28] ; load w + mov bp,WORD PTR [bp+26] ; load num + shr bp,1 ; div count by 4 and do groups of 4 + shr bp,1 + je $L555 + +$L546: + mov eax,ecx + mul DWORD PTR es:[bx] ; w* *a + add eax,DWORD PTR ds:[di] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] ; w* *a + add eax,DWORD PTR ds:[di+4] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] ; w* *a + add eax,DWORD PTR ds:[di+8] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx + ; + mov eax,ecx + mul DWORD PTR es:[bx+12] ; w* *a + add eax,DWORD PTR ds:[di+12] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+12],eax + mov esi,edx + ; + add bx,16 + add di,16 + ; + dec bp + je $L555 + jmp $L546 +; +; +$L555: + mov bp,sp + mov bp,WORD PTR [bp+26] ; load num + and bp,3 + dec bp + js $L547 + + mov eax,ecx + mul DWORD PTR es:[bx] ; w* *a + add eax,DWORD PTR ds:[di] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + dec bp + js $L547 ; Note that we are now testing for -1 + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] ; w* *a + add eax,DWORD PTR ds:[di+4] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + dec bp + js $L547 + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] ; w* *a + add eax,DWORD PTR ds:[di+8] ; + *r + adc edx,0 + adc eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx +$L547: + mov eax,esi + mov edx,esi + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop + +_bn_mul_add_word ENDP + PUBLIC _bn_mul_word +_bn_mul_word PROC FAR +; Line 76 + push bp + push bx + push esi + push di + push ds + push es + xor esi,esi + mov bp,sp + mov di,WORD PTR [bp+18] ; r + mov ds,WORD PTR [bp+20] + mov bx,WORD PTR [bp+22] ; a + mov es,WORD PTR [bp+24] + mov ecx,DWORD PTR [bp+28] ; w + mov bp,WORD PTR [bp+26] ; num + +$FC743: + mov eax,ecx + mul DWORD PTR es:[bx] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+4] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+4],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+8] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+8],eax + mov esi,edx + dec bp + je $L764 + ; + mov eax,ecx + mul DWORD PTR es:[bx+12] + add eax,esi + adc edx,0 + mov DWORD PTR ds:[di+12],eax + mov esi,edx + dec bp + je $L764 + ; + add bx,16 + add di,16 + jmp $FC743 + nop +$L764: + mov eax,esi + mov edx,esi + shr edx,16 + pop es + pop ds + pop di + pop esi + pop bx + pop bp + ret + nop +_bn_mul_word ENDP + PUBLIC _bn_sqr_words +_bn_sqr_words PROC FAR +; Line 92 + push bp + push bx + push si + push di + push ds + push es + mov bp,sp + mov si,WORD PTR [bp+16] + mov ds,WORD PTR [bp+18] + mov di,WORD PTR [bp+20] + mov es,WORD PTR [bp+22] + mov bx,WORD PTR [bp+24] + + mov bp,bx ; save a memory lookup later + shr bx,1 ; div count by 4 and do groups of 4 + shr bx,1 + je $L666 + +$L765: + mov eax,DWORD PTR es:[di] + mul eax + mov DWORD PTR ds:[si],eax + mov DWORD PTR ds:[si+4],edx + ; + mov eax,DWORD PTR es:[di+4] + mul eax + mov DWORD PTR ds:[si+8],eax + mov DWORD PTR ds:[si+12],edx + ; + mov eax,DWORD PTR es:[di+8] + mul eax + mov DWORD PTR ds:[si+16],eax + mov DWORD PTR ds:[si+20],edx + ; + mov eax,DWORD PTR es:[di+12] + mul eax + mov DWORD PTR ds:[si+24],eax + mov DWORD PTR ds:[si+28],edx + ; + add di,16 + add si,32 + dec bx + je $L666 + jmp $L765 +$L666: + and bp,3 + dec bp ; The copied value of bx (num) + js $L645 + ; + mov eax,DWORD PTR es:[di] + mul eax + mov DWORD PTR ds:[si],eax + mov DWORD PTR ds:[si+4],edx + dec bp + js $L645 + ; + mov eax,DWORD PTR es:[di+4] + mul eax + mov DWORD PTR ds:[si+8],eax + mov DWORD PTR ds:[si+12],edx + dec bp + js $L645 + ; + mov eax,DWORD PTR es:[di+8] + mul eax + mov DWORD PTR ds:[si+16],eax + mov DWORD PTR ds:[si+20],edx +$L645: + pop es + pop ds + pop di + pop si + pop bx + pop bp + ret + +_bn_sqr_words ENDP + PUBLIC _bn_div64 +_bn_div64 PROC FAR + push bp + mov bp,sp + mov edx, DWORD PTR [bp+6] + mov eax, DWORD PTR [bp+10] + div DWORD PTR [bp+14] + mov edx,eax + shr edx,16 + pop bp + ret +_bn_div64 ENDP +F_TEXT ENDS +END |