diff options
Diffstat (limited to 'linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/m68k/mpih-lshift.S')
-rw-r--r--[-rwxr-xr-x] | linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/m68k/mpih-lshift.S | 328 |
1 files changed, 164 insertions, 164 deletions
diff --git a/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/m68k/mpih-lshift.S b/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/m68k/mpih-lshift.S index 1c2ec35..133d1aa 100755..100644 --- a/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/m68k/mpih-lshift.S +++ b/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/m68k/mpih-lshift.S | |||
@@ -1,164 +1,164 @@ | |||
1 | /* mc68020 lshift -- Shift left a low-level natural-number integer. | 1 | /* mc68020 lshift -- Shift left a low-level natural-number integer. |
2 | * | 2 | * |
3 | * Copyright (C) 1996, 1998, 2001, 2002 Free Software Foundation, Inc. | 3 | * Copyright (C) 1996, 1998, 2001, 2002 Free Software Foundation, Inc. |
4 | * | 4 | * |
5 | * This file is part of Libgcrypt. | 5 | * This file is part of Libgcrypt. |
6 | * | 6 | * |
7 | * Libgcrypt is free software; you can redistribute it and/or modify | 7 | * Libgcrypt is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU Lesser General Public License as | 8 | * it under the terms of the GNU Lesser General Public License as |
9 | * published by the Free Software Foundation; either version 2.1 of | 9 | * published by the Free Software Foundation; either version 2.1 of |
10 | * the License, or (at your option) any later version. | 10 | * the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * Libgcrypt is distributed in the hope that it will be useful, | 12 | * Libgcrypt is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU Lesser General Public License for more details. | 15 | * GNU Lesser General Public License for more details. |
16 | * | 16 | * |
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this program; if not, write to the Free Software | 18 | * License along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
20 | * | 20 | * |
21 | * Note: This code is heavily based on the GNU MP Library. | 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 | 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 | 23 | * way the data is stored; this is to support the abstraction |
24 | * of an optional secure memory allocation which may be used | 24 | * of an optional secure memory allocation which may be used |
25 | * to avoid revealing of sensitive data due to paging etc. | 25 | * to avoid revealing of sensitive data due to paging etc. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #include "sysdep.h" | 29 | #include "sysdep.h" |
30 | #include "asm-syntax.h" | 30 | #include "asm-syntax.h" |
31 | 31 | ||
32 | 32 | ||
33 | /******************* | 33 | /******************* |
34 | * mpi_limb_t | 34 | * mpi_limb_t |
35 | * _gcry_mpih_lshift( mpi_ptr_t wp, (sp + 4) | 35 | * _gcry_mpih_lshift( mpi_ptr_t wp, (sp + 4) |
36 | * mpi_ptr_t up, (sp + 8) | 36 | * mpi_ptr_t up, (sp + 8) |
37 | * mpi_size_t usize, (sp + 12) | 37 | * mpi_size_t usize, (sp + 12) |
38 | * unsigned cnt) (sp + 16) | 38 | * unsigned cnt) (sp + 16) |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #define res_ptr a1 | 41 | #define res_ptr a1 |
42 | #define s_ptr a0 | 42 | #define s_ptr a0 |
43 | #define s_size d6 | 43 | #define s_size d6 |
44 | #define cnt d4 | 44 | #define cnt d4 |
45 | 45 | ||
46 | TEXT | 46 | TEXT |
47 | ALIGN | 47 | ALIGN |
48 | GLOBL C_SYMBOL_NAME(_gcry_mpih_lshift) | 48 | GLOBL C_SYMBOL_NAME(_gcry_mpih_lshift) |
49 | 49 | ||
50 | C_SYMBOL_NAME(_gcry_mpih_lshift:) | 50 | C_SYMBOL_NAME(_gcry_mpih_lshift:) |
51 | PROLOG(_gcry_mpih_lshift) | 51 | PROLOG(_gcry_mpih_lshift) |
52 | 52 | ||
53 | /* Save used registers on the stack. */ | 53 | /* Save used registers on the stack. */ |
54 | moveml R(d2)-R(d6)/R(a2),MEM_PREDEC(sp) | 54 | moveml R(d2)-R(d6)/R(a2),MEM_PREDEC(sp) |
55 | 55 | ||
56 | /* Copy the arguments to registers. */ | 56 | /* Copy the arguments to registers. */ |
57 | movel MEM_DISP(sp,28),R(res_ptr) | 57 | movel MEM_DISP(sp,28),R(res_ptr) |
58 | movel MEM_DISP(sp,32),R(s_ptr) | 58 | movel MEM_DISP(sp,32),R(s_ptr) |
59 | movel MEM_DISP(sp,36),R(s_size) | 59 | movel MEM_DISP(sp,36),R(s_size) |
60 | movel MEM_DISP(sp,40),R(cnt) | 60 | movel MEM_DISP(sp,40),R(cnt) |
61 | 61 | ||
62 | moveql #1,R(d5) | 62 | moveql #1,R(d5) |
63 | cmpl R(d5),R(cnt) | 63 | cmpl R(d5),R(cnt) |
64 | bne L(Lnormal) | 64 | bne L(Lnormal) |
65 | cmpl R(s_ptr),R(res_ptr) | 65 | cmpl R(s_ptr),R(res_ptr) |
66 | bls L(Lspecial) /* jump if s_ptr >= res_ptr */ | 66 | bls L(Lspecial) /* jump if s_ptr >= res_ptr */ |
67 | #if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) | 67 | #if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) |
68 | lea MEM_INDX1(s_ptr,s_size,l,4),R(a2) | 68 | lea MEM_INDX1(s_ptr,s_size,l,4),R(a2) |
69 | #else /* not mc68020 */ | 69 | #else /* not mc68020 */ |
70 | movel R(s_size),R(d0) | 70 | movel R(s_size),R(d0) |
71 | asll #2,R(d0) | 71 | asll #2,R(d0) |
72 | lea MEM_INDX(s_ptr,d0,l),R(a2) | 72 | lea MEM_INDX(s_ptr,d0,l),R(a2) |
73 | #endif | 73 | #endif |
74 | cmpl R(res_ptr),R(a2) | 74 | cmpl R(res_ptr),R(a2) |
75 | bls L(Lspecial) /* jump if res_ptr >= s_ptr + s_size */ | 75 | bls L(Lspecial) /* jump if res_ptr >= s_ptr + s_size */ |
76 | 76 | ||
77 | L(Lnormal:) | 77 | L(Lnormal:) |
78 | moveql #32,R(d5) | 78 | moveql #32,R(d5) |
79 | subl R(cnt),R(d5) | 79 | subl R(cnt),R(d5) |
80 | 80 | ||
81 | #if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) | 81 | #if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) |
82 | lea MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr) | 82 | lea MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr) |
83 | lea MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr) | 83 | lea MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr) |
84 | #else /* not mc68000 */ | 84 | #else /* not mc68000 */ |
85 | movel R(s_size),R(d0) | 85 | movel R(s_size),R(d0) |
86 | asll #2,R(d0) | 86 | asll #2,R(d0) |
87 | addl R(s_size),R(s_ptr) | 87 | addl R(s_size),R(s_ptr) |
88 | addl R(s_size),R(res_ptr) | 88 | addl R(s_size),R(res_ptr) |
89 | #endif | 89 | #endif |
90 | movel MEM_PREDEC(s_ptr),R(d2) | 90 | movel MEM_PREDEC(s_ptr),R(d2) |
91 | movel R(d2),R(d0) | 91 | movel R(d2),R(d0) |
92 | lsrl R(d5),R(d0) /* compute carry limb */ | 92 | lsrl R(d5),R(d0) /* compute carry limb */ |
93 | 93 | ||
94 | lsll R(cnt),R(d2) | 94 | lsll R(cnt),R(d2) |
95 | movel R(d2),R(d1) | 95 | movel R(d2),R(d1) |
96 | subql #1,R(s_size) | 96 | subql #1,R(s_size) |
97 | beq L(Lend) | 97 | beq L(Lend) |
98 | lsrl #1,R(s_size) | 98 | lsrl #1,R(s_size) |
99 | bcs L(L1) | 99 | bcs L(L1) |
100 | subql #1,R(s_size) | 100 | subql #1,R(s_size) |
101 | 101 | ||
102 | L(Loop:) | 102 | L(Loop:) |
103 | movel MEM_PREDEC(s_ptr),R(d2) | 103 | movel MEM_PREDEC(s_ptr),R(d2) |
104 | movel R(d2),R(d3) | 104 | movel R(d2),R(d3) |
105 | lsrl R(d5),R(d3) | 105 | lsrl R(d5),R(d3) |
106 | orl R(d3),R(d1) | 106 | orl R(d3),R(d1) |
107 | movel R(d1),MEM_PREDEC(res_ptr) | 107 | movel R(d1),MEM_PREDEC(res_ptr) |
108 | lsll R(cnt),R(d2) | 108 | lsll R(cnt),R(d2) |
109 | L(L1:) | 109 | L(L1:) |
110 | movel MEM_PREDEC(s_ptr),R(d1) | 110 | movel MEM_PREDEC(s_ptr),R(d1) |
111 | movel R(d1),R(d3) | 111 | movel R(d1),R(d3) |
112 | lsrl R(d5),R(d3) | 112 | lsrl R(d5),R(d3) |
113 | orl R(d3),R(d2) | 113 | orl R(d3),R(d2) |
114 | movel R(d2),MEM_PREDEC(res_ptr) | 114 | movel R(d2),MEM_PREDEC(res_ptr) |
115 | lsll R(cnt),R(d1) | 115 | lsll R(cnt),R(d1) |
116 | 116 | ||
117 | dbf R(s_size),L(Loop) | 117 | dbf R(s_size),L(Loop) |
118 | subl #0x10000,R(s_size) | 118 | subl #0x10000,R(s_size) |
119 | bcc L(Loop) | 119 | bcc L(Loop) |
120 | 120 | ||
121 | L(Lend:) | 121 | L(Lend:) |
122 | movel R(d1),MEM_PREDEC(res_ptr) /* store least significant limb */ | 122 | movel R(d1),MEM_PREDEC(res_ptr) /* store least significant limb */ |
123 | 123 | ||
124 | /* Restore used registers from stack frame. */ | 124 | /* Restore used registers from stack frame. */ |
125 | moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) | 125 | moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) |
126 | rts | 126 | rts |
127 | 127 | ||
128 | /* We loop from least significant end of the arrays, which is only | 128 | /* We loop from least significant end of the arrays, which is only |
129 | permissable if the source and destination don't overlap, since the | 129 | permissable if the source and destination don't overlap, since the |
130 | function is documented to work for overlapping source and destination. */ | 130 | function is documented to work for overlapping source and destination. */ |
131 | 131 | ||
132 | L(Lspecial:) | 132 | L(Lspecial:) |
133 | clrl R(d0) /* initialize carry */ | 133 | clrl R(d0) /* initialize carry */ |
134 | eorw #1,R(s_size) | 134 | eorw #1,R(s_size) |
135 | lsrl #1,R(s_size) | 135 | lsrl #1,R(s_size) |
136 | bcc L(LL1) | 136 | bcc L(LL1) |
137 | subql #1,R(s_size) | 137 | subql #1,R(s_size) |
138 | 138 | ||
139 | L(LLoop:) | 139 | L(LLoop:) |
140 | movel MEM_POSTINC(s_ptr),R(d2) | 140 | movel MEM_POSTINC(s_ptr),R(d2) |
141 | addxl R(d2),R(d2) | 141 | addxl R(d2),R(d2) |
142 | movel R(d2),MEM_POSTINC(res_ptr) | 142 | movel R(d2),MEM_POSTINC(res_ptr) |
143 | L(LL1:) | 143 | L(LL1:) |
144 | movel MEM_POSTINC(s_ptr),R(d2) | 144 | movel MEM_POSTINC(s_ptr),R(d2) |
145 | addxl R(d2),R(d2) | 145 | addxl R(d2),R(d2) |
146 | movel R(d2),MEM_POSTINC(res_ptr) | 146 | movel R(d2),MEM_POSTINC(res_ptr) |
147 | 147 | ||
148 | dbf R(s_size),L(LLoop) | 148 | dbf R(s_size),L(LLoop) |
149 | addxl R(d0),R(d0) /* save cy in lsb */ | 149 | addxl R(d0),R(d0) /* save cy in lsb */ |
150 | subl #0x10000,R(s_size) | 150 | subl #0x10000,R(s_size) |
151 | bcs L(LLend) | 151 | bcs L(LLend) |
152 | lsrl #1,R(d0) /* restore cy */ | 152 | lsrl #1,R(d0) /* restore cy */ |
153 | bra L(LLoop) | 153 | bra L(LLoop) |
154 | 154 | ||
155 | L(LLend:) | 155 | L(LLend:) |
156 | /* Restore used registers from stack frame. */ | 156 | /* Restore used registers from stack frame. */ |
157 | moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) | 157 | moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) |
158 | rts | 158 | rts |
159 | EPILOG(_gcry_mpih_lshift) | 159 | EPILOG(_gcry_mpih_lshift) |
160 | 160 | ||
161 | 161 | ||
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||