aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/conf-w32brg/nasm586/mpih-mul2.asm
blob: f1c989345ce5da0ce5f7d0c42cab741a652f5b67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
; i80586 addmul_1 -- Multiply a limb vector with a limb and add
; the result to a second limb vector.
;
;      Copyright (C) 1992, 1994, 1995, 1996, 1998,
;                    2001 Free Software Foundation, Inc.
;
; This file is part of GnuPG.
;
; GnuPG is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; GnuPG is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
;
; Modified versions of the GPG i586 assembler for use with NASM.  This 
; file is part of a native port of Gnu PG for use with Microsoft Visual 
; Studio .net. Ported by Brian Gladman <[email protected]> March 2002.

%define res_ptr	edi
%define s1_ptr	esi
%define size	ecx
%define s2_limb ebp

	global _mpihelp_addmul_1
	
	section	.text
	align	8

_mpihelp_addmul_1:
	push	edi
	push	esi
	push	ebx
	push	ebp
	mov		res_ptr,[esp+20]
	mov		s1_ptr,[esp+24]
	mov		size,[esp+28]
	mov		s2_limb,[esp+32]
	lea		res_ptr,[res_ptr+4*size]
	lea		s1_ptr,[s1_ptr+4*size]
	neg		size
	xor		ebx,ebx
	
	align	8
.1:
	adc		ebx,0
	mov		eax,[s1_ptr+4*size]
	mul		s2_limb
	add		eax,ebx
	mov		ebx,[res_ptr+4*size]
	adc		edx,0
	add		ebx,eax
	mov		[res_ptr+4*size],ebx
	inc		size
	mov		ebx,edx
	jnz		short .1
	adc		ebx,0
	mov		eax,ebx
	pop		ebp
	pop		ebx
	pop		esi
	pop		edi
	ret

	end