diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-07-16 04:45:12 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-07-16 04:45:12 +0000 |
commit | ff9cf2cbe4fb8e865dc0e2371cedbcd7fbec8aad (patch) | |
tree | 61b678b18b7625a97357df0fb6f2bdf8f2c1f142 /hw | |
parent | 931ea4353032643a0324fd6e080f38c464db1ec0 (diff) |
Properly byte-swap values in VMware SVGA (malc).
Makes PPC host happy. Also use the right type for a memory offset.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4874 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/vmware_vga.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index a43510499e..efbcd966a5 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -483,6 +483,8 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, } #endif +#define CMD(f) le32_to_cpu(s->cmd->f) + static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) { if (!s->config || !s->enable) @@ -490,15 +492,20 @@ static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) return (s->cmd->next_cmd == s->cmd->stop); } -static inline uint32_t vmsvga_fifo_read(struct vmsvga_state_s *s) +static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s) { - uint32_t cmd = s->fifo[s->cmd->stop >> 2]; - s->cmd->stop += 4; - if (s->cmd->stop >= s->cmd->max) + uint32_t cmd = s->fifo[CMD(stop) >> 2]; + s->cmd->stop = cpu_to_le32(CMD(stop) + 4); + if (CMD(stop) >= CMD(max)) s->cmd->stop = s->cmd->min; return cmd; } +static inline uint32_t vmsvga_fifo_read(struct vmsvga_state_s *s) +{ + return le32_to_cpu(vmsvga_fifo_read_raw(s)); +} + static void vmsvga_fifo_run(struct vmsvga_state_s *s) { uint32_t cmd, colour; @@ -552,9 +559,9 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) vmsvga_fifo_read(s); cursor.bpp = vmsvga_fifo_read(s); for (args = 0; args < SVGA_BITMAP_SIZE(x, y); args ++) - cursor.mask[args] = vmsvga_fifo_read(s); + cursor.mask[args] = vmsvga_fifo_read_raw(s); for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.bpp); args ++) - cursor.image[args] = vmsvga_fifo_read(s); + cursor.image[args] = vmsvga_fifo_read_raw(s); #ifdef HW_MOUSE_ACCEL vmsvga_cursor_define(s, &cursor); break; @@ -788,14 +795,14 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) if (value) { s->fifo = (uint32_t *) &s->vram[s->vram_size - SVGA_FIFO_SIZE]; /* Check range and alignment. */ - if ((s->cmd->min | s->cmd->max | - s->cmd->next_cmd | s->cmd->stop) & 3) + if ((CMD(min) | CMD(max) | + CMD(next_cmd) | CMD(stop)) & 3) break; - if (s->cmd->min < (uint8_t *) s->cmd->fifo - (uint8_t *) s->fifo) + if (CMD(min) < (uint8_t *) s->cmd->fifo - (uint8_t *) s->fifo) break; - if (s->cmd->max > SVGA_FIFO_SIZE) + if (CMD(max) > SVGA_FIFO_SIZE) break; - if (s->cmd->max < s->cmd->min + 10 * 1024) + if (CMD(max) < CMD(min) + 10 * 1024) break; } s->config = !!value; @@ -1189,7 +1196,7 @@ static void pci_vmsvga_map_mem(PCIDevice *pci_dev, int region_num, { struct pci_vmsvga_state_s *d = (struct pci_vmsvga_state_s *) pci_dev; struct vmsvga_state_s *s = &d->chip; - int iomemtype; + ram_addr_t iomemtype; s->vram_base = addr; #ifdef DIRECT_VRAM |