~ubuntu-branches/ubuntu/karmic/gnupg2/karmic-updates

« back to all changes in this revision

Viewing changes to mpi/i586/mpih-add1.S

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2006-01-24 04:31:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060124043142-pbg192or6qxv3yk2
Tags: 1.9.20-1
* New Upstream version. Closes:#306890,#344530
  * Closes:#320490: gpg-protect-tool fails to decrypt PKCS-12 files 
* Depend on libopensc2-dev, not -1-. Closes:#348106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* i80586 add_n -- Add two limb vectors of the same length > 0 and store
 
2
 *                 sum in a third limb vector.
 
3
 *
 
4
 *      Copyright (C) 1992, 1994, 1995, 1996, 1998,
 
5
 *                    2001 Free Software Foundation, Inc.
 
6
 *
 
7
 * This file is part of GnuPG.
 
8
 *
 
9
 * GnuPG is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 2 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * GnuPG is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
22
 */
 
23
 
 
24
 
 
25
#include "sysdep.h"
 
26
#include "asm-syntax.h"
 
27
 
 
28
 
 
29
/*******************
 
30
 *  mpi_limb_t
 
31
 *  mpihelp_add_n( mpi_ptr_t res_ptr,   (sp + 4)
 
32
 *                 mpi_ptr_t s1_ptr,    (sp + 8)
 
33
 *                 mpi_ptr_t s2_ptr,    (sp + 12)
 
34
 *                 mpi_size_t size)     (sp + 16)
 
35
 */
 
36
 
 
37
.text
 
38
        ALIGN (3)
 
39
        .globl C_SYMBOL_NAME(mpihelp_add_n)
 
40
C_SYMBOL_NAME(mpihelp_add_n:)
 
41
        pushl   %edi
 
42
        pushl   %esi
 
43
        pushl   %ebx
 
44
        pushl   %ebp
 
45
 
 
46
        movl    20(%esp),%edi           /* res_ptr */
 
47
        movl    24(%esp),%esi           /* s1_ptr */
 
48
        movl    28(%esp),%ebp           /* s2_ptr */
 
49
        movl    32(%esp),%ecx           /* size */
 
50
 
 
51
        movl    (%ebp),%ebx
 
52
 
 
53
        decl    %ecx
 
54
        movl    %ecx,%edx
 
55
        shrl    $3,%ecx
 
56
        andl    $7,%edx
 
57
        testl   %ecx,%ecx               /* zero carry flag */
 
58
        jz      Lend
 
59
        pushl   %edx
 
60
 
 
61
        ALIGN (3)
 
62
Loop:   movl    28(%edi),%eax           /* fetch destination cache line */
 
63
        leal    32(%edi),%edi
 
64
 
 
65
L1:     movl    (%esi),%eax
 
66
        movl    4(%esi),%edx
 
67
        adcl    %ebx,%eax
 
68
        movl    4(%ebp),%ebx
 
69
        adcl    %ebx,%edx
 
70
        movl    8(%ebp),%ebx
 
71
        movl    %eax,-32(%edi)
 
72
        movl    %edx,-28(%edi)
 
73
 
 
74
L2:     movl    8(%esi),%eax
 
75
        movl    12(%esi),%edx
 
76
        adcl    %ebx,%eax
 
77
        movl    12(%ebp),%ebx
 
78
        adcl    %ebx,%edx
 
79
        movl    16(%ebp),%ebx
 
80
        movl    %eax,-24(%edi)
 
81
        movl    %edx,-20(%edi)
 
82
 
 
83
L3:     movl    16(%esi),%eax
 
84
        movl    20(%esi),%edx
 
85
        adcl    %ebx,%eax
 
86
        movl    20(%ebp),%ebx
 
87
        adcl    %ebx,%edx
 
88
        movl    24(%ebp),%ebx
 
89
        movl    %eax,-16(%edi)
 
90
        movl    %edx,-12(%edi)
 
91
 
 
92
L4:     movl    24(%esi),%eax
 
93
        movl    28(%esi),%edx
 
94
        adcl    %ebx,%eax
 
95
        movl    28(%ebp),%ebx
 
96
        adcl    %ebx,%edx
 
97
        movl    32(%ebp),%ebx
 
98
        movl    %eax,-8(%edi)
 
99
        movl    %edx,-4(%edi)
 
100
 
 
101
        leal    32(%esi),%esi
 
102
        leal    32(%ebp),%ebp
 
103
        decl    %ecx
 
104
        jnz     Loop
 
105
 
 
106
        popl    %edx
 
107
Lend:
 
108
        decl    %edx                    /* test %edx w/o clobbering carry */
 
109
        js      Lend2
 
110
        incl    %edx
 
111
Loop2:
 
112
        leal    4(%edi),%edi
 
113
        movl    (%esi),%eax
 
114
        adcl    %ebx,%eax
 
115
        movl    4(%ebp),%ebx
 
116
        movl    %eax,-4(%edi)
 
117
        leal    4(%esi),%esi
 
118
        leal    4(%ebp),%ebp
 
119
        decl    %edx
 
120
        jnz     Loop2
 
121
Lend2:
 
122
        movl    (%esi),%eax
 
123
        adcl    %ebx,%eax
 
124
        movl    %eax,(%edi)
 
125
 
 
126
        sbbl    %eax,%eax
 
127
        negl    %eax
 
128
 
 
129
        popl    %ebp
 
130
        popl    %ebx
 
131
        popl    %esi
 
132
        popl    %edi
 
133
        ret
 
134
 
 
135