- get rid of the unused description field of shadow bool and data parameters

(new/modified constructor)
- new constructor for bx_list_c objects without title
- shadow parameter bitmasks fixed
- functions bx_sr_before_save_state() and bx_sr_after_restore_state() prepared
- ne2k.cc: reset behaviour fixes
- sb16: some variable types changed
This commit is contained in:
Volker Ruppert 2006-05-14 15:47:37 +00:00
parent 0a953ffa75
commit 6a299e61a7
6 changed files with 112 additions and 65 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.192 2006-03-13 18:55:52 vruppert Exp $
// $Id: bochs.h,v 1.193 2006-05-14 15:47:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -107,6 +107,9 @@ extern "C" {
// prototypes
int bx_begin_simulation(int argc, char *argv[]);
void bx_stop_simulation();
#if BX_SUPPORT_SAVE_RESTORE
void bx_sr_before_save_state();
#endif
char *bx_find_bochsrc(void);
int bx_parse_cmdline(int arg, int argc, char *argv[]);
int bx_read_configuration(const char *rcfile);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.145 2006-05-01 18:24:47 vruppert Exp $
// $Id: siminterface.cc,v 1.146 2006-05-14 15:47:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// See siminterface.h for description of the siminterface concept.
@ -865,7 +865,7 @@ bx_bool bx_real_sim_c::save_state(const char *checkpoint_path)
int type, ntype = SIM->get_max_log_level();
FILE *fp;
DEV_before_save_state();
bx_sr_before_save_state();
sprintf(sr_file, "%s/config", checkpoint_path);
write_rc(sr_file, 1);
sprintf(sr_file, "%s/logopts", checkpoint_path);
@ -1350,7 +1350,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 64;
this->lowbit = lowbit;
this->mask = (1 << (highbit - lowbit)) - 1;
this->mask = ((BX_MAX_BIT64S >> (63 - (highbit - lowbit))) << lowbit);
val.p64bit = ptr_to_real_val;
if (base == 16) {
this->base = base;
@ -1370,7 +1370,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 64;
this->lowbit = lowbit;
this->mask = (1 << (highbit - lowbit)) - 1;
this->mask = ((BX_MAX_BIT64U >> (63 - (highbit - lowbit))) << lowbit);
val.p64bit = (Bit64s*) ptr_to_real_val;
if (base == 16) {
this->base = base;
@ -1390,7 +1390,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 16;
this->lowbit = lowbit;
this->mask = (1 << (highbit - lowbit)) - 1;
this->mask = ((BX_MAX_BIT32S >> (31 - (highbit - lowbit))) << lowbit);
val.p32bit = ptr_to_real_val;
if (base == 16) {
this->base = base;
@ -1410,7 +1410,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 32;
this->lowbit = lowbit;
this->mask = (1 << (highbit - lowbit)) - 1;
this->mask = ((BX_MAX_BIT32U >> (31 - (highbit - lowbit))) << lowbit);
val.p32bit = (Bit32s*) ptr_to_real_val;
if (base == 16) {
this->base = base;
@ -1430,7 +1430,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 16;
this->lowbit = lowbit;
this->mask = (1 << (highbit - lowbit)) - 1;
this->mask = ((BX_MAX_BIT16S >> (15 - (highbit - lowbit))) << lowbit);
val.p16bit = ptr_to_real_val;
if (base == 16) {
this->base = base;
@ -1450,7 +1450,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 16;
this->lowbit = lowbit;
this->mask = (1 << (highbit - lowbit)) - 1;
this->mask = ((BX_MAX_BIT16U >> (15 - (highbit - lowbit))) << lowbit);
val.p16bit = (Bit16s*) ptr_to_real_val;
if (base == 16) {
this->base = base;
@ -1470,6 +1470,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 16;
this->lowbit = lowbit;
this->mask = ((BX_MAX_BIT8S >> (7 - (highbit - lowbit))) << lowbit);
this->mask = (1 << (highbit - lowbit)) - 1;
val.p8bit = ptr_to_real_val;
if (base == 16) {
@ -1490,7 +1491,7 @@ bx_shadow_num_c::bx_shadow_num_c(bx_param_c *parent,
{
this->varsize = 8;
this->lowbit = lowbit;
this->mask = (1 << (highbit - lowbit)) - 1;
this->mask = ((BX_MAX_BIT8U >> (7 - (highbit - lowbit))) << lowbit);
val.p8bit = (Bit8s*) ptr_to_real_val;
if (base == 16) {
this->base = base;
@ -1579,6 +1580,16 @@ bx_shadow_bool_c::bx_shadow_bool_c(bx_param_c *parent,
this->bitnum = bitnum;
}
bx_shadow_bool_c::bx_shadow_bool_c(bx_param_c *parent,
char *name,
bx_bool *ptr_to_real_val,
Bit8u bitnum)
: bx_param_bool_c(parent, name, NULL, NULL, (Bit64s) *ptr_to_real_val, 1)
{
val.pbool = ptr_to_real_val;
this->bitnum = bitnum;
}
Bit64s bx_shadow_bool_c::get64() {
if (handler) {
// the handler can decide what value to return and/or do some side effect
@ -1773,10 +1784,9 @@ void bx_param_string_c::set_initial_val(char *buf) {
#if BX_SUPPORT_SAVE_RESTORE
bx_shadow_data_c::bx_shadow_data_c(bx_param_c *parent,
char *name,
char *description,
Bit8u *ptr_to_data,
Bit32u data_size)
: bx_param_c(SIM->gen_param_id(), name, description)
: bx_param_c(SIM->gen_param_id(), name, "")
{
set_type(BXT_PARAM_DATA);
this->data_ptr = ptr_to_data;
@ -1805,6 +1815,22 @@ bx_list_c::bx_list_c(bx_param_c *parent, int maxsize)
init("");
}
bx_list_c::bx_list_c(bx_param_c *parent, char *name, int maxsize)
: bx_param_c(SIM->gen_param_id(), name, "")
{
set_type (BXT_LIST);
this->size = 0;
this->maxsize = maxsize;
this->list = new bx_param_c* [maxsize];
this->parent = NULL;
if (parent) {
BX_ASSERT(parent->get_type() == BXT_LIST);
this->parent = (bx_list_c *)parent;
this->parent->add(this);
}
init("");
}
bx_list_c::bx_list_c(bx_param_c *parent, char *name, char *title,
int maxsize)
: bx_param_c(SIM->gen_param_id(), name, "")

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.189 2006-05-01 18:24:47 vruppert Exp $
// $Id: siminterface.h,v 1.190 2006-05-14 15:47:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Intro to siminterface by Bryce Denney:
@ -791,6 +791,10 @@ public:
char *label,
bx_bool *ptr_to_real_val,
Bit8u bitnum = 0);
bx_shadow_bool_c(bx_param_c *parent,
char *name,
bx_bool *ptr_to_real_val,
Bit8u bitnum = 0);
virtual Bit64s get64();
virtual void set(Bit64s val);
};
@ -879,7 +883,6 @@ class BOCHSAPI bx_shadow_data_c : public bx_param_c {
public:
bx_shadow_data_c(bx_param_c *parent,
char *name,
char *description,
Bit8u *ptr_to_data,
Bit32u data_size);
Bit8u *getptr() {return data_ptr;}
@ -931,6 +934,7 @@ public:
SHOW_GROUP_NAME = (1<<4)
} bx_listopt_bits;
bx_list_c(bx_param_c *parent, int maxsize = BX_DEFAULT_LIST_SIZE);
bx_list_c(bx_param_c *parent, char *name, int maxsize = BX_DEFAULT_LIST_SIZE);
bx_list_c(bx_param_c *parent, char *name, char *title, int maxsize = BX_DEFAULT_LIST_SIZE);
bx_list_c(bx_param_c *parent, char *name, char *title, bx_param_c **init_list);
virtual ~bx_list_c();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ne2k.cc,v 1.85 2006-05-01 18:24:47 vruppert Exp $
// $Id: ne2k.cc,v 1.86 2006-05-14 15:47:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -76,48 +76,50 @@ bx_ne2k_c::~bx_ne2k_c()
//
void bx_ne2k_c::reset(unsigned type)
{
BX_DEBUG (("reset"));
// Zero out registers and memory
memset( & BX_NE2K_THIS s.CR, 0, sizeof(BX_NE2K_THIS s.CR) );
memset( & BX_NE2K_THIS s.ISR, 0, sizeof(BX_NE2K_THIS s.ISR));
memset( & BX_NE2K_THIS s.IMR, 0, sizeof(BX_NE2K_THIS s.IMR));
memset( & BX_NE2K_THIS s.DCR, 0, sizeof(BX_NE2K_THIS s.DCR));
memset( & BX_NE2K_THIS s.TCR, 0, sizeof(BX_NE2K_THIS s.TCR));
memset( & BX_NE2K_THIS s.TSR, 0, sizeof(BX_NE2K_THIS s.TSR));
memset( & BX_NE2K_THIS s.RCR, 0, sizeof(BX_NE2K_THIS s.RCR));
memset( & BX_NE2K_THIS s.RSR, 0, sizeof(BX_NE2K_THIS s.RSR));
BX_NE2K_THIS s.local_dma = 0;
BX_NE2K_THIS s.page_start = 0;
BX_NE2K_THIS s.page_stop = 0;
BX_NE2K_THIS s.bound_ptr = 0;
BX_NE2K_THIS s.tx_page_start = 0;
BX_NE2K_THIS s.num_coll = 0;
BX_NE2K_THIS s.tx_bytes = 0;
BX_NE2K_THIS s.fifo = 0;
BX_NE2K_THIS s.remote_dma = 0;
BX_NE2K_THIS s.remote_start = 0;
BX_NE2K_THIS s.remote_bytes = 0;
BX_NE2K_THIS s.tallycnt_0 = 0;
BX_NE2K_THIS s.tallycnt_1 = 0;
BX_NE2K_THIS s.tallycnt_2 = 0;
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));
memset(&BX_NE2K_THIS s.IMR, 0, sizeof(BX_NE2K_THIS s.IMR));
memset(&BX_NE2K_THIS s.DCR, 0, sizeof(BX_NE2K_THIS s.DCR));
memset(&BX_NE2K_THIS s.TCR, 0, sizeof(BX_NE2K_THIS s.TCR));
memset(&BX_NE2K_THIS s.TSR, 0, sizeof(BX_NE2K_THIS s.TSR));
memset(&BX_NE2K_THIS s.RCR, 0, sizeof(BX_NE2K_THIS s.RCR));
memset(&BX_NE2K_THIS s.RSR, 0, sizeof(BX_NE2K_THIS s.RSR));
BX_NE2K_THIS s.local_dma = 0;
BX_NE2K_THIS s.page_start = 0;
BX_NE2K_THIS s.page_stop = 0;
BX_NE2K_THIS s.bound_ptr = 0;
BX_NE2K_THIS s.tx_page_start = 0;
BX_NE2K_THIS s.num_coll = 0;
BX_NE2K_THIS s.tx_bytes = 0;
BX_NE2K_THIS s.fifo = 0;
BX_NE2K_THIS s.remote_dma = 0;
BX_NE2K_THIS s.remote_start = 0;
BX_NE2K_THIS s.remote_bytes = 0;
BX_NE2K_THIS s.tallycnt_0 = 0;
BX_NE2K_THIS s.tallycnt_1 = 0;
BX_NE2K_THIS s.tallycnt_2 = 0;
memset( & BX_NE2K_THIS s.physaddr, 0, sizeof(BX_NE2K_THIS s.physaddr));
memset( & BX_NE2K_THIS s.mchash, 0, sizeof(BX_NE2K_THIS s.mchash));
BX_NE2K_THIS s.curr_page = 0;
memset(&BX_NE2K_THIS s.physaddr, 0, sizeof(BX_NE2K_THIS s.physaddr));
memset(&BX_NE2K_THIS s.mchash, 0, sizeof(BX_NE2K_THIS s.mchash));
BX_NE2K_THIS s.curr_page = 0;
BX_NE2K_THIS s.rempkt_ptr = 0;
BX_NE2K_THIS s.localpkt_ptr = 0;
BX_NE2K_THIS s.address_cnt = 0;
BX_NE2K_THIS s.rempkt_ptr = 0;
BX_NE2K_THIS s.localpkt_ptr = 0;
BX_NE2K_THIS s.address_cnt = 0;
memset( & BX_NE2K_THIS s.mem, 0, sizeof(BX_NE2K_THIS s.mem));
// Set power-up conditions
BX_NE2K_THIS s.CR.stop = 1;
BX_NE2K_THIS s.CR.rdma_cmd = 4;
BX_NE2K_THIS s.ISR.reset = 1;
BX_NE2K_THIS s.DCR.longaddr = 1;
memset(&BX_NE2K_THIS s.mem, 0, sizeof(BX_NE2K_THIS s.mem));
set_irq_level(0);
// Set power-up conditions
BX_NE2K_THIS s.CR.stop = 1;
BX_NE2K_THIS s.CR.rdma_cmd = 4;
BX_NE2K_THIS s.DCR.longaddr = 1;
set_irq_level(0);
}
memset(&BX_NE2K_THIS s.ISR, 0, sizeof(BX_NE2K_THIS s.ISR));
BX_NE2K_THIS s.ISR.reset = 1;
}
//
@ -407,7 +409,7 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit32u value, unsigned io_len)
break;
case 0xf: // Reset register
theNE2kDevice->reset(BX_RESET_SOFTWARE);
// end of reset pulse
break;
default: // this is invalid, but happens under win95 device detection
@ -1279,7 +1281,7 @@ void bx_ne2k_c::init(void)
char devname[16];
bx_list_c *base;
BX_DEBUG(("Init $Id: ne2k.cc,v 1.85 2006-05-01 18:24:47 vruppert Exp $"));
BX_DEBUG(("Init $Id: ne2k.cc,v 1.86 2006-05-14 15:47:37 vruppert Exp $"));
// Read in values from config interface
base = (bx_list_c*) SIM->get_param(BXPN_NE2K);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sb16.h,v 1.25 2006-05-06 15:19:57 sshwarts Exp $
// $Id: sb16.h,v 1.26 2006-05-14 15:47:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -226,9 +226,9 @@ private:
int bankmsb[BX_SB16_PATCHTABLESIZE]; // current patch lists
int program[BX_SB16_PATCHTABLESIZE];
int outputinit, timer_handle;
int current_timer; // no. of delta times passed
int timer_handle, current_timer; // no. of delta times passed
Bit32u last_delta_time; // timer value at last command
bx_bool outputinit;
} mpu401;
// the DSP variables
@ -250,17 +250,17 @@ private:
// issigned= 0: unsigned data, 1: signed data
// highspeed= 0: normal mode, 1: highspeed mode (only SBPro)
// timer= so many us between data bytes
int mode, bits, fifo, output, bps;
int stereo, issigned, highspeed, format, timer;
int mode, bits, bps, format, timer;
bx_bool fifo, output, stereo, issigned, highspeed;
Bit16u count; // bytes remaining in this transfer
Bit8u *chunk; // buffers up to BX_SB16_WAVEPACKETSIZE bytes
Bit8u *chunk; // buffers up to BX_SOUND_OUTPUT_WAVEPACKETSIZE bytes
int chunkindex; // index into the buffer
int chunkcount; // for input: size of the recorded input
Bit16u timeconstant;
Bit16u blocklength, samplerate;
} dma;
int timer_handle; // handle for the DMA timer
int outputinit; // have the output functions been initialized
bx_bool outputinit; // have the output functions been initialized
} dsp;
// the ASP/CSP registers
@ -303,7 +303,7 @@ private:
struct bx_sb16_emul_struct {
bx_sb16_buffer datain, dataout;
bx_sb16_ins_map remaplist[256];
int remaps;
Bit16u remaps;
} emuldata;
/* DMA input and output, 8 and 16 bit */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.333 2006-04-29 07:12:13 sshwarts Exp $
// $Id: main.cc,v 1.334 2006-05-14 15:47:37 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -893,6 +893,18 @@ void bx_stop_simulation()
// the cpu loop will exit very soon after this condition is set.
}
#if BX_SUPPORT_SAVE_RESTORE
void bx_sr_before_save_state(void)
{
DEV_before_save_state();
}
void bx_sr_after_restore_state(void)
{
DEV_after_restore_state();
}
#endif
int bx_init_hardware()
{
// all configuration has been read, now initialize everything.
@ -1020,7 +1032,7 @@ int bx_init_hardware()
#if BX_SUPPORT_SAVE_RESTORE
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
// SIM->restore_hardware();
// DEV_after_restore_state();
// bx_sr_after_restore_state();
}
#endif
bx_gui->init_signal_handlers();