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

« back to all changes in this revision

Viewing changes to unix/xc/extras/Mesa/src/X86/x86_vertex.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
/* $XFree86: xc/extras/Mesa/src/X86/x86_vertex.S,v 1.2 2002/03/05 20:27:24 dawes Exp $ */
 
2
 
 
3
#include "matypes.h"
 
4
 
 
5
 
 
6
        SEG_TEXT
 
7
 
 
8
/*#define MAT_SX 0*/        /*  accessed by REGIND !! */
 
9
#define MAT_SY 20
 
10
#define MAT_SZ 40
 
11
#define MAT_TX 48
 
12
#define MAT_TY 52
 
13
#define MAT_TZ 56
 
14
 
 
15
 
 
16
#define FP_ONE          1065353216
 
17
#define FP_ZERO         0
 
18
 
 
19
#define S0              REGOFF(0, ESI)
 
20
#define S1              REGOFF(4, ESI)
 
21
#define S2              REGOFF(8, ESI)
 
22
#define S3              REGOFF(12, ESI)
 
23
#define D0              REGOFF(0, EDI)
 
24
#define D1              REGOFF(4, EDI)
 
25
#define D2              REGOFF(8, EDI)
 
26
#define D3              REGOFF(12, EDI)
 
27
#define M0              REGOFF(0, EDX)
 
28
#define M1              REGOFF(4, EDX)
 
29
#define M2              REGOFF(8, EDX)
 
30
#define M3              REGOFF(12, EDX)
 
31
 
 
32
 
 
33
 
 
34
/*
 
35
 * void _mesa_v16_x86_general_xform (   GLfloat *dest,
 
36
 *                              const GLfloat *m,
 
37
 *                              const GLfloat *src,
 
38
 *                              GLuint src_stride,
 
39
 *                              GLuint count )
 
40
 */
 
41
 
 
42
 
 
43
/* This is nothing more glamorous than an objdump of one of Josh's
 
44
 * routines hacked to match the above.
 
45
 */
 
46
ALIGNTEXT16
 
47
GLOBL GLNAME( _mesa_v16_x86_general_xform )
 
48
GLNAME( _mesa_v16_x86_general_xform ):
 
49
 
 
50
 
 
51
        PUSH_L ( EDI )
 
52
        PUSH_L ( ESI )
 
53
 
 
54
        MOV_L     ( REGOFF(12, ESP), EAX ) /* dest */
 
55
        MOV_L     ( REGOFF(16, ESP), ESI ) /* mat */
 
56
        MOV_L     ( REGOFF(20, ESP), EDX ) /* src */
 
57
        MOV_L     ( REGOFF(24, ESP), EDI ) /* src_stride */
 
58
        MOV_L     ( REGOFF(28, ESP), ECX ) /* count */
 
59
 
 
60
 
 
61
LLBL(v16x86_loop):
 
62
        FLD_S   ( REGOFF( 0x0, EDX ) )
 
63
        FMUL_S  ( REGOFF( 0x0, ESI ) )
 
64
        FLD_S   ( REGOFF( 0x0, EDX ) )
 
65
        FMUL_S  ( REGOFF( 0x4, ESI ) )
 
66
        FLD_S   ( REGOFF( 0x0, EDX ) )
 
67
        FMUL_S  ( REGOFF( 0x8, ESI ) )
 
68
        FLD_S   ( REGOFF( 0x0, EDX ) )
 
69
        FMUL_S  ( REGOFF( 0xc, ESI ) )
 
70
        FLD_S   ( REGOFF( 0x4, EDX ) )
 
71
        FMUL_S  ( REGOFF( 0x10, ESI ) )
 
72
        FLD_S   ( REGOFF( 0x4, EDX ) )
 
73
        FMUL_S  ( REGOFF( 0x14, ESI ) )
 
74
        FLD_S   ( REGOFF( 0x4, EDX ) )
 
75
        FMUL_S  ( REGOFF( 0x18, ESI ) )
 
