Commit b8ed223bfe3b1af434adce07b2981ce8b5b9ecb4

Authored by bellard
1 parent c970a162

big endian fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@437 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 15 additions and 19 deletions
hw/vga.c
... ... @@ -141,12 +141,24 @@ static const uint8_t gr_mask[16] = {
141 141 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
142 142 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) ))
143 143  
144   -#ifdef WORD_BIGENDIAN
  144 +#ifdef WORDS_BIGENDIAN
145 145 #define PAT(x) cbswap_32(x)
146 146 #else
147 147 #define PAT(x) (x)
148 148 #endif
149 149  
  150 +#ifdef WORDS_BIGENDIAN
  151 +#define BIG 1
  152 +#else
  153 +#define BIG 0
  154 +#endif
  155 +
  156 +#ifdef WORDS_BIGENDIAN
  157 +#define GET_PLANE(data, p) (((data) >> (24 - (p) * 8)) & 0xff)
  158 +#else
  159 +#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff)
  160 +#endif
  161 +
150 162 static const uint32_t mask16[16] = {
151 163 PAT(0x00000000),
152 164 PAT(0x000000ff),
... ... @@ -168,7 +180,7 @@ static const uint32_t mask16[16] = {
168 180  
169 181 #undef PAT
170 182  
171   -#ifdef WORD_BIGENDIAN
  183 +#ifdef WORDS_BIGENDIAN
172 184 #define PAT(x) (x)
173 185 #else
174 186 #define PAT(x) cbswap_32(x)
... ... @@ -465,11 +477,7 @@ static uint32_t vga_mem_readb(uint32_t addr)
465 477 if (!(s->gr[5] & 0x08)) {
466 478 /* read mode 0 */
467 479 plane = s->gr[4];
468   -#ifdef WORD_BIGENDIAN
469   - ret = (s->latch >> (24 - (plane * 8))) & 0xff;
470   -#else
471   - ret = (s->latch >> (plane * 8)) & 0xff;
472   -#endif
  480 + ret = GET_PLANE(s->latch, plane);
473 481 } else {
474 482 /* read mode 1 */
475 483 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)
641 649 vga_mem_writeb(addr + 3, (val >> 24) & 0xff);
642 650 }
643 651  
644   -#ifdef WORD_BIGENDIAN
645   -#define BIG 1
646   -#else
647   -#define BIG 0
648   -#endif
649   -
650   -#ifdef WORDS_BIGENDIAN
651   -#define GET_PLANE(data, p) (((data) >> (24 - (p) * 8)) & 0xff)
652   -#else
653   -#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff)
654   -#endif
655   -
656 652 typedef void vga_draw_glyph8_func(uint8_t *d, int linesize,
657 653 const uint8_t *font_ptr, int h,
658 654 uint32_t fgcol, uint32_t bgcol);
... ...