~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/cfb/stipsparc.s

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Xorg: stipsparc.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
 
3
 *
 
4
Copyright 1990, 1998  The Open Group
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software and its
 
7
documentation for any purpose is hereby granted without fee, provided that
 
8
the above copyright notice appear in all copies and that both that
 
9
copyright notice and this permission notice appear in supporting
 
10
documentation.
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
 
 
22
Except as contained in this notice, the name of The Open Group shall not be
 
23
used in advertising or otherwise to promote the sale, use or other dealings
 
24
in this Software without prior written authorization from The Open Group.
 
25
 *
 
26
 * Author:  Keith Packard, MIT X Consortium
 
27
 */
 
28
/* $XFree86: xc/programs/Xserver/cfb/stipsparc.s,v 1.5 2001/12/14 19:59:26 dawes Exp $ */
 
29
 
 
30
/*
 
31
 * SPARC assembly code for optimized text rendering.
 
32
 *
 
33
 * Other stippling could be done in assembly, but the payoff is
 
34
 * not nearly as large.  Mostly because large areas are heavily
 
35
 * optimized already.
 
36
 */
 
37
 
 
38
/* not that I expect to ever see an LSB SPARC, but ... */
 
39
#ifdef LITTLE_ENDIAN
 
40
# define BitsR          sll
 
41
# define BitsL          srl
 
42
# define BO(o)          o
 
43
# define HO(o)          o
 
44
# define WO(o)          o
 
45
# define FourBits(dest,bits)    and     bits, 0xf, dest
 
46
#else
 
47
# define BitsR          srl
 
48
# define BitsL          sll
 
49
# define BO(o)          3-o
 
50
# define HO(o)          2-o
 
51
# define WO(o)          o
 
52
# define FourBits(dest,bits)    srl     bits, 28, dest
 
53
#endif
 
54
 
 
55
/*
 
56
 * cfbStippleStack(addr, stipple, value, stride, Count, Shift)
 
57
 *               4       5       6      7     16(sp) 20(sp)
 
58
 *
 
59
 *  Apply successive 32-bit stipples starting at addr, addr+stride, ...
 
60
 *
 
61
 *  Used for text rendering, but only when no data could be lost
 
62
 *  when the stipple is shifted left by Shift bits
 
63
 */
 
64
/* arguments */
 
65
#define addr    %i0
 
66
#define stipple %i1
 
67
#define value   %i2
 
68
#define stride  %i3
 
69
#define count   %i4
 
70
#define shift   %i5
 
71
 
 
72
/* local variables */
 
73
#define atemp   %l0
 
74
#define bits    %l1
 
75
#define lshift  %l2
 
76
#define sbase   %l3
 
77
#define stemp   %l4
 
78
 
 
79
#define CASE_SIZE       5       /* case blocks are 2^5 bytes each */
 
80
#define CASE_MASK       0x1e0   /* first case mask */
 
81
 
 
82
#define ForEachLine     LY1
 
83
#define NextLine        LY2
 
84
#define CaseBegin       LY3
 
85
#define ForEachBits     LY4
 
86
#define NextBits        LY5
 
87
 
 
88
#if defined(SVR4) || defined(__ELF__)
 
89
#ifdef TETEXT
 
90
#define _cfbStippleStack        cfbStippleStackTE
 
91
#else
 
92
#define _cfbStippleStack        cfbStippleStack
 
93
#endif
 
94
#else
 
95
#ifdef TETEXT
 
96
#define _cfbStippleStack        _cfbStippleStackTE
 
97
#endif
 
98
#endif
 
99
        .seg    "text"
 
100
        .proc   16
 
101
        .globl  _cfbStippleStack
 
102
_cfbStippleStack:
 
103
        save    %sp,-64,%sp
 
104
        sethi   %hi(CaseBegin),sbase            /* load up switch table */
 
105
        or      sbase,%lo(CaseBegin),sbase
 
106
 
 
107
        mov     4,lshift                        /* compute offset within */
 
108
        sub     lshift, shift, lshift           /*  stipple of remaining bits */
 
109
#ifdef LITTLE_ENDIAN
 
110
        inc     CASE_SIZE, shift                /* first shift for LSB */
 
111
#else
 
112
        inc     28-CASE_SIZE, shift             /* first shift for MSB */
 
113
#endif
 
114
        /* do ... while (--count > 0); */
 
115
ForEachLine:
 
116
        ld      [stipple],bits                  /* get stipple bits */
 
117
        mov     addr,atemp                      /* set up for this line */
 
118
#ifdef TETEXT
 
119
        /* Terminal emulator fonts are expanded and have many 0 rows */
 
120
        tst     bits
 
121
        bz      NextLine                        /* skip out early on 0 */
 
122
#endif
 
123
        add     addr, stride, addr              /* step for the loop */
 
124
        BitsR   bits, shift, stemp              /* get first bits */
 
125
        and     stemp, CASE_MASK, stemp         /* compute first jump */
 
126
        BitsL   bits, lshift, bits              /* set remaining bits */
 
127
        jmp     sbase+stemp                     /*  ... */
 
128
        tst     bits
 
129
 
 
130
ForEachBits:
 
131
        inc     4, atemp
 
132
ForEachBits1:
 
133
        FourBits(stemp, bits)                   /* compute jump for */
 
134
        sll     stemp, CASE_SIZE, stemp         /*  these four bits */
 