76
        FLD_S   ( REGOFF( 0x4, EDX ) )
 
77
        FMUL_S  ( REGOFF( 0x1c, ESI ) )
 
78
        FXCH    ( ST(3) )
 
79
        FADDP   ( ST0,ST(7) )
 
80
        FXCH    ( ST(1) )
 
81
        FADDP   ( ST0,ST(5) )
 
82
        FADDP   ( ST0,ST(3) )
 
83
        FADDP   ( ST0,ST(1) )
 
84
        FLD_S   ( REGOFF( 0x8, EDX ) )
 
85
        FMUL_S  ( REGOFF( 0x20, ESI ) )
 
86
        FLD_S   ( REGOFF( 0x8, EDX ) )
 
87
        FMUL_S  ( REGOFF( 0x24, ESI ) )
 
88
        FLD_S   ( REGOFF( 0x8, EDX ) )
 
89
        FMUL_S  ( REGOFF( 0x28, ESI ) )
 
90
        FLD_S   ( REGOFF( 0x8, EDX ) )
 
91
        FMUL_S  ( REGOFF( 0x2c, ESI ) )
 
92
        FXCH    ( ST(3) )
 
93
        FADDP   ( ST0,ST(7) )
 
94
        FXCH    ( ST(1) )
 
95
        FADDP   ( ST0,ST(5) )
 
96
        FADDP   ( ST0,ST(3) )
 
97
        FADDP   ( ST0,ST(1) )
 
98
        FXCH    ( ST(3) )
 
99
        FADD_S  ( REGOFF( 0x30, ESI ) )
 
100
        FXCH    ( ST(2) )
 
101
        FADD_S  ( REGOFF( 0x34, ESI ) )
 
102
        FXCH    ( ST(1) )
 
103
        FADD_S  ( REGOFF( 0x38, ESI ) )
 
104
        FXCH    ( ST(3) )
 
105
        FADD_S  ( REGOFF( 0x3c, ESI ) )
 
106
        FXCH    ( ST(2) )
 
107
        FSTP_S  ( REGOFF( 0x0, EAX ) )
 
108
        FSTP_S  ( REGOFF( 0x4, EAX ) )
 
109
        FXCH    ( ST(1) )
 
110
        FSTP_S  ( REGOFF( 0x8, EAX ) )
 
111
        FSTP_S  ( REGOFF( 0xc, EAX ) )
 
112
        ADD_L   ( CONST(64), EAX )
 
113
        ADD_L   ( EDI, EDX )
 
114
        DEC_L   ( ECX )
 
115
        JNE     ( LLBL(v16x86_loop) )
 
116
 
 
117
        POP_L ( ESI )
 
118
        POP_L ( EDI )
 
119
        RET
 
120
 
 
121
 
 
122
/*
 
123
 * Table for clip test.
 
124
 *
 
125
 *      bit6 = S3 < 0
 
126
 *      bit5 = S2 < 0
 
127
 *      bit4 = abs(S2) > abs(S3)
 
128
 *      bit3 = S1 < 0
 
129
 *      bit2 = abs(S1) > abs(S3)
 
130
 *      bit1 = S0 < 0
 
131
 *      bit0 = abs(S0) > abs(S3)
 
132
 */
 
133
 
 
134
 
 
135
        SEG_DATA
 
136
 
 
137
clip_table:
 
138
        D_BYTE 0, 1, 0, 2, 4, 5, 4, 6
 
139
        D_BYTE 0, 1, 0, 2, 8, 9, 8, 10
 
140
        D_BYTE 32, 33, 32, 34, 36, 37, 36, 38
 
141
        D_BYTE 32, 33, 32, 34, 40, 41, 40, 42
 
142
        D_BYTE 0, 1, 0, 2, 4, 5, 4, 6
 
143
        D_BYTE 0, 1, 0, 2, 8, 9, 8, 10
 
144
        D_BYTE 16, 17, 16, 18, 20, 21, 20, 22
 
