diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2006-08-01 13:45:43 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2006-08-01 13:45:43 -0700 |
commit | ee02e647882a4be29e1130bd79904ee79ed6b802 (patch) | |
tree | f4a2d76b462019f4ea16a7c2004d257db6684ab6 /fb/fb24_32.c | |
parent | a69335dc299be6de8b82ed34de1cb30f1255feb4 (diff) |
Wrap libwfb memory access.
Use the READ and WRITE macros to wrap memory accesses that could be in video
memory. Add MEMCPY_WRAPPED and MEMSET_WRAPPED macros to wrap memcpy and
memset, respectively.
Diffstat (limited to 'fb/fb24_32.c')
-rw-r--r-- | fb/fb24_32.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/fb/fb24_32.c b/fb/fb24_32.c index 0fdd9b821..00b739b25 100644 --- a/fb/fb24_32.c +++ b/fb/fb24_32.c @@ -38,18 +38,18 @@ * by reading/writing aligned CARD32s where it's easy */ -#define Get8(a) ((CARD32) *(a)) +#define Get8(a) ((CARD32) READ(a)) #if BITMAP_BIT_ORDER == MSBFirst #define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2)) -#define Put24(a,p) (((a)[0] = (CARD8) ((p) >> 16)), \ - ((a)[1] = (CARD8) ((p) >> 8)), \ - ((a)[2] = (CARD8) (p))) +#define Put24(a,p) ((WRITE((a+0), (CARD8) ((p) >> 16))), \ + (WRITE((a+1), (CARD8) ((p) >> 8))), \ + (WRITE((a+2), (CARD8) (p)))) #else #define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16)) -#define Put24(a,p) (((a)[0] = (CARD8) (p)), \ - ((a)[1] = (CARD8) ((p) >> 8)), \ - ((a)[2] = (CARD8) ((p) >> 16))) +#define Put24(a,p) ((WRITE((a+0), (CARD8) (p))), \ + (WRITE((a+1), (CARD8) ((p) >> 8))), \ + (WRITE((a+2), (CARD8) ((p) >> 16)))) #endif typedef void (*fb24_32BltFunc) (CARD8 *srcLine, @@ -106,7 +106,7 @@ fb24_32BltDown (CARD8 *srcLine, while (((long) dst & 3) && w) { w--; - pixel = *src++; + pixel = READ(src++); pixel = FbDoDestInvarientMergeRop(pixel); Put24 (dst, pixel); dst += 3; @@ -115,35 +115,35 @@ fb24_32BltDown (CARD8 *srcLine, while (w >= 4) { CARD32 s0, s1; - s0 = *src++; + s0 = READ(src++); s0 = FbDoDestInvarientMergeRop(s0); - s1 = *src++; + s1 = READ(src++); s1 = FbDoDestInvarientMergeRop(s1); #if BITMAP_BIT_ORDER == LSBFirst - *(CARD32 *)(dst) = (s0 & 0xffffff) | (s1 << 24); + WRITE((CARD32 *)dst, (s0 & 0xffffff) | (s1 << 24)); #else - *(CARD32 *)(dst) = (s0 << 8) | ((s1 & 0xffffff) >> 16); + WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16)); #endif - s0 = *src++; + s0 = READ(src++); s0 = FbDoDestInvarientMergeRop(s0); #if BITMAP_BIT_ORDER == LSBFirst - *(CARD32 *)(dst+4) = ((s1 & 0xffffff) >> 8) | (s0 << 16); + WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16)); #else - *(CARD32 *)(dst+4) = (s1 << 16) | ((s0 & 0xffffff) >> 8); + WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8)); #endif - s1 = *src++; + s1 = READ(src++); s1 = FbDoDestInvarientMergeRop(s1); #if BITMAP_BIT_ORDER == LSBFirst - *(CARD32 *)(dst+8) = ((s0 & 0xffffff) >> 16) | (s1 << 8); + WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8)); #else - *(CARD32 *)(dst+8) = (s0 << 24) | (s1 & 0xffffff); + WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff)); #endif dst += 12; w -= 4; } while (w--) { - pixel = *src++; + pixel = READ(src++); pixel = FbDoDestInvarientMergeRop(pixel); Put24 (dst, pixel); dst += 3; @@ -153,7 +153,7 @@ fb24_32BltDown (CARD8 *srcLine, { while (w--) { - pixel = *src++; + pixel = READ(src++); dpixel = Get24 (dst); pixel = FbDoMergeRop(pixel, dpixel); Put24 (dst, pixel); @@ -205,40 +205,40 @@ fb24_32BltUp (CARD8 *srcLine, w--; pixel = Get24(src); src += 3; - *dst++ = FbDoDestInvarientMergeRop(pixel); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); } /* Do four aligned pixels at a time */ while (w >= 4) { CARD32 s0, s1; - s0 = *(CARD32 *)(src); + s0 = READ((CARD32 *)src); #if BITMAP_BIT_ORDER == LSBFirst pixel = s0 & 0xffffff; #else pixel = s0 >> 8; #endif - *dst++ = FbDoDestInvarientMergeRop(pixel); - s1 = *(CARD32 *)(src+4); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); + s1 = READ((CARD32 *)(src+4)); #if BITMAP_BIT_ORDER == LSBFirst pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff); #else pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16); #endif - *dst++ = FbDoDestInvarientMergeRop(pixel); - s0 = *(CARD32 *)(src+8); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); + s0 = READ((CARD32 *)(src+8)); #if BITMAP_BIT_ORDER == LSBFirst pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff); #else pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24); #endif - *dst++ = FbDoDestInvarientMergeRop(pixel); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); #if BITMAP_BIT_ORDER == LSBFirst pixel = s0 >> 8; #else pixel = s0 & 0xffffff; #endif - *dst++ = FbDoDestInvarientMergeRop(pixel); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); src += 12; w -= 4; } @@ -247,7 +247,7 @@ fb24_32BltUp (CARD8 *srcLine, w--; pixel = Get24(src); src += 3; - *dst++ = FbDoDestInvarientMergeRop(pixel); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); } } else @@ -256,7 +256,7 @@ fb24_32BltUp (CARD8 *srcLine, { pixel = Get24(src); src += 3; - *dst = FbDoMergeRop(pixel, *dst); + WRITE(dst, FbDoMergeRop(pixel, READ(dst))); dst++; } } |