diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2003-10-30 22:10:22 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2003-10-30 22:10:22 +0000 |
commit | b8ed223bfe3b1af434adce07b2981ce8b5b9ecb4 (patch) | |
tree | 3658a10a9d5daec55edf7c23321ddd1f73ddbea1 | |
parent | c970a162e7b152622b394f9268fc4aeb0f0e3b20 (diff) |
big endian fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@437 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | hw/vga.c | 34 |
1 files changed, 15 insertions, 19 deletions
@@ -141,12 +141,24 @@ static const uint8_t gr_mask[16] = { (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN #define PAT(x) cbswap_32(x) #else #define PAT(x) (x) #endif +#ifdef WORDS_BIGENDIAN +#define BIG 1 +#else +#define BIG 0 +#endif + +#ifdef WORDS_BIGENDIAN +#define GET_PLANE(data, p) (((data) >> (24 - (p) * 8)) & 0xff) +#else +#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff) +#endif + static const uint32_t mask16[16] = { PAT(0x00000000), PAT(0x000000ff), @@ -168,7 +180,7 @@ static const uint32_t mask16[16] = { #undef PAT -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN #define PAT(x) (x) #else #define PAT(x) cbswap_32(x) @@ -465,11 +477,7 @@ static uint32_t vga_mem_readb(uint32_t addr) if (!(s->gr[5] & 0x08)) { /* read mode 0 */ plane = s->gr[4]; -#ifdef WORD_BIGENDIAN - ret = (s->latch >> (24 - (plane * 8))) & 0xff; -#else - ret = (s->latch >> (plane * 8)) & 0xff; -#endif + ret = GET_PLANE(s->latch, plane); } else { /* read mode 1 */ ret = (s->latch ^ mask16[s->gr[2]]) & mask16[s->gr[7]]; @@ -641,18 +649,6 @@ void vga_mem_writel(uint32_t addr, uint32_t val) vga_mem_writeb(addr + 3, (val >> 24) & 0xff); } -#ifdef WORD_BIGENDIAN -#define BIG 1 -#else -#define BIG 0 -#endif - -#ifdef WORDS_BIGENDIAN -#define GET_PLANE(data, p) (((data) >> (24 - (p) * 8)) & 0xff) -#else -#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff) -#endif - typedef void vga_draw_glyph8_func(uint8_t *d, int linesize, const uint8_t *font_ptr, int h, uint32_t fgcol, uint32_t bgcol); |