145
        D_BYTE 16, 17, 16, 18, 24, 25, 24, 26
 
146
        D_BYTE 63, 61, 63, 62, 55, 53, 55, 54
 
147
        D_BYTE 63, 61, 63, 62, 59, 57, 59, 58
 
148
        D_BYTE 47, 45, 47, 46, 39, 37, 39, 38
 
149
        D_BYTE 47, 45, 47, 46, 43, 41, 43, 42
 
150
        D_BYTE 63, 61, 63, 62, 55, 53, 55, 54
 
151
        D_BYTE 63, 61, 63, 62, 59, 57, 59, 58
 
152
        D_BYTE 31, 29, 31, 30, 23, 21, 23, 22
 
153
        D_BYTE 31, 29, 31, 30, 27, 25, 27, 26
 
154
 
 
155
        SEG_TEXT
 
156
 
 
157
 
 
158
/*
 
159
########################################
 
160
##
 
161
## _mesa_v16_x86_cliptest_points4
 
162
##
 
163
## Performs cliptesting equivalent to that done by cliptest_v16()
 
164
## in vertices.c
 
165
##
 
166
## This is a hacked version of the original above.
 
167
##
 
168
########################################
 
169
*/
 
170
 
 
171
 
 
172
 
 
173
#define OFFSET_V16_SOURCE       4
 
174
#define OFFSET_V16_LAST         8
 
175
#define OFFSET_V16_OR           12
 
176
#define OFFSET_V16_AND          16
 
177
#define OFFSET_V16_MASK         20
 
178
 
 
179
#define ARG_V16_SOURCE  REGOFF(V16_FRAME_OFFSET+OFFSET_V16_SOURCE, ESP)
 
180
#define ARG_V16_LAST    REGOFF(V16_FRAME_OFFSET+OFFSET_V16_LAST, ESP)
 
181
#define ARG_V16_OR      REGOFF(V16_FRAME_OFFSET+OFFSET_V16_OR, ESP)
 
182
#define ARG_V16_AND     REGOFF(V16_FRAME_OFFSET+OFFSET_V16_AND, ESP)
 
183
#define ARG_V16_MASK    REGOFF(V16_FRAME_OFFSET+OFFSET_V16_MASK, ESP)
 
184
 
 
185
 
 
186
#if defined(__ELF__) && defined(__PIC__) && !defined(ELFPIC)
 
187
#define ELFPIC
 
188
#endif
 
189
 
 
190
        GLOBL GLNAME(_mesa_v16_x86_cliptest_points4)
 
191
        ALIGNTEXT4
 
192
 
 
193
GLNAME(_mesa_v16_x86_cliptest_points4):
 
194
#ifdef ELFPIC
 
195
#define V16_FRAME_OFFSET 20
 
196
#else
 
197
#define V16_FRAME_OFFSET 16
 
198
#endif
 
199
        PUSH_L( ESI )
 
200
        PUSH_L( EDI )
 
201
        PUSH_L( EBP )
 
202
        PUSH_L( EBX )
 
203
 
 
204
#ifdef ELFPIC
 
205
        /* store pointer to clip_table on stack */
 
206
        CALL( LLBL(v16_ctp4_get_eip) )
 
207
        ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX )
 
208
        MOV_L( REGOFF(clip_table@GOT, EBX), EBX )
 
209
        PUSH_L( EBX )
 
210
        JMP( LLBL(v16_ctp4_clip_table_ready) )
 
211
 
 
212
LLBL(v16_ctp4_get_eip):
 
213
        /* store eip in ebx */
 
214
        MOV_L( REGIND(ESP), EBX )
 
215
        RET
 
216
 
 
217
LLBL(v16_ctp4_clip_table_ready):
 
218
#endif
 
219
 
 
220
        MOV_L( ARG_V16_SOURCE, ESI )            /* ptr to first source vertex */
 
221
        MOV_L( ARG_V16_LAST, EDX )              /* ptr to last source vertex */
 
222
        MOV_L( ARG_V16_OR, EBX )
 
