Several x86-64 MSRs were not-initilized !

Fixed small save-restore bug in dma.cc
First step to make save-restore code look better (only several files processed for example)
This commit is contained in:
Stanislav Shwartsman 2006-05-28 17:07:57 +00:00
parent 6ca6b46203
commit 286b89d763
12 changed files with 265 additions and 245 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.194 2006-05-27 17:50:29 vruppert Exp $
// $Id: bochs.h,v 1.195 2006-05-28 17:07:56 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -122,6 +122,38 @@ void print_tree(bx_param_c *node, int level = 0);
// needed.
//
#if BX_SUPPORT_SAVE_RESTORE
#define BXRS_PARAM_SPECIAL(parent, name, maxvalue, save_handler, restore_handler) { \
bx_param_num_c *param = new bx_param_num_c(parent, #name, "", "", 0, maxvalue, 0); \
param->set_base(BASE_HEX); \
param->set_sr_handlers(this, save_handler, restore_handler); \
}
#define BXRS_PARAM_SPECIAL64(parent, name, save_handler, restore_handler) \
BXRS_PARAM_SPECIAL(parent, name, BX_MAX_BIT64U, save_handler, restore_handler)
#define BXRS_PARAM_SPECIAL32(parent, name, save_handler, restore_handler) \
BXRS_PARAM_SPECIAL(parent, name, BX_MAX_BIT32U, save_handler, restore_handler)
#define BXRS_PARAM_SPECIAL16(parent, name, save_handler, restore_handler) \
BXRS_PARAM_SPECIAL(parent, name, BX_MAX_BIT16U, save_handler, restore_handler)
#define BXRS_PARAM_SPECIAL8(parent, name, save_handler, restore_handler) \
BXRS_PARAM_SPECIAL(parent, name, BX_MAX_BIT8U, save_handler, restore_handler)
#define BXRS_HEX_PARAM_SIMPLE(parent, name) \
new bx_shadow_num_c(parent, #name, &(name), BASE_HEX)
#define BXRS_HEX_PARAM_FIELD(parent, name, field) \
new bx_shadow_num_c(parent, #name, &(field), BASE_HEX)
#define BXRS_DEC_PARAM_SIMPLE(parent, name) \
new bx_shadow_num_c(parent, #name, &(name), BASE_DEC)
#define BXRS_DEC_PARAM_FIELD(parent, name, field) \
new bx_shadow_num_c(parent, #name, &(field), BASE_DEC)
#define BXRS_PARAM_BOOL(parent, name, field) \
new bx_shadow_bool_c(parent, #name, (bx_bool*)(&(field)))
#endif
// =-=-=-=-=-=-=- Normal optimized use -=-=-=-=-=-=-=-=-=-=-=-=-=-=
// some pc_systems functions just redirect to the IO devices so optimize
// by eliminating call here

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: apic.cc,v 1.87 2006-05-27 21:44:40 sshwarts Exp $
// $Id: apic.cc,v 1.88 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -906,14 +906,17 @@ void bx_local_apic_c::register_state(bx_param_c *parent)
{
unsigned i;
char name[6];
new bx_shadow_num_c(parent, "base_addr", &base_addr, BASE_HEX);
new bx_shadow_num_c(parent, "id", &id, BASE_HEX);
new bx_shadow_num_c(parent, "spurious_vector", &spurious_vector, BASE_HEX);
new bx_shadow_bool_c(parent, "software_enabled", &software_enabled);
new bx_shadow_bool_c(parent, "focus_disable", &focus_disable);
new bx_shadow_num_c(parent, "task_priority", &task_priority, BASE_HEX);
new bx_shadow_num_c(parent, "log_dest", &log_dest, BASE_HEX);
new bx_shadow_num_c(parent, "dest_format", &dest_format, BASE_HEX);
BXRS_HEX_PARAM_SIMPLE(parent, base_addr);
BXRS_HEX_PARAM_SIMPLE(parent, id);
BXRS_HEX_PARAM_SIMPLE(parent, spurious_vector);
BXRS_PARAM_BOOL(parent, software_enabled, software_enabled);
BXRS_PARAM_BOOL(parent, focus_disable, focus_disable);
BXRS_HEX_PARAM_SIMPLE(parent, task_priority);
BXRS_HEX_PARAM_SIMPLE(parent, spurious_vector);
BXRS_HEX_PARAM_SIMPLE(parent, log_dest);
BXRS_HEX_PARAM_SIMPLE(parent, dest_format);
bx_list_c *ISR = new bx_list_c(parent, "isr", BX_LOCAL_APIC_MAX_INTS);
bx_list_c *TMR = new bx_list_c(parent, "tmr", BX_LOCAL_APIC_MAX_INTS);
bx_list_c *IRR = new bx_list_c(parent, "irr", BX_LOCAL_APIC_MAX_INTS);
@ -923,22 +926,25 @@ void bx_local_apic_c::register_state(bx_param_c *parent)
new bx_shadow_num_c(TMR, strdup(name), &tmr[i]);
new bx_shadow_num_c(IRR, strdup(name), &irr[i]);
}
new bx_shadow_num_c(parent, "error_status", &error_status, BASE_HEX);
new bx_shadow_num_c(parent, "shadow_error_status", &shadow_error_status, BASE_HEX);
new bx_shadow_num_c(parent, "icr_hi", &icr_hi, BASE_HEX);
new bx_shadow_num_c(parent, "icr_lo", &icr_lo, BASE_HEX);
BXRS_HEX_PARAM_SIMPLE(parent, error_status);
BXRS_HEX_PARAM_SIMPLE(parent, shadow_error_status);
BXRS_HEX_PARAM_SIMPLE(parent, icr_hi);
BXRS_HEX_PARAM_SIMPLE(parent, icr_lo);
bx_list_c *LVT = new bx_list_c(parent, "lvt", APIC_LVT_ENTRIES);
for (i=0; i<APIC_LVT_ENTRIES; i++) {
sprintf(name, "%d", i);
new bx_shadow_num_c(LVT, strdup(name), &lvt[i], BASE_HEX);
}
new bx_shadow_num_c(parent, "timer_initial", &timer_initial, BASE_HEX);
new bx_shadow_num_c(parent, "timer_current", &timer_current, BASE_HEX);
new bx_shadow_num_c(parent, "timer_divconf", &timer_divconf, BASE_HEX);
new bx_shadow_num_c(parent, "timer_divide_factor", &timer_divide_factor, BASE_HEX);
new bx_shadow_bool_c(parent, "timer_active", &timer_active);
new bx_shadow_num_c(parent, "ticksInitial", &ticksInitial, BASE_HEX);
new bx_shadow_bool_c(parent, "INTR", &INTR);
BXRS_HEX_PARAM_SIMPLE(parent, timer_initial);
BXRS_HEX_PARAM_SIMPLE(parent, timer_current);
BXRS_HEX_PARAM_SIMPLE(parent, timer_divconf);
BXRS_DEC_PARAM_SIMPLE(parent, timer_divide_factor);
BXRS_PARAM_BOOL(parent, timer_active, timer_active);
BXRS_HEX_PARAM_SIMPLE(parent, ticksInitial);
BXRS_PARAM_BOOL(parent, INTR, INTR);
}
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.156 2006-05-26 17:24:36 sshwarts Exp $
// $Id: cpu.cc,v 1.157 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.296 2006-05-27 15:54:48 sshwarts Exp $
// $Id: cpu.h,v 1.297 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1294,8 +1294,8 @@ public: // for now...
#endif
void initialize(BX_MEM_C *addrspace);
#if BX_SUPPORT_SAVE_RESTORE
void register_state();
void after_restore_state();
void register_state(void);
void after_restore_state(void);
static Bit64s param_save_handler(void *devptr, bx_param_c *param, Bit64s val);
static Bit64s param_restore_handler(void *devptr, bx_param_c *param, Bit64s val);
#if !BX_USE_CPU_SMF

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debugstuff.cc,v 1.68 2006-05-24 16:46:57 sshwarts Exp $
// $Id: debugstuff.cc,v 1.69 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -819,14 +819,13 @@ bx_bool BX_CPU_C::dbg_set_cpu(bx_dbg_cpu_t *cpu)
BX_CPU_THIS_PTR dr7 = cpu->dr7;
#if BX_CPU_LEVEL >= 2
// cr0, cr1, cr2, cr3, cr4
// Control registers
SetCR0(cpu->cr0);
BX_CPU_THIS_PTR cr1 = cpu->cr1;
BX_CPU_THIS_PTR cr2 = cpu->cr2;
CR3_change(cpu->cr3);
#endif
#if BX_CPU_LEVEL >= 4
BX_CPU_THIS_PTR cr4.setRegister(cpu->cr4);
#endif
#endif
BX_CPU_THIS_PTR inhibit_mask = cpu->inhibit_mask;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: init.cc,v 1.107 2006-05-27 16:05:30 sshwarts Exp $
// $Id: init.cc,v 1.108 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -378,75 +378,65 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
}
#if BX_SUPPORT_SAVE_RESTORE
void BX_CPU_C::register_state()
void BX_CPU_C::register_state(void)
{
unsigned i;
char cpu_name[10], cpu_title[10], name[10];
bx_param_num_c *param;
bx_list_c *reg;
bx_param_num_c *param;
sprintf(cpu_name, "%d", BX_CPU_ID);
sprintf(cpu_title, "CPU %d", BX_CPU_ID);
bx_list_c *list = new bx_list_c(SIM->get_param("save_restore.cpu"), strdup(cpu_name),
cpu_title, 60);
#define BXRS_PARAM_SPECIAL(name) \
param = new bx_param_num_c(list, #name, "", "", 0, BX_MAX_BIT32U, 0); \
param->set_base(BASE_HEX); \
param->set_sr_handlers(this, param_save_handler, param_restore_handler);
#define BXRS_PARAM_SIMPLE(name) \
new bx_shadow_num_c(list, #name, &(name), BASE_HEX)
#define BXRS_PARAM_FIELD(name, field) \
new bx_shadow_num_c(list, #name, &(field), BASE_HEX)
BXRS_PARAM_SPECIAL(cpu_version);
BXRS_PARAM_SPECIAL(cpuid_std);
BXRS_PARAM_SPECIAL(cpuid_ext);
BXRS_PARAM_SIMPLE(cpu_mode);
BXRS_PARAM_SIMPLE(inhibit_mask);
BXRS_PARAM_SPECIAL32(list, cpu_version, param_save_handler, param_restore_handler);
BXRS_PARAM_SPECIAL32(list, cpuid_std, param_save_handler, param_restore_handler);
BXRS_PARAM_SPECIAL32(list, cpuid_ext, param_save_handler, param_restore_handler);
BXRS_HEX_PARAM_SIMPLE(list, cpu_mode);
BXRS_HEX_PARAM_SIMPLE(list, inhibit_mask);
#if BX_SUPPORT_X86_64
BXRS_PARAM_SIMPLE(RAX);
BXRS_PARAM_SIMPLE(RBX);
BXRS_PARAM_SIMPLE(RCX);
BXRS_PARAM_SIMPLE(RDX);
BXRS_PARAM_SIMPLE(RSP);
BXRS_PARAM_SIMPLE(RBP);
BXRS_PARAM_SIMPLE(RSI);
BXRS_PARAM_SIMPLE(RDI);
BXRS_PARAM_SIMPLE(R8);
BXRS_PARAM_SIMPLE(R9);
BXRS_PARAM_SIMPLE(R10);
BXRS_PARAM_SIMPLE(R11);
BXRS_PARAM_SIMPLE(R12);
BXRS_PARAM_SIMPLE(R13);
BXRS_PARAM_SIMPLE(R14);
BXRS_PARAM_SIMPLE(R15);
BXRS_PARAM_SIMPLE(RIP);
BXRS_HEX_PARAM_SIMPLE(list, RAX);
BXRS_HEX_PARAM_SIMPLE(list, RBX);
BXRS_HEX_PARAM_SIMPLE(list, RCX);
BXRS_HEX_PARAM_SIMPLE(list, RDX);
BXRS_HEX_PARAM_SIMPLE(list, RSP);
BXRS_HEX_PARAM_SIMPLE(list, RBP);
BXRS_HEX_PARAM_SIMPLE(list, RSI);
BXRS_HEX_PARAM_SIMPLE(list, RDI);
BXRS_HEX_PARAM_SIMPLE(list, R8);
BXRS_HEX_PARAM_SIMPLE(list, R9);
BXRS_HEX_PARAM_SIMPLE(list, R10);
BXRS_HEX_PARAM_SIMPLE(list, R11);
BXRS_HEX_PARAM_SIMPLE(list, R12);
BXRS_HEX_PARAM_SIMPLE(list, R13);
BXRS_HEX_PARAM_SIMPLE(list, R14);
BXRS_HEX_PARAM_SIMPLE(list, R15);
BXRS_HEX_PARAM_SIMPLE(list, RIP);
#else
BXRS_PARAM_SIMPLE(EAX);
BXRS_PARAM_SIMPLE(EBX);
BXRS_PARAM_SIMPLE(ECX);
BXRS_PARAM_SIMPLE(EDX);
BXRS_PARAM_SIMPLE(ESP);
BXRS_PARAM_SIMPLE(EBP);
BXRS_PARAM_SIMPLE(ESI);
BXRS_PARAM_SIMPLE(EDI);
BXRS_PARAM_SIMPLE(EIP);
BXRS_HEX_PARAM_SIMPLE(list, EAX);
BXRS_HEX_PARAM_SIMPLE(list, EBX);
BXRS_HEX_PARAM_SIMPLE(list, ECX);
BXRS_HEX_PARAM_SIMPLE(list, EDX);
BXRS_HEX_PARAM_SIMPLE(list, ESP);
BXRS_HEX_PARAM_SIMPLE(list, EBP);
BXRS_HEX_PARAM_SIMPLE(list, ESI);
BXRS_HEX_PARAM_SIMPLE(list, EDI);
BXRS_HEX_PARAM_SIMPLE(list, EIP);
#endif
BXRS_PARAM_FIELD(EFLAGS, eflags.val32);
BXRS_HEX_PARAM_FIELD(list, EFLAGS, eflags.val32);
#if BX_CPU_LEVEL >= 3
BXRS_PARAM_SIMPLE(dr0);
BXRS_PARAM_SIMPLE(dr1);
BXRS_PARAM_SIMPLE(dr2);
BXRS_PARAM_SIMPLE(dr3);
BXRS_PARAM_SIMPLE(dr6);
BXRS_PARAM_SIMPLE(dr7);
BXRS_HEX_PARAM_FIELD(list, DR0, dr0);
BXRS_HEX_PARAM_FIELD(list, DR1, dr1);
BXRS_HEX_PARAM_FIELD(list, DR2, dr2);
BXRS_HEX_PARAM_FIELD(list, DR3, dr3);
BXRS_HEX_PARAM_FIELD(list, DR6, dr6);
BXRS_HEX_PARAM_FIELD(list, DR7, dr7);
#endif
BXRS_PARAM_FIELD (cr0, cr0.val32);
BXRS_PARAM_SIMPLE(cr1);
BXRS_PARAM_SIMPLE(cr2);
BXRS_PARAM_SIMPLE(cr3);
BXRS_HEX_PARAM_FIELD(list, cR0, cr0.val32);
BXRS_HEX_PARAM_FIELD(list, CR2, cr2);
BXRS_HEX_PARAM_FIELD(list, CR3, cr3);
#if BX_CPU_LEVEL >= 4
BXRS_PARAM_FIELD(cr4, cr4.registerValue);
BXRS_HEX_PARAM_FIELD(list, CR4, cr4.registerValue);
#endif
#define BXRS_PARAM_SEG_REG(x) \
@ -470,91 +460,86 @@ void BX_CPU_C::register_state()
new bx_shadow_bool_c(reg, \
"avl", &(sregs[BX_SEG_REG_##x].cache.u.segment.avl));
#define BXRS_PARAM_GLOBAL_SEG_REG(name,field) \
new bx_shadow_num_c(list, \
#name"_base", & BX_CPU_THIS_PTR field.base, BASE_HEX); \
new bx_shadow_num_c(list, \
#name"_limit", & BX_CPU_THIS_PTR field.limit, BASE_HEX);
BXRS_PARAM_SEG_REG(CS);
BXRS_PARAM_SEG_REG(DS);
BXRS_PARAM_SEG_REG(SS);
BXRS_PARAM_SEG_REG(ES);
BXRS_PARAM_SEG_REG(FS);
BXRS_PARAM_SEG_REG(GS);
#if BX_CPU_LEVEL >= 2
#define BXRS_PARAM_GLOBAL_SEG_REG(name,field) \
new bx_shadow_num_c(list, \
#name"_base", &(BX_CPU_THIS_PTR field.base), BASE_HEX); \
new bx_shadow_num_c(list, \
#name"_limit", &(BX_CPU_THIS_PTR field.limit), BASE_HEX);
BXRS_PARAM_GLOBAL_SEG_REG(GDTR, gdtr);
BXRS_PARAM_GLOBAL_SEG_REG(IDTR, idtr);
#endif
reg = new bx_list_c (list, "LDTR", 4);
param = new bx_param_num_c(reg, "selector", "", "", 0, BX_MAX_BIT16U, 0);
param->set_base(BASE_HEX);
param->set_sr_handlers(this, param_save_handler, param_restore_handler);
new bx_shadow_num_c (reg, "base", &ldtr.cache.u.ldt.base, BASE_HEX);
new bx_shadow_num_c (reg, "limit", &ldtr.cache.u.ldt.limit, BASE_HEX);
param = new bx_param_num_c(reg, "ar_byte", "", "", 0, BX_MAX_BIT8U, 0);
param->set_base(BASE_HEX);
param->set_sr_handlers(this, param_save_handler, param_restore_handler);
bx_list_c *LDTR = new bx_list_c (list, "LDTR", 4);
BXRS_PARAM_SPECIAL16(LDTR, selector, param_save_handler, param_restore_handler);
BXRS_HEX_PARAM_FIELD(LDTR, base, ldtr.cache.u.ldt.base );
BXRS_HEX_PARAM_FIELD(LDTR, limit, ldtr.cache.u.ldt.limit);
BXRS_PARAM_SPECIAL8 (LDTR, ar_byte, param_save_handler, param_restore_handler);
reg = new bx_list_c (list, "TR", 7);
param = new bx_param_num_c(reg, "selector", "", "", 0, BX_MAX_BIT16U, 0);
param->set_base(BASE_HEX);
param->set_sr_handlers(this, param_save_handler, NULL);
new bx_shadow_num_c (reg, "base", &tr.cache.u.tss.base, BASE_HEX);
new bx_shadow_num_c (reg, "limit", &tr.cache.u.tss.limit, BASE_HEX);
new bx_shadow_num_c (reg, "limit_scaled", &tr.cache.u.tss.limit_scaled, BASE_HEX);
param = new bx_param_num_c(reg, "ar_byte", "", "", 0, BX_MAX_BIT8U, 0);
param->set_base(BASE_HEX);
param->set_sr_handlers(this, param_save_handler, param_restore_handler);
new bx_shadow_bool_c(reg, "granularity", &tr.cache.u.tss.g);
new bx_shadow_bool_c(reg, "avl", &tr.cache.u.tss.avl);
bx_list_c *TR = new bx_list_c (list, "TR", 7);
BXRS_PARAM_SPECIAL16(TR, selector, param_save_handler, param_restore_handler);
BXRS_HEX_PARAM_FIELD(TR, base, tr.cache.u.tss.base);
BXRS_HEX_PARAM_FIELD(TR, limit, tr.cache.u.tss.limit);
BXRS_HEX_PARAM_FIELD(TR, limit_scaled, tr.cache.u.tss.limit_scaled);
BXRS_PARAM_SPECIAL8 (TR, ar_byte, param_save_handler, param_restore_handler);
BXRS_PARAM_BOOL(TR, granularity, tr.cache.u.tss.g);
BXRS_PARAM_BOOL(TR, avl, tr.cache.u.tss.avl);
BXRS_HEX_PARAM_SIMPLE(list, smbase);
BXRS_PARAM_SIMPLE(smbase);
#if BX_CPU_LEVEL >= 5
bx_list_c *MSR = new bx_list_c(list, "msr", 12);
#if BX_SUPPORT_APIC
new bx_shadow_num_c(MSR, "apicbase", &msr.apicbase, BASE_HEX);
BXRS_HEX_PARAM_FIELD(MSR, apicbase, msr.apicbase);
#endif
#if BX_SUPPORT_X86_64
param = new bx_param_num_c(MSR, "EFER", "", "", 0, BX_MAX_BIT32U, 0);
param->set_base(BASE_HEX);
param->set_sr_handlers(this, param_save_handler, param_restore_handler);
new bx_shadow_num_c(MSR, "star", &msr.star, BASE_HEX);
new bx_shadow_num_c(MSR, "lstar", &msr.lstar, BASE_HEX);
new bx_shadow_num_c(MSR, "cstar", &msr.cstar, BASE_HEX);
new bx_shadow_num_c(MSR, "fmask", &msr.fmask, BASE_HEX);
new bx_shadow_num_c(MSR, "kernelgsbase", &msr.kernelgsbase, BASE_HEX);
new bx_shadow_num_c(MSR, "tsc_aux", &msr.tsc_aux, BASE_HEX);
BXRS_PARAM_SPECIAL32(MSR, EFER, param_save_handler, param_restore_handler);
BXRS_HEX_PARAM_FIELD(MSR, star, msr.star);
BXRS_HEX_PARAM_FIELD(MSR, lstar, msr.lstar);
BXRS_HEX_PARAM_FIELD(MSR, cstar, msr.cstar);
BXRS_HEX_PARAM_FIELD(MSR, fmask, msr.fmask);
BXRS_HEX_PARAM_FIELD(MSR, kernelgsbase, msr.kernelgsbase);
BXRS_HEX_PARAM_FIELD(MSR, tsc_aux, msr.tsc_aux);
#endif
new bx_shadow_num_c(MSR, "tsc_last_reset", &msr.tsc_last_reset, BASE_HEX);
BXRS_HEX_PARAM_FIELD(MSR, tsc_last_reset, msr.tsc_last_reset);
#if BX_SUPPORT_SEP
new bx_shadow_num_c(MSR, "sysenter_cs_msr", &msr.sysenter_cs_msr, BASE_HEX);
new bx_shadow_num_c(MSR, "sysenter_esp_msr", &msr.sysenter_esp_msr, BASE_HEX);
new bx_shadow_num_c(MSR, "sysenter_eip_msr", &msr.sysenter_eip_msr, BASE_HEX);
BXRS_HEX_PARAM_FIELD(MSR, sysenter_cs_msr, msr.sysenter_cs_msr);
BXRS_HEX_PARAM_FIELD(MSR, sysenter_esp_msr, msr.sysenter_esp_msr);
BXRS_HEX_PARAM_FIELD(MSR, sysenter_eip_msr, msr.sysenter_eip_msr);
#endif
#endif
#if BX_SUPPORT_FPU || BX_SUPPORT_MMX
bx_list_c *fpu = new bx_list_c(list, "fpu", 17);
new bx_shadow_num_c(fpu, "cwd", &the_i387.cwd, BASE_HEX);
new bx_shadow_num_c(fpu, "swd", &the_i387.swd, BASE_HEX);
new bx_shadow_num_c(fpu, "twd", &the_i387.twd, BASE_HEX);
new bx_shadow_num_c(fpu, "foo", &the_i387.foo, BASE_HEX);
new bx_shadow_num_c(fpu, "fip", &the_i387.fip, BASE_HEX);
new bx_shadow_num_c(fpu, "fdp", &the_i387.fdp, BASE_HEX);
new bx_shadow_num_c(fpu, "fcs", &the_i387.fcs, BASE_HEX);
new bx_shadow_num_c(fpu, "fds", &the_i387.fds, BASE_HEX);
bx_list_c *fpu = new bx_list_c(list, "FPU", 17);
BXRS_HEX_PARAM_FIELD(fpu, cwd, the_i387.cwd);
BXRS_HEX_PARAM_FIELD(fpu, swd, the_i387.swd);
BXRS_HEX_PARAM_FIELD(fpu, twd, the_i387.twd);
BXRS_HEX_PARAM_FIELD(fpu, foo, the_i387.foo);
BXRS_HEX_PARAM_FIELD(fpu, fcs, the_i387.fcs);
BXRS_HEX_PARAM_FIELD(fpu, fip, the_i387.fip);
BXRS_HEX_PARAM_FIELD(fpu, fds, the_i387.fds);
BXRS_HEX_PARAM_FIELD(fpu, fdp, the_i387.fdp);
for (i=0; i<8; i++) {
sprintf(name, "st%d", i);
reg = new bx_list_c(fpu, strdup(name), 8);
new bx_shadow_num_c(reg, "exp", &the_i387.st_space[i].exp, BASE_HEX);
new bx_shadow_num_c(reg, "fraction", &the_i387.st_space[i].fraction, BASE_HEX);
bx_list_c *STx = new bx_list_c(fpu, strdup(name), 8);
BXRS_HEX_PARAM_FIELD(STx, exp, the_i387.st_space[i].exp);
BXRS_HEX_PARAM_FIELD(STx, fraction, the_i387.st_space[i].fraction);
}
new bx_shadow_num_c(fpu, "tos", &the_i387.tos, BASE_HEX);
BXRS_DEC_PARAM_FIELD(fpu, tos, the_i387.tos);
#endif
#if BX_SUPPORT_SSE
bx_list_c *sse = new bx_list_c(list, "sse", 2*BX_XMM_REGISTERS+1);
new bx_shadow_num_c(sse, "mxcsr", &mxcsr.mxcsr, BASE_HEX);
bx_list_c *sse = new bx_list_c(list, "SSE", 2*BX_XMM_REGISTERS+1);
BXRS_HEX_PARAM_FIELD(sse, mxcsr, mxcsr.mxcsr);
for (i=0; i<BX_XMM_REGISTERS; i++) {
sprintf(name, "xmm%02d_hi", i);
new bx_shadow_num_c(sse, strdup(name), &BX_CPU_THIS_PTR xmm[i].xmm64u(1), BASE_HEX);
@ -562,17 +547,19 @@ void BX_CPU_C::register_state()
new bx_shadow_num_c(sse, strdup(name), &BX_CPU_THIS_PTR xmm[i].xmm64u(0), BASE_HEX);
}
#endif
#if BX_SUPPORT_APIC
bx_list_c *lapic = new bx_list_c(list, "local_apic", 25);
local_apic.register_state(lapic);
#endif
new bx_shadow_bool_c(list, "EXT", &EXT);
new bx_shadow_bool_c(list, "async_event", (bx_bool*)&async_event);
new bx_shadow_bool_c(list, "INTR", (bx_bool*)&INTR);
new bx_shadow_bool_c(list, "smi_pending", (bx_bool*)&smi_pending);
new bx_shadow_bool_c(list, "nmi_pending", (bx_bool*)&nmi_pending);
new bx_shadow_bool_c(list, "in_smm", (bx_bool*)&in_smm);
new bx_shadow_bool_c(list, "nmi_disable", (bx_bool*)&nmi_disable);
BXRS_PARAM_BOOL(list, EXT, EXT);
BXRS_PARAM_BOOL(list, async_event, async_event);
BXRS_PARAM_BOOL(list, INTR, INTR);
BXRS_PARAM_BOOL(list, smi_pending, smi_pending);
BXRS_PARAM_BOOL(list, nmi_pending, nmi_pending);
BXRS_PARAM_BOOL(list, in_smm, in_smm);
BXRS_PARAM_BOOL(list, nmi_disable, nmi_disable);
}
Bit64s BX_CPU_C::param_save_handler(void *devptr, bx_param_c *param, Bit64s val)
@ -599,7 +586,7 @@ Bit64s BX_CPU_C::param_save(bx_param_c *param, Bit64s val)
val = get_extended_cpuid_features();
#if BX_SUPPORT_X86_64
} else if (!strcmp(pname, "EFER")) {
val = get_EFER();
val = BX_CPU_THIS_PTR get_EFER();
#endif
} else if (!strcmp(pname, "ar_byte") || !strcmp(pname, "selector")) {
segname = param->get_parent()->get_name();
@ -710,7 +697,7 @@ Bit64s BX_CPU_C::param_restore(bx_param_c *param, Bit64s val)
return val;
}
void BX_CPU_C::after_restore_state()
void BX_CPU_C::after_restore_state(void)
{
SetCR0(cr0.val32);
CR3_change(cr3);
@ -722,7 +709,7 @@ void BX_CPU_C::after_restore_state()
}
#endif
BX_CPU_C::~BX_CPU_C(void)
BX_CPU_C::~BX_CPU_C()
{
BX_INSTR_SHUTDOWN(BX_CPU_ID);
BX_DEBUG(("Exit."));
@ -982,6 +969,7 @@ void BX_CPU_C::reset(unsigned source)
TLB_flush(1);
#if BX_CPU_LEVEL >= 3
BX_CPU_THIS_PTR cr1 = 0;
BX_CPU_THIS_PTR cr2 = 0;
BX_CPU_THIS_PTR cr3 = 0;
BX_CPU_THIS_PTR cr3_masked = 0;
@ -1000,10 +988,22 @@ void BX_CPU_C::reset(unsigned source)
#endif
#if BX_SUPPORT_X86_64
BX_CPU_THIS_PTR msr.lme = BX_CPU_THIS_PTR msr.lma = 0;
BX_CPU_THIS_PTR msr.sce = BX_CPU_THIS_PTR msr.nxe = 0;
BX_CPU_THIS_PTR msr.ffxsr = 0;
BX_CPU_THIS_PTR msr.star = 0;
BX_CPU_THIS_PTR msr.lstar = 0;
BX_CPU_THIS_PTR msr.cstar = 0;
BX_CPU_THIS_PTR msr.fmask = 0;
BX_CPU_THIS_PTR msr.kernelgsbase = 0;
BX_CPU_THIS_PTR msr.tsc_aux = 0;
#endif
BX_CPU_THIS_PTR set_TSC(0);
#endif
BX_CPU_THIS_PTR msr.sysenter_cs_msr = 0;
BX_CPU_THIS_PTR msr.sysenter_esp_msr = 0;
BX_CPU_THIS_PTR msr.sysenter_eip_msr = 0;
BX_CPU_THIS_PTR EXT = 0;
#if BX_SUPPORT_PAGING

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: busmouse.cc,v 1.4 2006-05-27 15:54:48 sshwarts Exp $
// $Id: busmouse.cc,v 1.5 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -71,7 +71,7 @@ bx_busm_c::~bx_busm_c()
void bx_busm_c::init(void)
{
BX_DEBUG(("Init $Id: busmouse.cc,v 1.4 2006-05-27 15:54:48 sshwarts Exp $"));
BX_DEBUG(("Init $Id: busmouse.cc,v 1.5 2006-05-28 17:07:57 sshwarts Exp $"));
DEV_register_irq(BUS_MOUSE_IRQ, "Bus Mouse");
@ -117,25 +117,27 @@ void bx_busm_c::reset(unsigned type)
void bx_busm_c::register_state(void)
{
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "busmouse", "Busmouse State", 12);
new bx_shadow_num_c(list, "mouse_delayed_dx", &BX_BUSM_THIS mouse_delayed_dx);
new bx_shadow_num_c(list, "mouse_delayed_dy", &BX_BUSM_THIS mouse_delayed_dx);
new bx_shadow_num_c(list, "current_x", &BX_BUSM_THIS current_x);
new bx_shadow_num_c(list, "current_y", &BX_BUSM_THIS current_y);
new bx_shadow_num_c(list, "current_b", &BX_BUSM_THIS current_b);
new bx_shadow_num_c(list, "sig_port_sequ", &BX_BUSM_THIS sig_port_sequ, BASE_HEX);
new bx_shadow_num_c(list, "control_val", &BX_BUSM_THIS control_val, BASE_HEX);
BXRS_HEX_PARAM_FIELD(list, mouse_delayed_dx, BX_BUSM_THIS mouse_delayed_dx);
BXRS_HEX_PARAM_FIELD(list, mouse_delayed_dx, BX_BUSM_THIS mouse_delayed_dy);
BXRS_HEX_PARAM_FIELD(list, current_x, BX_BUSM_THIS current_x);
BXRS_HEX_PARAM_FIELD(list, current_y, BX_BUSM_THIS current_y);
BXRS_HEX_PARAM_FIELD(list, current_b, BX_BUSM_THIS current_b);
BXRS_HEX_PARAM_FIELD(list, sig_port_sequ, BX_BUSM_THIS sig_port_sequ);
BXRS_HEX_PARAM_FILED(list, control_val, BX_BUSM_THIS control_val);
bx_list_c *ctrl = new bx_list_c(list, "control", 7);
new bx_shadow_bool_c(ctrl, "mode_set", &BX_BUSM_THIS control.mode_set);
new bx_shadow_num_c(ctrl, "modeA_select", &BX_BUSM_THIS control.modeA_select);
new bx_shadow_bool_c(ctrl, "portA_dir", &BX_BUSM_THIS control.portA_dir);
new bx_shadow_bool_c(ctrl, "portC_upper_dir", &BX_BUSM_THIS control.portC_upper_dir);
new bx_shadow_bool_c(ctrl, "modeBC_select", &BX_BUSM_THIS control.modeBC_select);
new bx_shadow_bool_c(ctrl, "portB_dir", &BX_BUSM_THIS control.portB_dir);
new bx_shadow_bool_c(ctrl, "portC_lower_dir", &BX_BUSM_THIS control.portC_lower_dir);
new bx_shadow_bool_c(list, "interrupts", &BX_BUSM_THIS interrupts);
new bx_shadow_bool_c(list, "packet_update", &BX_BUSM_THIS packet_update);
new bx_shadow_num_c(list, "cur_command", &BX_BUSM_THIS cur_command, BASE_HEX);
new bx_shadow_num_c(list, "command_val", &BX_BUSM_THIS command_val, BASE_HEX);
BXRS_PARAM_BOOL(ctrl, mode_set, BX_BUSM_THIS control.mode_set);
BXRS_HEX_PARAM_FILED(ctrl, modeA_select, BX_BUSM_THIS control.modeA_select);
BXRS_PARAM_BOOL(ctrl, portA_dir, BX_BUSM_THIS control.portA_dir);
BXRS_PARAM_BOOL(ctrl, portC_upper_dir, BX_BUSM_THIS control.portC_upper_dir);
BXRS_PARAM_BOOL(ctrl, modeBC_select, BX_BUSM_THIS control.modeBC_select);
BXRS_PARAM_BOOL(ctrl, portB_dir, BX_BUSM_THIS control.portB_dir);
BXRS_PARAM_BOOL(ctrl, portC_lower_dir, BX_BUSM_THIS control.portC_lower_dir);
BXRS_PARAM_BOOL(list, interrupts, BX_BUSM_THIS control.interrupts);
BXRS_PARAM_BOOL(list, packet_update, BX_BUSM_THIS control.packet_update);
BXRS_HEX_PARAM_FILED(list, cur_command, BX_BUSM_THIS cur_command);
BXRS_HEX_PARAM_FILED(list, command_val, BX_BUSM_THIS command_val);
}
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dma.cc,v 1.36 2006-05-27 15:54:48 sshwarts Exp $
// $Id: dma.cc,v 1.37 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -123,7 +123,7 @@ unsigned bx_dma_c::get_TC(void)
void bx_dma_c::init(void)
{
unsigned c, i, j;
BX_DEBUG(("Init $Id: dma.cc,v 1.36 2006-05-27 15:54:48 sshwarts Exp $"));
BX_DEBUG(("Init $Id: dma.cc,v 1.37 2006-05-28 17:07:57 sshwarts Exp $"));
/* 8237 DMA controller */
@ -210,7 +210,7 @@ void bx_dma_c::register_state(void)
bx_list_c *chan = new bx_list_c(ctrl, strdup(name), 12);
new bx_shadow_bool_c(chan, "DRQ", &BX_DMA_THIS s[i].DRQ[c]);
new bx_shadow_bool_c(chan, "DACK", &BX_DMA_THIS s[i].DACK[c]);
new bx_shadow_bool_c(chan, "mask", &BX_DMA_THIS s[i].mask[4]);
new bx_shadow_bool_c(chan, "mask", &BX_DMA_THIS s[i].mask[c]);
new bx_shadow_num_c(chan, "mode_type", &BX_DMA_THIS s[i].chan[c].mode.mode_type);
new bx_shadow_num_c(chan, "address_decrement", &BX_DMA_THIS s[i].chan[c].mode.address_decrement);
new bx_shadow_num_c(chan, "autoinit_enable", &BX_DMA_THIS s[i].chan[c].mode.autoinit_enable);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ioapic.cc,v 1.29 2006-05-27 15:54:48 sshwarts Exp $
// $Id: ioapic.cc,v 1.30 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -65,8 +65,8 @@ void bx_io_redirect_entry_t::sprintf_self(char *buf)
#if BX_SUPPORT_SAVE_RESTORE
void bx_io_redirect_entry_t::register_state(bx_param_c *parent)
{
new bx_shadow_num_c(parent, "lo", &lo, BASE_HEX);
new bx_shadow_num_c(parent, "hi", &hi, BASE_HEX);
BXRS_HEX_PARAM_SIMPLE(parent, lo);
BXRS_HEX_PARAM_SIMPLE(parent, hi);
}
#endif
@ -252,18 +252,16 @@ void bx_ioapic_c::service_ioapic()
#if BX_SUPPORT_SAVE_RESTORE
void bx_ioapic_c::register_state(void)
{
unsigned i;
char name[6];
bx_list_c *entry;
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "ioapic", "IOAPIC State");
new bx_shadow_num_c(list, "ioregsel", &ioregsel, BASE_HEX);
new bx_shadow_num_c(list, "intin", &intin, BASE_HEX);
new bx_shadow_num_c(list, "irr", &irr, BASE_HEX);
BXRS_HEX_PARAM_SIMPLE(list, ioregsel);
BXRS_HEX_PARAM_SIMPLE(list, intin);
BXRS_HEX_PARAM_SIMPLE(list, irr);
bx_list_c *table = new bx_list_c(list, "ioredtbl", BX_IOAPIC_NUM_PINS);
for (i=0; i<BX_IOAPIC_NUM_PINS; i++) {
for (unsigned i=0; i<BX_IOAPIC_NUM_PINS; i++) {
char name[6];
sprintf(name, "0x%02x", i);
entry = new bx_list_c(table, strdup(name), 2);
bx_list_c *entry = new bx_list_c(table, strdup(name), 2);
ioredtbl[i].register_state(entry);
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci.cc,v 1.49 2006-05-27 15:54:48 sshwarts Exp $
// $Id: pci.cc,v 1.50 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -151,14 +151,12 @@ bx_pci_bridge_c::reset(unsigned type)
#if BX_SUPPORT_SAVE_RESTORE
void bx_pci_bridge_c::register_state(void)
{
unsigned i;
char name[6];
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pci_bridge", "PCI Bridge State");
new bx_shadow_num_c(list, "confAddr", &BX_PCI_THIS s.i440fx.confAddr, BASE_HEX);
new bx_shadow_num_c(list, "confData", &BX_PCI_THIS s.i440fx.confData, BASE_HEX);
BXRS_HEX_PARAM_FIELD(list, confAddr, BX_PCI_THIS s.i440fx.confAddr);
BXRS_HEX_PARAM_FIELD(list, confData, BX_PCI_THIS s.i440fx.confData);
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
for (i=0; i<256; i++) {
for (unsigned i=0; i<256; i++) {
char name[6];
sprintf(name, "0x%02x", i);
new bx_shadow_num_c(pci_conf, strdup(name), &BX_PCI_THIS s.i440fx.pci_conf[i], BASE_HEX);
}
@ -177,7 +175,6 @@ Bit32u bx_pci_bridge_c::read_handler(void *this_ptr, Bit32u address, unsigned io
{
#if !BX_USE_PCI_SMF
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
return class_ptr->read(address, io_len);
}
@ -189,10 +186,7 @@ Bit32u bx_pci_bridge_c::read(Bit32u address, unsigned io_len)
switch (address) {
case 0x0CF8:
{
return BX_PCI_THIS s.i440fx.confAddr;
}
break;
return BX_PCI_THIS s.i440fx.confAddr;
case 0x0CFC:
case 0x0CFD:
case 0x0CFE:
@ -228,7 +222,6 @@ void bx_pci_bridge_c::write_handler(void *this_ptr, Bit32u address, Bit32u value
{
#if !BX_USE_PCI_SMF
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
class_ptr->write(address, value, io_len);
}
@ -240,14 +233,12 @@ void bx_pci_bridge_c::write(Bit32u address, Bit32u value, unsigned io_len)
switch (address) {
case 0xCF8:
{
BX_PCI_THIS s.i440fx.confAddr = value;
if ((value & 0x80FFFF00) == 0x80000000) {
BX_DEBUG(("440FX PMC register 0x%02x selected", value & 0xfc));
} else if ((value & 0x80000000) == 0x80000000) {
BX_DEBUG(("440FX request for bus 0x%02x device 0x%02x function 0x%02x",
(value >> 16) & 0xFF, (value >> 11) & 0x1F, (value >> 8) & 0x07));
}
BX_PCI_THIS s.i440fx.confAddr = value;
if ((value & 0x80FFFF00) == 0x80000000) {
BX_DEBUG(("440FX PMC register 0x%02x selected", value & 0xfc));
} else if ((value & 0x80000000) == 0x80000000) {
BX_DEBUG(("440FX request for bus 0x%02x device 0x%02x function 0x%02x",
(value >> 16) & 0xFF, (value >> 11) & 0x1F, (value >> 8) & 0x07));
}
break;
@ -255,14 +246,10 @@ void bx_pci_bridge_c::write(Bit32u address, Bit32u value, unsigned io_len)
case 0xCFD:
case 0xCFE:
case 0xCFF:
{
Bit32u handle;
Bit8u devfunc, regnum;
if ((BX_PCI_THIS s.i440fx.confAddr & 0x80FF0000) == 0x80000000) {
devfunc = (BX_PCI_THIS s.i440fx.confAddr >> 8) & 0xff;
regnum = (BX_PCI_THIS s.i440fx.confAddr & 0xfc) + (address & 0x03);
handle = BX_PCI_THIS pci_handler_id[devfunc];
Bit8u devfunc = (BX_PCI_THIS s.i440fx.confAddr >> 8) & 0xff;
Bit8u regnum = (BX_PCI_THIS s.i440fx.confAddr & 0xfc) + (address & 0x03);
Bit32u handle = BX_PCI_THIS pci_handler_id[devfunc];
if ((io_len <= 4) && (handle < BX_MAX_PCI_DEVICES)) {
if (((regnum>=4) && (regnum<=7)) || (regnum==12) || (regnum==13) || (regnum>14)) {
BX_PCI_THIS pci_handler[handle].handler->pci_write_handler(regnum, value, io_len);
@ -270,14 +257,13 @@ void bx_pci_bridge_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
else
BX_DEBUG(("read only register, write ignored"));
}
}
}
break;
default:
BX_PANIC(("IO write to port 0x%x", (unsigned) address));
}
}
}
// pci configuration space read callback handler

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci2isa.cc,v 1.32 2006-05-27 15:54:48 sshwarts Exp $
// $Id: pci2isa.cc,v 1.33 2006-05-28 17:07:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -157,11 +157,12 @@ void bx_pci2isa_c::register_state(void)
sprintf(name, "0x%02x", i);
new bx_shadow_num_c(pci_conf, strdup(name), &BX_P2I_THIS s.pci_conf[i], BASE_HEX);
}
new bx_shadow_num_c(list, "elcr1", &BX_P2I_THIS s.elcr1, BASE_HEX);
new bx_shadow_num_c(list, "elcr2", &BX_P2I_THIS s.elcr2, BASE_HEX);
new bx_shadow_num_c(list, "apmc", &BX_P2I_THIS s.apmc, BASE_HEX);
new bx_shadow_num_c(list, "apms", &BX_P2I_THIS s.apms, BASE_HEX);
new bx_shadow_num_c(list, "pci_reset", &BX_P2I_THIS s.pci_reset, BASE_HEX);
BXRS_HEX_PARAM_FIELD(list, elcr1, BX_P2I_THIS s.elcr1);
BXRS_HEX_PARAM_FIELD(list, elcr2, BX_P2I_THIS s.elcr2);
BXRS_HEX_PARAM_FIELD(list, apmc, BX_P2I_THIS s.apmc);
BXRS_HEX_PARAM_FIELD(list, apms, BX_P2I_THIS s.apms);
BXRS_HEX_PARAM_FIELD(list, pci_reset, BX_P2I_THIS s.pci_reset);
bx_list_c *irqr = new bx_list_c(list, "irq_registry", 16);
for (i=0; i<16; i++) {
sprintf(name, "%d", i);
@ -176,9 +177,7 @@ void bx_pci2isa_c::register_state(void)
void bx_pci2isa_c::after_restore_state(void)
{
unsigned i;
for (i=0; i<16; i++) {
for (unsigned i=0; i<16; i++) {
if (BX_P2I_THIS s.irq_registry[i]) {
DEV_register_irq(i, "PIIX3 IRQ routing");
}
@ -349,13 +348,11 @@ Bit32u bx_pci2isa_c::pci_read_handler(Bit8u address, unsigned io_len)
// pci configuration space write callback handler
void bx_pci2isa_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
Bit8u value8;
if ((address >= 0x10) && (address < 0x34))
return;
if (io_len <= 4) {
for (unsigned i=0; i<io_len; i++) {
value8 = (value >> (i*8)) & 0xFF;
Bit8u value8 = (value >> (i*8)) & 0xFF;
switch (address+i) {
case 0x04:
case 0x06:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pc_system.cc,v 1.59 2006-05-27 15:54:47 sshwarts Exp $
// $Id: pc_system.cc,v 1.60 2006-05-28 17:07:56 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -227,26 +227,26 @@ void bx_pc_system_c::exit(void)
#if BX_SUPPORT_SAVE_RESTORE
void bx_pc_system_c::register_state(void)
{
unsigned i;
bx_list_c *bxtimer;
char name[4];
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pc_system", "PC System State", 8);
new bx_shadow_bool_c(list, "enable_a20", &enable_a20);
new bx_shadow_num_c(list, "currCountdown", &currCountdown);
new bx_shadow_num_c(list, "currCountdownPeriod", &currCountdownPeriod);
new bx_shadow_num_c(list, "ticksTotal", &bx_pc_system.ticksTotal);
new bx_shadow_num_c(list, "lastTimeUsec", &lastTimeUsec);
new bx_shadow_num_c(list, "usecSinceLast", &usecSinceLast);
new bx_shadow_num_c(list, "HRQ", &HRQ);
BXRS_PARAM_BOOL(list, enable_a20, enable_a20);
BXRS_HEX_PARAM_SIMPLE(list, currCountdown);
BXRS_HEX_PARAM_SIMPLE(list, currCountdownPeriod);
BXRS_HEX_PARAM_SIMPLE(list, ticksTotal);
BXRS_HEX_PARAM_SIMPLE(list, lastTimeUsec);
BXRS_HEX_PARAM_SIMPLE(list, usecSinceLast);
BXRS_HEX_PARAM_SIMPLE(list, HRQ);
bx_list_c *timers = new bx_list_c(list, "timer", numTimers);
for (i = 0; i < numTimers; i++) {
for (unsigned i = 0; i < numTimers; i++) {
char name[4];
sprintf(name, "%d", i);
bxtimer = new bx_list_c(timers, strdup(name));
new bx_shadow_num_c(bxtimer, "period", &timer[i].period);
new bx_shadow_num_c(bxtimer, "timeToFire", &timer[i].timeToFire);
new bx_shadow_bool_c(bxtimer, "active", &timer[i].active);
new bx_shadow_bool_c(bxtimer, "continuous", &timer[i].continuous);
bx_list_c *bxtimer = new bx_list_c(timers, strdup(name));
BXRS_PARAM_BOOL(bxtimer, inUse, timer[i].inUse);
BXRS_HEX_PARAM_FIELD(bxtimer, period, timer[i].period);
BXRS_HEX_PARAM_FIELD(bxtimer, timeToFire, timer[i].timeToFire);
BXRS_PARAM_BOOL(bxtimer, active, timer[i].active);
BXRS_PARAM_BOOL(bxtimer, continuous, timer[i].continuous);
}
}
#endif