瀏覽代碼

arm: explicitly mark device loads as little-endian

Behaviour of emulated devices should not depend on the endianness
of the CPU, so avoid using the endian-dependent load and store
functions in the PXA2xx and OMAP display devices. These devices
are little endian when they do DMA access.

(Since ARM softmmu is always compiled as little endian, this means
that the endian-dependent load and store functions are always little
endian, so this commit makes no functionally visible change.)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: rewrote commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Paolo Bonzini 9 年之前
父節點
當前提交
58f6d82fc4
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 2 2
      hw/display/omap_lcd_template.h
  2. 4 4
      hw/display/pxa2xx_lcd.c

+ 2 - 2
hw/display/omap_lcd_template.h

@@ -136,7 +136,7 @@ static void glue(draw_line12_, DEPTH)(void *opaque,
     uint8_t r, g, b;
     uint8_t r, g, b;
 
 
     do {
     do {
-        v = lduw_p((void *) s);
+        v = lduw_le_p((void *) s);
         r = (v >> 4) & 0xf0;
         r = (v >> 4) & 0xf0;
         g = v & 0xf0;
         g = v & 0xf0;
         b = (v << 4) & 0xf0;
         b = (v << 4) & 0xf0;
@@ -159,7 +159,7 @@ static void glue(draw_line16_, DEPTH)(void *opaque,
     uint8_t r, g, b;
     uint8_t r, g, b;
 
 
     do {
     do {
-        v = lduw_p((void *) s);
+        v = lduw_le_p((void *) s);
         r = (v >> 8) & 0xf8;
         r = (v >> 8) & 0xf8;
         g = (v >> 3) & 0xfc;
         g = (v >> 3) & 0xfc;
         b = (v << 3) & 0xf8;
         b = (v << 3) & 0xf8;

+ 4 - 4
hw/display/pxa2xx_lcd.c

@@ -309,10 +309,10 @@ static void pxa2xx_descriptor_load(PXA2xxLCDState *s)
         }
         }
 
 
         cpu_physical_memory_read(descptr, &desc, sizeof(desc));
         cpu_physical_memory_read(descptr, &desc, sizeof(desc));
-        s->dma_ch[i].descriptor = tswap32(desc.fdaddr);
-        s->dma_ch[i].source = tswap32(desc.fsaddr);
-        s->dma_ch[i].id = tswap32(desc.fidr);
-        s->dma_ch[i].command = tswap32(desc.ldcmd);
+        s->dma_ch[i].descriptor = le32_to_cpu(desc.fdaddr);
+        s->dma_ch[i].source = le32_to_cpu(desc.fsaddr);
+        s->dma_ch[i].id = le32_to_cpu(desc.fidr);
+        s->dma_ch[i].command = le32_to_cpu(desc.ldcmd);
     }
     }
 }
 }