223
        MOV_L( ARG_V16_AND, EBP )
 
224
        MOV_L( ARG_V16_MASK, EDI )
 
225
 
 
226
        CMP_L( EDX, ESI )
 
227
 
 
228
        MOV_B( REGIND(EBX), AL )
 
229
        MOV_B( REGIND(EBP), AH )
 
230
 
 
231
        JZ( LLBL(v16_ctp4_finish) )
 
232
 
 
233
        ALIGNTEXT4ifNOP
 
234
LLBL(v16_ctp4_top):
 
235
#if 0
 
236
        FLD1    /* F0 */
 
237
        FDIV_S( S3 )
 
238
#endif
 
239
 
 
240
        MOV_L( S3, EBP )
 
241
        MOV_L( S2, EBX )
 
242
 
 
243
        XOR_L( ECX, ECX )
 
244
        ADD_L( EBP, EBP )       /* ebp = abs(S3)*2 ; carry = sign of S3 */
 
245
 
 
246
        ADC_L( ECX, ECX )
 
247
        ADD_L( EBX, EBX )       /* ebx = abs(S2)*2 ; carry = sign of S2 */
 
248
 
 
249
        ADC_L( ECX, ECX )
 
250
        CMP_L( EBX, EBP )       /* carry = abs(S2)*2 > abs(S3)*2 */
 
251
 
 
252
        ADC_L( ECX, ECX )
 
253
        MOV_L( S1, EBX )
 
254
 
 
255
        ADD_L( EBX, EBX )       /* ebx = abs(S1)*2 ; carry = sign of S1 */
 
256
 
 
257
        ADC_L( ECX, ECX )
 
258
        CMP_L( EBX, EBP )       /* carry = abs(S1)*2 > abs(S3)*2 */
 
259
 
 
260
        ADC_L( ECX, ECX )
 
261
        MOV_L( S0, EBX )
 
262
 
 
263
        ADD_L( EBX, EBX )       /* ebx = abs(S0)*2 ; carry = sign of S0 */
 
264
 
 
265
        ADC_L( ECX, ECX )
 
266
        CMP_L( EBX, EBP )       /* carry = abs(S0)*2 > abs(S3)*2 */
 
267
 
 
268
        ADC_L( ECX, ECX )
 
269
 
 
270
#ifdef ELFPIC
 
271
        MOV_L( REGIND(ESP), EBP )       /* clip_table */
 
272
 
 
273
        MOV_B( REGBI(EBP, ECX), CL )
 
274
#else
 
275
        MOV_B( REGOFF(clip_table,ECX), CL )
 
276
#endif
 
277
 
 
278
        OR_B( CL, AL )
 
279
        AND_B( CL, AH )
 
280
 
 
281
        MOV_B( CL, REGIND(EDI) )     /* save clipmask */
 
282
        INC_L( EDI )                 /* next clipmask */
 
283
 
 
284
#if 0
 
285
        FSTP_S( S8   )  /* */   /* GR_VERTEX_OOW_OFFSET */
 
286
#endif
 
287
 
 
288
        ADD_L( CONST(64), ESI )      /* next fxVertex  */
 
289
 
 
290
        CMP_L( EDX, ESI )            /* finished? */
 
291
        JNZ( LLBL(v16_ctp4_top) )
 
292
 
 
293
        MOV_L( ARG_V16_OR, ECX )
 
294
        MOV_L( ARG_V16_AND, EDX )
 
295
 
 
296
        MOV_B( AL, REGIND(ECX) )
 
297
        MOV_B( AH, REGIND(EDX) )
 
298
 
 
299
LLBL(v16_ctp4_finish):
 
300
 
 
301
#ifdef ELFPIC
 
302
        POP_L( ESI )    /* discard ptr to clip_table */
 
303
#endif
 
304
        POP_L( EBX )
 
305
        POP_L( EBP )
 
306
        POP_L( EDI )
 
307
        POP_L( ESI )
 
308
 
 
309
        RET