Commit 4e3e9d0b4d31cc7966147543634c3476aec52d21
1 parent
358c6407
avoid using anonymous struct extension (not supported by all gcc 3.x)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@896 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
67 additions
and
53 deletions
hw/cirrus_vga.c
... | ... | @@ -205,8 +205,7 @@ typedef void (*cirrus_bitblt_rop_t) (uint8_t * dst, const uint8_t * src, |
205 | 205 | typedef void (*cirrus_bitblt_handler_t) (void *opaque); |
206 | 206 | |
207 | 207 | typedef struct CirrusVGAState { |
208 | - /* XXX: we use the anonymous struct/union gcc 3.x extension */ | |
209 | - __extension__ struct VGAState; | |
208 | + VGA_STATE_COMMON | |
210 | 209 | |
211 | 210 | int cirrus_linear_io_addr; |
212 | 211 | int cirrus_mmio_io_addr; | ... | ... |
hw/vga_int.h
... | ... | @@ -56,61 +56,76 @@ |
56 | 56 | |
57 | 57 | #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000 |
58 | 58 | |
59 | -typedef struct VGAState { | |
60 | - uint8_t *vram_ptr; | |
61 | - unsigned long vram_offset; | |
62 | - unsigned int vram_size; | |
63 | - uint32_t latch; | |
64 | - uint8_t sr_index; | |
65 | - uint8_t sr[256]; | |
66 | - uint8_t gr_index; | |
67 | - uint8_t gr[256]; | |
68 | - uint8_t ar_index; | |
69 | - uint8_t ar[21]; | |
70 | - int ar_flip_flop; | |
71 | - uint8_t cr_index; | |
72 | - uint8_t cr[256]; /* CRT registers */ | |
73 | - uint8_t msr; /* Misc Output Register */ | |
74 | - uint8_t fcr; /* Feature Control Register */ | |
75 | - uint8_t st00; /* status 0 */ | |
76 | - uint8_t st01; /* status 1 */ | |
77 | - uint8_t dac_state; | |
78 | - uint8_t dac_sub_index; | |
79 | - uint8_t dac_read_index; | |
80 | - uint8_t dac_write_index; | |
81 | - uint8_t dac_cache[3]; /* used when writing */ | |
82 | - uint8_t palette[768]; | |
83 | - int32_t bank_offset; | |
84 | - int (*get_bpp)(struct VGAState *s); | |
85 | - void (*get_offsets)(struct VGAState *s, | |
86 | - uint32_t *pline_offset, | |
87 | - uint32_t *pstart_addr); | |
88 | 59 | #ifdef CONFIG_BOCHS_VBE |
89 | - uint16_t vbe_index; | |
90 | - uint16_t vbe_regs[VBE_DISPI_INDEX_NB]; | |
91 | - uint32_t vbe_start_addr; | |
92 | - uint32_t vbe_line_offset; | |
60 | + | |
61 | +#define VGA_STATE_COMMON_BOCHS_VBE \ | |
62 | + uint16_t vbe_index; \ | |
63 | + uint16_t vbe_regs[VBE_DISPI_INDEX_NB]; \ | |
64 | + uint32_t vbe_start_addr; \ | |
65 | + uint32_t vbe_line_offset; \ | |
93 | 66 | uint32_t vbe_bank_mask; |
94 | -#endif | |
95 | - /* display refresh support */ | |
96 | - DisplayState *ds; | |
97 | - uint32_t font_offsets[2]; | |
98 | - int graphic_mode; | |
99 | - uint8_t shift_control; | |
100 | - uint8_t double_scan; | |
101 | - uint32_t line_offset; | |
102 | - uint32_t line_compare; | |
103 | - uint32_t start_addr; | |
104 | - uint8_t last_cw, last_ch; | |
105 | - uint32_t last_width, last_height; /* in chars or pixels */ | |
106 | - uint32_t last_scr_width, last_scr_height; /* in pixels */ | |
107 | - uint8_t cursor_start, cursor_end; | |
108 | - uint32_t cursor_offset; | |
109 | - unsigned int (*rgb_to_pixel)(unsigned int r, unsigned int g, unsigned b); | |
110 | - /* tell for each page if it has been updated since the last time */ | |
111 | - uint32_t last_palette[256]; | |
67 | + | |
68 | +#else | |
69 | + | |
70 | +#define VGA_STATE_COMMON_BOCHS_VBE | |
71 | + | |
72 | +#endif /* !CONFIG_BOCHS_VBE */ | |
73 | + | |
112 | 74 | #define CH_ATTR_SIZE (160 * 100) |
75 | + | |
76 | +#define VGA_STATE_COMMON \ | |
77 | + uint8_t *vram_ptr; \ | |
78 | + unsigned long vram_offset; \ | |
79 | + unsigned int vram_size; \ | |
80 | + uint32_t latch; \ | |
81 | + uint8_t sr_index; \ | |
82 | + uint8_t sr[256]; \ | |
83 | + uint8_t gr_index; \ | |
84 | + uint8_t gr[256]; \ | |
85 | + uint8_t ar_index; \ | |
86 | + uint8_t ar[21]; \ | |
87 | + int ar_flip_flop; \ | |
88 | + uint8_t cr_index; \ | |
89 | + uint8_t cr[256]; /* CRT registers */ \ | |
90 | + uint8_t msr; /* Misc Output Register */ \ | |
91 | + uint8_t fcr; /* Feature Control Register */ \ | |
92 | + uint8_t st00; /* status 0 */ \ | |
93 | + uint8_t st01; /* status 1 */ \ | |
94 | + uint8_t dac_state; \ | |
95 | + uint8_t dac_sub_index; \ | |
96 | + uint8_t dac_read_index; \ | |
97 | + uint8_t dac_write_index; \ | |
98 | + uint8_t dac_cache[3]; /* used when writing */ \ | |
99 | + uint8_t palette[768]; \ | |
100 | + int32_t bank_offset; \ | |
101 | + int (*get_bpp)(struct VGAState *s); \ | |
102 | + void (*get_offsets)(struct VGAState *s, \ | |
103 | + uint32_t *pline_offset, \ | |
104 | + uint32_t *pstart_addr); \ | |
105 | + VGA_STATE_COMMON_BOCHS_VBE \ | |
106 | + /* display refresh support */ \ | |
107 | + DisplayState *ds; \ | |
108 | + uint32_t font_offsets[2]; \ | |
109 | + int graphic_mode; \ | |
110 | + uint8_t shift_control; \ | |
111 | + uint8_t double_scan; \ | |
112 | + uint32_t line_offset; \ | |
113 | + uint32_t line_compare; \ | |
114 | + uint32_t start_addr; \ | |
115 | + uint8_t last_cw, last_ch; \ | |
116 | + uint32_t last_width, last_height; /* in chars or pixels */ \ | |
117 | + uint32_t last_scr_width, last_scr_height; /* in pixels */ \ | |
118 | + uint8_t cursor_start, cursor_end; \ | |
119 | + uint32_t cursor_offset; \ | |
120 | + unsigned int (*rgb_to_pixel)(unsigned int r, \ | |
121 | + unsigned int g, unsigned b); \ | |
122 | + /* tell for each page if it has been updated since the last time */ \ | |
123 | + uint32_t last_palette[256]; \ | |
113 | 124 | uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */ |
125 | + | |
126 | + | |
127 | +typedef struct VGAState { | |
128 | + VGA_STATE_COMMON | |
114 | 129 | } VGAState; |
115 | 130 | |
116 | 131 | void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, | ... | ... |