aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-10-10 15:44:19 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-10-10 15:44:19 +0000
commit188d857911636fa43628eb8a7beeab4702636317 (patch)
tree8a907e76d2a08d23a9c496074f2d8b59d9ac9818 /hw
parent9bc9d1c75abf23b1a11c8e633fe5eeb3d6d4c8d3 (diff)
downloadqemu-188d857911636fa43628eb8a7beeab4702636317.zip
qemu-188d857911636fa43628eb8a7beeab4702636317.tar.gz
qemu-188d857911636fa43628eb8a7beeab4702636317.tar.bz2
limited 8 bit support - removed unaligned memory accesses in VGA (initial patch by Johannes Schindelin)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1116 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/vga.c3
-rw-r--r--hw/vga_template.h15
2 files changed, 8 insertions, 10 deletions
diff --git a/hw/vga.c b/hw/vga.c
index 2a0a9c3..2660b04 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -824,8 +824,7 @@ typedef void vga_draw_line_func(VGAState *s1, uint8_t *d,
static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b)
{
- /* XXX: TODO */
- return 0;
+ return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6);
}
static inline unsigned int rgb_to_pixel15(unsigned int r, unsigned int g, unsigned b)
diff --git a/hw/vga_template.h b/hw/vga_template.h
index 51302b3..909571e 100644
--- a/hw/vga_template.h
+++ b/hw/vga_template.h
@@ -44,7 +44,7 @@ static inline void glue(vga_draw_glyph_line_, DEPTH)(uint8_t *d,
{
#if BPP == 1
((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;
- ((uint32_t *)d)[3] = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;
+ ((uint32_t *)d)[1] = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;
#elif BPP == 2
((uint32_t *)d)[0] = (dmask4[(font_data >> 6)] & xorcol) ^ bgcol;
((uint32_t *)d)[1] = (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol;
@@ -106,22 +106,21 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
xorcol = bgcol ^ fgcol;
do {
font_data = font_ptr[0];
- /* XXX: unaligned accesses are done */
#if BPP == 1
- ((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;
+ cpu_to_32wu((uint32_t *)d, (dmask16[(font_data >> 4)] & xorcol) ^ bgcol);
v = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;
- ((uint32_t *)d)[3] = v;
+ cpu_to_32wu(((uint32_t *)d)+1, v);
if (dup9)
((uint8_t *)d)[8] = v >> (24 * (1 - BIG));
else
((uint8_t *)d)[8] = bgcol;
#elif BPP == 2
- ((uint32_t *)d)[0] = (dmask4[(font_data >> 6)] & xorcol) ^ bgcol;
- ((uint32_t *)d)[1] = (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol;
- ((uint32_t *)d)[2] = (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol;
+ cpu_to_32wu(((uint32_t *)d)+0, (dmask4[(font_data >> 6)] & xorcol) ^ bgcol);
+ cpu_to_32wu(((uint32_t *)d)+1, (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol);
+ cpu_to_32wu(((uint32_t *)d)+2, (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol);
v = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;
- ((uint32_t *)d)[3] = v;
+ cpu_to_32wu(((uint32_t *)d)+3, v);
if (dup9)
((uint16_t *)d)[8] = v >> (16 * (1 - BIG));
else