Merge SAVE_RESTORE branch to CVS
This commit is contained in:
parent
7c1767d17a
commit
8b0df8e99b
@ -29,6 +29,7 @@
|
||||
--enable-instrumentation=instrument/example1 \
|
||||
--enable-iodebug \
|
||||
--enable-show-ips \
|
||||
--enable-save_restore \
|
||||
--enable-clgd54xx \
|
||||
--enable-usb \
|
||||
--with-all-libs
|
||||
|
@ -725,7 +725,7 @@ typedef
|
||||
|
||||
#define BX_SUPPORT_ICACHE 0
|
||||
|
||||
// save/restore support (under construction)
|
||||
// save/restore support
|
||||
#define BX_SUPPORT_SAVE_RESTORE 0
|
||||
|
||||
// if 1, don't do gpf on MSRs that we don't implement
|
||||
|
93
bochs/configure
vendored
93
bochs/configure
vendored
@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.in Id: configure.in,v 1.318 2006/04/06 19:14:34 sshwarts Exp .
|
||||
# From configure.in Id.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59.
|
||||
#
|
||||
@ -1069,6 +1069,7 @@ Optional Features:
|
||||
--enable-ignore-bad-msr ignore bad MSR references
|
||||
--enable-port-e9-hack writes to port e9 go to console
|
||||
--enable-show-ips show IPS in Bochs log file
|
||||
--enable-save-restore support for simulation save and restore
|
||||
--enable-cpp use .cpp as C++ suffix
|
||||
--enable-debugger compile in support for Bochs internal debugger
|
||||
--enable-external-debugger enable external debugger support (win32 only)
|
||||
@ -3678,7 +3679,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 3681 "configure"' > conftest.$ac_ext
|
||||
echo '#line 3682 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@ -4786,7 +4787,7 @@ fi
|
||||
|
||||
|
||||
# Provide some information about the compiler.
|
||||
echo "$as_me:4789:" \
|
||||
echo "$as_me:4790:" \
|
||||
"checking for Fortran 77 compiler version" >&5
|
||||
ac_compiler=`set X $ac_compile; echo $2`
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||
@ -5824,11 +5825,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:5827: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:5828: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:5831: \$? = $ac_status" >&5
|
||||
echo "$as_me:5832: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -6057,11 +6058,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:6060: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:6061: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:6064: \$? = $ac_status" >&5
|
||||
echo "$as_me:6065: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -6124,11 +6125,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:6127: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:6128: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:6131: \$? = $ac_status" >&5
|
||||
echo "$as_me:6132: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -8290,7 +8291,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 8293 "configure"
|
||||
#line 8294 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -8388,7 +8389,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 8391 "configure"
|
||||
#line 8392 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -10567,11 +10568,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:10570: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:10571: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:10574: \$? = $ac_status" >&5
|
||||
echo "$as_me:10575: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -10634,11 +10635,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:10637: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:10638: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:10641: \$? = $ac_status" >&5
|
||||
echo "$as_me:10642: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -11977,7 +11978,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 11980 "configure"
|
||||
#line 11981 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12075,7 +12076,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12078 "configure"
|
||||
#line 12079 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12898,11 +12899,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:12901: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:12902: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:12905: \$? = $ac_status" >&5
|
||||
echo "$as_me:12906: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -12965,11 +12966,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:12968: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:12969: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:12972: \$? = $ac_status" >&5
|
||||
echo "$as_me:12973: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -14981,11 +14982,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:14984: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:14985: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:14988: \$? = $ac_status" >&5
|
||||
echo "$as_me:14989: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -15214,11 +15215,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15217: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15218: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:15221: \$? = $ac_status" >&5
|
||||
echo "$as_me:15222: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -15281,11 +15282,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15284: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15285: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:15288: \$? = $ac_status" >&5
|
||||
echo "$as_me:15289: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -17447,7 +17448,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 17450 "configure"
|
||||
#line 17451 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -17545,7 +17546,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 17548 "configure"
|
||||
#line 17549 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -19864,7 +19865,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 19867 "configure"
|
||||
#line 19868 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -34866,6 +34867,38 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
fi;
|
||||
|
||||
echo "$as_me:$LINENO: checking save/restore support" >&5
|
||||
echo $ECHO_N "checking save/restore support... $ECHO_C" >&6
|
||||
# Check whether --enable-save-restore or --disable-save-restore was given.
|
||||
if test "${enable_save_restore+set}" = set; then
|
||||
enableval="$enable_save_restore"
|
||||
if test "$enableval" = yes; then
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define BX_SUPPORT_SAVE_RESTORE 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define BX_SUPPORT_SAVE_RESTORE 0
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
else
|
||||
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define BX_SUPPORT_SAVE_RESTORE 0
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
fi;
|
||||
|
||||
echo "$as_me:$LINENO: checking for use of .cpp as suffix" >&5
|
||||
|
@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(bochs.h)
|
||||
AC_REVISION([[$Id: configure.in,v 1.319 2006-05-15 17:40:16 sshwarts Exp $]])
|
||||
AC_REVISION([[$Id: configure.in,v 1.320 2006-05-27 15:54:47 sshwarts Exp $]])
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_HEADER(ltdlconf.h)
|
||||
|
||||
@ -1072,6 +1072,22 @@ AC_ARG_ENABLE(show-ips,
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(save/restore support)
|
||||
AC_ARG_ENABLE(save-restore,
|
||||
[ --enable-save-restore support for simulation save and restore],
|
||||
[if test "$enableval" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(BX_SUPPORT_SAVE_RESTORE, 1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(BX_SUPPORT_SAVE_RESTORE, 0)
|
||||
fi],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(BX_SUPPORT_SAVE_RESTORE, 0)
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for use of .cpp as suffix)
|
||||
AC_ARG_ENABLE(cpp,
|
||||
[ --enable-cpp use .cpp as C++ suffix],
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: apic.cc,v 1.85 2006-05-23 16:42:50 sshwarts Exp $
|
||||
// $Id: apic.cc,v 1.86 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -901,4 +901,45 @@ void bx_local_apic_c::set_initial_timer_count(Bit32u value)
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
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);
|
||||
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);
|
||||
for (i=0; i<BX_LOCAL_APIC_MAX_INTS; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(ISR, strdup(name), &isr[i]);
|
||||
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);
|
||||
bx_list_c *LVT = new bx_list_c(parent, "lvt");
|
||||
for (i=0; i<6; 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* if BX_SUPPORT_APIC */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: apic.h,v 1.30 2006-05-23 16:42:50 sshwarts Exp $
|
||||
// $Id: apic.h,v 1.31 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -189,6 +189,9 @@ public:
|
||||
void periodic(void);
|
||||
void set_divide_configuration(Bit32u value);
|
||||
void set_initial_timer_count(Bit32u value);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void register_state(bx_param_c *parent);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* BX_INCLUDE_LOCAL_APIC */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.295 2006-05-27 14:02:34 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.296 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1293,6 +1293,16 @@ public: // for now...
|
||||
~BX_CPU_C();
|
||||
#endif
|
||||
void initialize(BX_MEM_C *addrspace);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void register_state();
|
||||
void after_restore_state();
|
||||
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
|
||||
Bit64s param_save(bx_param_c *param, Bit64s val);
|
||||
Bit64s param_restore(bx_param_c *param, Bit64s val);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <TAG-CLASS-CPU-START>
|
||||
// prototypes for CPU instructions...
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: init.cc,v 1.105 2006-05-21 20:41:48 sshwarts Exp $
|
||||
// $Id: init.cc,v 1.106 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -30,6 +30,11 @@
|
||||
#include "cpu.h"
|
||||
#define LOG_THIS BX_CPU_THIS_PTR
|
||||
|
||||
#if BX_SUPPORT_X86_64==0
|
||||
// Make life easier merging cpu64 & cpu code.
|
||||
#define RIP EIP
|
||||
#endif
|
||||
|
||||
|
||||
BX_CPU_C::BX_CPU_C(unsigned id): bx_cpuid(id)
|
||||
#if BX_SUPPORT_APIC
|
||||
@ -264,7 +269,7 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
bx_list_c *list = new bx_list_c(SIM->get_param(BXPN_WX_CPU_STATE), strdup(cpu_name),
|
||||
cpu_title, 60);
|
||||
#define DEFPARAM_NORMAL(name,field) \
|
||||
new bx_shadow_num_c(list, #name, #name, &(field))
|
||||
new bx_shadow_num_c(list, #name, &(field))
|
||||
|
||||
DEFPARAM_NORMAL(EAX, EAX);
|
||||
DEFPARAM_NORMAL(EBX, EBX);
|
||||
@ -281,17 +286,13 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
DEFPARAM_NORMAL(DR3, dr3);
|
||||
DEFPARAM_NORMAL(DR6, dr6);
|
||||
DEFPARAM_NORMAL(DR7, dr7);
|
||||
#if BX_SUPPORT_X86_64==0
|
||||
#if BX_CPU_LEVEL >= 2
|
||||
DEFPARAM_NORMAL(CR0, cr0.val32);
|
||||
DEFPARAM_NORMAL(CR1, cr1);
|
||||
DEFPARAM_NORMAL(CR2, cr2);
|
||||
DEFPARAM_NORMAL(CR3, cr3);
|
||||
#endif
|
||||
#if BX_CPU_LEVEL >= 4
|
||||
DEFPARAM_NORMAL(CR4, cr4.registerValue);
|
||||
#endif
|
||||
#endif // #if BX_SUPPORT_X86_64==0
|
||||
|
||||
// segment registers require a handler function because they have
|
||||
// special get/set requirements.
|
||||
@ -302,10 +303,10 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
param->set_format(fmt16);
|
||||
#define DEFPARAM_GLOBAL_SEG_REG(name,field) \
|
||||
param = new bx_shadow_num_c(list, \
|
||||
#name"_base", #name" base", \
|
||||
#name"_base", \
|
||||
& BX_CPU_THIS_PTR field.base); \
|
||||
param = new bx_shadow_num_c(list, \
|
||||
#name"_limit", #name" limit", \
|
||||
#name"_limit", \
|
||||
& BX_CPU_THIS_PTR field.limit);
|
||||
|
||||
DEFPARAM_SEG_REG(CS);
|
||||
@ -322,10 +323,8 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
#undef DEFPARAM_SEG_REG
|
||||
#undef DEFPARAM_GLOBAL_SEG_REG
|
||||
|
||||
#if BX_SUPPORT_X86_64==0
|
||||
param = new bx_shadow_num_c(list, "EFLAGS", "EFLAGS",
|
||||
param = new bx_shadow_num_c(list, "EFLAGS",
|
||||
&BX_CPU_THIS_PTR eflags.val32);
|
||||
#endif
|
||||
|
||||
// flags implemented in lazy_flags.cc must be done with a handler
|
||||
// that calls their get function, to force them to be computed.
|
||||
@ -353,13 +352,11 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
// IOPL is a special case because it is 2 bits wide.
|
||||
param = new bx_shadow_num_c(
|
||||
list,
|
||||
"IOPL", "IOPL",
|
||||
"IOPL",
|
||||
&eflags.val32, 10,
|
||||
12, 13);
|
||||
param->set_range(0, 3);
|
||||
#if BX_SUPPORT_X86_64==0
|
||||
param->set_format("%d");
|
||||
#endif
|
||||
#endif
|
||||
DEFPARAM_LAZY_EFLAG(OF);
|
||||
DEFPARAM_EFLAG(DF);
|
||||
@ -380,10 +377,355 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void BX_CPU_C::register_state()
|
||||
{
|
||||
unsigned i;
|
||||
char cpu_name[10], cpu_title[10], name[10];
|
||||
bx_param_num_c *param;
|
||||
bx_list_c *reg;
|
||||
|
||||
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);
|
||||
#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);
|
||||
#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);
|
||||
#endif
|
||||
BXRS_PARAM_FIELD(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);
|
||||
#endif
|
||||
BXRS_PARAM_FIELD (cr0, cr0.val32);
|
||||
BXRS_PARAM_SIMPLE(cr1);
|
||||
BXRS_PARAM_SIMPLE(cr2);
|
||||
BXRS_PARAM_SIMPLE(cr3);
|
||||
#if BX_CPU_LEVEL >= 4
|
||||
BXRS_PARAM_FIELD(cr4, cr4.registerValue);
|
||||
#endif
|
||||
|
||||
#define BXRS_PARAM_SEG_REG(x) \
|
||||
reg = new bx_list_c(list, strdup(#x), 8); \
|
||||
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", &(sregs[BX_SEG_REG_##x].cache.u.segment.base), BASE_HEX); \
|
||||
new bx_shadow_num_c(reg, \
|
||||
"limit", &(sregs[BX_SEG_REG_##x].cache.u.segment.limit), BASE_HEX); \
|
||||
new bx_shadow_num_c(reg, \
|
||||
"limit_scaled", &(sregs[BX_SEG_REG_##x].cache.u.segment.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", &(sregs[BX_SEG_REG_##x].cache.u.segment.g)); \
|
||||
new bx_shadow_bool_c(reg, \
|
||||
"d_b", &(sregs[BX_SEG_REG_##x].cache.u.segment.d_b)); \
|
||||
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
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
#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);
|
||||
#endif
|
||||
new bx_shadow_num_c(MSR, "tsc_last_reset", &msr.tsc_last_reset, BASE_HEX);
|
||||
#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);
|
||||
#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);
|
||||
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);
|
||||
}
|
||||
new bx_shadow_num_c(fpu, "tos", &the_i387.tos, BASE_HEX);
|
||||
#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);
|
||||
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);
|
||||
sprintf(name, "xmm%02d_lo", i);
|
||||
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);
|
||||
}
|
||||
|
||||
Bit64s BX_CPU_C::param_save_handler(void *devptr, bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#if !BX_USE_CPU_SMF
|
||||
BX_CPU_C *class_ptr = (BX_CPU_C *) devptr;
|
||||
return class_ptr->param_save(param, val);
|
||||
}
|
||||
|
||||
Bit64s BX_CPU_C::param_save(bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#else
|
||||
UNUSED(devptr);
|
||||
#endif // !BX_USE_CPU_SMF
|
||||
char *pname, *segname;
|
||||
bx_segment_reg_t *segment = NULL;
|
||||
|
||||
pname = param->get_name();
|
||||
if (!strcmp(pname, "cpu_version")) {
|
||||
val = get_cpu_version_information();
|
||||
} else if (!strcmp(pname, "cpuid_std")) {
|
||||
val = get_std_cpuid_features();
|
||||
} else if (!strcmp(pname, "cpuid_ext")) {
|
||||
val = get_extended_cpuid_features();
|
||||
#if BX_SUPPORT_X86_64
|
||||
} else if (!strcmp(pname, "EFER")) {
|
||||
val = get_EFER();
|
||||
#endif
|
||||
} else if (!strcmp(pname, "ar_byte") || !strcmp(pname, "selector")) {
|
||||
segname = param->get_parent()->get_name();
|
||||
if (!strcmp(segname, "CS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS];
|
||||
} else if (!strcmp(segname, "DS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS];
|
||||
} else if (!strcmp(segname, "SS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS];
|
||||
} else if (!strcmp(segname, "ES")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES];
|
||||
} else if (!strcmp(segname, "FS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS];
|
||||
} else if (!strcmp(segname, "GS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS];
|
||||
} else if (!strcmp(segname, "LDTR")) {
|
||||
segment = &BX_CPU_THIS_PTR ldtr;
|
||||
} else if (!strcmp(segname, "TR")) {
|
||||
segment = &BX_CPU_THIS_PTR tr;
|
||||
}
|
||||
if (segment != NULL) {
|
||||
if (!strcmp(pname, "ar_byte")) {
|
||||
val = ar_byte(&(segment->cache));
|
||||
}
|
||||
else if (!strcmp(pname, "selector")) {
|
||||
val = segment->selector.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BX_PANIC(("Unknown param %s in param_save handler !", pname));
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
Bit64s BX_CPU_C::param_restore_handler(void *devptr, bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#if !BX_USE_CPU_SMF
|
||||
BX_CPU_C *class_ptr = (BX_CPU_C *) devptr;
|
||||
return class_ptr->param_restore(param, val);
|
||||
}
|
||||
|
||||
Bit64s BX_CPU_C::param_restore(bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#else
|
||||
UNUSED(devptr);
|
||||
#endif // !BX_USE_CPU_SMF
|
||||
char *pname, *segname;
|
||||
bx_segment_reg_t *segment = NULL;
|
||||
|
||||
pname = param->get_name();
|
||||
if (!strcmp(pname, "cpu_version")) {
|
||||
if (val != get_cpu_version_information()) {
|
||||
BX_PANIC(("save/restore: CPU version mismatch"));
|
||||
}
|
||||
} else if (!strcmp(pname, "cpuid_std")) {
|
||||
if (val != get_std_cpuid_features()) {
|
||||
BX_PANIC(("save/restore: CPUID mismatch"));
|
||||
}
|
||||
} else if (!strcmp(pname, "cpuid_ext")) {
|
||||
if (val != get_extended_cpuid_features()) {
|
||||
BX_PANIC(("save/restore: CPUID mismatch"));
|
||||
}
|
||||
#if BX_SUPPORT_X86_64
|
||||
} else if (!strcmp(pname, "EFER")) {
|
||||
BX_CPU_THIS_PTR msr.sce = (val >> 0) & 1;
|
||||
BX_CPU_THIS_PTR msr.lme = (val >> 8) & 1;
|
||||
BX_CPU_THIS_PTR msr.lma = (val >> 10) & 1;
|
||||
BX_CPU_THIS_PTR msr.nxe = (val >> 11) & 1;
|
||||
BX_CPU_THIS_PTR msr.ffxsr = (val >> 14) & 1;
|
||||
#endif
|
||||
} else if (!strcmp(pname, "ar_byte") || !strcmp(pname, "selector")) {
|
||||
segname = param->get_parent()->get_name();
|
||||
if (!strcmp(segname, "CS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS];
|
||||
} else if (!strcmp(segname, "DS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS];
|
||||
} else if (!strcmp(segname, "SS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS];
|
||||
} else if (!strcmp(segname, "ES")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES];
|
||||
} else if (!strcmp(segname, "FS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS];
|
||||
} else if (!strcmp(segname, "GS")) {
|
||||
segment = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS];
|
||||
} else if (!strcmp(segname, "LDTR")) {
|
||||
segment = &BX_CPU_THIS_PTR ldtr;
|
||||
} else if (!strcmp(segname, "TR")) {
|
||||
segment = &BX_CPU_THIS_PTR tr;
|
||||
}
|
||||
if (segment != NULL) {
|
||||
bx_descriptor_t *d = &(segment->cache);
|
||||
bx_selector_t *selector = &(segment->selector);
|
||||
if (!strcmp(pname, "ar_byte")) {
|
||||
set_ar_byte(d, val);
|
||||
}
|
||||
else if (!strcmp(pname, "selector")) {
|
||||
parse_selector(val, selector);
|
||||
// validate the selector
|
||||
if ((selector->value & 0xfffc) != 0) d->valid = 1;
|
||||
else d->valid = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BX_PANIC(("Unknown param %s in param_restore handler !", pname));
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
void BX_CPU_C::after_restore_state()
|
||||
{
|
||||
SetCR0(cr0.val32);
|
||||
CR3_change(cr3);
|
||||
setEFlags(eflags.val32);
|
||||
TLB_flush(1);
|
||||
assert_checks();
|
||||
invalidate_prefetch_q();
|
||||
debug(RIP);
|
||||
}
|
||||
#endif
|
||||
|
||||
BX_CPU_C::~BX_CPU_C(void)
|
||||
{
|
||||
BX_INSTR_SHUTDOWN(BX_CPU_ID);
|
||||
BX_DEBUG(( "Exit."));
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
void BX_CPU_C::reset(unsigned source)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: io.cc,v 1.33 2006-05-24 20:57:37 sshwarts Exp $
|
||||
// $Id: io.cc,v 1.34 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.cc,v 1.148 2006-05-27 14:02:34 sshwarts Exp $
|
||||
// $Id: siminterface.cc,v 1.149 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// See siminterface.h for description of the siminterface concept.
|
||||
@ -867,7 +867,6 @@ bx_bool bx_real_sim_c::save_state(const char *checkpoint_path)
|
||||
int type, ntype = SIM->get_max_log_level();
|
||||
FILE *fp;
|
||||
|
||||
bx_sr_before_save_state();
|
||||
sprintf(sr_file, "%s/config", checkpoint_path);
|
||||
write_rc(sr_file, 1);
|
||||
sprintf(sr_file, "%s/logopts", checkpoint_path);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: textconfig.cc,v 1.52 2006-04-09 13:55:55 vruppert Exp $
|
||||
// $Id: textconfig.cc,v 1.53 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This is code for a text-mode configuration interface. Note that this file
|
||||
@ -230,7 +230,7 @@ static char *startup_menu_prompt =
|
||||
"3. Edit options\n"
|
||||
"4. Save options to...\n"
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
"5. Restore Bochs config and log options from...\n"
|
||||
"5. Restore the Bochs state from...\n"
|
||||
"6. Begin simulation\n"
|
||||
"7. Quit now\n"
|
||||
#else
|
||||
@ -279,7 +279,7 @@ static char *runtime_menu_prompt =
|
||||
"10. Instruction tracing: off (doesn't exist yet)\n"
|
||||
"11. Misc runtime options\n"
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
"12. Save Bochs config and log options to...\n"
|
||||
"12. Save the Bochs state to directory and quit...\n"
|
||||
"13. Continue simulation\n"
|
||||
"14. Quit now\n"
|
||||
"\n"
|
||||
@ -425,7 +425,7 @@ int bx_config_interface(int menu)
|
||||
case 4: bx_write_rc(NULL); break;
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
case 5:
|
||||
if (ask_string("\nWhat is the path to restore Bochs config and log options from?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
|
||||
if (ask_string("\nWhat is the path to restore the Bochs state from?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
|
||||
if (strcmp (sr_path, "none")) {
|
||||
SIM->get_param_bool(BXPN_RESTORE_FLAG)->set(1);
|
||||
SIM->get_param_string(BXPN_RESTORE_PATH)->set(sr_path);
|
||||
@ -513,9 +513,12 @@ int bx_config_interface(int menu)
|
||||
return -1;
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
case BX_CI_RT_SAVE:
|
||||
if (ask_string("\nWhat is the path to save the Bochs config and log options to?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
|
||||
if (ask_string("\nWhat is the path to save the Bochs state to?\nNOTE: Bochs quits after saving!\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
|
||||
if (strcmp (sr_path, "none")) {
|
||||
SIM->save_state(sr_path);
|
||||
bx_user_quit = 1;
|
||||
SIM->quit_sim(1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: busmouse.cc,v 1.3 2006-03-07 21:11:16 sshwarts Exp $
|
||||
// $Id: busmouse.cc,v 1.4 2006-05-27 15:54:48 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.3 2006-03-07 21:11:16 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: busmouse.cc,v 1.4 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
|
||||
DEV_register_irq(BUS_MOUSE_IRQ, "Bus Mouse");
|
||||
|
||||
@ -113,6 +113,32 @@ void bx_busm_c::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
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);
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
Bit32u bx_busm_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: busmouse.h,v 1.3 2006-03-07 21:11:16 sshwarts Exp $
|
||||
// $Id: busmouse.h,v 1.4 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -53,7 +53,10 @@ public:
|
||||
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
virtual void bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void timer_handler(void *);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cmos.cc,v 1.53 2006-03-22 18:06:16 vruppert Exp $
|
||||
// $Id: cmos.cc,v 1.54 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -25,9 +25,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
@ -139,7 +136,7 @@ bx_cmos_c::~bx_cmos_c(void)
|
||||
void
|
||||
bx_cmos_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: cmos.cc,v 1.53 2006-03-22 18:06:16 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: cmos.cc,v 1.54 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
// CMOS RAM & RTC
|
||||
|
||||
DEV_register_ioread_handler(this, read_handler, 0x0070, "CMOS RAM", 1);
|
||||
@ -295,6 +292,30 @@ void bx_cmos_c::save_image(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_cmos_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "cmos", "CMOS State");
|
||||
new bx_shadow_num_c(list, "mem_address", &BX_CMOS_THIS s.cmos_mem_address, BASE_HEX);
|
||||
bx_list_c *ram = new bx_list_c(list, "ram", 128);
|
||||
for (i=0; i<128; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(ram, strdup(name), &BX_CMOS_THIS s.reg[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_cmos_c::after_restore_state(void)
|
||||
{
|
||||
BX_CMOS_THIS s.rtc_mode_12hour = ((BX_CMOS_THIS s.reg[REG_STAT_B] & 0x02) == 0);
|
||||
BX_CMOS_THIS s.rtc_mode_binary = ((BX_CMOS_THIS s.reg[REG_STAT_B] & 0x04) != 0);
|
||||
BX_CMOS_THIS update_timeval();
|
||||
BX_CMOS_THIS CRA_change();
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_cmos_c::CRA_change(void)
|
||||
{
|
||||
Bit8u nibble, dcc;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cmos.h,v 1.15 2006-03-07 21:11:16 sshwarts Exp $
|
||||
// $Id: cmos.h,v 1.16 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -45,6 +45,10 @@ public:
|
||||
virtual void checksum_cmos(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void save_image(void);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
|
||||
virtual Bit32u get_reg(unsigned reg) {
|
||||
return s.reg[reg];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.100 2006-05-18 19:57:11 sshwarts Exp $
|
||||
// $Id: devices.cc,v 1.101 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -105,7 +105,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.100 2006-05-18 19:57:11 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.101 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set no-default handlers, will be overwritten by the real default handler */
|
||||
@ -344,7 +344,7 @@ void bx_devices_c::reset(unsigned type)
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_devices_c::register_state()
|
||||
{
|
||||
pluginUnmapped->register_state();
|
||||
bx_virt_timer.register_state();
|
||||
#if BX_SUPPORT_PCI
|
||||
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
|
||||
pluginPciBridge->register_state();
|
||||
@ -352,31 +352,29 @@ void bx_devices_c::register_state()
|
||||
}
|
||||
#endif
|
||||
#if BX_SUPPORT_APIC
|
||||
//ioapic->register_state();
|
||||
ioapic->register_state();
|
||||
#endif
|
||||
pluginBiosDevice->register_state();
|
||||
pluginCmosDevice->register_state();
|
||||
pluginDmaDevice->register_state();
|
||||
pluginFloppyDevice->register_state();
|
||||
pluginVgaDevice->register_state();
|
||||
pluginPicDevice->register_state();
|
||||
//pit->register_state();
|
||||
#if BX_SUPPORT_IODEBUG
|
||||
iodebug->register_state();
|
||||
#endif
|
||||
pit->register_state();
|
||||
// now register state of optional plugins
|
||||
bx_plugins_register_state();
|
||||
}
|
||||
|
||||
void bx_devices_c::before_save_state()
|
||||
{
|
||||
// TODO
|
||||
bx_plugins_before_save_state();
|
||||
}
|
||||
|
||||
void bx_devices_c::after_restore_state()
|
||||
{
|
||||
// TODO
|
||||
bx_slowdown_timer.after_restore_state();
|
||||
#if BX_SUPPORT_PCI
|
||||
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
|
||||
pluginPciBridge->after_restore_state();
|
||||
pluginPci2IsaBridge->after_restore_state();
|
||||
}
|
||||
#endif
|
||||
pluginCmosDevice->after_restore_state();
|
||||
pluginVgaDevice->after_restore_state();
|
||||
bx_plugins_after_restore_state();
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dma.cc,v 1.35 2006-03-06 19:23:13 sshwarts Exp $
|
||||
// $Id: dma.cc,v 1.36 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -51,8 +51,7 @@ libdma_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv
|
||||
return(0); // Success
|
||||
}
|
||||
|
||||
void
|
||||
libdma_LTX_plugin_fini(void)
|
||||
void libdma_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
@ -124,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.35 2006-03-06 19:23:13 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: dma.cc,v 1.36 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
|
||||
/* 8237 DMA controller */
|
||||
|
||||
@ -192,6 +191,45 @@ void bx_dma_c::reset_controller(unsigned num)
|
||||
BX_DMA_THIS s[num].flip_flop = 0;
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_dma_c::register_state(void)
|
||||
{
|
||||
unsigned i, c;
|
||||
char name[6];
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "dma", "DMA State");
|
||||
for (i=0; i<2; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
bx_list_c *ctrl = new bx_list_c(list, strdup(name), 8);
|
||||
new bx_shadow_bool_c(ctrl, "flip_flop", &BX_DMA_THIS s[i].flip_flop);
|
||||
new bx_shadow_num_c(ctrl, "status_reg", &BX_DMA_THIS s[i].status_reg, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "command_reg", &BX_DMA_THIS s[i].command_reg, BASE_HEX);
|
||||
new bx_shadow_bool_c(ctrl, "ctrl_disabled", &BX_DMA_THIS s[i].ctrl_disabled);
|
||||
for (c=0; c<4; c++) {
|
||||
sprintf(name, "%d", c);
|
||||
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_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);
|
||||
new bx_shadow_num_c(chan, "transfer_type", &BX_DMA_THIS s[i].chan[c].mode.transfer_type);
|
||||
new bx_shadow_num_c(chan, "base_address", &BX_DMA_THIS s[i].chan[c].base_address, BASE_HEX);
|
||||
new bx_shadow_num_c(chan, "current_address", &BX_DMA_THIS s[i].chan[c].current_address, BASE_HEX);
|
||||
new bx_shadow_num_c(chan, "base_count", &BX_DMA_THIS s[i].chan[c].base_count, BASE_HEX);
|
||||
new bx_shadow_num_c(chan, "current_count", &BX_DMA_THIS s[i].chan[c].current_count, BASE_HEX);
|
||||
new bx_shadow_num_c(chan, "page_reg", &BX_DMA_THIS s[i].chan[c].page_reg, BASE_HEX);
|
||||
}
|
||||
}
|
||||
bx_list_c *extpg = new bx_list_c(list, "ext_page", 16);
|
||||
for (i=0; i<16; i++) {
|
||||
sprintf(name, "0x%02x", 0x80+i);
|
||||
new bx_shadow_num_c(extpg, strdup(name), &BX_DMA_THIS ext_page_reg[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// index to find channel from register number (only [0],[1],[2],[6] used)
|
||||
Bit8u channelindex[7] = {2, 3, 1, 0, 0, 0, 0};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dma.h,v 1.19 2006-03-07 21:11:16 sshwarts Exp $
|
||||
// $Id: dma.h,v 1.20 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -47,6 +47,9 @@ public:
|
||||
virtual void raise_HLDA(void);
|
||||
virtual void set_DRQ(unsigned channel, bx_bool val);
|
||||
virtual unsigned get_TC(void);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
virtual unsigned registerDMA8Channel(unsigned channel,
|
||||
void (* dmaRead)(Bit8u *data_byte),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: floppy.cc,v 1.99 2006-05-01 18:24:47 vruppert Exp $
|
||||
// $Id: floppy.cc,v 1.100 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -137,7 +137,7 @@ void bx_floppy_ctrl_c::init(void)
|
||||
{
|
||||
Bit8u i;
|
||||
|
||||
BX_DEBUG(("Init $Id: floppy.cc,v 1.99 2006-05-01 18:24:47 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: floppy.cc,v 1.100 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
DEV_dma_register_8bit_channel(2, dma_read, dma_write, "Floppy Drive");
|
||||
DEV_register_irq(6, "Floppy Drive");
|
||||
for (unsigned addr=0x03F2; addr<=0x03F7; addr++) {
|
||||
@ -379,6 +379,67 @@ void bx_floppy_ctrl_c::reset(unsigned type)
|
||||
enter_idle_phase();
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_floppy_ctrl_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[8];
|
||||
bx_list_c *drive;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "floppy", "Floppy State", 36);
|
||||
new bx_shadow_num_c(list, "data_rate", &BX_FD_THIS s.data_rate);
|
||||
bx_list_c *command = new bx_list_c(list, "command", 10);
|
||||
for (i=0; i<10; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(command, strdup(name), &BX_FD_THIS s.command[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(list, "command_index", &BX_FD_THIS s.command_index);
|
||||
new bx_shadow_num_c(list, "command_size", &BX_FD_THIS s.command_size);
|
||||
new bx_shadow_bool_c(list, "command_complete", &BX_FD_THIS s.command_complete);
|
||||
new bx_shadow_num_c(list, "pending_command", &BX_FD_THIS s.pending_command, BASE_HEX);
|
||||
new bx_shadow_bool_c(list, "multi_track", &BX_FD_THIS s.multi_track);
|
||||
new bx_shadow_bool_c(list, "pending_irq", &BX_FD_THIS s.pending_irq);
|
||||
new bx_shadow_num_c(list, "reset_sensei", &BX_FD_THIS s.reset_sensei);
|
||||
new bx_shadow_num_c(list, "format_count", &BX_FD_THIS s.format_count);
|
||||
new bx_shadow_num_c(list, "format_fillbyte", &BX_FD_THIS s.format_fillbyte, BASE_HEX);
|
||||
bx_list_c *result = new bx_list_c(list, "result", 10);
|
||||
for (i=0; i<10; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(result, strdup(name), &BX_FD_THIS s.result[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(list, "result_index", &BX_FD_THIS s.result_index);
|
||||
new bx_shadow_num_c(list, "result_size", &BX_FD_THIS s.result_size);
|
||||
new bx_shadow_num_c(list, "DOR", &BX_FD_THIS s.DOR, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "TDR", &BX_FD_THIS s.TDR, BASE_HEX);
|
||||
new bx_shadow_bool_c(list, "TC", &BX_FD_THIS s.TC);
|
||||
new bx_shadow_num_c(list, "main_status_reg", &BX_FD_THIS s.main_status_reg, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "status_reg0", &BX_FD_THIS s.status_reg0, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "status_reg1", &BX_FD_THIS s.status_reg1, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "status_reg2", &BX_FD_THIS s.status_reg2, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "status_reg3", &BX_FD_THIS s.status_reg3, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "floppy_buffer_index", &BX_FD_THIS s.floppy_buffer_index);
|
||||
new bx_shadow_bool_c(list, "non_dma", &BX_FD_THIS s.non_dma);
|
||||
new bx_shadow_bool_c(list, "lock", &BX_FD_THIS s.lock);
|
||||
new bx_shadow_num_c(list, "SRT", &BX_FD_THIS s.SRT, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "HUT", &BX_FD_THIS s.HUT, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "HLT", &BX_FD_THIS s.HLT, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "config", &BX_FD_THIS s.config, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "pretrk", &BX_FD_THIS s.pretrk);
|
||||
new bx_shadow_num_c(list, "perp_mode", &BX_FD_THIS s.perp_mode);
|
||||
new bx_shadow_data_c(list, "buffer", BX_FD_THIS s.floppy_buffer, 512);
|
||||
for (i=0; i<4; i++) {
|
||||
sprintf(name, "drive%d", i);
|
||||
drive = new bx_list_c(list, strdup(name));
|
||||
new bx_shadow_num_c(drive, "cylinder", &BX_FD_THIS s.cylinder[i]);
|
||||
new bx_shadow_num_c(drive, "head", &BX_FD_THIS s.head[i]);
|
||||
new bx_shadow_num_c(drive, "sector", &BX_FD_THIS s.sector[i]);
|
||||
new bx_shadow_num_c(drive, "eot", &BX_FD_THIS s.eot[i]);
|
||||
new bx_shadow_bool_c(drive, "media_present", &BX_FD_THIS s.media_present[i]);
|
||||
new bx_shadow_num_c(drive, "DIR", &BX_FD_THIS s.DIR[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: floppy.h,v 1.28 2006-03-07 21:11:16 sshwarts Exp $
|
||||
// $Id: floppy.h,v 1.29 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -60,6 +60,9 @@ public:
|
||||
virtual void reset(unsigned type);
|
||||
virtual unsigned set_media_status(unsigned drive, unsigned status);
|
||||
virtual unsigned get_media_status(unsigned drive);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gameport.cc,v 1.8 2006-04-05 18:49:34 sshwarts Exp $
|
||||
// $Id: gameport.cc,v 1.9 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 MandrakeSoft S.A.
|
||||
@ -118,6 +118,19 @@ void bx_gameport_c::reset(unsigned type)
|
||||
// nothing for now
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_gameport_c::register_state(void)
|
||||
{
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "gameport", "Gameport State");
|
||||
new bx_shadow_num_c(list, "port", &BX_GAMEPORT_THIS port, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "delay_x", &BX_GAMEPORT_THIS delay_x);
|
||||
new bx_shadow_num_c(list, "delay_y", &BX_GAMEPORT_THIS delay_y);
|
||||
new bx_shadow_bool_c(list, "timer_x", &BX_GAMEPORT_THIS timer_x);
|
||||
new bx_shadow_bool_c(list, "timer_y", &BX_GAMEPORT_THIS timer_y);
|
||||
new bx_shadow_num_c(list, "write_usec", &BX_GAMEPORT_THIS write_usec);
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_gameport_c::poll_joydev(void)
|
||||
{
|
||||
#ifdef __linux__
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gameport.h,v 1.4 2006-04-05 18:49:35 sshwarts Exp $
|
||||
// $Id: gameport.h,v 1.5 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 MandrakeSoft S.A.
|
||||
@ -42,6 +42,9 @@ public:
|
||||
virtual ~bx_gameport_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.cc,v 1.165 2006-03-26 00:38:58 vruppert Exp $
|
||||
// $Id: harddrv.cc,v 1.166 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -143,7 +143,7 @@ void bx_hard_drive_c::init(void)
|
||||
char ata_name[20];
|
||||
bx_list_c *base;
|
||||
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.165 2006-03-26 00:38:58 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.166 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
|
||||
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
sprintf(ata_name, "ata.%d.resources", channel);
|
||||
@ -605,6 +605,56 @@ void bx_hard_drive_c::reset(unsigned type)
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_hard_drive_c::register_state(void)
|
||||
{
|
||||
unsigned i, j;
|
||||
char cname[4], dname[8];
|
||||
bx_list_c *chan, *drive, *status;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "hard_drive", "Hard Drive State");
|
||||
for (i=0; i<BX_MAX_ATA_CHANNEL; i++) {
|
||||
sprintf(cname, "%d", i);
|
||||
chan = new bx_list_c(list, strdup(cname));
|
||||
for (j=0; j<2; j++) {
|
||||
if (BX_DRIVE_IS_PRESENT(i, j)) {
|
||||
sprintf(dname, "drive%d", i);
|
||||
drive = new bx_list_c(chan, strdup(dname), 20);
|
||||
new bx_shadow_data_c(drive, "buffer", BX_CONTROLLER(i, j).buffer, 2352);
|
||||
status = new bx_list_c(drive, "status", 9);
|
||||
new bx_shadow_bool_c(status, "busy", &BX_CONTROLLER(i, j).status.busy);
|
||||
new bx_shadow_bool_c(status, "drive_ready", &BX_CONTROLLER(i, j).status.drive_ready);
|
||||
new bx_shadow_bool_c(status, "write_fault", &BX_CONTROLLER(i, j).status.write_fault);
|
||||
new bx_shadow_bool_c(status, "seek_complete", &BX_CONTROLLER(i, j).status.seek_complete);
|
||||
new bx_shadow_bool_c(status, "drq", &BX_CONTROLLER(i, j).status.drq);
|
||||
new bx_shadow_bool_c(status, "corrected_data", &BX_CONTROLLER(i, j).status.corrected_data);
|
||||
new bx_shadow_bool_c(status, "index_pulse", &BX_CONTROLLER(i, j).status.index_pulse);
|
||||
new bx_shadow_num_c(status, "index_pulse_count", &BX_CONTROLLER(i, j).status.index_pulse_count);
|
||||
new bx_shadow_bool_c(status, "err", &BX_CONTROLLER(i, j).status.err);
|
||||
new bx_shadow_num_c(drive, "error_register", &BX_CONTROLLER(i, j).error_register, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "head_no", &BX_CONTROLLER(i, j).head_no, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "sector_count", &BX_CONTROLLER(i, j).sector_count, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "sector_no", &BX_CONTROLLER(i, j).sector_no, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "cylinder_no", &BX_CONTROLLER(i, j).cylinder_no, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "buffer_size", &BX_CONTROLLER(i, j).buffer_size, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "buffer_index", &BX_CONTROLLER(i, j).buffer_index, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "drq_index", &BX_CONTROLLER(i, j).drq_index, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "current_command", &BX_CONTROLLER(i, j).current_command, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "sectors_per_block", &BX_CONTROLLER(i, j).sectors_per_block, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "lba_mode", &BX_CONTROLLER(i, j).lba_mode, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "packet_dma", &BX_CONTROLLER(i, j).packet_dma, BASE_HEX);
|
||||
new bx_shadow_bool_c(drive, "control_reset", &BX_CONTROLLER(i, j).control.reset);
|
||||
new bx_shadow_bool_c(drive, "control_disable_irq", &BX_CONTROLLER(i, j).control.disable_irq);
|
||||
new bx_shadow_num_c(drive, "reset_in_progress", &BX_CONTROLLER(i, j).reset_in_progress, BASE_HEX);
|
||||
new bx_shadow_num_c(drive, "features", &BX_CONTROLLER(i, j).features, BASE_HEX);
|
||||
new bx_shadow_bool_c(drive, "cdrom_locked", &BX_HD_THIS channels[i].drives[j].cdrom.locked);
|
||||
}
|
||||
}
|
||||
new bx_shadow_num_c(chan, "drive_select", &BX_HD_THIS channels[i].drive_select);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_hard_drive_c::iolight_timer_handler(void *this_ptr)
|
||||
{
|
||||
bx_hard_drive_c *class_ptr = (bx_hard_drive_c *) this_ptr;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.h,v 1.39 2006-03-07 18:16:40 sshwarts Exp $
|
||||
// $Id: harddrv.h,v 1.40 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -170,6 +170,9 @@ public:
|
||||
virtual bx_bool bmdma_write_sector(Bit8u channel, Bit8u *buffer);
|
||||
virtual void bmdma_complete(Bit8u channel);
|
||||
#endif
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
virtual Bit32u virt_read_handler(Bit32u address, unsigned io_len) {
|
||||
return read_handler (this, address, io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ioapic.cc,v 1.28 2006-03-06 22:03:16 sshwarts Exp $
|
||||
// $Id: ioapic.cc,v 1.29 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -62,6 +62,14 @@ void bx_io_redirect_entry_t::sprintf_self(char *buf)
|
||||
(unsigned) vector());
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define BX_IOAPIC_BASE_ADDR (0xfec00000)
|
||||
|
||||
bx_ioapic_c::bx_ioapic_c()
|
||||
@ -241,4 +249,24 @@ 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);
|
||||
bx_list_c *table = new bx_list_c(list, "ioredtbl", BX_IOAPIC_NUM_PINS);
|
||||
for (i=0; i<BX_IOAPIC_NUM_PINS; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
entry = new bx_list_c(table, strdup(name), 2);
|
||||
ioredtbl[i].register_state(entry);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* if BX_SUPPORT_APIC */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ioapic.h,v 1.20 2006-03-07 21:11:16 sshwarts Exp $
|
||||
// $Id: ioapic.h,v 1.21 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -67,7 +67,10 @@ public:
|
||||
// keep low 32 bits of value, replace high 32
|
||||
hi = val_hi_part;
|
||||
}
|
||||
void sprintf_self (char *buf);
|
||||
void sprintf_self(char *buf);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void register_state(bx_param_c *parent);
|
||||
#endif
|
||||
};
|
||||
|
||||
class bx_ioapic_c : public bx_generic_apic_c
|
||||
@ -93,6 +96,9 @@ public:
|
||||
void receive_eoi(Bit8u vector);
|
||||
void service_ioapic(void);
|
||||
virtual bx_apic_type_t get_type() { return APIC_TYPE_IOAPIC; }
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: iodev.h,v 1.74 2006-04-15 17:03:59 vruppert Exp $
|
||||
// $Id: iodev.h,v 1.75 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -87,7 +87,6 @@ class BOCHSAPI bx_devmodel_c : public logfunctions {
|
||||
virtual void reset(unsigned type) {}
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void) {}
|
||||
virtual void before_save_state(void) {}
|
||||
virtual void after_restore_state(void) {}
|
||||
#endif
|
||||
};
|
||||
@ -392,7 +391,6 @@ public:
|
||||
void reset(unsigned type);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void register_state(void);
|
||||
void before_save_state(void);
|
||||
void after_restore_state(void);
|
||||
#endif
|
||||
BX_MEM_C *mem; // address space associated with these devices
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.cc,v 1.115 2006-04-27 11:58:07 sshwarts Exp $
|
||||
// $Id: keyboard.cc,v 1.116 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -109,7 +109,7 @@ void bx_keyb_c::resetinternals(bx_bool powerup)
|
||||
|
||||
void bx_keyb_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.115 2006-04-27 11:58:07 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.116 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
Bit32u i;
|
||||
|
||||
DEV_register_irq(1, "8042 Keyboard controller");
|
||||
@ -196,6 +196,7 @@ void bx_keyb_c::init(void)
|
||||
|
||||
#if BX_WITH_WX
|
||||
static bx_bool first_time = 1;
|
||||
bx_param_num_c *param;
|
||||
if (first_time) {
|
||||
first_time = 0;
|
||||
// register shadow params (Experimental, not a complete list by far)
|
||||
@ -207,9 +208,9 @@ void bx_keyb_c::init(void)
|
||||
new bx_shadow_bool_c(list, "irq12_req",
|
||||
"Keyboard IRQ12 requested",
|
||||
&BX_KEY_THIS s.kbd_controller.irq12_requested);
|
||||
new bx_shadow_num_c(list, "timer_pending",
|
||||
"Keyboard timer pending",
|
||||
param = new bx_shadow_num_c(list, "timer_pending",
|
||||
&BX_KEY_THIS s.kbd_controller.timer_pending);
|
||||
param->set_label("Keyboard timer pending");
|
||||
new bx_shadow_bool_c(list, "pare",
|
||||
"Keyboard PARE",
|
||||
&BX_KEY_THIS s.kbd_controller.pare);
|
||||
@ -251,6 +252,83 @@ void bx_keyb_c::reset(unsigned type)
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_keyb_c::register_state(void)
|
||||
{
|
||||
int i;
|
||||
char name[4];
|
||||
bx_list_c *buffer;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "keyboard", "Keyboard State", 7);
|
||||
bx_list_c *ctrl = new bx_list_c(list, "controller", 23);
|
||||
new bx_shadow_bool_c(ctrl, "tim", &BX_KEY_THIS s.kbd_controller.tim);
|
||||
new bx_shadow_bool_c(ctrl, "auxb", &BX_KEY_THIS s.kbd_controller.auxb);
|
||||
new bx_shadow_bool_c(ctrl, "c_d", &BX_KEY_THIS s.kbd_controller.c_d);
|
||||
new bx_shadow_bool_c(ctrl, "sysf", &BX_KEY_THIS s.kbd_controller.sysf);
|
||||
new bx_shadow_bool_c(ctrl, "inpb", &BX_KEY_THIS s.kbd_controller.inpb);
|
||||
new bx_shadow_bool_c(ctrl, "outb", &BX_KEY_THIS s.kbd_controller.outb);
|
||||
new bx_shadow_bool_c(ctrl, "kbd_clock_enabled", &BX_KEY_THIS s.kbd_controller.kbd_clock_enabled);
|
||||
new bx_shadow_bool_c(ctrl, "aux_clock_enabled", &BX_KEY_THIS s.kbd_controller.aux_clock_enabled);
|
||||
new bx_shadow_bool_c(ctrl, "allow_irq1", &BX_KEY_THIS s.kbd_controller.allow_irq1);
|
||||
new bx_shadow_bool_c(ctrl, "allow_irq12", &BX_KEY_THIS s.kbd_controller.allow_irq12);
|
||||
new bx_shadow_num_c(ctrl, "kbd_output_buffer", &BX_KEY_THIS s.kbd_controller.kbd_output_buffer, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "aux_output_buffer", &BX_KEY_THIS s.kbd_controller.aux_output_buffer, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "last_comm", &BX_KEY_THIS s.kbd_controller.last_comm, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "expecting_port60h", &BX_KEY_THIS s.kbd_controller.expecting_port60h);
|
||||
new bx_shadow_num_c(ctrl, "expecting_mouse_parameter", &BX_KEY_THIS s.kbd_controller.expecting_mouse_parameter);
|
||||
new bx_shadow_num_c(ctrl, "last_mouse_command", &BX_KEY_THIS s.kbd_controller.last_mouse_command, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "timer_pending", &BX_KEY_THIS s.kbd_controller.timer_pending);
|
||||
new bx_shadow_bool_c(ctrl, "irq1_requested", &BX_KEY_THIS s.kbd_controller.irq1_requested);
|
||||
new bx_shadow_bool_c(ctrl, "irq12_requested", &BX_KEY_THIS s.kbd_controller.irq12_requested);
|
||||
new bx_shadow_bool_c(ctrl, "scancodes_translate", &BX_KEY_THIS s.kbd_controller.scancodes_translate);
|
||||
new bx_shadow_bool_c(ctrl, "expecting_scancodes_set", &BX_KEY_THIS s.kbd_controller.expecting_scancodes_set);
|
||||
new bx_shadow_num_c(ctrl, "current_scancodes_set", &BX_KEY_THIS s.kbd_controller.current_scancodes_set);
|
||||
new bx_shadow_bool_c(ctrl, "bat_in_progress", &BX_KEY_THIS s.kbd_controller.bat_in_progress);
|
||||
bx_list_c *mouse = new bx_list_c(list, "mouse", 12);
|
||||
new bx_shadow_num_c(mouse, "sample_rate", &BX_KEY_THIS s.mouse.sample_rate);
|
||||
new bx_shadow_num_c(mouse, "resolution_cpmm", &BX_KEY_THIS s.mouse.resolution_cpmm);
|
||||
new bx_shadow_num_c(mouse, "scaling", &BX_KEY_THIS s.mouse.scaling);
|
||||
new bx_shadow_num_c(mouse, "mode", &BX_KEY_THIS s.mouse.mode);
|
||||
new bx_shadow_num_c(mouse, "saved_mode", &BX_KEY_THIS s.mouse.saved_mode);
|
||||
new bx_shadow_bool_c(mouse, "enable", &BX_KEY_THIS s.mouse.enable);
|
||||
new bx_shadow_num_c(mouse, "button_status", &BX_KEY_THIS s.mouse.button_status);
|
||||
new bx_shadow_num_c(mouse, "delayed_dx", &BX_KEY_THIS s.mouse.delayed_dx);
|
||||
new bx_shadow_num_c(mouse, "delayed_dy", &BX_KEY_THIS s.mouse.delayed_dy);
|
||||
new bx_shadow_num_c(mouse, "delayed_dz", &BX_KEY_THIS s.mouse.delayed_dz);
|
||||
new bx_shadow_num_c(mouse, "im_request", &BX_KEY_THIS s.mouse.im_request);
|
||||
new bx_shadow_bool_c(mouse, "im_mode", &BX_KEY_THIS s.mouse.im_mode);
|
||||
bx_list_c *kbdbuf = new bx_list_c(list, "kbd_internal_buffer", 9);
|
||||
new bx_shadow_num_c(kbdbuf, "num_elements", &BX_KEY_THIS s.kbd_internal_buffer.num_elements);
|
||||
buffer = new bx_list_c(kbdbuf, "buffer", BX_KBD_ELEMENTS);
|
||||
for (i=0; i<BX_KBD_ELEMENTS; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(buffer, strdup(name), &BX_KEY_THIS s.kbd_internal_buffer.buffer[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(kbdbuf, "head", &BX_KEY_THIS s.kbd_internal_buffer.head);
|
||||
new bx_shadow_bool_c(kbdbuf, "expecting_typematic", &BX_KEY_THIS s.kbd_internal_buffer.expecting_typematic);
|
||||
new bx_shadow_bool_c(kbdbuf, "expecting_led_write", &BX_KEY_THIS s.kbd_internal_buffer.expecting_led_write);
|
||||
new bx_shadow_num_c(kbdbuf, "delay", &BX_KEY_THIS s.kbd_internal_buffer.delay);
|
||||
new bx_shadow_num_c(kbdbuf, "repeat_rate", &BX_KEY_THIS s.kbd_internal_buffer.repeat_rate);
|
||||
new bx_shadow_num_c(kbdbuf, "led_status", &BX_KEY_THIS s.kbd_internal_buffer.led_status);
|
||||
new bx_shadow_bool_c(kbdbuf, "scanning_enabled", &BX_KEY_THIS s.kbd_internal_buffer.scanning_enabled);
|
||||
bx_list_c *mousebuf = new bx_list_c(list, "mouse_internal_buffer");
|
||||
new bx_shadow_num_c(mousebuf, "num_elements", &BX_KEY_THIS s.mouse_internal_buffer.num_elements);
|
||||
buffer = new bx_list_c(mousebuf, "buffer", BX_MOUSE_BUFF_SIZE);
|
||||
for (i=0; i<BX_MOUSE_BUFF_SIZE; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(buffer, strdup(name), &BX_KEY_THIS s.mouse_internal_buffer.buffer[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(mousebuf, "head", &BX_KEY_THIS s.mouse_internal_buffer.head);
|
||||
buffer = new bx_list_c(list, "controller_Q", BX_KBD_CONTROLLER_QSIZE);
|
||||
for (i=0; i<BX_KBD_CONTROLLER_QSIZE; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(buffer, strdup(name), &BX_KEY_THIS s.controller_Q[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(list, "controller_Qsize", &BX_KEY_THIS s.controller_Qsize);
|
||||
new bx_shadow_num_c(list, "controller_Qsource", &BX_KEY_THIS s.controller_Qsource);
|
||||
}
|
||||
#endif
|
||||
|
||||
Bit64s bx_keyb_c::kbd_param_handler(bx_param_c *param, int set, Bit64s val)
|
||||
{
|
||||
if (set) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.h,v 1.32 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: keyboard.h,v 1.33 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -57,6 +57,9 @@ public:
|
||||
virtual void gen_scancode(Bit32u key);
|
||||
virtual void paste_bytes(Bit8u *data, Bit32s length);
|
||||
virtual void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
// runtime options
|
||||
static Bit64s kbd_param_handler(bx_param_c *param, int set, Bit64s val);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ne2k.cc,v 1.86 2006-05-14 15:47:37 vruppert Exp $
|
||||
// $Id: ne2k.cc,v 1.87 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -76,7 +76,6 @@ bx_ne2k_c::~bx_ne2k_c()
|
||||
//
|
||||
void bx_ne2k_c::reset(unsigned type)
|
||||
{
|
||||
BX_DEBUG(("reset"));
|
||||
if (type == BX_RESET_HARDWARE) {
|
||||
// Zero out registers and memory
|
||||
memset(&BX_NE2K_THIS s.CR, 0, sizeof(BX_NE2K_THIS s.CR));
|
||||
@ -122,6 +121,129 @@ void bx_ne2k_c::reset(unsigned type)
|
||||
BX_NE2K_THIS s.ISR.reset = 1;
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_ne2k_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "ne2k", "NE2000 State", 31);
|
||||
bx_list_c *CR = new bx_list_c(list, "CR");
|
||||
new bx_shadow_bool_c(CR, "stop", &BX_NE2K_THIS s.CR.stop);
|
||||
new bx_shadow_bool_c(CR, "start", &BX_NE2K_THIS s.CR.start);
|
||||
new bx_shadow_bool_c(CR, "tx_packet", &BX_NE2K_THIS s.CR.tx_packet);
|
||||
new bx_shadow_num_c(CR, "rdma_cmd", &BX_NE2K_THIS s.CR.rdma_cmd);
|
||||
new bx_shadow_num_c(CR, "pgsel", &BX_NE2K_THIS s.CR.pgsel);
|
||||
bx_list_c *ISR = new bx_list_c(list, "ISR", 8);
|
||||
new bx_shadow_bool_c(ISR, "pkt_rx", &BX_NE2K_THIS s.ISR.pkt_rx);
|
||||
new bx_shadow_bool_c(ISR, "pkt_tx", &BX_NE2K_THIS s.ISR.pkt_tx);
|
||||
new bx_shadow_bool_c(ISR, "rx_err", &BX_NE2K_THIS s.ISR.rx_err);
|
||||
new bx_shadow_bool_c(ISR, "tx_err", &BX_NE2K_THIS s.ISR.tx_err);
|
||||
new bx_shadow_bool_c(ISR, "overwrite", &BX_NE2K_THIS s.ISR.overwrite);
|
||||
new bx_shadow_bool_c(ISR, "cnt_oflow", &BX_NE2K_THIS s.ISR.cnt_oflow);
|
||||
new bx_shadow_bool_c(ISR, "rdma_done", &BX_NE2K_THIS s.ISR.rdma_done);
|
||||
new bx_shadow_bool_c(ISR, "reset", &BX_NE2K_THIS s.ISR.reset);
|
||||
bx_list_c *IMR = new bx_list_c(list, "IMR", 7);
|
||||
new bx_shadow_bool_c(IMR, "rx_inte", &BX_NE2K_THIS s.IMR.rx_inte);
|
||||
new bx_shadow_bool_c(IMR, "tx_inte", &BX_NE2K_THIS s.IMR.tx_inte);
|
||||
new bx_shadow_bool_c(IMR, "rxerr_inte", &BX_NE2K_THIS s.IMR.rxerr_inte);
|
||||
new bx_shadow_bool_c(IMR, "txerr_inte", &BX_NE2K_THIS s.IMR.txerr_inte);
|
||||
new bx_shadow_bool_c(IMR, "overw_inte", &BX_NE2K_THIS s.IMR.overw_inte);
|
||||
new bx_shadow_bool_c(IMR, "cofl_inte", &BX_NE2K_THIS s.IMR.cofl_inte);
|
||||
new bx_shadow_bool_c(IMR, "rdma_inte", &BX_NE2K_THIS s.IMR.rdma_inte);
|
||||
bx_list_c *DCR = new bx_list_c(list, "DCR");
|
||||
new bx_shadow_bool_c(DCR, "wdsize", &BX_NE2K_THIS s.DCR.wdsize);
|
||||
new bx_shadow_bool_c(DCR, "endian", &BX_NE2K_THIS s.DCR.endian);
|
||||
new bx_shadow_bool_c(DCR, "longaddr", &BX_NE2K_THIS s.DCR.longaddr);
|
||||
new bx_shadow_bool_c(DCR, "loop", &BX_NE2K_THIS s.DCR.loop);
|
||||
new bx_shadow_bool_c(DCR, "auto_rx", &BX_NE2K_THIS s.DCR.auto_rx);
|
||||
new bx_shadow_num_c(DCR, "fifo_size", &BX_NE2K_THIS s.DCR.fifo_size);
|
||||
bx_list_c *TCR = new bx_list_c(list, "TCR");
|
||||
new bx_shadow_bool_c(TCR, "crc_disable", &BX_NE2K_THIS s.TCR.crc_disable);
|
||||
new bx_shadow_num_c(TCR, "loop_cntl", &BX_NE2K_THIS s.TCR.loop_cntl);
|
||||
new bx_shadow_bool_c(TCR, "ext_stoptx", &BX_NE2K_THIS s.TCR.ext_stoptx);
|
||||
new bx_shadow_bool_c(TCR, "coll_prio", &BX_NE2K_THIS s.TCR.coll_prio);
|
||||
bx_list_c *TSR = new bx_list_c(list, "TSR", 7);
|
||||
new bx_shadow_bool_c(TSR, "tx_ok", &BX_NE2K_THIS s.TSR.tx_ok);
|
||||
new bx_shadow_bool_c(TSR, "collided", &BX_NE2K_THIS s.TSR.collided);
|
||||
new bx_shadow_bool_c(TSR, "aborted", &BX_NE2K_THIS s.TSR.aborted);
|
||||
new bx_shadow_bool_c(TSR, "no_carrier", &BX_NE2K_THIS s.TSR.no_carrier);
|
||||
new bx_shadow_bool_c(TSR, "fifo_ur", &BX_NE2K_THIS s.TSR.fifo_ur);
|
||||
new bx_shadow_bool_c(TSR, "cd_hbeat", &BX_NE2K_THIS s.TSR.cd_hbeat);
|
||||
new bx_shadow_bool_c(TSR, "ow_coll", &BX_NE2K_THIS s.TSR.ow_coll);
|
||||
bx_list_c *RCR = new bx_list_c(list, "RCR");
|
||||
new bx_shadow_bool_c(RCR, "errors_ok", &BX_NE2K_THIS s.RCR.errors_ok);
|
||||
new bx_shadow_bool_c(RCR, "runts_ok", &BX_NE2K_THIS s.RCR.runts_ok);
|
||||
new bx_shadow_bool_c(RCR, "broadcast", &BX_NE2K_THIS s.RCR.broadcast);
|
||||
new bx_shadow_bool_c(RCR, "multicast", &BX_NE2K_THIS s.RCR.multicast);
|
||||
new bx_shadow_bool_c(RCR, "promisc", &BX_NE2K_THIS s.RCR.promisc);
|
||||
new bx_shadow_bool_c(RCR, "monitor", &BX_NE2K_THIS s.RCR.monitor);
|
||||
bx_list_c *RSR = new bx_list_c(list, "RSR", 8);
|
||||
new bx_shadow_bool_c(RSR, "rx_ok", &BX_NE2K_THIS s.RSR.rx_ok);
|
||||
new bx_shadow_bool_c(RSR, "bad_crc", &BX_NE2K_THIS s.RSR.bad_crc);
|
||||
new bx_shadow_bool_c(RSR, "bad_falign", &BX_NE2K_THIS s.RSR.bad_falign);
|
||||
new bx_shadow_bool_c(RSR, "fifo_or", &BX_NE2K_THIS s.RSR.fifo_or);
|
||||
new bx_shadow_bool_c(RSR, "rx_missed", &BX_NE2K_THIS s.RSR.rx_missed);
|
||||
new bx_shadow_bool_c(RSR, "rx_mbit", &BX_NE2K_THIS s.RSR.rx_mbit);
|
||||
new bx_shadow_bool_c(RSR, "rx_disabled", &BX_NE2K_THIS s.RSR.rx_disabled);
|
||||
new bx_shadow_bool_c(RSR, "deferred", &BX_NE2K_THIS s.RSR.deferred);
|
||||
new bx_shadow_num_c(list, "local_dma", &BX_NE2K_THIS s.local_dma, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "page_start", &BX_NE2K_THIS s.page_start, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "page_stop", &BX_NE2K_THIS s.page_stop, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "bound_ptr", &BX_NE2K_THIS s.bound_ptr, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "tx_page_start", &BX_NE2K_THIS s.tx_page_start, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "num_coll", &BX_NE2K_THIS s.num_coll, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "tx_bytes", &BX_NE2K_THIS s.tx_bytes, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "fifo", &BX_NE2K_THIS s.fifo, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "remote_dma", &BX_NE2K_THIS s.remote_dma, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "remote_start", &BX_NE2K_THIS s.remote_start, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "remote_bytes", &BX_NE2K_THIS s.remote_bytes, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "tallycnt_0", &BX_NE2K_THIS s.tallycnt_0, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "tallycnt_1", &BX_NE2K_THIS s.tallycnt_1, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "tallycnt_2", &BX_NE2K_THIS s.tallycnt_2, BASE_HEX);
|
||||
bx_list_c *paddr = new bx_list_c(list, "physaddr");
|
||||
for (i=0; i<6; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(paddr, strdup(name), &BX_NE2K_THIS s.physaddr[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(list, "curr_page", &BX_NE2K_THIS s.curr_page, BASE_HEX);
|
||||
bx_list_c *mchash = new bx_list_c(list, "mchash", 8);
|
||||
for (i=0; i<8; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(mchash, strdup(name), &BX_NE2K_THIS s.mchash[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(list, "rempkt_ptr", &BX_NE2K_THIS s.rempkt_ptr, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "localpkt_ptr", &BX_NE2K_THIS s.localpkt_ptr, BASE_HEX);
|
||||
new bx_shadow_num_c(list, "address_cnt", &BX_NE2K_THIS s.address_cnt, BASE_HEX);
|
||||
new bx_shadow_data_c(list, "mem", BX_NE2K_THIS s.mem, BX_NE2K_MEMSIZ);
|
||||
new bx_shadow_bool_c(list, "tx_timer_active", &BX_NE2K_THIS s.tx_timer_active);
|
||||
#if BX_SUPPORT_PCI
|
||||
if (BX_NE2K_THIS s.pci_enabled) {
|
||||
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(pci_conf, strdup(name), &BX_NE2K_THIS s.pci_conf[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_PCI
|
||||
void bx_ne2k_c::after_restore_state(void)
|
||||
{
|
||||
if (BX_NE2K_THIS s.pci_enabled) {
|
||||
if (DEV_pci_set_base_io(BX_NE2K_THIS_PTR, read_handler, write_handler,
|
||||
&BX_NE2K_THIS s.base_address,
|
||||
&BX_NE2K_THIS s.pci_conf[0x10],
|
||||
32, &ne2k_iomask[0], "NE2000 PCI NIC")) {
|
||||
BX_INFO(("new base address: 0x%04x", BX_NE2K_THIS s.base_address));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// read_cr/write_cr - utility routines for handling reads/writes to
|
||||
// the Command Register
|
||||
@ -1281,7 +1403,7 @@ void bx_ne2k_c::init(void)
|
||||
char devname[16];
|
||||
bx_list_c *base;
|
||||
|
||||
BX_DEBUG(("Init $Id: ne2k.cc,v 1.86 2006-05-14 15:47:37 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: ne2k.cc,v 1.87 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
|
||||
// Read in values from config interface
|
||||
base = (bx_list_c*) SIM->get_param(BXPN_NE2K);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ne2k.h,v 1.20 2006-05-01 18:24:47 vruppert Exp $
|
||||
// $Id: ne2k.h,v 1.21 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -214,6 +214,12 @@ public:
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void print_info (FILE *file, int page, int reg, int nodups);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#if BX_SUPPORT_PCI
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_PCI
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: parallel.cc,v 1.28 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: parallel.cc,v 1.29 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -75,7 +75,7 @@ void bx_parallel_c::init(void)
|
||||
char name[16], pname[20];
|
||||
bx_list_c *base;
|
||||
|
||||
BX_DEBUG(("Init $Id: parallel.cc,v 1.28 2006-03-07 21:11:19 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: parallel.cc,v 1.29 2006-05-27 15:54:48 sshwarts Exp $"));
|
||||
|
||||
for (unsigned i=0; i<BX_N_PARALLEL_PORTS; i++) {
|
||||
sprintf(pname, "ports.parallel.%d", i+1);
|
||||
@ -121,6 +121,36 @@ void bx_parallel_c::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_parallel_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[4], pname[20];
|
||||
bx_list_c *base, *port;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "parallel", "Parallel Port State");
|
||||
for (i=0; i<BX_N_PARALLEL_PORTS; i++) {
|
||||
sprintf(pname, "ports.parallel.%d", i+1);
|
||||
base = (bx_list_c*) SIM->get_param(pname);
|
||||
if (SIM->get_param_bool("enabled", base)->get()) {
|
||||
sprintf(name, "%d", i);
|
||||
port = new bx_list_c(list, strdup(name), 11);
|
||||
new bx_shadow_num_c(port, "data", &BX_PAR_THIS s[i].data, BASE_HEX);
|
||||
new bx_shadow_bool_c(port, "slct", &BX_PAR_THIS s[i].STATUS.slct);
|
||||
new bx_shadow_bool_c(port, "ack", &BX_PAR_THIS s[i].STATUS.ack);
|
||||
new bx_shadow_bool_c(port, "busy", &BX_PAR_THIS s[i].STATUS.busy);
|
||||
new bx_shadow_bool_c(port, "strobe", &BX_PAR_THIS s[i].CONTROL.strobe);
|
||||
new bx_shadow_bool_c(port, "autofeed", &BX_PAR_THIS s[i].CONTROL.autofeed);
|
||||
new bx_shadow_bool_c(port, "init", &BX_PAR_THIS s[i].CONTROL.init);
|
||||
new bx_shadow_bool_c(port, "slct_in", &BX_PAR_THIS s[i].CONTROL.slct_in);
|
||||
new bx_shadow_bool_c(port, "irq", &BX_PAR_THIS s[i].CONTROL.irq);
|
||||
new bx_shadow_bool_c(port, "input", &BX_PAR_THIS s[i].CONTROL.input);
|
||||
new bx_shadow_bool_c(port, "initmode", &BX_PAR_THIS s[i].initmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_parallel_c::virtual_printer(Bit8u port)
|
||||
{
|
||||
if (BX_PAR_THIS s[port].STATUS.slct) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: parallel.h,v 1.14 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: parallel.h,v 1.15 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -69,6 +69,9 @@ public:
|
||||
virtual ~bx_parallel_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
bx_par_t s[BX_PARPORT_MAXDEV];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci.cc,v 1.48 2006-04-29 17:21:49 sshwarts Exp $
|
||||
// $Id: pci.cc,v 1.49 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -148,6 +148,28 @@ bx_pci_bridge_c::reset(unsigned type)
|
||||
BX_PCI_THIS s.i440fx.pci_conf[0x72] = 0x02;
|
||||
}
|
||||
|
||||
#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);
|
||||
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(pci_conf, strdup(name), &BX_PCI_THIS s.i440fx.pci_conf[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_pci_bridge_c::after_restore_state(void)
|
||||
{
|
||||
BX_PCI_THIS smram_control(BX_PCI_THIS s.i440fx.pci_conf[0x72]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci.h,v 1.25 2006-03-26 22:15:06 sshwarts Exp $
|
||||
// $Id: pci.h,v 1.26 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -58,6 +58,10 @@ public:
|
||||
virtual ~bx_pci_bridge_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
virtual bx_bool register_pci_handlers(bx_pci_device_stub_c *device,
|
||||
Bit8u *devfunc, const char *name,
|
||||
const char *descr);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci2isa.cc,v 1.31 2006-04-26 16:15:45 sshwarts Exp $
|
||||
// $Id: pci2isa.cc,v 1.32 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -145,6 +145,47 @@ void bx_pci2isa_c::reset(unsigned type)
|
||||
BX_P2I_THIS s.apmc = 0x00;
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pci2isa_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pci2isa", "PCI-to-ISA Bridge State", 8);
|
||||
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
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);
|
||||
bx_list_c *irqr = new bx_list_c(list, "irq_registry", 16);
|
||||
for (i=0; i<16; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(irqr, strdup(name), &BX_P2I_THIS s.irq_registry[i], BASE_HEX);
|
||||
}
|
||||
bx_list_c *irql = new bx_list_c(list, "irq_level", 16);
|
||||
for (i=0; i<16; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(irql, strdup(name), &BX_P2I_THIS s.irq_level[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_pci2isa_c::after_restore_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
if (BX_P2I_THIS s.irq_registry[i]) {
|
||||
DEV_register_irq(i, "PIIX3 IRQ routing");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_pci2isa_c::pci_register_irq(unsigned pirq, unsigned irq)
|
||||
{
|
||||
if ((irq < 16) && (((1 << irq) & 0xdef8) > 0)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci2isa.h,v 1.12 2006-04-07 10:48:54 sshwarts Exp $
|
||||
// $Id: pci2isa.h,v 1.13 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -44,6 +44,10 @@ public:
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void pci_set_irq(Bit8u devfunc, unsigned line, bx_bool level);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci_ide.cc,v 1.22 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: pci_ide.cc,v 1.23 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -110,8 +110,7 @@ void bx_pci_ide_c::init(void)
|
||||
BX_PIDE_THIS s.bmdma_addr = 0;
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci_ide_c::reset(unsigned type)
|
||||
void bx_pci_ide_c::reset(unsigned type)
|
||||
{
|
||||
BX_PIDE_THIS s.pci_conf[0x04] = 0x01;
|
||||
BX_PIDE_THIS s.pci_conf[0x06] = 0x80;
|
||||
@ -136,8 +135,92 @@ bx_pci_ide_c::reset(unsigned type)
|
||||
}
|
||||
}
|
||||
|
||||
bx_bool
|
||||
bx_pci_ide_c::bmdma_present(void)
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pci_ide_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
bx_list_c *ctrl;
|
||||
bx_param_num_c *param;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pci_ide", "PCI IDE Controller State");
|
||||
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(pci_conf, strdup(name), &BX_PIDE_THIS s.pci_conf[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_data_c(list, "buffer0", BX_PIDE_THIS s.bmdma[0].buffer, 0x20000);
|
||||
new bx_shadow_data_c(list, "buffer1", BX_PIDE_THIS s.bmdma[1].buffer, 0x20000);
|
||||
for (i=0; i<2; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
ctrl = new bx_list_c(list, strdup(name), 7);
|
||||
new bx_shadow_bool_c(ctrl, "cmd_ssbm", &BX_PIDE_THIS s.bmdma[i].cmd_ssbm);
|
||||
new bx_shadow_bool_c(ctrl, "cmd_rwcon", &BX_PIDE_THIS s.bmdma[i].cmd_rwcon);
|
||||
new bx_shadow_num_c(ctrl, "status", &BX_PIDE_THIS s.bmdma[i].status, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "dtpr", &BX_PIDE_THIS s.bmdma[i].dtpr, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "prd_current", &BX_PIDE_THIS s.bmdma[i].prd_current, BASE_HEX);
|
||||
param = new bx_param_num_c(ctrl, "buffer_top", "", "", 0, BX_MAX_BIT32U, 0);
|
||||
param->set_base(BASE_HEX);
|
||||
param->set_sr_handlers(BX_PIDE_THIS_PTR, BX_PIDE_THIS param_save_handler, BX_PIDE_THIS param_restore_handler);
|
||||
param = new bx_param_num_c(ctrl, "buffer_idx", "", "", 0, BX_MAX_BIT32U, 0);
|
||||
param->set_base(BASE_HEX);
|
||||
param->set_sr_handlers(BX_PIDE_THIS_PTR, BX_PIDE_THIS param_save_handler, BX_PIDE_THIS param_restore_handler);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_pci_ide_c::after_restore_state(void)
|
||||
{
|
||||
if (DEV_pci_set_base_io(BX_PIDE_THIS_PTR, read_handler, write_handler,
|
||||
&BX_PIDE_THIS s.bmdma_addr, &BX_PIDE_THIS s.pci_conf[0x20],
|
||||
16, &bmdma_iomask[0], "PIIX3 PCI IDE controller")) {
|
||||
BX_INFO(("new BM-DMA address: 0x%04x", BX_PIDE_THIS s.bmdma_addr));
|
||||
}
|
||||
}
|
||||
|
||||
Bit64s bx_pci_ide_c::param_save_handler(void *devptr, bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#if !BX_USE_PIDE_SMF
|
||||
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) devptr;
|
||||
return class_ptr->param_save(param, val);
|
||||
}
|
||||
|
||||
Bit64s bx_pci_ide_c::param_save(bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#else
|
||||
UNUSED(devptr);
|
||||
#endif // !BX_USE_PIDE_SMF
|
||||
int chan = atoi(param->get_parent()->get_name());
|
||||
if (!strcmp(param->get_name(), "buffer_top")) {
|
||||
val = (Bit32u)(BX_PIDE_THIS s.bmdma[chan].buffer_top - BX_PIDE_THIS s.bmdma[chan].buffer);
|
||||
} else if (!strcmp(param->get_name(), "buffer_idx")) {
|
||||
val = (Bit32u)(BX_PIDE_THIS s.bmdma[chan].buffer_idx - BX_PIDE_THIS s.bmdma[chan].buffer);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
Bit64s bx_pci_ide_c::param_restore_handler(void *devptr, bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#if !BX_USE_PIDE_SMF
|
||||
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) devptr;
|
||||
return class_ptr->param_restore(param, val);
|
||||
}
|
||||
|
||||
Bit64s bx_pci_ide_c::param_restore(bx_param_c *param, Bit64s val)
|
||||
{
|
||||
#else
|
||||
UNUSED(devptr);
|
||||
#endif // !BX_USE_PIDE_SMF
|
||||
int chan = atoi(param->get_parent()->get_name());
|
||||
if (!strcmp(param->get_name(), "buffer_top")) {
|
||||
BX_PIDE_THIS s.bmdma[chan].buffer_top = BX_PIDE_THIS s.bmdma[chan].buffer + val;
|
||||
} else if (!strcmp(param->get_name(), "buffer_idx")) {
|
||||
BX_PIDE_THIS s.bmdma[chan].buffer_idx = BX_PIDE_THIS s.bmdma[chan].buffer + val;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
bx_bool bx_pci_ide_c::bmdma_present(void)
|
||||
{
|
||||
return (BX_PIDE_THIS s.bmdma_addr > 0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci_ide.h,v 1.10 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: pci_ide.h,v 1.11 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -45,6 +45,16 @@ public:
|
||||
virtual void reset(unsigned type);
|
||||
virtual bx_bool bmdma_present(void);
|
||||
virtual void bmdma_set_irq(Bit8u channel);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual 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_PIDE_SMF
|
||||
Bit64s param_save(bx_param_c *param, Bit64s val);
|
||||
Bit64s param_restore(bx_param_c *param, Bit64s val);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcipnic.cc,v 1.19 2006-04-26 00:04:49 mcb30 Exp $
|
||||
// $Id: pcipnic.cc,v 1.20 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 Fen Systems Ltd.
|
||||
@ -148,6 +148,45 @@ void bx_pcipnic_c::reset(unsigned type)
|
||||
set_irq_level(0);
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pcipnic_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pcipnic", "PCI Pseudo NIC State", 11);
|
||||
new bx_shadow_num_c(list, "irqEnabled", &BX_PNIC_THIS s.irqEnabled);
|
||||
new bx_shadow_num_c(list, "rCmd", &BX_PNIC_THIS s.rCmd);
|
||||
new bx_shadow_num_c(list, "rStatus", &BX_PNIC_THIS s.rStatus);
|
||||
new bx_shadow_num_c(list, "rLength", &BX_PNIC_THIS s.rLength);
|
||||
new bx_shadow_num_c(list, "rDataCursor", &BX_PNIC_THIS s.rDataCursor);
|
||||
new bx_shadow_num_c(list, "recvIndex", &BX_PNIC_THIS s.recvIndex);
|
||||
new bx_shadow_num_c(list, "recvQueueLength", &BX_PNIC_THIS s.recvQueueLength);
|
||||
bx_list_c *recvRL = new bx_list_c(list, "recvRingLength", PNIC_RECV_RINGS);
|
||||
for (i=0; i<PNIC_RECV_RINGS; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(recvRL, strdup(name), &BX_PNIC_THIS s.recvRingLength[i]);
|
||||
}
|
||||
new bx_shadow_data_c(list, "rData", BX_PNIC_THIS s.rData, PNIC_DATA_SIZE);
|
||||
new bx_shadow_data_c(list, "recvRing", (Bit8u*)BX_PNIC_THIS s.recvRing, PNIC_RECV_RINGS*PNIC_DATA_SIZE);
|
||||
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(pci_conf, strdup(name), &BX_PNIC_THIS s.pci_conf[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_pcipnic_c::after_restore_state(void)
|
||||
{
|
||||
if (DEV_pci_set_base_io(BX_PNIC_THIS_PTR, read_handler, write_handler,
|
||||
&BX_PNIC_THIS s.base_ioaddr,
|
||||
&BX_PNIC_THIS s.pci_conf[0x10],
|
||||
16, &pnic_iomask[0], "PNIC")) {
|
||||
BX_INFO(("new base address: 0x%04x", BX_PNIC_THIS s.base_ioaddr));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_pcipnic_c::set_irq_level(bx_bool level)
|
||||
{
|
||||
DEV_pci_set_irq(BX_PNIC_THIS s.devfunc, BX_PNIC_THIS s.pci_conf[0x3d], level);
|
||||
@ -423,8 +462,8 @@ void bx_pcipnic_c::exec_command(void)
|
||||
break;
|
||||
|
||||
case PNIC_CMD_XMIT :
|
||||
BX_PNIC_THIS ethdev->sendpkt ( data, ilength );
|
||||
if ( BX_PNIC_THIS s.irqEnabled ) {
|
||||
BX_PNIC_THIS ethdev->sendpkt(data, ilength);
|
||||
if (BX_PNIC_THIS s.irqEnabled) {
|
||||
set_irq_level(1);
|
||||
}
|
||||
status = PNIC_STATUS_OK;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcipnic.h,v 1.6 2006-04-26 00:04:49 mcb30 Exp $
|
||||
// $Id: pcipnic.h,v 1.7 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 Fen Systems Ltd.
|
||||
@ -66,6 +66,10 @@ public:
|
||||
virtual ~bx_pcipnic_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pciusb.cc,v 1.37 2006-03-13 18:55:53 vruppert Exp $
|
||||
// $Id: pciusb.cc,v 1.38 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -236,6 +236,101 @@ void bx_pciusb_c::reset(unsigned type)
|
||||
init_device(1, SIM->get_param_string(BXPN_USB1_PORT2)->getptr());
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pciusb_c::register_state(void)
|
||||
{
|
||||
unsigned i, j, n;
|
||||
char hubnum[8], portnum[8], name[6];
|
||||
bx_list_c *hub, *usb_cmd, *usb_st, *usb_en, *port;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pciusb", "PCI USB Controller State", BX_USB_CONFDEV + 15);
|
||||
for (i=0; i<BX_USB_CONFDEV; i++) {
|
||||
sprintf(hubnum, "hub%d", i+1);
|
||||
hub = new bx_list_c(list, strdup(hubnum), USB_NUM_PORTS + 7);
|
||||
usb_cmd = new bx_list_c(hub, "usb_command", 8);
|
||||
new bx_shadow_bool_c(usb_cmd, "max_packet_size", &BX_USB_THIS hub[i].usb_command.max_packet_size);
|
||||
new bx_shadow_bool_c(usb_cmd, "configured", &BX_USB_THIS hub[i].usb_command.configured);
|
||||
new bx_shadow_bool_c(usb_cmd, "debug", &BX_USB_THIS hub[i].usb_command.debug);
|
||||
new bx_shadow_bool_c(usb_cmd, "resume", &BX_USB_THIS hub[i].usb_command.resume);
|
||||
new bx_shadow_bool_c(usb_cmd, "suspend", &BX_USB_THIS hub[i].usb_command.suspend);
|
||||
new bx_shadow_bool_c(usb_cmd, "reset", &BX_USB_THIS hub[i].usb_command.reset);
|
||||
new bx_shadow_bool_c(usb_cmd, "host_reset", &BX_USB_THIS hub[i].usb_command.host_reset);
|
||||
new bx_shadow_bool_c(usb_cmd, "schedule", &BX_USB_THIS hub[i].usb_command.schedule);
|
||||
usb_st = new bx_list_c(hub, "usb_status");
|
||||
new bx_shadow_bool_c(usb_st, "host_halted", &BX_USB_THIS hub[i].usb_status.host_halted);
|
||||
new bx_shadow_bool_c(usb_st, "host_error", &BX_USB_THIS hub[i].usb_status.host_error);
|
||||
new bx_shadow_bool_c(usb_st, "pci_error", &BX_USB_THIS hub[i].usb_status.pci_error);
|
||||
new bx_shadow_bool_c(usb_st, "resume", &BX_USB_THIS hub[i].usb_status.resume);
|
||||
new bx_shadow_bool_c(usb_st, "error_interrupt", &BX_USB_THIS hub[i].usb_status.error_interrupt);
|
||||
new bx_shadow_bool_c(usb_st, "interrupt", &BX_USB_THIS hub[i].usb_status.interrupt);
|
||||
usb_en = new bx_list_c(hub, "usb_enable");
|
||||
new bx_shadow_bool_c(usb_en, "short_packet", &BX_USB_THIS hub[i].usb_enable.short_packet);
|
||||
new bx_shadow_bool_c(usb_en, "on_complete", &BX_USB_THIS hub[i].usb_enable.on_complete);
|
||||
new bx_shadow_bool_c(usb_en, "resume", &BX_USB_THIS hub[i].usb_enable.resume);
|
||||
new bx_shadow_bool_c(usb_en, "timeout_crc", &BX_USB_THIS hub[i].usb_enable.timeout_crc);
|
||||
new bx_shadow_num_c(hub, "frame_num", &BX_USB_THIS hub[i].usb_frame_num.frame_num, BASE_HEX);
|
||||
new bx_shadow_num_c(hub, "frame_base", &BX_USB_THIS hub[i].usb_frame_base.frame_base, BASE_HEX);
|
||||
new bx_shadow_num_c(hub, "sof_timing", &BX_USB_THIS hub[i].usb_sof.sof_timing, BASE_HEX);
|
||||
for (j=0; j<USB_NUM_PORTS; j++) {
|
||||
sprintf(portnum, "port%d", j+1);
|
||||
port = new bx_list_c(hub, strdup(portnum), 10);
|
||||
new bx_shadow_bool_c(port, "suspend", &BX_USB_THIS hub[i].usb_port[j].suspend);
|
||||
new bx_shadow_bool_c(port, "reset", &BX_USB_THIS hub[i].usb_port[j].reset);
|
||||
new bx_shadow_bool_c(port, "low_speed", &BX_USB_THIS hub[i].usb_port[j].low_speed);
|
||||
new bx_shadow_bool_c(port, "resume", &BX_USB_THIS hub[i].usb_port[j].resume);
|
||||
new bx_shadow_bool_c(port, "line_dminus", &BX_USB_THIS hub[i].usb_port[j].line_dminus);
|
||||
new bx_shadow_bool_c(port, "line_dplus", &BX_USB_THIS hub[i].usb_port[j].line_dplus);
|
||||
new bx_shadow_bool_c(port, "able_changed", &BX_USB_THIS hub[i].usb_port[j].able_changed);
|
||||
new bx_shadow_bool_c(port, "enabled", &BX_USB_THIS hub[i].usb_port[j].enabled);
|
||||
new bx_shadow_bool_c(port, "connect_changed", &BX_USB_THIS hub[i].usb_port[j].connect_changed);
|
||||
new bx_shadow_bool_c(port, "status", &BX_USB_THIS hub[i].usb_port[j].status);
|
||||
}
|
||||
bx_list_c *pci_conf = new bx_list_c(hub, "pci_conf", 256);
|
||||
for (n=0; n<256; n++) {
|
||||
sprintf(name, "0x%02x", n);
|
||||
new bx_shadow_num_c(pci_conf, strdup(name), &BX_USB_THIS hub[i].pci_conf[n], BASE_HEX);
|
||||
}
|
||||
}
|
||||
new bx_shadow_bool_c(list, "busy", &BX_USB_THIS busy);
|
||||
new bx_shadow_num_c(list, "global_reset", &BX_USB_THIS global_reset);
|
||||
new bx_shadow_num_c(list, "mouse_delayed_dx", &BX_USB_THIS mouse_delayed_dx);
|
||||
new bx_shadow_num_c(list, "mouse_delayed_dy", &BX_USB_THIS mouse_delayed_dy);
|
||||
new bx_shadow_num_c(list, "mouse_delayed_dz", &BX_USB_THIS mouse_delayed_dz);
|
||||
new bx_shadow_num_c(list, "button_state", &BX_USB_THIS button_state);
|
||||
new bx_shadow_num_c(list, "mouse_x", &BX_USB_THIS mouse_x);
|
||||
new bx_shadow_num_c(list, "mouse_y", &BX_USB_THIS mouse_y);
|
||||
new bx_shadow_num_c(list, "mouse_z", &BX_USB_THIS mouse_z);
|
||||
new bx_shadow_num_c(list, "b_state", &BX_USB_THIS b_state);
|
||||
bx_list_c *svkey = new bx_list_c(list, "saved_key", 8);
|
||||
for (i=0; i<8; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(svkey, strdup(name), &BX_USB_THIS saved_key[i]);
|
||||
}
|
||||
bx_list_c *kppkt = new bx_list_c(list, "key_pad_packet", 8);
|
||||
for (i=0; i<8; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
new bx_shadow_num_c(kppkt, strdup(name), &BX_USB_THIS key_pad_packet[i]);
|
||||
}
|
||||
new bx_shadow_data_c(list, "device_buffer", BX_USB_THIS device_buffer, 65536);
|
||||
new bx_shadow_num_c(list, "set_address_stk", &BX_USB_THIS set_address_stk);
|
||||
bx_list_c *setaddr = new bx_list_c(list, "set_address", 128);
|
||||
for (i=0; i<128; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(setaddr, strdup(name), &BX_USB_THIS set_address[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_pciusb_c::after_restore_state(void)
|
||||
{
|
||||
if (DEV_pci_set_base_io(BX_USB_THIS_PTR, read_handler, write_handler,
|
||||
&BX_USB_THIS hub[0].base_ioaddr,
|
||||
&BX_USB_THIS hub[0].pci_conf[0x20],
|
||||
32, &usb_iomask[0], "USB Hub #1")) {
|
||||
BX_INFO(("new base address: 0x%04x", BX_USB_THIS hub[0].base_ioaddr));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_pciusb_c::init_device(Bit8u port, char *devname)
|
||||
{
|
||||
Bit8u type = USB_DEV_TYPE_NONE;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pciusb.h,v 1.17 2006-03-13 18:55:53 vruppert Exp $
|
||||
// $Id: pciusb.h,v 1.18 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -346,8 +346,12 @@ public:
|
||||
virtual bx_bool usb_key_enq(Bit8u *scan_code);
|
||||
virtual bx_bool usb_keyboard_connected();
|
||||
virtual bx_bool usb_mouse_connected();
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
||||
|
||||
static const char *usb_param_handler(bx_param_string_c *param, int set, const char *val, int maxlen);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcivga.cc,v 1.9 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: pcivga.cc,v 1.10 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002,2003 Mike Nordell
|
||||
@ -104,10 +104,25 @@ void bx_pcivga_c::reset(unsigned type)
|
||||
{ 0x06, 0x00 }, { 0x07, 0x02 } // status_devsel_medium
|
||||
};
|
||||
for (unsigned i = 0; i < sizeof(reset_vals) / sizeof(*reset_vals); ++i) {
|
||||
BX_PCIVGA_THIS s.pci_conf[reset_vals[i].addr] = reset_vals[i].val;
|
||||
BX_PCIVGA_THIS s.pci_conf[reset_vals[i].addr] = reset_vals[i].val;
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pcivga_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pcivga", "PCI VGA Adapter State");
|
||||
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(pci_conf, strdup(name), &BX_PCIVGA_THIS s.pci_conf[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// pci configuration space read callback handler
|
||||
Bit32u bx_pcivga_c::pci_read_handler(Bit8u address, unsigned io_len)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcivga.h,v 1.5 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: pcivga.h,v 1.6 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002,2003 Mike Nordell
|
||||
@ -33,6 +33,9 @@ public:
|
||||
virtual ~bx_pcivga_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pic.cc,v 1.42 2006-02-27 19:04:01 sshwarts Exp $
|
||||
// $Id: pic.cc,v 1.43 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -123,6 +123,51 @@ void bx_pic_c::init(void)
|
||||
|
||||
void bx_pic_c::reset(unsigned type) {}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pic_c::register_state(void)
|
||||
{
|
||||
bx_list_c *ctrl;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pic", "PIC State");
|
||||
ctrl = new bx_list_c(list, "master", 17);
|
||||
new bx_shadow_num_c(ctrl, "interrupt_offset", &BX_PIC_THIS s.master_pic.interrupt_offset, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "auto_eoi", &BX_PIC_THIS s.master_pic.auto_eoi, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "imr", &BX_PIC_THIS s.master_pic.imr, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "isr", &BX_PIC_THIS s.master_pic.isr, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "irr", &BX_PIC_THIS s.master_pic.irr, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "read_reg_select", &BX_PIC_THIS s.master_pic.read_reg_select);
|
||||
new bx_shadow_num_c(ctrl, "irq", &BX_PIC_THIS s.master_pic.irq, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "lowest_priority", &BX_PIC_THIS s.master_pic.lowest_priority, BASE_HEX);
|
||||
new bx_shadow_bool_c(ctrl, "INT", &BX_PIC_THIS s.master_pic.INT);
|
||||
new bx_shadow_num_c(ctrl, "IRQ_in", &BX_PIC_THIS s.master_pic.IRQ_in, BASE_HEX);
|
||||
new bx_shadow_bool_c(ctrl, "in_init", &BX_PIC_THIS s.master_pic.init.in_init);
|
||||
new bx_shadow_bool_c(ctrl, "requires_4", &BX_PIC_THIS s.master_pic.init.requires_4);
|
||||
new bx_shadow_num_c(ctrl, "byte_expected", &BX_PIC_THIS s.master_pic.init.byte_expected);
|
||||
new bx_shadow_bool_c(ctrl, "special_mask", &BX_PIC_THIS s.master_pic.special_mask);
|
||||
new bx_shadow_bool_c(ctrl, "polled", &BX_PIC_THIS s.master_pic.polled);
|
||||
new bx_shadow_bool_c(ctrl, "rotate_on_autoeoi", &BX_PIC_THIS s.master_pic.rotate_on_autoeoi);
|
||||
new bx_shadow_num_c(ctrl, "edge_level", &BX_PIC_THIS s.master_pic.edge_level, BASE_HEX);
|
||||
ctrl = new bx_list_c(list, "slave", 17);
|
||||
new bx_shadow_num_c(ctrl, "interrupt_offset", &BX_PIC_THIS s.slave_pic.interrupt_offset, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "auto_eoi", &BX_PIC_THIS s.slave_pic.auto_eoi, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "imr", &BX_PIC_THIS s.slave_pic.imr, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "isr", &BX_PIC_THIS s.slave_pic.isr, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "irr", &BX_PIC_THIS s.slave_pic.irr, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "read_reg_select", &BX_PIC_THIS s.slave_pic.read_reg_select);
|
||||
new bx_shadow_num_c(ctrl, "irq", &BX_PIC_THIS s.slave_pic.irq, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "lowest_priority", &BX_PIC_THIS s.slave_pic.lowest_priority, BASE_HEX);
|
||||
new bx_shadow_bool_c(ctrl, "INT", &BX_PIC_THIS s.slave_pic.INT);
|
||||
new bx_shadow_num_c(ctrl, "IRQ_in", &BX_PIC_THIS s.slave_pic.IRQ_in, BASE_HEX);
|
||||
new bx_shadow_bool_c(ctrl, "in_init", &BX_PIC_THIS s.slave_pic.init.in_init);
|
||||
new bx_shadow_bool_c(ctrl, "requires_4", &BX_PIC_THIS s.slave_pic.init.requires_4);
|
||||
new bx_shadow_num_c(ctrl, "byte_expected", &BX_PIC_THIS s.slave_pic.init.byte_expected);
|
||||
new bx_shadow_bool_c(ctrl, "special_mask", &BX_PIC_THIS s.slave_pic.special_mask);
|
||||
new bx_shadow_bool_c(ctrl, "polled", &BX_PIC_THIS s.slave_pic.polled);
|
||||
new bx_shadow_bool_c(ctrl, "rotate_on_autoeoi", &BX_PIC_THIS s.slave_pic.rotate_on_autoeoi);
|
||||
new bx_shadow_num_c(ctrl, "edge_level", &BX_PIC_THIS s.slave_pic.edge_level, BASE_HEX);
|
||||
}
|
||||
#endif
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pic.h,v 1.17 2006-05-01 18:24:47 vruppert Exp $
|
||||
// $Id: pic.h,v 1.18 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -78,6 +78,9 @@ public:
|
||||
virtual void set_mode(bx_bool ma_sl, Bit8u mode);
|
||||
virtual Bit8u IAC(void);
|
||||
virtual void show_pic_state(void);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit.cc,v 1.21 2006-01-08 09:45:11 vruppert Exp $
|
||||
// $Id: pit.cc,v 1.22 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -223,9 +223,40 @@ bx_pit_c::init( void )
|
||||
return(1);
|
||||
}
|
||||
|
||||
void bx_pit_c::reset(unsigned type) {
|
||||
void bx_pit_c::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pit_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[4];
|
||||
bx_list_c *tim;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pit", "8254 PIT State");
|
||||
for (i=0; i<3; i++) {
|
||||
sprintf(name, "timer%d", i);
|
||||
tim = new bx_list_c(list, strdup(name), 13);
|
||||
new bx_shadow_num_c(tim, "mode", &BX_PIT_THIS s.timer[i].mode, 16);
|
||||
new bx_shadow_num_c(tim, "latch_mode", &BX_PIT_THIS s.timer[i].latch_mode, 16);
|
||||
new bx_shadow_num_c(tim, "input_latch_value", &BX_PIT_THIS s.timer[i].input_latch_value, 16);
|
||||
new bx_shadow_bool_c(tim, "input_latch_toggle", &BX_PIT_THIS s.timer[i].input_latch_toggle);
|
||||
new bx_shadow_num_c(tim, "output_latch_value", &BX_PIT_THIS s.timer[i].output_latch_value, 16);
|
||||
new bx_shadow_bool_c(tim, "output_latch_toggle", &BX_PIT_THIS s.timer[i].output_latch_toggle);
|
||||
new bx_shadow_bool_c(tim, "output_latch_full", &BX_PIT_THIS s.timer[i].output_latch_full);
|
||||
new bx_shadow_num_c(tim, "counter_max", &BX_PIT_THIS s.timer[i].counter_max, 16);
|
||||
new bx_shadow_num_c(tim, "counter", &BX_PIT_THIS s.timer[i].counter, 16);
|
||||
new bx_shadow_bool_c(tim, "bcd_mode", &BX_PIT_THIS s.timer[i].bcd_mode);
|
||||
new bx_shadow_bool_c(tim, "active", &BX_PIT_THIS s.timer[i].active);
|
||||
new bx_shadow_bool_c(tim, "GATE", &BX_PIT_THIS s.timer[i].GATE);
|
||||
new bx_shadow_bool_c(tim, "OUT", &BX_PIT_THIS s.timer[i].OUT);
|
||||
}
|
||||
new bx_shadow_num_c(list, "speaker_data_on", &BX_PIT_THIS s.speaker_data_on, 16);
|
||||
new bx_shadow_bool_c(list, "refresh_clock_div2", &BX_PIT_THIS s.refresh_clock_div2);
|
||||
}
|
||||
#endif
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit.h,v 1.14 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: pit.h,v 1.15 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -67,6 +67,9 @@ public:
|
||||
BX_PIT_SMF int init(void);
|
||||
BX_PIT_SMF void reset( unsigned type);
|
||||
BX_PIT_SMF bx_bool periodic( Bit32u usec_delta );
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
BX_PIT_SMF void register_state(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit82c54.cc,v 1.26 2006-01-08 20:39:08 vruppert Exp $
|
||||
// $Id: pit82c54.cc,v 1.27 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/*
|
||||
@ -178,13 +178,51 @@ void pit_82C54::init (void) {
|
||||
seen_problems=0;
|
||||
}
|
||||
|
||||
pit_82C54::pit_82C54 (void) {
|
||||
pit_82C54::pit_82C54(void)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void pit_82C54::reset (unsigned type) {
|
||||
void pit_82C54::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void pit_82C54::register_state(bx_param_c *parent)
|
||||
{
|
||||
unsigned i;
|
||||
char name[4];
|
||||
bx_list_c *tim;
|
||||
|
||||
for (i=0; i<3; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
tim = new bx_list_c(parent, strdup(name), 22);
|
||||
new bx_shadow_bool_c(tim, "GATE", &counter[i].GATE);
|
||||
new bx_shadow_bool_c(tim, "OUTpin", &counter[i].OUTpin);
|
||||
new bx_shadow_num_c(tim, "count", &counter[i].count);
|
||||
new bx_shadow_num_c(tim, "outlatch", &counter[i].outlatch);
|
||||
new bx_shadow_num_c(tim, "inlatch", &counter[i].inlatch);
|
||||
new bx_shadow_num_c(tim, "status_latch", &counter[i].status_latch);
|
||||
new bx_shadow_num_c(tim, "rw_mode", &counter[i].rw_mode);
|
||||
new bx_shadow_num_c(tim, "mode", &counter[i].mode);
|
||||
new bx_shadow_bool_c(tim, "bcd_mode", &counter[i].bcd_mode);
|
||||
new bx_shadow_bool_c(tim, "null_count", &counter[i].null_count);
|
||||
new bx_shadow_bool_c(tim, "count_LSB_latched", &counter[i].count_LSB_latched);
|
||||
new bx_shadow_bool_c(tim, "count_MSB_latched", &counter[i].count_MSB_latched);
|
||||
new bx_shadow_bool_c(tim, "status_latched", &counter[i].status_latched);
|
||||
new bx_shadow_num_c(tim, "count_binary", &counter[i].count_binary);
|
||||
new bx_shadow_bool_c(tim, "triggerGATE", &counter[i].triggerGATE);
|
||||
new bx_shadow_num_c(tim, "write_state", (Bit8u*)&counter[i].write_state);
|
||||
new bx_shadow_num_c(tim, "read_state", (Bit8u*)&counter[i].read_state);
|
||||
new bx_shadow_bool_c(tim, "count_written", &counter[i].count_written);
|
||||
new bx_shadow_bool_c(tim, "first_pass", &counter[i].first_pass);
|
||||
new bx_shadow_bool_c(tim, "state_bit_1", &counter[i].state_bit_1);
|
||||
new bx_shadow_bool_c(tim, "state_bit_2", &counter[i].state_bit_2);
|
||||
new bx_shadow_num_c(tim, "next_change_time", &counter[i].next_change_time);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void BX_CPP_AttrRegparmN(2)
|
||||
pit_82C54::decrement_multiple(counter_type & thisctr, Bit32u cycles) {
|
||||
while(cycles>0) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit82c54.h,v 1.14 2006-01-08 20:39:08 vruppert Exp $
|
||||
// $Id: pit82c54.h,v 1.15 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/*
|
||||
@ -111,6 +111,9 @@ public:
|
||||
void init (void);
|
||||
void reset (unsigned type);
|
||||
pit_82C54 (void);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void register_state(bx_param_c *parent);
|
||||
#endif
|
||||
|
||||
void clock_all(Bit32u cycles);
|
||||
void clock_multiple(Bit8u cnum, Bit32u cycles);
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit_wrap.cc,v 1.61 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: pit_wrap.cc,v 1.62 2006-05-27 15:54:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -151,6 +151,21 @@ void bx_pit_c::reset(unsigned type)
|
||||
BX_PIT_THIS s.timer.reset(type);
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_pit_c::register_state(void)
|
||||
{
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pit", "8254 PIT State", 7);
|
||||
new bx_shadow_num_c(list, "speaker_data_on", &BX_PIT_THIS s.speaker_data_on, BASE_HEX);
|
||||
new bx_shadow_bool_c(list, "refresh_clock_div2", &BX_PIT_THIS s.refresh_clock_div2);
|
||||
new bx_shadow_num_c(list, "last_usec", &BX_PIT_THIS s.last_usec);
|
||||
new bx_shadow_num_c(list, "last_next_event_time", &BX_PIT_THIS s.last_next_event_time);
|
||||
new bx_shadow_num_c(list, "total_ticks", &BX_PIT_THIS s.total_ticks);
|
||||
new bx_shadow_num_c(list, "total_usec", &BX_PIT_THIS s.total_usec);
|
||||
bx_list_c *counter = new bx_list_c(list, "counter");
|
||||
BX_PIT_THIS s.timer.register_state(counter);
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_pit_c::timer_handler(void *this_ptr)
|
||||
{
|
||||
bx_pit_c * class_ptr = (bx_pit_c *) this_ptr;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit_wrap.h,v 1.23 2006-05-01 18:24:47 vruppert Exp $
|
||||
// $Id: pit_wrap.h,v 1.24 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -52,6 +52,9 @@ public:
|
||||
BX_PIT_SMF int init(void);
|
||||
BX_PIT_SMF void reset(unsigned type);
|
||||
BX_PIT_SMF bx_bool periodic(Bit32u usec_delta);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
BX_PIT_SMF void register_state(void);
|
||||
#endif
|
||||
|
||||
Bit16u get_timer(int Timer) {
|
||||
return s.timer.get_inlatch(Timer);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sb16.cc,v 1.48 2006-05-06 15:19:57 sshwarts Exp $
|
||||
// $Id: sb16.cc,v 1.49 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -310,8 +310,143 @@ void bx_sb16_c::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
|
||||
// the timer functions
|
||||
void bx_sb16_c::mpu_timer(void *this_ptr)
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_sb16_c::register_state(void)
|
||||
{
|
||||
unsigned i, j;
|
||||
char name[8];
|
||||
bx_list_c *chip, *ins_map, *item, *patch;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "sb16", "SB16 State", 8);
|
||||
bx_list_c *mpu = new bx_list_c(list, "mpu", 8);
|
||||
new bx_shadow_bool_c(mpu, "uartmode", &MPU.uartmode);
|
||||
new bx_shadow_bool_c(mpu, "irqpending", &MPU.irqpending);
|
||||
new bx_shadow_bool_c(mpu, "forceuartmode", &MPU.forceuartmode);
|
||||
new bx_shadow_bool_c(mpu, "singlecommand", &MPU.singlecommand);
|
||||
new bx_shadow_bool_c(mpu, "outputinit", &MPU.outputinit);
|
||||
new bx_shadow_num_c(mpu, "current_timer", &MPU.current_timer);
|
||||
new bx_shadow_num_c(mpu, "last_delta_time", &MPU.last_delta_time);
|
||||
bx_list_c *patchtbl = new bx_list_c(mpu, "patchtable", BX_SB16_PATCHTABLESIZE);
|
||||
for (i=0; i<BX_SB16_PATCHTABLESIZE; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
patch = new bx_list_c(patchtbl, strdup(name));
|
||||
new bx_shadow_num_c(patch, "banklsb", &MPU.banklsb[i]);
|
||||
new bx_shadow_num_c(patch, "bankmsb", &MPU.bankmsb[i]);
|
||||
new bx_shadow_num_c(patch, "program", &MPU.program[i]);
|
||||
}
|
||||
bx_list_c *dsp = new bx_list_c(list, "dsp", 8);
|
||||
new bx_shadow_num_c(dsp, "resetport", &DSP.resetport, BASE_HEX);
|
||||
new bx_shadow_num_c(dsp, "speaker", &DSP.speaker, BASE_HEX);
|
||||
new bx_shadow_num_c(dsp, "prostereo", &DSP.prostereo, BASE_HEX);
|
||||
new bx_shadow_bool_c(dsp, "irqpending", &DSP.irqpending);
|
||||
new bx_shadow_bool_c(dsp, "midiuartmode", &DSP.midiuartmode);
|
||||
new bx_shadow_num_c(dsp, "testreg", &DSP.testreg, BASE_HEX);
|
||||
bx_list_c *dma = new bx_list_c(dsp, "dma", 16);
|
||||
new bx_shadow_num_c(dma, "mode", &DSP.dma.mode);
|
||||
new bx_shadow_num_c(dma, "bits", &DSP.dma.bits);
|
||||
new bx_shadow_num_c(dma, "bps", &DSP.dma.bps);
|
||||
new bx_shadow_num_c(dma, "format", &DSP.dma.format);
|
||||
new bx_shadow_num_c(dma, "timer", &DSP.dma.timer);
|
||||
new bx_shadow_bool_c(dma, "fifo", &DSP.dma.fifo);
|
||||
new bx_shadow_bool_c(dma, "output", &DSP.dma.output);
|
||||
new bx_shadow_bool_c(dma, "stereo", &DSP.dma.stereo);
|
||||
new bx_shadow_bool_c(dma, "issigned", &DSP.dma.issigned);
|
||||
new bx_shadow_bool_c(dma, "highspeed", &DSP.dma.highspeed);
|
||||
new bx_shadow_num_c(dma, "count", &DSP.dma.count);
|
||||
new bx_shadow_num_c(dma, "chunkindex", &DSP.dma.chunkindex);
|
||||
new bx_shadow_num_c(dma, "chunkcount", &DSP.dma.chunkcount);
|
||||
new bx_shadow_num_c(dma, "timeconstant", &DSP.dma.timeconstant);
|
||||
new bx_shadow_num_c(dma, "blocklength", &DSP.dma.blocklength);
|
||||
new bx_shadow_num_c(dma, "samplerate", &DSP.dma.samplerate);
|
||||
new bx_shadow_bool_c(dsp, "outputinit", &DSP.outputinit);
|
||||
new bx_shadow_data_c(list, "chunk", DSP.dma.chunk, BX_SOUND_OUTPUT_WAVEPACKETSIZE);
|
||||
bx_list_c *csp = new bx_list_c(list, "csp_reg", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(csp, strdup(name), &BX_SB16_THIS csp_reg[i], BASE_HEX);
|
||||
}
|
||||
bx_list_c *opl = new bx_list_c(list, "opl", 8);
|
||||
new bx_shadow_num_c(opl, "mode", (Bit8u*)&OPL.mode);
|
||||
new bx_shadow_num_c(opl, "timer_running", &OPL.timer_running);
|
||||
new bx_shadow_num_c(opl, "midichannels", &OPL.midichannels);
|
||||
new bx_shadow_num_c(opl, "drumchannel", &OPL.drumchannel);
|
||||
for (i=0; i<2; i++) {
|
||||
sprintf(name, "chip%d", i+1);
|
||||
chip = new bx_list_c(opl, strdup(name), 11);
|
||||
new bx_shadow_num_c(chip, "index", &OPL.index[i]);
|
||||
new bx_shadow_num_c(chip, "wsenable", &OPL.wsenable[i]);
|
||||
new bx_shadow_num_c(chip, "timer1", &OPL.timer[i*2]);
|
||||
new bx_shadow_num_c(chip, "timer2", &OPL.timer[i*2+1]);
|
||||
new bx_shadow_num_c(chip, "timerinit1", &OPL.timerinit[i*2]);
|
||||
new bx_shadow_num_c(chip, "timerinit2", &OPL.timerinit[i*2+1]);
|
||||
new bx_shadow_num_c(chip, "tmask", &OPL.tmask[i]);
|
||||
new bx_shadow_num_c(chip, "tflag", &OPL.tflag[i]);
|
||||
new bx_shadow_num_c(chip, "percmode", &OPL.percmode[i]);
|
||||
new bx_shadow_num_c(chip, "cyhhnote", &OPL.cyhhnote[i]);
|
||||
new bx_shadow_num_c(chip, "cyhhon", &OPL.cyhhon[i]);
|
||||
}
|
||||
bx_list_c *oper = new bx_list_c(opl, "oper", BX_SB16_FM_NOP);
|
||||
for (i=0; i<BX_SB16_FM_NOP; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
item = new bx_list_c(oper, strdup(name), BX_SB16_FM_OPB);
|
||||
for (j=0; j<BX_SB16_FM_OPB; j++) {
|
||||
sprintf(name, "%d", j);
|
||||
new bx_shadow_num_c(item, strdup(name), &OPL.oper[i][j]);
|
||||
}
|
||||
}
|
||||
bx_list_c *chan = new bx_list_c(opl, "chan", BX_SB16_FM_NCH);
|
||||
for (i=0; i<BX_SB16_FM_NCH; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
item = new bx_list_c(chan, strdup(name), 19);
|
||||
new bx_shadow_num_c(item, "nop", &OPL.chan[i].nop);
|
||||
new bx_shadow_num_c(item, "ncarr", &OPL.chan[i].ncarr);
|
||||
new bx_shadow_num_c(item, "opnum1", &OPL.chan[i].opnum[0]);
|
||||
new bx_shadow_num_c(item, "opnum2", &OPL.chan[i].opnum[1]);
|
||||
new bx_shadow_num_c(item, "opnum3", &OPL.chan[i].opnum[2]);
|
||||
new bx_shadow_num_c(item, "opnum4", &OPL.chan[i].opnum[3]);
|
||||
new bx_shadow_num_c(item, "freq", &OPL.chan[i].freq);
|
||||
new bx_shadow_num_c(item, "afreq", &OPL.chan[i].afreq);
|
||||
new bx_shadow_bool_c(item, "freqch", &OPL.chan[i].freqch);
|
||||
new bx_shadow_num_c(item, "midichan", &OPL.chan[i].midichan);
|
||||
new bx_shadow_bool_c(item, "needprogch", &OPL.chan[i].needprogch);
|
||||
new bx_shadow_num_c(item, "midinote", &OPL.chan[i].midinote);
|
||||
new bx_shadow_bool_c(item, "midion", &OPL.chan[i].midion);
|
||||
new bx_shadow_num_c(item, "midibend", &OPL.chan[i].midibend);
|
||||
new bx_shadow_num_c(item, "outputlevel1", &OPL.chan[i].outputlevel[0]);
|
||||
new bx_shadow_num_c(item, "outputlevel2", &OPL.chan[i].outputlevel[1]);
|
||||
new bx_shadow_num_c(item, "outputlevel3", &OPL.chan[i].outputlevel[2]);
|
||||
new bx_shadow_num_c(item, "outputlevel4", &OPL.chan[i].outputlevel[3]);
|
||||
new bx_shadow_num_c(item, "midivol", &OPL.chan[i].midivol);
|
||||
}
|
||||
new bx_shadow_num_c(list, "mixer_regindex", &MIXER.regindex, BASE_HEX);
|
||||
bx_list_c *mixer = new bx_list_c(list, "mixer_reg", BX_SB16_MIX_REG);
|
||||
for (i=0; i<BX_SB16_MIX_REG; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(mixer, strdup(name), &MIXER.reg[i], BASE_HEX);
|
||||
}
|
||||
bx_list_c *emul = new bx_list_c(list, "emul");
|
||||
new bx_shadow_num_c(emul, "remaps", &EMUL.remaps);
|
||||
bx_list_c *remap = new bx_list_c(emul, "remaplist", 256);
|
||||
for (i=0; i<EMUL.remaps; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
ins_map = new bx_list_c(remap, strdup(name));
|
||||
new bx_shadow_num_c(ins_map, "oldbankmsb", &EMUL.remaplist[i].oldbankmsb);
|
||||
new bx_shadow_num_c(ins_map, "oldbanklsb", &EMUL.remaplist[i].oldbanklsb);
|
||||
new bx_shadow_num_c(ins_map, "oldprogch", &EMUL.remaplist[i].oldprogch);
|
||||
new bx_shadow_num_c(ins_map, "newbankmsb", &EMUL.remaplist[i].newbankmsb);
|
||||
new bx_shadow_num_c(ins_map, "newbanklsb", &EMUL.remaplist[i].newbanklsb);
|
||||
new bx_shadow_num_c(ins_map, "newprogch", &EMUL.remaplist[i].newprogch);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_sb16_c::after_restore_state(void)
|
||||
{
|
||||
set_irq_dma();
|
||||
}
|
||||
#endif
|
||||
|
||||
// the timer functions
|
||||
void bx_sb16_c::mpu_timer (void *this_ptr)
|
||||
{
|
||||
((bx_sb16_c *) this_ptr)->mpu401.current_timer++;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sb16.h,v 1.26 2006-05-14 15:47:37 vruppert Exp $
|
||||
// $Id: sb16.h,v 1.27 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -198,6 +198,10 @@ public:
|
||||
virtual ~bx_sb16_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
|
||||
/* Make writelog available to output functions */
|
||||
BX_SB16_SMF void writelog(int loglev, const char *str, ...);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: serial.cc,v 1.69 2006-03-01 17:14:36 vruppert Exp $
|
||||
// $Id: serial.cc,v 1.70 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -358,13 +358,110 @@ bx_serial_c::init(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_serial_c::reset(unsigned type)
|
||||
void bx_serial_c::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
bx_serial_c::lower_interrupt(Bit8u port)
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_serial_c::register_state(void)
|
||||
{
|
||||
unsigned i, j;
|
||||
char name[6];
|
||||
bx_list_c *port;
|
||||
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "serial", "Serial Port State", 9);
|
||||
for (i=0; i<BX_N_SERIAL_PORTS; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
port = new bx_list_c(list, strdup(name), 28);
|
||||
new bx_shadow_bool_c(port, "ls_interrupt", &BX_SER_THIS s[i].ls_interrupt);
|
||||
new bx_shadow_bool_c(port, "ms_interrupt", &BX_SER_THIS s[i].ms_interrupt);
|
||||
new bx_shadow_bool_c(port, "rx_interrupt", &BX_SER_THIS s[i].rx_interrupt);
|
||||
new bx_shadow_bool_c(port, "tx_interrupt", &BX_SER_THIS s[i].tx_interrupt);
|
||||
new bx_shadow_bool_c(port, "fifo_interrupt", &BX_SER_THIS s[i].fifo_interrupt);
|
||||
new bx_shadow_bool_c(port, "ls_ipending", &BX_SER_THIS s[i].ls_ipending);
|
||||
new bx_shadow_bool_c(port, "ms_ipending", &BX_SER_THIS s[i].ms_ipending);
|
||||
new bx_shadow_bool_c(port, "rx_ipending", &BX_SER_THIS s[i].rx_ipending);
|
||||
new bx_shadow_bool_c(port, "fifo_ipending", &BX_SER_THIS s[i].fifo_ipending);
|
||||
new bx_shadow_num_c(port, "rx_fifo_end", &BX_SER_THIS s[i].rx_fifo_end);
|
||||
new bx_shadow_num_c(port, "tx_fifo_end", &BX_SER_THIS s[i].tx_fifo_end);
|
||||
new bx_shadow_num_c(port, "baudrate", &BX_SER_THIS s[i].baudrate);
|
||||
new bx_shadow_num_c(port, "rx_pollstate", &BX_SER_THIS s[i].rx_pollstate);
|
||||
new bx_shadow_num_c(port, "rxbuffer", &BX_SER_THIS s[i].rxbuffer, BASE_HEX);
|
||||
new bx_shadow_num_c(port, "thrbuffer", &BX_SER_THIS s[i].thrbuffer, BASE_HEX);
|
||||
bx_list_c *int_en = new bx_list_c(port, "int_enable");
|
||||
new bx_shadow_bool_c(int_en, "rxdata_enable", &BX_SER_THIS s[i].int_enable.rxdata_enable);
|
||||
new bx_shadow_bool_c(int_en, "txhold_enable", &BX_SER_THIS s[i].int_enable.txhold_enable);
|
||||
new bx_shadow_bool_c(int_en, "rxlstat_enable", &BX_SER_THIS s[i].int_enable.rxlstat_enable);
|
||||
new bx_shadow_bool_c(int_en, "modstat_enable", &BX_SER_THIS s[i].int_enable.modstat_enable);
|
||||
bx_list_c *int_id = new bx_list_c(port, "int_ident");
|
||||
new bx_shadow_bool_c(int_id, "ipending", &BX_SER_THIS s[i].int_ident.ipending);
|
||||
new bx_shadow_num_c(int_id, "int_ID", &BX_SER_THIS s[i].int_ident.int_ID, BASE_HEX);
|
||||
bx_list_c *fifo = new bx_list_c(port, "fifo_cntl");
|
||||
new bx_shadow_bool_c(fifo, "enable", &BX_SER_THIS s[i].fifo_cntl.enable);
|
||||
new bx_shadow_num_c(fifo, "rxtrigger", &BX_SER_THIS s[i].fifo_cntl.rxtrigger, BASE_HEX);
|
||||
bx_list_c *lcntl = new bx_list_c(port, "line_cntl", 7);
|
||||
new bx_shadow_num_c(lcntl, "wordlen_sel", &BX_SER_THIS s[i].line_cntl.wordlen_sel, BASE_HEX);
|
||||
new bx_shadow_bool_c(lcntl, "stopbits", &BX_SER_THIS s[i].line_cntl.stopbits);
|
||||
new bx_shadow_bool_c(lcntl, "parity_enable", &BX_SER_THIS s[i].line_cntl.parity_enable);
|
||||
new bx_shadow_bool_c(lcntl, "evenparity_sel", &BX_SER_THIS s[i].line_cntl.evenparity_sel);
|
||||
new bx_shadow_bool_c(lcntl, "stick_parity", &BX_SER_THIS s[i].line_cntl.stick_parity);
|
||||
new bx_shadow_bool_c(lcntl, "break_cntl", &BX_SER_THIS s[i].line_cntl.break_cntl);
|
||||
new bx_shadow_bool_c(lcntl, "dlab", &BX_SER_THIS s[i].line_cntl.dlab);
|
||||
bx_list_c *mcntl = new bx_list_c(port, "modem_cntl");
|
||||
new bx_shadow_bool_c(mcntl, "dtr", &BX_SER_THIS s[i].modem_cntl.dtr);
|
||||
new bx_shadow_bool_c(mcntl, "rts", &BX_SER_THIS s[i].modem_cntl.rts);
|
||||
new bx_shadow_bool_c(mcntl, "out1", &BX_SER_THIS s[i].modem_cntl.out1);
|
||||
new bx_shadow_bool_c(mcntl, "out2", &BX_SER_THIS s[i].modem_cntl.out2);
|
||||
new bx_shadow_bool_c(mcntl, "local_loopback", &BX_SER_THIS s[i].modem_cntl.local_loopback);
|
||||
bx_list_c *lstatus = new bx_list_c(port, "line_status", 8);
|
||||
new bx_shadow_bool_c(lstatus, "rxdata_ready", &BX_SER_THIS s[i].line_status.rxdata_ready);
|
||||
new bx_shadow_bool_c(lstatus, "overrun_error", &BX_SER_THIS s[i].line_status.overrun_error);
|
||||
new bx_shadow_bool_c(lstatus, "parity_error", &BX_SER_THIS s[i].line_status.parity_error);
|
||||
new bx_shadow_bool_c(lstatus, "framing_error", &BX_SER_THIS s[i].line_status.framing_error);
|
||||
new bx_shadow_bool_c(lstatus, "break_int", &BX_SER_THIS s[i].line_status.break_int);
|
||||
new bx_shadow_bool_c(lstatus, "thr_empty", &BX_SER_THIS s[i].line_status.thr_empty);
|
||||
new bx_shadow_bool_c(lstatus, "tsr_empty", &BX_SER_THIS s[i].line_status.tsr_empty);
|
||||
new bx_shadow_bool_c(lstatus, "fifo_error", &BX_SER_THIS s[i].line_status.fifo_error);
|
||||
bx_list_c *mstatus = new bx_list_c(port, "modem_status", 8);
|
||||
new bx_shadow_bool_c(mstatus, "delta_cts", &BX_SER_THIS s[i].modem_status.delta_cts);
|
||||
new bx_shadow_bool_c(mstatus, "delta_dsr", &BX_SER_THIS s[i].modem_status.delta_dsr);
|
||||
new bx_shadow_bool_c(mstatus, "ri_trailedge", &BX_SER_THIS s[i].modem_status.ri_trailedge);
|
||||
new bx_shadow_bool_c(mstatus, "delta_dcd", &BX_SER_THIS s[i].modem_status.delta_dcd);
|
||||
new bx_shadow_bool_c(mstatus, "cts", &BX_SER_THIS s[i].modem_status.cts);
|
||||
new bx_shadow_bool_c(mstatus, "dsr", &BX_SER_THIS s[i].modem_status.dsr);
|
||||
new bx_shadow_bool_c(mstatus, "ri", &BX_SER_THIS s[i].modem_status.ri);
|
||||
new bx_shadow_bool_c(mstatus, "dcd", &BX_SER_THIS s[i].modem_status.dcd);
|
||||
new bx_shadow_num_c(port, "scratch", &BX_SER_THIS s[i].scratch, BASE_HEX);
|
||||
new bx_shadow_num_c(port, "tsrbuffer", &BX_SER_THIS s[i].tsrbuffer, BASE_HEX);
|
||||
bx_list_c *rxfifo = new bx_list_c(port, "rx_fifo", 16);
|
||||
for (j=0; j<16; j++) {
|
||||
sprintf(name, "0x%02x", j);
|
||||
new bx_shadow_num_c(rxfifo, strdup(name), &BX_SER_THIS s[i].rx_fifo[j], BASE_HEX);
|
||||
}
|
||||
bx_list_c *txfifo = new bx_list_c(port, "tx_fifo", 16);
|
||||
for (j=0; j<16; j++) {
|
||||
sprintf(name, "0x%02x", j);
|
||||
new bx_shadow_num_c(txfifo, strdup(name), &BX_SER_THIS s[i].tx_fifo[j], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(port, "divisor_lsb", &BX_SER_THIS s[i].divisor_lsb, BASE_HEX);
|
||||
new bx_shadow_num_c(port, "divisor_msb", &BX_SER_THIS s[i].divisor_msb, BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(list, "detect_mouse", &BX_SER_THIS detect_mouse);
|
||||
new bx_shadow_num_c(list, "mouse_delayed_dx", &BX_SER_THIS mouse_delayed_dx);
|
||||
new bx_shadow_num_c(list, "mouse_delayed_dy", &BX_SER_THIS mouse_delayed_dy);
|
||||
new bx_shadow_num_c(list, "mouse_delayed_dz", &BX_SER_THIS mouse_delayed_dz);
|
||||
bx_list_c *mousebuf = new bx_list_c(list, "mouse_internal_buffer");
|
||||
new bx_shadow_num_c(mousebuf, "num_elements", &BX_SER_THIS mouse_internal_buffer.num_elements);
|
||||
bx_list_c *buffer = new bx_list_c(mousebuf, "buffer", BX_MOUSE_BUFF_SIZE);
|
||||
for (i=0; i<BX_MOUSE_BUFF_SIZE; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(buffer, strdup(name), &BX_SER_THIS mouse_internal_buffer.buffer[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(mousebuf, "head", &BX_SER_THIS mouse_internal_buffer.head);
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_serial_c::lower_interrupt(Bit8u port)
|
||||
{
|
||||
/* If there are no more ints pending, clear the irq */
|
||||
if ((BX_SER_THIS s[port].rx_interrupt == 0) &&
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: serial.h,v 1.28 2006-03-07 21:11:19 sshwarts Exp $
|
||||
// $Id: serial.h,v 1.29 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -207,6 +207,9 @@ public:
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void serial_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
bx_serial_t s[BX_SERIAL_MAXDEV];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: slowdown_timer.cc,v 1.24 2006-02-19 15:43:03 vruppert Exp $
|
||||
// $Id: slowdown_timer.cc,v 1.25 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -59,8 +59,7 @@ bx_slowdown_timer_c::bx_slowdown_timer_c()
|
||||
s.timer_handle=BX_NULL_TIMER_HANDLE;
|
||||
}
|
||||
|
||||
void
|
||||
bx_slowdown_timer_c::init(void)
|
||||
void bx_slowdown_timer_c::init(void)
|
||||
{
|
||||
// Return early if slowdown timer not selected
|
||||
if ((SIM->get_param_enum(BXPN_CLOCK_SYNC)->get() != BX_CLOCK_SYNC_SLOWDOWN) &&
|
||||
@ -85,16 +84,21 @@ bx_slowdown_timer_c::init(void)
|
||||
bx_pc_system.activate_timer(s.timer_handle,(Bit32u)s.Q,0);
|
||||
}
|
||||
|
||||
void
|
||||
bx_slowdown_timer_c::timer_handler(void * this_ptr)
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_slowdown_timer_c::after_restore_state(void)
|
||||
{
|
||||
s.start_emulated_time = bx_pc_system.time_usec();
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_slowdown_timer_c::timer_handler(void * this_ptr)
|
||||
{
|
||||
bx_slowdown_timer_c * class_ptr = (bx_slowdown_timer_c *) this_ptr;
|
||||
|
||||
class_ptr->handle_timer();
|
||||
}
|
||||
|
||||
void
|
||||
bx_slowdown_timer_c::handle_timer()
|
||||
void bx_slowdown_timer_c::handle_timer()
|
||||
{
|
||||
Bit64u total_emu_time = (bx_pc_system.time_usec()) - s.start_emulated_time;
|
||||
Bit64u wanttime = s.lasttime+s.Q;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: slowdown_timer.h,v 1.10 2006-03-06 22:32:03 sshwarts Exp $
|
||||
// $Id: slowdown_timer.h,v 1.11 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -45,6 +45,9 @@ public:
|
||||
bx_slowdown_timer_c();
|
||||
|
||||
void init(void);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void after_restore_state(void);
|
||||
#endif
|
||||
|
||||
static void timer_handler(void * this_ptr);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: svga_cirrus.cc,v 1.31 2006-04-27 11:58:07 sshwarts Exp $
|
||||
// $Id: svga_cirrus.cc,v 1.32 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2004 Makoto Suzuki (suzu)
|
||||
@ -355,8 +355,7 @@ void bx_svga_cirrus_c::svga_init_members()
|
||||
BX_CIRRUS_THIS disp_ptr = BX_CIRRUS_THIS vidmem;
|
||||
}
|
||||
|
||||
void
|
||||
bx_svga_cirrus_c::reset(unsigned type)
|
||||
void bx_svga_cirrus_c::reset(unsigned type)
|
||||
{
|
||||
// reset VGA stuffs.
|
||||
BX_CIRRUS_THIS bx_vga_c::reset(type);
|
||||
@ -367,6 +366,108 @@ bx_svga_cirrus_c::reset(unsigned type)
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_svga_cirrus_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
bx_list_c *reg;
|
||||
|
||||
if (BX_CIRRUS_THIS vidmem != NULL) {
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "svga_cirrus", "Cirrus SVGA State", 18);
|
||||
bx_list_c *crtc = new bx_list_c(list, "crtc");
|
||||
new bx_shadow_num_c(crtc, "index", &BX_CIRRUS_THIS crtc.index, BASE_HEX);
|
||||
reg = new bx_list_c(crtc, "reg", CIRRUS_CRTC_MAX+1);
|
||||
for (i=0; i<=CIRRUS_CRTC_MAX; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(reg, strdup(name), &BX_CIRRUS_THIS crtc.reg[i], BASE_HEX);
|
||||
}
|
||||
bx_list_c *sequ = new bx_list_c(list, "sequencer");
|
||||
new bx_shadow_num_c(sequ, "index", &BX_CIRRUS_THIS sequencer.index, BASE_HEX);
|
||||
reg = new bx_list_c(sequ, "reg", CIRRUS_SEQENCER_MAX+1);
|
||||
for (i=0; i<=CIRRUS_SEQENCER_MAX; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(reg, strdup(name), &BX_CIRRUS_THIS sequencer.reg[i], BASE_HEX);
|
||||
}
|
||||
bx_list_c *ctrl = new bx_list_c(list, "control");
|
||||
new bx_shadow_num_c(ctrl, "index", &BX_CIRRUS_THIS control.index, BASE_HEX);
|
||||
reg = new bx_list_c(ctrl, "reg", CIRRUS_CONTROL_MAX+1);
|
||||
for (i=0; i<=CIRRUS_CONTROL_MAX; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(reg, strdup(name), &BX_CIRRUS_THIS control.reg[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(ctrl, "shadow_reg0", &BX_CIRRUS_THIS control.shadow_reg0, BASE_HEX);
|
||||
new bx_shadow_num_c(ctrl, "shadow_reg1", &BX_CIRRUS_THIS control.shadow_reg1, BASE_HEX);
|
||||
bx_list_c *hdac = new bx_list_c(list, "hidden_dac");
|
||||
new bx_shadow_num_c(hdac, "lockindex", &BX_CIRRUS_THIS hidden_dac.lockindex, BASE_HEX);
|
||||
new bx_shadow_num_c(hdac, "data", &BX_CIRRUS_THIS hidden_dac.data, BASE_HEX);
|
||||
reg = new bx_list_c(hdac, "palette", 48);
|
||||
for (i=0; i<48; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(reg, strdup(name), &BX_CIRRUS_THIS hidden_dac.palette[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_bool_c(list, "svga_unlock_special", &BX_CIRRUS_THIS svga_unlock_special);
|
||||
new bx_shadow_num_c(list, "svga_xres", &BX_CIRRUS_THIS svga_xres);
|
||||
new bx_shadow_num_c(list, "svga_yres", &BX_CIRRUS_THIS svga_yres);
|
||||
new bx_shadow_num_c(list, "svga_pitch", &BX_CIRRUS_THIS svga_pitch);
|
||||
new bx_shadow_num_c(list, "svga_bpp", &BX_CIRRUS_THIS svga_bpp);
|
||||
new bx_shadow_num_c(list, "svga_dispbpp", &BX_CIRRUS_THIS svga_dispbpp);
|
||||
new bx_shadow_num_c(list, "bank_base0", &BX_CIRRUS_THIS bank_base[0], BASE_HEX);
|
||||
new bx_shadow_num_c(list, "bank_base1", &BX_CIRRUS_THIS bank_base[1], BASE_HEX);
|
||||
new bx_shadow_num_c(list, "bank_limit0", &BX_CIRRUS_THIS bank_limit[0], BASE_HEX);
|
||||
new bx_shadow_num_c(list, "bank_limit1", &BX_CIRRUS_THIS bank_limit[1], BASE_HEX);
|
||||
bx_list_c *cursor = new bx_list_c(list, "hw_cursor");
|
||||
new bx_shadow_num_c(cursor, "x", &BX_CIRRUS_THIS hw_cursor.x, BASE_HEX);
|
||||
new bx_shadow_num_c(cursor, "y", &BX_CIRRUS_THIS hw_cursor.y, BASE_HEX);
|
||||
new bx_shadow_num_c(cursor, "size", &BX_CIRRUS_THIS hw_cursor.size, BASE_HEX);
|
||||
new bx_shadow_data_c(list, "vidmem", BX_CIRRUS_THIS vidmem, BX_CIRRUS_THIS memsize);
|
||||
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
|
||||
if (BX_CIRRUS_THIS pci_enabled) {
|
||||
bx_list_c *pci_conf = new bx_list_c(list, "pci_conf", 256);
|
||||
for (i=0; i<256; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(pci_conf, strdup(name), &BX_CIRRUS_THIS pci_conf[i], BASE_HEX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
bx_vga_c::register_state();
|
||||
}
|
||||
|
||||
void bx_svga_cirrus_c::after_restore_state(void)
|
||||
{
|
||||
if ((BX_CIRRUS_THIS sequencer.reg[0x07] & 0x01) == CIRRUS_SR7_BPP_VGA) {
|
||||
BX_CIRRUS_THIS bx_vga_c::after_restore_state();
|
||||
} else {
|
||||
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
|
||||
if (BX_CIRRUS_THIS pci_enabled) {
|
||||
if (DEV_pci_set_base_mem(BX_CIRRUS_THIS_PTR, cirrus_mem_read_handler,
|
||||
cirrus_mem_write_handler,
|
||||
&BX_CIRRUS_THIS pci_memaddr,
|
||||
&BX_CIRRUS_THIS pci_conf[0x10],
|
||||
CIRRUS_PNPMEM_SIZE)) {
|
||||
BX_INFO(("new pci_memaddr: 0x%04x", BX_CIRRUS_THIS pci_memaddr));
|
||||
}
|
||||
if (DEV_pci_set_base_mem(BX_CIRRUS_THIS_PTR, cirrus_mem_read_handler,
|
||||
cirrus_mem_write_handler,
|
||||
&BX_CIRRUS_THIS pci_mmioaddr,
|
||||
&BX_CIRRUS_THIS pci_conf[0x14],
|
||||
CIRRUS_PNPMMIO_SIZE)) {
|
||||
BX_INFO(("new pci_mmioaddr = 0x%08x", BX_CIRRUS_THIS pci_mmioaddr));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (unsigned i=0; i<256; i++) {
|
||||
bx_gui->palette_change(i, BX_CIRRUS_THIS s.pel.data[i].red<<2,
|
||||
BX_CIRRUS_THIS s.pel.data[i].green<<2,
|
||||
BX_CIRRUS_THIS s.pel.data[i].blue<<2);
|
||||
}
|
||||
BX_CIRRUS_THIS svga_needs_update_mode = 1;
|
||||
BX_CIRRUS_THIS svga_update();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_svga_cirrus_c::redraw_area(unsigned x0, unsigned y0,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: svga_cirrus.h,v 1.8 2006-04-27 11:58:07 sshwarts Exp $
|
||||
// $Id: svga_cirrus.h,v 1.9 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2004 Makoto Suzuki (suzu)
|
||||
@ -79,6 +79,10 @@ public:
|
||||
unsigned *txHeight, unsigned *txWidth);
|
||||
virtual void trigger_timer(void *this_ptr);
|
||||
virtual Bit8u get_actl_palette_idx(Bit8u index);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: vga.cc,v 1.128 2006-03-07 21:11:20 sshwarts Exp $
|
||||
// $Id: vga.cc,v 1.129 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -395,9 +395,160 @@ void bx_vga_c::reset(unsigned type)
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_vga_c::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char name[6];
|
||||
bx_list_c *parent, *reg;
|
||||
|
||||
void
|
||||
bx_vga_c::determine_screen_dimensions(unsigned *piHeight, unsigned *piWidth)
|
||||
parent = SIM->get_sr_root();
|
||||
#if BX_SUPPORT_CLGD54XX
|
||||
if (!strcmp(SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr(), "cirrus")) {
|
||||
parent = (bx_list_c*)SIM->get_param("svga_cirrus", parent);;
|
||||
}
|
||||
#endif
|
||||
bx_list_c *list = new bx_list_c(parent, "vga", "VGA Adapter State", 17);
|
||||
bx_list_c *misc = new bx_list_c(list, "misc_output");
|
||||
new bx_shadow_bool_c(misc, "color_emulation", &BX_VGA_THIS s.misc_output.color_emulation);
|
||||
new bx_shadow_bool_c(misc, "enable_ram", &BX_VGA_THIS s.misc_output.enable_ram);
|
||||
new bx_shadow_num_c(misc, "clock_select", &BX_VGA_THIS s.misc_output.clock_select);
|
||||
new bx_shadow_bool_c(misc, "select_high_bank", &BX_VGA_THIS s.misc_output.select_high_bank);
|
||||
new bx_shadow_bool_c(misc, "horiz_sync_pol", &BX_VGA_THIS s.misc_output.horiz_sync_pol);
|
||||
new bx_shadow_bool_c(misc, "vert_sync_pol", &BX_VGA_THIS s.misc_output.vert_sync_pol);
|
||||
bx_list_c *crtc = new bx_list_c(list, "CRTC");
|
||||
new bx_shadow_num_c(crtc, "address", &BX_VGA_THIS s.CRTC.address, BASE_HEX);
|
||||
reg = new bx_list_c(crtc, "reg", 0x19);
|
||||
for (i=0; i<=0x18; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(reg, strdup(name), &BX_VGA_THIS s.CRTC.reg[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_bool_c(crtc, "write_protect", &BX_VGA_THIS s.CRTC.write_protect);
|
||||
bx_list_c *actl = new bx_list_c(list, "attribute_ctrl", 9);
|
||||
new bx_shadow_bool_c(actl, "flip_flop", &BX_VGA_THIS s.attribute_ctrl.flip_flop);
|
||||
new bx_shadow_num_c(actl, "address", &BX_VGA_THIS s.attribute_ctrl.address, BASE_HEX);
|
||||
new bx_shadow_bool_c(actl, "video_enabled", &BX_VGA_THIS s.attribute_ctrl.video_enabled);
|
||||
reg = new bx_list_c(actl, "palette_reg", 16);
|
||||
for (i=0; i<16; i++) {
|
||||
sprintf(name, "0x%02x", i);
|
||||
new bx_shadow_num_c(reg, strdup(name), &BX_VGA_THIS s.attribute_ctrl.palette_reg[i], BASE_HEX);
|
||||
}
|
||||
new bx_shadow_num_c(actl, "overscan_color", &BX_VGA_THIS s.attribute_ctrl.overscan_color, BASE_HEX);
|
||||
new bx_shadow_num_c(actl, "color_plane_enable", &BX_VGA_THIS s.attribute_ctrl.color_plane_enable, BASE_HEX);
|
||||
new bx_shadow_num_c(actl, "horiz_pel_panning", &BX_VGA_THIS s.attribute_ctrl.horiz_pel_panning, BASE_HEX);
|
||||
new bx_shadow_num_c(actl, "color_select", &BX_VGA_THIS s.attribute_ctrl.color_select, BASE_HEX);
|
||||
bx_list_c *mode = new bx_list_c(actl, "mode_ctrl", 7);
|
||||
new bx_shadow_bool_c(mode, "graphics_alpha", &BX_VGA_THIS s.attribute_ctrl.mode_ctrl.graphics_alpha);
|
||||
new bx_shadow_bool_c(mode, "display_type", &BX_VGA_THIS s.attribute_ctrl.mode_ctrl.display_type);
|
||||
new bx_shadow_bool_c(mode, "enable_line_graphics", &BX_VGA_THIS s.attribute_ctrl.mode_ctrl.enable_line_graphics);
|
||||
new bx_shadow_bool_c(mode, "blink_intensity", &BX_VGA_THIS s.attribute_ctrl.mode_ctrl.blink_intensity);
|
||||
new bx_shadow_bool_c(mode, "pixel_panning_compat", &BX_VGA_THIS s.attribute_ctrl.mode_ctrl.pixel_panning_compat);
|
||||
new bx_shadow_bool_c(mode, "pixel_clock_select", &BX_VGA_THIS s.attribute_ctrl.mode_ctrl.pixel_clock_select);
|
||||
new bx_shadow_bool_c(mode, "internal_palette_size", &BX_VGA_THIS s.attribute_ctrl.mode_ctrl.internal_palette_size);
|
||||
bx_list_c *pel = new bx_list_c(list, "pel");
|
||||
new bx_shadow_num_c(pel, "write_data_register", &BX_VGA_THIS s.pel.write_data_register, BASE_HEX);
|
||||
new bx_shadow_num_c(pel, "write_data_cycle", &BX_VGA_THIS s.pel.write_data_cycle);
|
||||
new bx_shadow_num_c(pel, "read_data_register", &BX_VGA_THIS s.pel.read_data_register, BASE_HEX);
|
||||
new bx_shadow_num_c(pel, "read_data_cycle", &BX_VGA_THIS s.pel.read_data_cycle);
|
||||
new bx_shadow_num_c(pel, "dac_state", &BX_VGA_THIS s.pel.dac_state);
|
||||
new bx_shadow_num_c(pel, "mask", &BX_VGA_THIS s.pel.mask);
|
||||
new bx_shadow_data_c(list, "pel_data", &BX_VGA_THIS s.pel.data[0].red, sizeof(BX_VGA_THIS s.pel.data));
|
||||
bx_list_c *gfxc = new bx_list_c(list, "graphics_ctrl", 20);
|
||||
new bx_shadow_num_c(gfxc, "index", &BX_VGA_THIS s.graphics_ctrl.index);
|
||||
new bx_shadow_num_c(gfxc, "set_reset", &BX_VGA_THIS s.graphics_ctrl.set_reset);
|
||||
new bx_shadow_num_c(gfxc, "enable_set_reset", &BX_VGA_THIS s.graphics_ctrl.enable_set_reset);
|
||||
new bx_shadow_num_c(gfxc, "color_compare", &BX_VGA_THIS s.graphics_ctrl.color_compare);
|
||||
new bx_shadow_num_c(gfxc, "data_rotate", &BX_VGA_THIS s.graphics_ctrl.data_rotate);
|
||||
new bx_shadow_num_c(gfxc, "raster_op", &BX_VGA_THIS s.graphics_ctrl.raster_op);
|
||||
new bx_shadow_num_c(gfxc, "read_map_select", &BX_VGA_THIS s.graphics_ctrl.read_map_select);
|
||||
new bx_shadow_num_c(gfxc, "write_mode", &BX_VGA_THIS s.graphics_ctrl.write_mode);
|
||||
new bx_shadow_bool_c(gfxc, "read_mode", &BX_VGA_THIS s.graphics_ctrl.read_mode);
|
||||
new bx_shadow_bool_c(gfxc, "odd_even", &BX_VGA_THIS s.graphics_ctrl.odd_even);
|
||||
new bx_shadow_bool_c(gfxc, "chain_odd_even", &BX_VGA_THIS s.graphics_ctrl.chain_odd_even);
|
||||
new bx_shadow_num_c(gfxc, "shift_reg", &BX_VGA_THIS s.graphics_ctrl.shift_reg);
|
||||
new bx_shadow_bool_c(gfxc, "graphics_alpha", &BX_VGA_THIS s.graphics_ctrl.graphics_alpha);
|
||||
new bx_shadow_num_c(gfxc, "memory_mapping", &BX_VGA_THIS s.graphics_ctrl.memory_mapping);
|
||||
new bx_shadow_num_c(gfxc, "color_dont_care", &BX_VGA_THIS s.graphics_ctrl.color_dont_care);
|
||||
new bx_shadow_num_c(gfxc, "bitmask", &BX_VGA_THIS s.graphics_ctrl.bitmask);
|
||||
new bx_shadow_num_c(gfxc, "latch0", &BX_VGA_THIS s.graphics_ctrl.latch[0]);
|
||||
new bx_shadow_num_c(gfxc, "latch1", &BX_VGA_THIS s.graphics_ctrl.latch[1]);
|
||||
new bx_shadow_num_c(gfxc, "latch2", &BX_VGA_THIS s.graphics_ctrl.latch[2]);
|
||||
new bx_shadow_num_c(gfxc, "latch3", &BX_VGA_THIS s.graphics_ctrl.latch[3]);
|
||||
bx_list_c *sequ = new bx_list_c(list, "sequencer", 13);
|
||||
new bx_shadow_num_c(sequ, "index", &BX_VGA_THIS s.sequencer.index);
|
||||
new bx_shadow_num_c(sequ, "map_mask", &BX_VGA_THIS s.sequencer.map_mask);
|
||||
new bx_shadow_bool_c(sequ, "map_mask_bit0", &BX_VGA_THIS s.sequencer.map_mask_bit[0]);
|
||||
new bx_shadow_bool_c(sequ, "map_mask_bit1", &BX_VGA_THIS s.sequencer.map_mask_bit[1]);
|
||||
new bx_shadow_bool_c(sequ, "map_mask_bit2", &BX_VGA_THIS s.sequencer.map_mask_bit[2]);
|
||||
new bx_shadow_bool_c(sequ, "map_mask_bit3", &BX_VGA_THIS s.sequencer.map_mask_bit[3]);
|
||||
new bx_shadow_bool_c(sequ, "reset1", &BX_VGA_THIS s.sequencer.reset1);
|
||||
new bx_shadow_bool_c(sequ, "reset2", &BX_VGA_THIS s.sequencer.reset2);
|
||||
new bx_shadow_num_c(sequ, "reg1", &BX_VGA_THIS s.sequencer.reg1);
|
||||
new bx_shadow_num_c(sequ, "char_map_select", &BX_VGA_THIS s.sequencer.char_map_select);
|
||||
new bx_shadow_bool_c(sequ, "extended_mem", &BX_VGA_THIS s.sequencer.extended_mem);
|
||||
new bx_shadow_bool_c(sequ, "odd_even", &BX_VGA_THIS s.sequencer.odd_even);
|
||||
new bx_shadow_bool_c(sequ, "chain_four", &BX_VGA_THIS s.sequencer.chain_four);
|
||||
new bx_shadow_bool_c(list, "enabled", &BX_VGA_THIS s.vga_enabled);
|
||||
new bx_shadow_num_c(list, "line_offset", &BX_VGA_THIS s.line_offset);
|
||||
new bx_shadow_num_c(list, "line_compare", &BX_VGA_THIS s.line_compare);
|
||||
new bx_shadow_num_c(list, "vertical_display_end", &BX_VGA_THIS s.vertical_display_end);
|
||||
new bx_shadow_num_c(list, "charmap_address", &BX_VGA_THIS s.charmap_address);
|
||||
new bx_shadow_bool_c(list, "x_dotclockdiv2", &BX_VGA_THIS s.x_dotclockdiv2);
|
||||
new bx_shadow_bool_c(list, "y_doublescan", &BX_VGA_THIS s.y_doublescan);
|
||||
new bx_shadow_num_c(list, "last_bpp", &BX_VGA_THIS s.last_bpp);
|
||||
new bx_shadow_data_c(list, "memory", BX_VGA_THIS s.vga_memory, sizeof(BX_VGA_THIS s.vga_memory));
|
||||
#if BX_SUPPORT_VBE
|
||||
if (BX_VGA_THIS s.vbe_memory != NULL) {
|
||||
bx_list_c *vbe = new bx_list_c(list, "vbe", 18);
|
||||
new bx_shadow_num_c(vbe, "cur_dispi", &BX_VGA_THIS s.vbe_cur_dispi);
|
||||
new bx_shadow_num_c(vbe, "xres", &BX_VGA_THIS s.vbe_xres);
|
||||
new bx_shadow_num_c(vbe, "yres", &BX_VGA_THIS s.vbe_yres);
|
||||
new bx_shadow_num_c(vbe, "bpp", &BX_VGA_THIS s.vbe_bpp);
|
||||
new bx_shadow_num_c(vbe, "bank", &BX_VGA_THIS s.vbe_bank);
|
||||
new bx_shadow_bool_c(vbe, "enabled", &BX_VGA_THIS s.vbe_enabled);
|
||||
new bx_shadow_num_c(vbe, "curindex", &BX_VGA_THIS s.vbe_curindex);
|
||||
new bx_shadow_num_c(vbe, "visible_screen_size", &BX_VGA_THIS s.vbe_visible_screen_size);
|
||||
new bx_shadow_num_c(vbe, "offset_x", &BX_VGA_THIS s.vbe_offset_x);
|
||||
new bx_shadow_num_c(vbe, "offset_y", &BX_VGA_THIS s.vbe_offset_y);
|
||||
new bx_shadow_num_c(vbe, "virtual_xres", &BX_VGA_THIS s.vbe_virtual_xres);
|
||||
new bx_shadow_num_c(vbe, "virtual_yres", &BX_VGA_THIS s.vbe_virtual_yres);
|
||||
new bx_shadow_num_c(vbe, "virtual_start", &BX_VGA_THIS s.vbe_virtual_start);
|
||||
new bx_shadow_num_c(vbe, "bpp_multiplier", &BX_VGA_THIS s.vbe_bpp_multiplier);
|
||||
new bx_shadow_bool_c(vbe, "lfb_enabled", &BX_VGA_THIS s.vbe_lfb_enabled);
|
||||
new bx_shadow_bool_c(vbe, "get_capabilities", &BX_VGA_THIS s.vbe_get_capabilities);
|
||||
new bx_shadow_bool_c(vbe, "8bit_dac", &BX_VGA_THIS s.vbe_8bit_dac);
|
||||
new bx_shadow_data_c(vbe, "memory", BX_VGA_THIS s.vbe_memory, VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void bx_vga_c::after_restore_state(void)
|
||||
{
|
||||
for (unsigned i=0; i<256; i++) {
|
||||
#if BX_SUPPORT_VBE
|
||||
if (BX_VGA_THIS s.vbe_8bit_dac) {
|
||||
bx_gui->palette_change(i, BX_VGA_THIS s.pel.data[i].red,
|
||||
BX_VGA_THIS s.pel.data[i].green,
|
||||
BX_VGA_THIS s.pel.data[i].blue);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
bx_gui->palette_change(i, BX_VGA_THIS s.pel.data[i].red<<2,
|
||||
BX_VGA_THIS s.pel.data[i].green<<2,
|
||||
BX_VGA_THIS s.pel.data[i].blue<<2);
|
||||
}
|
||||
}
|
||||
bx_gui->set_text_charmap(&BX_VGA_THIS s.vga_memory[0x20000 + BX_VGA_THIS s.charmap_address]);
|
||||
old_iWidth = BX_MAX_XRES;
|
||||
old_iHeight = BX_MAX_YRES;
|
||||
BX_VGA_THIS redraw_area(0, 0, BX_MAX_XRES, BX_MAX_YRES);
|
||||
BX_VGA_THIS update();
|
||||
bx_gui->flush();
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_vga_c::determine_screen_dimensions(unsigned *piHeight, unsigned *piWidth)
|
||||
{
|
||||
int ai[0x20];
|
||||
int i,h,v;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: vga.h,v 1.53 2006-04-27 11:58:07 sshwarts Exp $
|
||||
// $Id: vga.h,v 1.54 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -142,6 +142,10 @@ public:
|
||||
virtual void mem_write(Bit32u addr, Bit8u value);
|
||||
virtual void trigger_timer(void *this_ptr);
|
||||
virtual void dump_status(void);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_VBE
|
||||
BX_VGA_SMF Bit8u vbe_mem_read(Bit32u addr) BX_CPP_AttrRegparmN(1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// $Id: virt_timer.cc,v 1.28 2006-05-27 14:02:34 sshwarts Exp $
|
||||
// $Id: virt_timer.cc,v 1.29 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -266,7 +266,7 @@ int bx_virt_timer_c::register_timer(void *this_ptr, bx_timer_handler_t handler,
|
||||
for (i=0; i < numTimers; i++) {
|
||||
if (timer[i].inUse == 0 || i==numTimers)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If we didn't find a free slot, increment the bound, numTimers.
|
||||
if (i==numTimers)
|
||||
numTimers++; // One new timer installed.
|
||||
@ -421,6 +421,42 @@ void bx_virt_timer_c::init(void)
|
||||
init_done = 1;
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_virt_timer_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(), "virt_timer", "Virtual Timer State", 17);
|
||||
bx_list_c *vtimers = new bx_list_c(list, "timer", numTimers);
|
||||
for (i = 0; i < numTimers; i++) {
|
||||
sprintf(name, "%d", i);
|
||||
bxtimer = new bx_list_c(vtimers, 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);
|
||||
}
|
||||
new bx_shadow_num_c(list, "current_timers_time", ¤t_timers_time);
|
||||
new bx_shadow_num_c(list, "timers_next_event_time", &timers_next_event_time);
|
||||
new bx_shadow_num_c(list, "last_sequential_time", &last_sequential_time);
|
||||
new bx_shadow_num_c(list, "virtual_next_event_time", &virtual_next_event_time);
|
||||
new bx_shadow_num_c(list, "current_virtual_time", ¤t_virtual_time);
|
||||
new bx_shadow_num_c(list, "last_real_time", &last_real_time);
|
||||
new bx_shadow_num_c(list, "total_real_usec", &total_real_usec);
|
||||
new bx_shadow_num_c(list, "last_realtime_delta", &last_realtime_delta);
|
||||
new bx_shadow_num_c(list, "last_usec", &last_usec);
|
||||
new bx_shadow_num_c(list, "usec_per_second", &usec_per_second);
|
||||
new bx_shadow_num_c(list, "stored_delta", &stored_delta);
|
||||
new bx_shadow_num_c(list, "last_system_usec", &last_system_usec);
|
||||
new bx_shadow_num_c(list, "em_last_realtime", &em_last_realtime);
|
||||
new bx_shadow_num_c(list, "total_ticks", &total_ticks);
|
||||
new bx_shadow_num_c(list, "last_realtime_ticks", &last_realtime_ticks);
|
||||
new bx_shadow_num_c(list, "ticks_per_second", &ticks_per_second);
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_virt_timer_c::timer_handler(void)
|
||||
{
|
||||
if(!virtual_timers_realtime) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// $Id: virt_timer.h,v 1.10 2006-05-27 14:02:34 sshwarts Exp $
|
||||
// $Id: virt_timer.h,v 1.11 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -147,6 +147,10 @@ public:
|
||||
|
||||
//Initialization
|
||||
void init(void);
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void register_state(void);
|
||||
#endif
|
||||
};
|
||||
|
||||
extern bx_virt_timer_c bx_virt_timer;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.334 2006-05-14 15:47:37 vruppert Exp $
|
||||
// $Id: main.cc,v 1.335 2006-05-27 15:54:47 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -474,7 +474,7 @@ void print_usage()
|
||||
" -f configfile specify configuration file\n"
|
||||
" -q quick start (skip configuration interface)\n"
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
" -r path restore Bochs config and log options from path\n"
|
||||
" -r path restore the Bochs state from path\n"
|
||||
#endif
|
||||
" --help display this help and exit\n\n"
|
||||
"For information on Bochs configuration file arguments, see the\n"
|
||||
@ -694,17 +694,27 @@ int bx_init_main (int argc, char *argv[])
|
||||
if (!SIM->test_for_text_console())
|
||||
BX_PANIC(("Unable to start Bochs without a bochsrc.txt and without a text console"));
|
||||
else
|
||||
BX_ERROR (("Switching off quick start, because no configuration file was found."));
|
||||
BX_ERROR(("Switching off quick start, because no configuration file was found."));
|
||||
}
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_LOAD_START);
|
||||
}
|
||||
|
||||
// parse the rest of the command line. This is done after reading the
|
||||
// configuration file so that the command line arguments can override
|
||||
// the settings from the file.
|
||||
if (bx_parse_cmdline (arg, argc, argv)) {
|
||||
BX_PANIC(("There were errors while parsing the command line"));
|
||||
return -1;
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
|
||||
if (arg < argc) {
|
||||
BX_ERROR(("WARNING: bochsrc options are ignored in restore mode!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// parse the rest of the command line. This is done after reading the
|
||||
// configuration file so that the command line arguments can override
|
||||
// the settings from the file.
|
||||
if (bx_parse_cmdline(arg, argc, argv)) {
|
||||
BX_PANIC(("There were errors while parsing the command line"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// initialize plugin system. This must happen before we attempt to
|
||||
// load any modules.
|
||||
@ -894,13 +904,15 @@ void bx_stop_simulation()
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_sr_before_save_state(void)
|
||||
{
|
||||
DEV_before_save_state();
|
||||
}
|
||||
|
||||
void bx_sr_after_restore_state(void)
|
||||
{
|
||||
#if BX_SUPPORT_SMP == 0
|
||||
BX_CPU(0)->after_restore_state();
|
||||
#else
|
||||
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++) {
|
||||
BX_CPU(i)->after_restore_state();
|
||||
}
|
||||
#endif
|
||||
DEV_after_restore_state();
|
||||
}
|
||||
#endif
|
||||
@ -1008,6 +1020,9 @@ int bx_init_hardware()
|
||||
#if BX_SUPPORT_SMP == 0
|
||||
BX_CPU(0)->initialize(BX_MEM(0));
|
||||
BX_CPU(0)->sanity_checks();
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
BX_CPU(0)->register_state();
|
||||
#endif
|
||||
BX_INSTR_INIT(0);
|
||||
#else
|
||||
bx_cpu_array = new BX_CPU_C_PTR[BX_SMP_PROCESSORS];
|
||||
@ -1016,12 +1031,16 @@ int bx_init_hardware()
|
||||
BX_CPU(i) = new BX_CPU_C(i);
|
||||
BX_CPU(i)->initialize(BX_MEM(0)); // assign local apic id in 'initialize' method
|
||||
BX_CPU(i)->sanity_checks();
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
BX_CPU(i)->register_state();
|
||||
#endif
|
||||
BX_INSTR_INIT(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
DEV_init_devices();
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
bx_pc_system.register_state();
|
||||
DEV_register_state();
|
||||
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
|
||||
SIM->restore_logopts();
|
||||
@ -1031,8 +1050,8 @@ int bx_init_hardware()
|
||||
bx_pc_system.Reset(BX_RESET_HARDWARE);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
|
||||
// SIM->restore_hardware();
|
||||
// bx_sr_after_restore_state();
|
||||
SIM->restore_hardware();
|
||||
bx_sr_after_restore_state();
|
||||
}
|
||||
#endif
|
||||
bx_gui->init_signal_handlers();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: misc_mem.cc,v 1.90 2006-04-29 16:55:22 sshwarts Exp $
|
||||
// $Id: misc_mem.cc,v 1.91 2006-05-27 15:54:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -94,7 +94,7 @@ void BX_MEM_C::init_memory(int memsize)
|
||||
{
|
||||
int idx;
|
||||
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.90 2006-04-29 16:55:22 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.91 2006-05-27 15:54:49 sshwarts Exp $"));
|
||||
// you can pass 0 if memory has been allocated already through
|
||||
// the constructor, or the desired size of memory if it hasn't
|
||||
|
||||
@ -128,6 +128,11 @@ void BX_MEM_C::init_memory(int memsize)
|
||||
|
||||
// accept only memory size which is multiply of 1M
|
||||
BX_ASSERT((len & 0xfffff) == 0);
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "memory", "Memory State");
|
||||
new bx_shadow_data_c(list, "ram", BX_MEM_THIS vector, BX_MEM_THIS len);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_APIC
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.cc,v 1.58 2006-05-27 14:02:34 sshwarts Exp $
|
||||
// $Id: pc_system.cc,v 1.59 2006-05-27 15:54:47 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -224,6 +224,33 @@ void bx_pc_system_c::exit(void)
|
||||
if (bx_gui) bx_gui->exit();
|
||||
}
|
||||
|
||||
#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);
|
||||
bx_list_c *timers = new bx_list_c(list, "timer", numTimers);
|
||||
for (i = 0; i < numTimers; i++) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ================================================
|
||||
// Bochs internal timer delivery framework features
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.h,v 1.38 2006-05-27 14:02:34 sshwarts Exp $
|
||||
// $Id: pc_system.h,v 1.39 2006-05-27 15:54:47 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -176,6 +176,9 @@ public:
|
||||
bx_bool get_enable_a20(void);
|
||||
void MemoryMappingChanged(void); // flush TLB in all CPUs
|
||||
void exit(void);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void register_state(void);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.cc,v 1.17 2006-04-15 17:03:59 vruppert Exp $
|
||||
// $Id: plugin.cc,v 1.18 2006-05-27 15:54:47 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file defines the plugin and plugin-device registration functions and
|
||||
@ -622,19 +622,6 @@ void bx_plugins_register_state()
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* Plugin system: Execute code before saving state of all plugin devices */
|
||||
/**************************************************************************/
|
||||
|
||||
void bx_plugins_before_save_state()
|
||||
{
|
||||
device_t *device;
|
||||
for (device = devices; device; device = device->next)
|
||||
{
|
||||
device->devmodel->before_save_state();
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/* Plugin system: Execute code after restoring state of all plugin devices */
|
||||
/***************************************************************************/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.h,v 1.51 2006-04-15 17:03:59 vruppert Exp $
|
||||
// $Id: plugin.h,v 1.52 2006-05-27 15:54:47 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file provides macros and types needed for plugins. It is based on
|
||||
@ -54,7 +54,6 @@ extern "C" {
|
||||
#define DEV_init_devices() {bx_devices.init(BX_MEM(0)); }
|
||||
#define DEV_reset_devices(type) {bx_devices.reset(type); }
|
||||
#define DEV_register_state() {bx_devices.register_state(); }
|
||||
#define DEV_before_save_state() {bx_devices.before_save_state(); }
|
||||
#define DEV_after_restore_state() {bx_devices.after_restore_state(); }
|
||||
#define PLUG_load_plugin(name,type) {bx_load_plugin(#name,type);}
|
||||
|
||||
@ -77,7 +76,6 @@ extern "C" {
|
||||
#define DEV_init_devices() {bx_devices.init(BX_MEM(0)); }
|
||||
#define DEV_reset_devices(type) {bx_devices.reset(type); }
|
||||
#define DEV_register_state() {bx_devices.register_state(); }
|
||||
#define DEV_before_save_state() {bx_devices.before_save_state(); }
|
||||
#define DEV_after_restore_state() {bx_devices.after_restore_state(); }
|
||||
// When plugins are off, PLUG_load_plugin will call the plugin_init function
|
||||
// directly.
|
||||
@ -341,7 +339,6 @@ extern void bx_init_plugins(void);
|
||||
extern void bx_reset_plugins(unsigned);
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
extern void bx_plugins_register_state();
|
||||
extern void bx_plugins_before_save_state();
|
||||
extern void bx_plugins_after_restore_state();
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user