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

« back to all changes in this revision

Viewing changes to mpi/i586/mpih-sub1.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 sub_n -- Sub two limb vectors of the same length > 0 and store
 
2
 *                 sum in a third limb vector.
 
3
 *
 
4
 *      Copyright (C) 1992, 1994, 1995, 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
 * Note: This code is heavily based on the GNU MP Library.
 
24
 *       Actually it's the same code with only minor changes in the
 
25
 *       way the data is stored; this is to support the abstraction
 
26
 *       of an optional secure memory allocation which may be used
 
27
 *       to avoid revealing of sensitive data due to paging etc.
 
28
 *       The GNU MP Library itself is published under the LGPL;
 
29
 *       however I decided to publish this code under the plain GPL.
 
30
 */
 
31
 
 
32
 
 
33
#include "sysdep.h"
 
34
#include "asm-syntax.h"
 
35
 
 
36
 
 
37
/*******************
 
38
 *  mpi_limb_t
 
39
 *  mpihelp_sub_n( mpi_ptr_t res_ptr,   (sp + 4)
 
40
 *                 mpi_ptr_t s1_ptr,    (sp + 8)
 
41
 *                 mpi_ptr_t s2_ptr,    (sp + 12)
 
42
 *                 mpi_size_t size)     (sp + 16)
 
43
 */
 
44
 
 
45
 
 
46
.text
 
47
        ALIGN (3)
 
48
        .globl C_SYMBOL_NAME(mpihelp_sub_n)
 
49
C_SYMBOL_NAME(mpihelp_sub_n:)
 
50
 
 
51
        pushl   %edi
 
52
        pushl   %esi
 
53
        pushl   %ebx
 
54
        pushl   %ebp
 
55
 
 
56
        movl    20(%esp),%edi           /* res_ptr */
 
57
        movl    24(%esp),%esi           /* s1_ptr */
 
58
        movl    28(%esp),%ebp           /* s2_ptr */
 
59
        movl    32(%esp),%ecx           /* size */
 
60
 
 
61
        movl    (%ebp),%ebx
 
62
 
 
63
        decl    %ecx
 
64
        movl    %ecx,%edx
 
65
        shrl    $3,%ecx
 
66
        andl    $7,%edx
 
67
        testl   %ecx,%ecx               /* zero carry flag */
 
68
        jz      Lend
 
69
        pushl   %edx
 
70
 
 
71
        ALIGN (3)
 
72
Loop:   movl    28(%edi),%eax           /* fetch destination cache line */
 
73
        leal    32(%edi),%edi
 
74
 
 
75
L1:     movl    (%esi),%eax
 
76
        movl    4(%esi),%edx
 
77
        sbbl    %ebx,%eax
 
78
        movl    4(%ebp),%ebx
 
79
        sbbl    %ebx,%edx
 
80
        movl    8(%ebp),%ebx
 
81
        movl    %eax,-32(%edi)
 
82
        movl    %edx,-28(%edi)
 
83
 
 
84
L2:     movl    8(%esi),%eax
 
85
        movl    12(%esi),%edx
 
86
        sbbl    %ebx,%eax
 
87
        movl    12(%ebp),%ebx
 
88
        sbbl    %ebx,%edx
 
89
        movl    16(%ebp),%ebx
 
90
        movl    %eax,-24(%edi)
 
91
        movl    %edx,-20(%edi)
 
92
 
 
93
L3:     movl    16(%esi),%eax
 
94
        movl    20(%esi),%edx
 
95
        sbbl    %ebx,%eax
 
96
        movl    20(%ebp),%ebx
 
97
        sbbl    %ebx,%edx
 
98
        movl    24(%ebp),%ebx
 
99
        movl    %eax,-16(%edi)
 
100
        movl    %edx,-12(%edi)
 
101
 
 
102
L4:     movl    24(%esi),%eax
 
103
        movl    28(%esi),%edx
 
104
        sbbl    %ebx,%eax
 
105
        movl    28(%ebp),%ebx
 
106
        sbbl    %ebx,%edx
 
107
        movl    32(%ebp),%ebx
 
108
        movl    %eax,-8(%edi)
 
109
        movl    %edx,-4(%edi)
 
110
 
 
111
        leal    32(%esi),%esi
 
112
        leal    32(%ebp),%ebp
 
113
        decl    %ecx
 
114
        jnz     Loop
 
115
 
 
116
        popl    %edx
 
117
Lend:
 
118
        decl    %edx                    /* test %edx w/o clobbering carry */
 
119
        js      Lend2
 
120
        incl    %edx
 
121
Loop2:
 
122
        leal    4(%edi),%edi
 
123
        movl    (%esi),%eax
 
124
        sbbl    %ebx,%eax
 
125
        movl    4(%ebp),%ebx
 
126
        movl    %eax,-4(%edi)
 
127
        leal    4(%esi),%esi
 
128
        leal    4(%ebp),%ebp
 
129
        decl    %edx
 
130
        jnz     Loop2
 
131
Lend2:
 
132
        movl    (%esi),%eax
 
133
        sbbl    %ebx,%eax
 
134
        movl    %eax,(%edi)
 
135
 
 
136
        sbbl    %eax,%eax
 
137
        negl    %eax
 
138
 
 
139
        popl    %ebp
 
140
        popl    %ebx
 
141
        popl    %esi
 
142
        popl    %edi
 
143
        ret
 
144