~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to mpi/i386/mpih-shift.S

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* i80386   rshift, lshift
2
 
 *      Copyright (C) 1998 Free Software Foundation, Inc.
3
 
 *      Copyright (C) 1992, 1994 Free Software Foundation, Inc.
4
 
 *
5
 
 * This file is part of GNUPG.
6
 
 *
7
 
 * GNUPG is free software; you can redistribute it and/or modify
8
 
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; either version 2 of the License, or
10
 
 * (at your option) any later version.
11
 
 *
12
 
 * GNUPG is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 * GNU General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20
 
 *
21
 
 * Note: This code is heavily based on the GNU MP Library.
22
 
 *       Actually it's the same code with only minor changes in the
23
 
 *       way the data is stored; this is to support the abstraction
24
 
 *       of an optional secure memory allocation which may be used
25
 
 *       to avoid revealing of sensitive data due to paging etc.
26
 
 *       The GNU MP Library itself is published under the LGPL;
27
 
 *       however I decided to publish this code under the plain GPL.
28
 
 */
29
 
 
30
 
 
31
 
#include "sysdep.h"
32
 
#include "asm-syntax.h"
33
 
 
34
 
 
35
 
/*******************
36
 
 * mpi_limb_t
37
 
 * mpihelp_lshift( mpi_ptr_t wp,        (sp + 4)
38
 
 *                 mpi_ptr_t up,        (sp + 8)
39
 
 *                 mpi_size_t usize,    (sp + 12)
40
 
 *                 unsigned cnt)        (sp + 16)
41
 
 */
42
 
 
43
 
.text
44
 
        ALIGN (3)
45
 
        .globl C_SYMBOL_NAME(mpihelp_lshift)
46
 
C_SYMBOL_NAME(mpihelp_lshift:)
47
 
        pushl   %edi
48
 
        pushl   %esi
49
 
        pushl   %ebx
50
 
 
51
 
        movl    16(%esp),%edi           /* res_ptr */
52
 
        movl    20(%esp),%esi           /* s_ptr */
53
 
        movl    24(%esp),%edx           /* size */
54
 
        movl    28(%esp),%ecx           /* cnt */
55
 
 
56
 
        subl    $4,%esi                 /* adjust s_ptr */
57
 
 
58
 
        movl    (%esi,%edx,4),%ebx      /* read most significant limb */
59
 
        xorl    %eax,%eax
60
 
        shldl   %cl,%ebx,%eax           /* compute carry limb */
61
 
        decl    %edx
62
 
        jz      Lend
63
 
        pushl   %eax                    /* push carry limb onto stack */
64
 
        testb   $1,%edx
65
 
        jnz     L1                      /* enter loop in the middle */
66
 
        movl    %ebx,%eax
67
 
 
68
 
        ALIGN (3)
69
 
Loop:   movl    (%esi,%edx,4),%ebx      /* load next lower limb */
70
 
        shldl   %cl,%ebx,%eax           /* compute result limb */
71
 
        movl    %eax,(%edi,%edx,4)      /* store it */
72
 
        decl    %edx
73
 
L1:     movl    (%esi,%edx,4),%eax
74
 
        shldl   %cl,%eax,%ebx
75
 
        movl    %ebx,(%edi,%edx,4)
76
 
        decl    %edx
77
 
        jnz     Loop
78
 
 
79
 
        shll    %cl,%eax                /* compute least significant limb */
80
 
        movl    %eax,(%edi)             /* store it */
81
 
 
82
 
        popl    %eax                    /* pop carry limb */
83
 
 
84
 
        popl    %ebx
85
 
        popl    %esi
86
 
        popl    %edi
87
 
        ret
88
 
 
89
 
Lend:   shll    %cl,%ebx                /* compute least significant limb */
90
 
        movl    %ebx,(%edi)             /* store it */
91
 
 
92
 
        popl    %ebx
93
 
        popl    %esi
94
 
        popl    %edi
95
 
        ret
96
 
 
97
 
/*******************
98
 
 * mpi_limb_t
99
 
 * mpihelp_rshift( mpi_ptr_t wp,        (sp + 4)
100
 
 *                 mpi_ptr_t up,        (sp + 8)
101
 
 *                 mpi_size_t usize,    (sp + 12)
102
 
 *                 unsigned cnt)        (sp + 16)
103
 
 */
104
 
 
105
 
.text
106
 
        ALIGN (3)
107
 
        .globl C_SYMBOL_NAME(mpihelp_rshift)
108
 
C_SYMBOL_NAME(mpihelp_rshift:)
109
 
        pushl   %edi
110
 
        pushl   %esi
111
 
        pushl   %ebx
112
 
 
113
 
        movl    16(%esp),%edi           /* wp */
114
 
        movl    20(%esp),%esi           /* up */
115
 
        movl    24(%esp),%edx           /* usize */
116
 
        movl    28(%esp),%ecx           /* cnt */
117
 
 
118
 
        leal    -4(%edi,%edx,4),%edi
119
 
        leal    (%esi,%edx,4),%esi
120
 
        negl    %edx
121
 
 
122
 
        movl    (%esi,%edx,4),%ebx      /* read least significant limb */
123
 
        xorl    %eax,%eax
124
 
        shrdl   %cl,%ebx,%eax           /* compute carry limb */
125
 
        incl    %edx
126
 
        jz      Lend2
127
 
        pushl   %eax                    /* push carry limb onto stack */
128
 
        testb   $1,%edx
129
 
        jnz     L2                      /* enter loop in the middle */
130
 
        movl    %ebx,%eax
131
 
 
132
 
        ALIGN (3)
133
 
Loop2:   movl    (%esi,%edx,4),%ebx      /* load next higher limb */
134
 
        shrdl   %cl,%ebx,%eax           /* compute result limb */
135
 
        movl    %eax,(%edi,%edx,4)      /* store it */
136
 
        incl    %edx
137
 
L2:     movl    (%esi,%edx,4),%eax
138
 
        shrdl   %cl,%eax,%ebx
139
 
        movl    %ebx,(%edi,%edx,4)
140
 
        incl    %edx
141
 
        jnz     Loop2
142
 
 
143
 
        shrl    %cl,%eax                /* compute most significant limb */
144
 
        movl    %eax,(%edi)             /* store it */
145
 
 
146
 
        popl    %eax                    /* pop carry limb */
147
 
 
148
 
        popl    %ebx
149
 
        popl    %esi
150
 
        popl    %edi
151
 
        ret
152
 
 
153
 
Lend2:  shrl    %cl,%ebx                /* compute most significant limb */
154
 
        movl    %ebx,(%edi)             /* store it */
155
 
 
156
 
        popl    %ebx
157
 
        popl    %esi
158
 
        popl    %edi
159
 
        ret
160