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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h

  • 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/drivers/mga/mga_macros.h,v 1.22 2002/02/20 17:17:50 dawes Exp $ */
 
2
 
 
3
#ifndef _MGA_MACROS_H_
 
4
#define _MGA_MACROS_H_
 
5
 
 
6
#ifndef PSZ
 
7
#define PSZ 8
 
8
#endif
 
9
 
 
10
#if PSZ == 8
 
11
#define REPLICATE(r) r &= 0xFF; r |= r << 8; r |= r << 16
 
12
#elif PSZ == 16
 
13
#define REPLICATE(r) r &= 0xFFFF; r |= r << 16
 
14
#elif PSZ == 24
 
15
#define REPLICATE(r) r &= 0xFFFFFF; r |= r << 24
 
16
#else
 
17
#define REPLICATE(r) /* */
 
18
#endif
 
19
 
 
20
#define RGBEQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
 
21
 
 
22
#ifdef XF86DRI
 
23
#define MGA_SYNC_XTAG                 0x275f4200
 
24
 
 
25
#define MGABUSYWAIT() do { \
 
26
OUTREG(MGAREG_DWGSYNC, MGA_SYNC_XTAG); \
 
27
while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \
 
28
}while(0);
 
29
 
 
30
#endif
 
31
 
 
32
#define MGAISBUSY() (INREG8(MGAREG_Status + 2) & 0x01)
 
33
 
 
34
#define WAITFIFO(cnt) \
 
35
   if(!pMga->UsePCIRetry) {\
 
36
        register int n = cnt; \
 
37
        if(n > pMga->FifoSize) n = pMga->FifoSize; \
 
38
        while(pMga->fifoCount < (n))\
 
39
            pMga->fifoCount = INREG8(MGAREG_FIFOSTATUS);\
 
40
        pMga->fifoCount -= n;\
 
41
   }
 
42
 
 
43
#define XYADDRESS(x,y) \
 
44
    ((y) * pMga->CurrentLayout.displayWidth + (x) + pMga->YDstOrg)
 
45
 
 
46
#define MAKEDMAINDEX(index)  ((((index) >> 2) & 0x7f) | (((index) >> 6) & 0x80))
 
47
 
 
48
#define DMAINDICES(one,two,three,four)  \
 
49
        ( MAKEDMAINDEX(one) | \
 
50
         (MAKEDMAINDEX(two) << 8) | \
 
51
         (MAKEDMAINDEX(three) << 16) | \
 
52
         (MAKEDMAINDEX(four) << 24) )
 
53
 
 
54
#if PSZ == 24
 
55
#define SET_PLANEMASK(p) /**/
 
56
#else
 
57
#define SET_PLANEMASK(p) \
 
58
        if(!(pMga->AccelFlags & MGA_NO_PLANEMASK) && ((p) != pMga->PlaneMask)) { \
 
59
           pMga->PlaneMask = (p); \
 
60
           REPLICATE((p)); \
 
61
           OUTREG(MGAREG_PLNWT,(p)); \
 
62
        }
 
63
#endif
 
64
 
 
65
#define SET_FOREGROUND(c) \
 
66
        if((c) != pMga->FgColor) { \
 
67
           pMga->FgColor = (c); \
 
68
           REPLICATE((c)); \
 
69
           OUTREG(MGAREG_FCOL,(c)); \
 
70
        }
 
71
 
 
72
#define SET_BACKGROUND(c) \
 
73
        if((c) != pMga->BgColor) { \
 
74
           pMga->BgColor = (c); \
 
75
           REPLICATE((c)); \
 
76
           OUTREG(MGAREG_BCOL,(c)); \
 
77
        }
 
78
 
 
79
#define DISABLE_CLIP() { \
 
80
        pMga->AccelFlags &= ~CLIPPER_ON; \
 
81
        WAITFIFO(1); \
 
82
        OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); }
 
83
 
 
84
#ifdef XF86DRI
 
85
#define CHECK_DMA_QUIESCENT(pMGA, pScrn) {      \
 
86
   if (!pMGA->haveQuiescense) {                 \
 
87
      pMGA->GetQuiescence( pScrn );             \
 
88
   }                                            \
 
89
}
 
90
#else
 
91
#define CHECK_DMA_QUIESCENT(pMGA, pScrn)
 
92
#endif
 
93
 
 
94
#ifdef USEMGAHAL
 
95
#define HAL_CHIPSETS ((pMga->Chipset == PCI_CHIP_MGAG200_PCI) || \
 
96
                  (pMga->Chipset == PCI_CHIP_MGAG200) || \
 
97
                  (pMga->Chipset == PCI_CHIP_MGAG400) || \
 
98
                  (pMga->Chipset == PCI_CHIP_MGAG550))
 
99
    
 
100
#define MGA_HAL(x) { \
 
101
        MGAPtr pMga = MGAPTR(pScrn); \
 
102
        if (pMga->HALLoaded && HAL_CHIPSETS) { x; } \
 
103
}
 
104
#define MGA_NOT_HAL(x) { \
 
105
        MGAPtr pMga = MGAPTR(pScrn); \
 
106
        if (!pMga->HALLoaded || !HAL_CHIPSETS) { x; } \
 
107
}
 
108
#else
 
109
#define MGA_NOT_HAL(x) { x; }
 
110
#endif
 
111
 
 
112
#define MGAISGx50(x) ( (((x)->Chipset == PCI_CHIP_MGAG400) && ((x)->ChipRev >= 0x80)) || \
 
113
                       ((x)->Chipset == PCI_CHIP_MGAG550) )
 
114
 
 
115
#define MGA_DH_NEEDS_HAL(x) (((x)->Chipset == PCI_CHIP_MGAG400) && \
 
116
                             ((x)->ChipRev < 0x80))
 
117
 
 
118
#endif /* _MGA_MACROS_H_ */