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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c

  • 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/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c,v 3.6 2002/01/25 21:56:20 tsi Exp $ */
 
2
/*
 
3
 * Copyright 1998 by Metro Link Incorporated
 
4
 *
 
5
 * Permission to use, copy, modify, distribute, and sell this software
 
6
 * and its documentation for any purpose is hereby granted without fee,
 
7
 * provided that the above copyright notice appear in all copies and that
 
8
 * both that copyright notice and this permission notice appear in
 
9
 * supporting documentation, and that the name of Metro Link
 
10
 * Incorporated not be used in advertising or publicity pertaining to
 
11
 * distribution of the software without specific, written prior
 
12
 * permission.  Metro Link Incorporated makes no representations
 
13
 * about the suitability of this software for any purpose.  It is
 
14
 * provided "as is" without express or implied warranty.
 
15
 *
 
16
 * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
 
17
 * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 
18
 * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
 
19
 * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
 
20
 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
21
 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
22
 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
23
 * SOFTWARE.
 
24
 */
 
25
 
 
26
#if /* NO_INLINE && */ defined(__powerpc__)
 
27
 
 
28
#include "xf86Pci.h"
 
29
 
 
30
extern volatile unsigned char *ioBase;
 
31
 
 
32
void
 
33
eieio()
 
34
{
 
35
        __asm__ __volatile__ ("eieio");
 
36
}
 
37
 
 
38
unsigned long
 
39
ldl_brx(volatile unsigned char *base, int ndx)
 
40
{
 
41
        register unsigned long tmp = *(volatile unsigned long *)(base+ndx);
 
42
        return( ((tmp & 0x000000ff) << 24) |
 
43
                ((tmp & 0x0000ff00) << 8) |
 
44
                ((tmp & 0x00ff0000) >> 8) |
 
45
                ((tmp & 0xff000000) >> 24) );
 
46
}
 
47
 
 
48
unsigned short
 
49
ldw_brx(volatile unsigned char *base, int ndx)
 
50
{
 
51
        register unsigned short tmp = *(volatile unsigned short *)(base+ndx);
 
52
        return((tmp << 8) | (tmp >> 8));
 
53
}
 
54
 
 
55
void
 
56
stl_brx(unsigned long val, volatile unsigned char *base, int ndx)
 
57
{
 
58
   unsigned char *p = (unsigned char *)&val;
 
59
   unsigned long tmp = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0);
 
60
   *(volatile unsigned long *)(base+ndx) = tmp;
 
61
}
 
62
 
 
63
void
 
64
stw_brx(unsigned short val, volatile unsigned char *base, int ndx)
 
65
{
 
66
  unsigned char *p = (unsigned char *)&val;
 
67
  unsigned short tmp = (p[1] << 8) | p[0];
 
68
  *(volatile unsigned short *)(base+ndx) = tmp;
 
69
}
 
70
 
 
71
void
 
72
outb(IOADDRESS port, unsigned char value)
 
73
{
 
74
        *((volatile unsigned char *)(ioBase + port)) = value; eieio();
 
75
}
 
76
 
 
77
void
 
78
outw(IOADDRESS port, unsigned short value)
 
79
{
 
80
        stw_brx(value, ioBase, port); eieio();
 
81
}
 
82
 
 
83
void
 
84
outl(IOADDRESS port, unsigned int value)
 
85
{
 
86
        stl_brx(value, ioBase, port); eieio();
 
87
}
 
88
 
 
89
unsigned char
 
90
inb(IOADDRESS port)
 
91
{
 
92
        unsigned char val;
 
93
 
 
94
        val = *((volatile unsigned char *)(ioBase + port)); eieio();
 
95
        return(val);
 
96
}
 
97
 
 
98
unsigned short
 
99
inw(IOADDRESS port)
 
100
{
 
101
        unsigned short val;
 
102
 
 
103
        val = ldw_brx(ioBase, port); eieio();
 
104
        return(val);
 
105
}
 
106
 
 
107
unsigned int
 
108
inl(IOADDRESS port)
 
109
{
 
110
        unsigned int val;
 
111
 
 
112
        val = ldl_brx(ioBase, port); eieio();
 
113
        return(val);
 
114
}
 
115
 
 
116
unsigned long 
 
117
ldl_u(void *p)
 
118
{
 
119
        return (((*(unsigned char *)(p)) |
 
120
                 (*((unsigned char *)(p)+1)<<8) |
 
121
                 (*((unsigned char *)(p)+2)<<16) |
 
122
                 (*((unsigned char *)(p)+3)<<24)));
 
123
}
 
124
 
 
125
unsigned long 
 
126
ldq_u(void *p)
 
127
{
 
128
        return ldl_u(p);
 
129
}
 
130
 
 
131
unsigned short
 
132
ldw_u(void *p)
 
133
{
 
134
        return(((*(unsigned char *)(p)) |
 
135
               (*((unsigned char *)(p)+1)<<8)));
 
136
}
 
137
 
 
138
void
 
139
stl_u(unsigned long v, void *p)
 
140
{
 
141
 
 
142
        (*(unsigned char *)(p)) = (v);
 
143
        (*((unsigned char *)(p)+1)) = ((v) >> 8);
 
144
        (*((unsigned char *)(p)+2)) = ((v) >> 16);
 
145
        (*((unsigned char *)(p)+3)) = ((v) >> 24);
 
146
}
 
147
 
 
148
void
 
149
stq_u(unsigned long v, void *p)
 
150
{
 
151
        stl_u(v,p);
 
152
}
 
153
 
 
154
void
 
155
stw_u(unsigned short v, void *p)
 
156
{
 
157
        (*(unsigned char *)(p)) = (v);
 
158
        (*((unsigned char *)(p)+1)) = ((v) >> 8);
 
159
}
 
160
 
 
161
 
 
162
void
 
163
mem_barrier(void)
 
164
{
 
165
   __asm__ __volatile__("eieio");
 
166
}
 
167
 
 
168
void
 
169
write_mem_barrier(void)
 
170
{
 
171
   __asm__ __volatile__("eieio");
 
172
}
 
173
 
 
174
#endif /* NO_INLINE && __powerpc__ */