From 6e6b73631301d41e8b18de4d35937bc78b0117f3 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Sun, 28 Dec 2008 18:27:10 +0000 Subject: Register reset handlers git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6136 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/vga.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 7 deletions(-) (limited to 'hw/vga.c') diff --git a/hw/vga.c b/hw/vga.c index 29354f4..058a77c 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -1826,10 +1826,73 @@ static void vga_invalidate_display(void *opaque) s->last_height = -1; } -static void vga_reset(VGAState *s) +static void vga_reset(void *opaque) { - memset(s, 0, sizeof(VGAState)); + VGAState *s = (VGAState *) opaque; + + s->lfb_addr = 0; + s->lfb_end = 0; + s->map_addr = 0; + s->map_end = 0; + s->lfb_vram_mapped = 0; + s->bios_offset = 0; + s->bios_size = 0; + s->sr_index = 0; + memset(s->sr, '\0', sizeof(s->sr)); + s->gr_index = 0; + memset(s->gr, '\0', sizeof(s->gr)); + s->ar_index = 0; + memset(s->ar, '\0', sizeof(s->ar)); + s->ar_flip_flop = 0; + s->cr_index = 0; + memset(s->cr, '\0', sizeof(s->cr)); + s->msr = 0; + s->fcr = 0; + s->st00 = 0; + s->st01 = 0; + s->dac_state = 0; + s->dac_sub_index = 0; + s->dac_read_index = 0; + s->dac_write_index = 0; + memset(s->dac_cache, '\0', sizeof(s->dac_cache)); + s->dac_8bit = 0; + memset(s->palette, '\0', sizeof(s->palette)); + s->bank_offset = 0; +#ifdef CONFIG_BOCHS_VBE + s->vbe_index = 0; + memset(s->vbe_regs, '\0', sizeof(s->vbe_regs)); + s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; + s->vbe_start_addr = 0; + s->vbe_line_offset = 0; + s->vbe_bank_mask = (s->vram_size >> 16) - 1; +#endif + memset(s->font_offsets, '\0', sizeof(s->font_offsets)); s->graphic_mode = -1; /* force full update */ + s->shift_control = 0; + s->double_scan = 0; + s->line_offset = 0; + s->line_compare = 0; + s->start_addr = 0; + s->plane_updated = 0; + s->last_cw = 0; + s->last_ch = 0; + s->last_width = 0; + s->last_height = 0; + s->last_scr_width = 0; + s->last_scr_height = 0; + s->cursor_start = 0; + s->cursor_end = 0; + s->cursor_offset = 0; + memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table)); + memset(s->last_palette, '\0', sizeof(s->last_palette)); + memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr)); + switch (vga_retrace_method) { + case VGA_RETRACE_DUMB: + break; + case VGA_RETRACE_PRECISE: + memset(&s->retrace_info, 0, sizeof (s->retrace_info)); + break; + } } #define TEXTMODE_X(x) ((x) % width) @@ -2179,8 +2242,6 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, expand4to8[i] = v; } - vga_reset(s); - s->vram_ptr = vga_ram_base; s->vram_offset = vga_ram_offset; s->vram_size = vga_ram_size; @@ -2201,9 +2262,10 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, case VGA_RETRACE_PRECISE: s->retrace = vga_precise_retrace; s->update_retrace_info = vga_precise_update_retrace_info; - memset(&s->retrace_info, 0, sizeof (s->retrace_info)); break; } + qemu_register_reset(vga_reset, s); + vga_reset(s); } /* used by both ISA and PCI */ @@ -2229,8 +2291,6 @@ void vga_init(VGAState *s) s->bank_offset = 0; #ifdef CONFIG_BOCHS_VBE - s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; - s->vbe_bank_mask = ((s->vram_size >> 16) - 1); #if defined (TARGET_I386) register_ioport_read(0x1ce, 1, 2, vbe_ioport_read_index, s); register_ioport_read(0x1cf, 1, 2, vbe_ioport_read_data, s); -- cgit v1.1