From 4e12cd946f9e7a6e3d35bcce0bc7bfe38cec4eb7 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 3 May 2009 22:25:16 +0300 Subject: vga: Replace VGA_COMMON with a structure All VGA devices share a common field subset; currently they do so by a macro which defines the common fields inline their state structures, relying on the the common state being placed at offset 0 in the structure. This makes refactoring the code difficult and requires a lot of error prone casts. Replace the macro by a new VGACommonState structure, and the casts by regular field access and container_of() for upcasts. Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori --- hw/cirrus_vga_rop.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'hw/cirrus_vga_rop.h') diff --git a/hw/cirrus_vga_rop.h b/hw/cirrus_vga_rop.h index 0079d12..39a7b72 100644 --- a/hw/cirrus_vga_rop.h +++ b/hw/cirrus_vga_rop.h @@ -82,7 +82,7 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(CirrusVGAState *s, for (x = 0; x < bltwidth; x++) { p = *dst; ROP_OP(p, *src); - if (p != s->gr[0x34]) *dst = p; + if (p != s->vga.gr[0x34]) *dst = p; dst++; src++; } @@ -105,7 +105,7 @@ glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_8)(CirrusVGAState *s, for (x = 0; x < bltwidth; x++) { p = *dst; ROP_OP(p, *src); - if (p != s->gr[0x34]) *dst = p; + if (p != s->vga.gr[0x34]) *dst = p; dst--; src--; } @@ -130,7 +130,7 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(CirrusVGAState *s, p2 = *(dst+1); ROP_OP(p1, *src); ROP_OP(p2, *(src+1)); - if ((p1 != s->gr[0x34]) || (p2 != s->gr[0x35])) { + if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) { *dst = p1; *(dst+1) = p2; } @@ -158,7 +158,7 @@ glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_16)(CirrusVGAState *s, p2 = *dst; ROP_OP(p1, *(src-1)); ROP_OP(p2, *src); - if ((p1 != s->gr[0x34]) || (p2 != s->gr[0x35])) { + if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) { *(dst-1) = p1; *dst = p2; } -- cgit v1.1