135
        BitsL   bits, 4, bits                   /* step for remaining bits */
 
136
        jmp     sbase+stemp                     /* jump */
 
137
        tst     bits
 
138
CaseBegin:
 
139
        bnz,a   ForEachBits1                    /* 0 */
 
140
        inc     4, atemp
 
141
NextLine:
 
142
        deccc   1, count
 
143
        bnz,a   ForEachLine
 
144
        inc     4, stipple
 
145
        ret
 
146
        restore
 
147
        nop
 
148
 
 
149
        bnz     ForEachBits                     /* 1 */
 
150
        stb     value, [atemp+BO(0)]
 
151
        deccc   1, count
 
152
        bnz,a   ForEachLine
 
153
        inc     4, stipple
 
154
        ret
 
155
        restore
 
156
        nop
 
157
                                        
 
158
        bnz     ForEachBits                     /* 2 */
 
159
        stb     value, [atemp+BO(1)]
 
160
        deccc   1, count
 
161
        bnz,a   ForEachLine
 
162
        inc     4, stipple
 
163
        ret
 
164
        restore
 
165
        nop
 
166
                                        
 
167
        bnz     ForEachBits                     /* 3 */
 
168
        sth     value, [atemp+HO(0)]
 
169
        deccc   1, count
 
170
        bnz,a   ForEachLine
 
171
        inc     4, stipple
 
172
        ret
 
173
        restore
 
174
        nop
 
175
                                        
 
176
        bnz     ForEachBits                     /* 4 */
 
177
        stb     value, [atemp+BO(2)]
 
178
        deccc   1, count
 
179
        bnz,a   ForEachLine
 
180
        inc     4, stipple
 
181
        ret
 
182
        restore
 
183
        nop
 
184
                                        
 
185
        stb     value, [atemp+BO(0)]            /* 5 */
 
186
        bnz     ForEachBits
 
187
        stb     value, [atemp+BO(2)]
 
188
        deccc   1, count
 
189
        bnz,a   ForEachLine
 
190
        inc     4, stipple
 
191
        ret
 
192
        restore
 
193
                                        
 
194
        stb     value, [atemp+BO(1)]            /* 6 */
 
195
        bnz     ForEachBits
 
196
        stb     value, [atemp+BO(2)]
 
197
        deccc   1, count
 
198
        bnz,a   ForEachLine
 
199
        inc     4, stipple
 
200
        ret
 
201
        restore
 
202
                                        
 
203
        sth     value, [atemp+HO(0)]            /* 7 */
 
204
        bnz     ForEachBits
 
205
        stb     value, [atemp+BO(2)]
 
206
        deccc   1, count
 
207
        bnz,a   ForEachLine
 
208
        inc     4, stipple
 
209
        ret
 
210
        restore
 
211
                                        
 
212
        bnz     ForEachBits                     /* 8 */
 
213
        stb     value, [atemp+BO(3)]
 
214
        deccc   1, count
 
215
        bnz,a   ForEachLine
 
216
        inc     4, stipple
 
217
        ret
 
218
        restore
 
219
        nop
 
220
                                        
 
221
        stb     value, [atemp+BO(0)]            /* 9 */
 
222
        bnz     ForEachBits
 
223
        stb     value, [atemp+BO(3)]
 
224
        deccc   1, count
 
225
        bnz,a   ForEachLine
 
226
        inc     4, stipple
 
227
        ret
 
228
        restore
 
229
                                        
 
230
        stb     value, [atemp+BO(1)]            /* a */
 
231
        bnz     ForEachBits
 
232
        stb     value, [atemp+BO(3)]
 
233
        deccc   1, count
 
234
        bnz,a   ForEachLine
 
235
        inc     4, stipple
 
236
        ret
 
237
        restore
 
238
                                        
 
239
        sth     value, [atemp+HO(0)]            /* b */
 
240
        bnz     ForEachBits
 
241
        stb     value, [atemp+BO(3)]
 
242
        deccc   1, count
 
243
        bnz,a   ForEachLine
 
244
        inc     4, stipple
 
245
        ret
 
246
        restore
 
247
                                        
 
248
        bnz     ForEachBits                     /* c */
 
249
        sth     value, [atemp+HO(2)]
 
250
        deccc   1, count
 
251
        bnz,a   ForEachLine
 
252
        inc     4, stipple
 
253
        ret
 
254
        restore
 
255
        nop
 
256
                                        
 
257
        stb     value, [atemp+BO(0)]            /* d */
 
258
        bnz     ForEachBits
 
259
        sth     value, [atemp+HO(2)]
 
260
        deccc   1, count
 
261
        bnz,a   ForEachLine
 
262
        inc     4, stipple
 
263
        ret
 
264
        restore
 
265
                                        
 
266
        stb     value, [atemp+BO(1)]            /* e */
 
267
        bnz     ForEachBits
 
268
        sth     value, [atemp+HO(2)]
 
269
        deccc   1, count
 
270
        bnz,a   ForEachLine
 
271
        inc     4, stipple
 
272
        ret
 
273
        restore
 
274
                                        
 
275
        bnz     ForEachBits                     /* f */
 
276
        st      value, [atemp+WO(0)]
 
277
        deccc   1, count
 
278
        bnz,a   ForEachLine
 
279
        inc     4, stipple
 
280
        ret
 
281
        restore