Support for restore cpu (and any other device from bochs root) from debugger
This commit is contained in:
parent
834904f49b
commit
e9801ef501
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dbg_main.cc,v 1.101 2007-10-14 00:23:06 sshwarts Exp $
|
||||
// $Id: dbg_main.cc,v 1.102 2007-10-14 19:04:48 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -52,6 +52,7 @@ unsigned dbg_cpu = 0;
|
||||
bx_list_c *dbg_cpu_list = 0;
|
||||
|
||||
extern const char* cpu_mode_string(unsigned cpu_mode);
|
||||
extern void bx_sr_after_restore_state(void);
|
||||
|
||||
static bx_param_bool_c *sim_running = NULL;
|
||||
|
||||
@ -166,7 +167,7 @@ int bx_dbg_main(void)
|
||||
bx_debugger.default_addr = 0;
|
||||
bx_debugger.next_bpoint_id = 1;
|
||||
|
||||
dbg_cpu_list = (bx_list_c*) SIM->get_param("cpu.0", SIM->get_bochs_root());
|
||||
dbg_cpu_list = (bx_list_c*) SIM->get_param("cpu0", SIM->get_bochs_root());
|
||||
|
||||
// Open debugger log file if needed
|
||||
if ((strlen(SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr()) > 0)
|
||||
@ -500,14 +501,14 @@ void bx_dbg_exit(int code)
|
||||
void bx_dbg_print_sse_state(void)
|
||||
{
|
||||
#if BX_SUPPORT_SSE
|
||||
Bit32u mxcsr = SIM->get_param_num("sse.mxcsr", dbg_cpu_list)->get();
|
||||
Bit32u mxcsr = SIM->get_param_num("SSE.mxcsr", dbg_cpu_list)->get();
|
||||
dbg_printf("MXCSR: 0x%08x\n", mxcsr);
|
||||
|
||||
char param_name[20];
|
||||
for(unsigned i=0;i<BX_XMM_REGISTERS;i++) {
|
||||
sprintf(param_name, "sse.xmm%02d_hi", i);
|
||||
sprintf(param_name, "SSE.xmm%02d_hi", i);
|
||||
Bit64u hi = SIM->get_param_num(param_name, dbg_cpu_list)->get();
|
||||
sprintf(param_name, "sse.xmm%02d_lo", i);
|
||||
sprintf(param_name, "SSE.xmm%02d_lo", i);
|
||||
Bit64u lo = SIM->get_param_num(param_name, dbg_cpu_list)->get();
|
||||
dbg_printf("XMM[%02u]: %08x%08x:%08x%08x\n", i,
|
||||
GET32H(hi), GET32L(hi), GET32H(lo), GET32L(lo));
|
||||
@ -521,9 +522,8 @@ void bx_dbg_print_mmx_state(void)
|
||||
{
|
||||
#if BX_SUPPORT_MMX
|
||||
char param_name[20];
|
||||
|
||||
for(unsigned i=0;i<8;i++) {
|
||||
sprintf(param_name, "fpu.st%d.fraction", i);
|
||||
sprintf(param_name, "FPU.st%d.fraction", i);
|
||||
Bit64u mmreg = SIM->get_param_num(param_name, dbg_cpu_list)->get();
|
||||
dbg_printf("MM[%d]: %08x:%08x\n", i, GET32H(mmreg), GET32L(mmreg));
|
||||
}
|
||||
@ -1094,9 +1094,6 @@ void bx_dbg_show_command(const char* arg)
|
||||
void bx_dbg_show_param_command(char *param)
|
||||
{
|
||||
// remove leading and trailing quotas
|
||||
if (param[0]=='\"') param++;
|
||||
unsigned len = strlen(param);
|
||||
if (param[len - 1] == '\"') param[len - 1] = '\0';
|
||||
dbg_printf("show param name: <%s>\n", param);
|
||||
print_tree(SIM->get_param(param, SIM->get_bochs_root()), 0);
|
||||
}
|
||||
@ -2406,7 +2403,7 @@ void bx_dbg_set_symbol_command(char *symbol, Bit32u val)
|
||||
return;
|
||||
}
|
||||
char cpu_param_name[10];
|
||||
sprintf(cpu_param_name, "cpu.%d", val);
|
||||
sprintf(cpu_param_name, "cpu%d", val);
|
||||
dbg_cpu_list = (bx_list_c*) SIM->get_param(cpu_param_name, SIM->get_bochs_root());
|
||||
dbg_cpu = val;
|
||||
return;
|
||||
@ -2464,209 +2461,17 @@ void bx_dbg_query_command(const char *what)
|
||||
}
|
||||
}
|
||||
|
||||
void bx_dbg_set_cpu_command(void)
|
||||
void bx_dbg_restore_command(const char *param_name, const char *restore_path)
|
||||
{
|
||||
FILE *fp;
|
||||
int reti;
|
||||
char *rets;
|
||||
bx_bool retb;
|
||||
unsigned long ul1, ul2, ul3, ul4;
|
||||
|
||||
bx_dbg_cpu_t cpu;
|
||||
|
||||
fp = bx_infile_stack[bx_infile_stack_index].fp;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "eax:0x%lx", &ul1); cpu.eax = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "ebx:0x%lx", &ul1); cpu.ebx = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "ecx:0x%lx", &ul1); cpu.ecx = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "edx:0x%lx", &ul1); cpu.edx = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "ebp:0x%lx", &ul1); cpu.ebp = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "esi:0x%lx", &ul1); cpu.esi = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "edi:0x%lx", &ul1); cpu.edi = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "esp:0x%lx", &ul1); cpu.esp = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "eflags:0x%lx", &ul1); cpu.eflags = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "eip:0x%lx", &ul1); cpu.eip = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "cs:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.cs.sel = (Bit16u) ul1;
|
||||
cpu.cs.des_l = ul2;
|
||||
cpu.cs.des_h = ul3;
|
||||
cpu.cs.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "ss:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.ss.sel = (Bit16u) ul1;
|
||||
cpu.ss.des_l = ul2;
|
||||
cpu.ss.des_h = ul3;
|
||||
cpu.ss.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "ds:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.ds.sel = (Bit16u) ul1;
|
||||
cpu.ds.des_l = ul2;
|
||||
cpu.ds.des_h = ul3;
|
||||
cpu.ds.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "es:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.es.sel = (Bit16u) ul1;
|
||||
cpu.es.des_l = ul2;
|
||||
cpu.es.des_h = ul3;
|
||||
cpu.es.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "fs:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.fs.sel = (Bit16u) ul1;
|
||||
cpu.fs.des_l = ul2;
|
||||
cpu.fs.des_h = ul3;
|
||||
cpu.fs.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "gs:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.gs.sel = (Bit16u) ul1;
|
||||
cpu.gs.des_l = ul2;
|
||||
cpu.gs.des_h = ul3;
|
||||
cpu.gs.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "ldtr:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.ldtr.sel = (Bit16u) ul1;
|
||||
cpu.ldtr.des_l = ul2;
|
||||
cpu.ldtr.des_h = ul3;
|
||||
cpu.ldtr.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "tr:s=0x%lx, dl=0x%lx, dh=0x%lx, valid=%lu",
|
||||
&ul1, &ul2, &ul3, &ul4);
|
||||
cpu.tr.sel = (Bit16u) ul1;
|
||||
cpu.tr.des_l = ul2;
|
||||
cpu.tr.des_h = ul3;
|
||||
cpu.tr.valid = ul4;
|
||||
if (reti != 4) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "gdtr:base=0x%lx, limit=0x%lx",
|
||||
&ul1, &ul2);
|
||||
cpu.gdtr.base = ul1;
|
||||
cpu.gdtr.limit = ul2;
|
||||
if (reti != 2) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "idtr:base=0x%lx, limit=0x%lx",
|
||||
&ul1, &ul2);
|
||||
cpu.idtr.base = ul1;
|
||||
cpu.idtr.limit = ul2;
|
||||
if (reti != 2) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "dr0:0x%lx", &ul1); cpu.dr0 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "dr1:0x%lx", &ul1); cpu.dr1 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "dr2:0x%lx", &ul1); cpu.dr2 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "dr3:0x%lx", &ul1); cpu.dr3 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "dr6:0x%lx", &ul1); cpu.dr6 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "dr7:0x%lx", &ul1); cpu.dr7 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "cr0:0x%lx", &ul1); cpu.cr0 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "cr1:0x%lx", &ul1); cpu.cr1 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "cr2:0x%lx", &ul1); cpu.cr2 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "cr3:0x%lx", &ul1); cpu.cr3 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "cr4:0x%lx", &ul1); cpu.cr4 = ul1;
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "inhibit_mask:%u", &cpu.inhibit_mask);
|
||||
if (reti != 1) goto scanf_error;
|
||||
|
||||
rets = fgets(tmp_buf, 512, fp); if (!rets) goto eof_error;
|
||||
reti = sscanf(tmp_buf, "done");
|
||||
if (reti != 0) goto scanf_error;
|
||||
|
||||
retb = BX_CPU(dbg_cpu)->dbg_set_cpu(&cpu);
|
||||
if (retb == 0)
|
||||
dbg_printf("Error: dbg_set_cpu encountered error\n");
|
||||
else
|
||||
dbg_printf("OK\n");
|
||||
return;
|
||||
|
||||
eof_error:
|
||||
dbg_printf("Error: EOF encountered in dbg_set_cpu input stream\n");
|
||||
return;
|
||||
|
||||
scanf_error:
|
||||
dbg_printf("Error: scanf returned error in dbg_set_cpu input stream\n");
|
||||
const char *path = (restore_path == NULL) ? "." : restore_path;
|
||||
dbg_printf("restoring param (%s) state from file (%s/%s)\n",
|
||||
param_name, path, param_name);
|
||||
if (! SIM->restore_bochs_param(SIM->get_bochs_root(), path, param_name)) {
|
||||
dbg_printf("Error: error occured during restore\n");
|
||||
}
|
||||
else {
|
||||
bx_sr_after_restore_state();
|
||||
}
|
||||
}
|
||||
|
||||
void bx_dbg_disassemble_current(const char *format)
|
||||
@ -3350,7 +3155,9 @@ void bx_dbg_print_help(void)
|
||||
dbg_printf(" bpe, bpd, d|del|delete\n");
|
||||
dbg_printf("-*- CPU and memory contents -*-\n");
|
||||
dbg_printf(" x, xp, u|disasm|disassemble, r|reg|regs|registers, setpmem, crc, info,\n");
|
||||
dbg_printf(" page, set, dump_cpu, set_cpu, ptime, print-stack, watch, unwatch, ?|calc\n");
|
||||
dbg_printf(" page, set, dump_cpu, ptime, print-stack, watch, unwatch, ?|calc\n");
|
||||
dbg_printf("-*- Working with bochs param tree -*-\n");
|
||||
dbg_printf(" show \"param\", restore\n");
|
||||
}
|
||||
|
||||
void bx_dbg_calc_command(Bit64u value)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: debug.h,v 1.34 2007-10-12 22:11:25 sshwarts Exp $
|
||||
// $Id: debug.h,v 1.35 2007-10-14 19:04:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -236,7 +236,6 @@ void bx_dbg_where_command(void);
|
||||
void bx_dbg_print_string_command(bx_address addr);
|
||||
void bx_dbg_xlate_address(bx_lin_address address);
|
||||
void bx_dbg_show_command(const char*);
|
||||
void bx_dbg_show_param_command(char *param);
|
||||
void bx_dbg_print_stack_command(unsigned nwords);
|
||||
void bx_dbg_watch(int read, bx_phy_address address);
|
||||
void bx_dbg_unwatch(int read, bx_phy_address address);
|
||||
@ -278,7 +277,6 @@ void bx_dbg_setpmem_command(bx_phy_address addr, unsigned len, Bit32u val);
|
||||
void bx_dbg_query_command(const char *);
|
||||
void bx_dbg_take_command(const char *, unsigned n);
|
||||
void bx_dbg_dump_cpu_command(void);
|
||||
void bx_dbg_set_cpu_command(void);
|
||||
void bx_dbg_disassemble_current(const char *);
|
||||
void bx_dbg_disassemble_command(const char *, Bit64u from, Bit64u to);
|
||||
void bx_dbg_instrument_command(const char *);
|
||||
@ -295,6 +293,10 @@ void bx_dbg_dump_table(void);
|
||||
void bx_dbg_exception(unsigned cpu, Bit8u vector, Bit16u error_code);
|
||||
void bx_dbg_interrupt(unsigned cpu, Bit8u vector, Bit16u error_code);
|
||||
|
||||
// commands that work with Bochs param tree
|
||||
void bx_dbg_restore_command(const char *param_name, const char *path);
|
||||
void bx_dbg_show_param_command(char *param);
|
||||
|
||||
int bx_dbg_show_symbolic(void);
|
||||
void bx_dbg_set_symbol_command(char *symbol, Bit32u val);
|
||||
char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
%{
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: lexer.l,v 1.20 2007-10-11 18:11:58 sshwarts Exp $
|
||||
// $Id: lexer.l,v 1.21 2007-10-14 19:04:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -96,6 +96,7 @@ exit |
|
||||
q { bxlval.sval = strdup(bxtext); return(BX_TOKEN_QUIT); }
|
||||
x |
|
||||
xp { BEGIN(EXAMINE); bxlval.sval = strdup(bxtext); return(BX_TOKEN_EXAMINE); }
|
||||
restore { bxlval.sval = strdup(bxtext); return(BX_TOKEN_RESTORE); }
|
||||
setpmem { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SETPMEM); }
|
||||
query { bxlval.sval = strdup(bxtext); return(BX_TOKEN_QUERY); }
|
||||
pending { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PENDING); }
|
||||
@ -103,7 +104,6 @@ take { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TAKE); }
|
||||
dma { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DMA); }
|
||||
irq { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IRQ); }
|
||||
pic { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PIC); }
|
||||
set_cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SET_CPU); }
|
||||
u |
|
||||
disasm |
|
||||
disassemble { BEGIN(DISASM); bxlval.sval = strdup(bxtext); return(BX_TOKEN_DISASSEMBLE); }
|
||||
@ -231,8 +231,8 @@ calc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CALC); }
|
||||
"!" { return ('!'); }
|
||||
"(" { return ('('); }
|
||||
")" { return (')'); }
|
||||
\'([^\\\'\n]|(\\.))*\' |
|
||||
\"([^\\\"\n]|(\\.))*\" { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STRING); }
|
||||
\'([^\\\'\n]|(\\.))*\' | /* throw away leading and trailing \" */
|
||||
\"([^\\\"\n]|(\\.))*\" { bxlval.sval = strdup(bxtext+1); bxlval.sval[strlen(bxlval.sval)-1] = 0; return(BX_TOKEN_STRING); }
|
||||
0x[0-9a-fA-F]+ { bxlval.uval = strtoull(bxtext, NULL, 16); return(BX_TOKEN_NUMERIC); }
|
||||
0[0-7]+ { bxlval.uval = strtoull(bxtext, NULL, 8); return(BX_TOKEN_NUMERIC); }
|
||||
[0-9]+ { bxlval.uval = strtoull(bxtext, NULL, 10); return(BX_TOKEN_NUMERIC); }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -86,15 +86,15 @@
|
||||
BX_TOKEN_EXAMINE = 302,
|
||||
BX_TOKEN_XFORMAT = 303,
|
||||
BX_TOKEN_DISFORMAT = 304,
|
||||
BX_TOKEN_SETPMEM = 305,
|
||||
BX_TOKEN_SYMBOLNAME = 306,
|
||||
BX_TOKEN_QUERY = 307,
|
||||
BX_TOKEN_PENDING = 308,
|
||||
BX_TOKEN_TAKE = 309,
|
||||
BX_TOKEN_DMA = 310,
|
||||
BX_TOKEN_IRQ = 311,
|
||||
BX_TOKEN_DUMP_CPU = 312,
|
||||
BX_TOKEN_SET_CPU = 313,
|
||||
BX_TOKEN_RESTORE = 305,
|
||||
BX_TOKEN_SETPMEM = 306,
|
||||
BX_TOKEN_SYMBOLNAME = 307,
|
||||
BX_TOKEN_QUERY = 308,
|
||||
BX_TOKEN_PENDING = 309,
|
||||
BX_TOKEN_TAKE = 310,
|
||||
BX_TOKEN_DMA = 311,
|
||||
BX_TOKEN_IRQ = 312,
|
||||
BX_TOKEN_DUMP_CPU = 313,
|
||||
BX_TOKEN_DISASSEMBLE = 314,
|
||||
BX_TOKEN_INSTRUMENT = 315,
|
||||
BX_TOKEN_STRING = 316,
|
||||
@ -189,15 +189,15 @@
|
||||
#define BX_TOKEN_EXAMINE 302
|
||||
#define BX_TOKEN_XFORMAT 303
|
||||
#define BX_TOKEN_DISFORMAT 304
|
||||
#define BX_TOKEN_SETPMEM 305
|
||||
#define BX_TOKEN_SYMBOLNAME 306
|
||||
#define BX_TOKEN_QUERY 307
|
||||
#define BX_TOKEN_PENDING 308
|
||||
#define BX_TOKEN_TAKE 309
|
||||
#define BX_TOKEN_DMA 310
|
||||
#define BX_TOKEN_IRQ 311
|
||||
#define BX_TOKEN_DUMP_CPU 312
|
||||
#define BX_TOKEN_SET_CPU 313
|
||||
#define BX_TOKEN_RESTORE 305
|
||||
#define BX_TOKEN_SETPMEM 306
|
||||
#define BX_TOKEN_SYMBOLNAME 307
|
||||
#define BX_TOKEN_QUERY 308
|
||||
#define BX_TOKEN_PENDING 309
|
||||
#define BX_TOKEN_TAKE 310
|
||||
#define BX_TOKEN_DMA 311
|
||||
#define BX_TOKEN_IRQ 312
|
||||
#define BX_TOKEN_DUMP_CPU 313
|
||||
#define BX_TOKEN_DISASSEMBLE 314
|
||||
#define BX_TOKEN_INSTRUMENT 315
|
||||
#define BX_TOKEN_STRING 316
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: parser.y,v 1.22 2007-10-11 18:11:58 sshwarts Exp $
|
||||
// $Id: parser.y,v 1.23 2007-10-14 19:04:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%{
|
||||
@ -68,6 +68,7 @@
|
||||
%token <sval> BX_TOKEN_EXAMINE
|
||||
%token <sval> BX_TOKEN_XFORMAT
|
||||
%token <sval> BX_TOKEN_DISFORMAT
|
||||
%token <sval> BX_TOKEN_RESTORE
|
||||
%token <sval> BX_TOKEN_SETPMEM
|
||||
%token <sval> BX_TOKEN_SYMBOLNAME
|
||||
%token <sval> BX_TOKEN_QUERY
|
||||
@ -76,7 +77,6 @@
|
||||
%token <sval> BX_TOKEN_DMA
|
||||
%token <sval> BX_TOKEN_IRQ
|
||||
%token <sval> BX_TOKEN_DUMP_CPU
|
||||
%token <sval> BX_TOKEN_SET_CPU
|
||||
%token <sval> BX_TOKEN_DISASSEMBLE
|
||||
%token <sval> BX_TOKEN_INSTRUMENT
|
||||
%token <sval> BX_TOKEN_STRING
|
||||
@ -151,10 +151,10 @@ command:
|
||||
| bpd_command
|
||||
| quit_command
|
||||
| examine_command
|
||||
| restore_command
|
||||
| setpmem_command
|
||||
| query_command
|
||||
| take_command
|
||||
| set_cpu_command
|
||||
| disassemble_command
|
||||
| instrument_command
|
||||
| doit_command
|
||||
@ -699,6 +699,14 @@ examine_command:
|
||||
}
|
||||
;
|
||||
|
||||
restore_command:
|
||||
BX_TOKEN_RESTORE BX_TOKEN_STRING BX_TOKEN_STRING '\n'
|
||||
{
|
||||
bx_dbg_restore_command($2, $3);
|
||||
free($1); free($2); free($3);
|
||||
}
|
||||
;
|
||||
|
||||
setpmem_command:
|
||||
BX_TOKEN_SETPMEM BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
|
||||
{
|
||||
@ -733,14 +741,6 @@ take_command:
|
||||
}
|
||||
;
|
||||
|
||||
set_cpu_command:
|
||||
BX_TOKEN_SET_CPU '\n'
|
||||
{
|
||||
bx_dbg_set_cpu_command();
|
||||
free($1);
|
||||
}
|
||||
;
|
||||
|
||||
disassemble_command:
|
||||
BX_TOKEN_DISASSEMBLE '\n'
|
||||
{
|
||||
@ -896,9 +896,12 @@ help_command:
|
||||
dbg_printf("dump_cpu - dump complete cpu state\n");
|
||||
free($1);free($2);
|
||||
}
|
||||
| BX_TOKEN_HELP BX_TOKEN_SET_CPU '\n'
|
||||
| BX_TOKEN_HELP BX_TOKEN_RESTORE '\n'
|
||||
{
|
||||
dbg_printf("set_cpu - set complete cpu state\n");
|
||||
dbg_printf("restore <param_name> [path] - restore bochs root param from the file\n");
|
||||
dbg_printf("for example:\n");
|
||||
dbg_printf("restore \"cpu0\" - restore CPU #0 from file \"cpu0\" in current directory\n");
|
||||
dbg_printf("restore \"cpu0\" \"/save\" - restore CPU #0 from file \"cpu0\" located in directory \"/save\"\n");
|
||||
free($1);free($2);
|
||||
}
|
||||
| BX_TOKEN_HELP BX_TOKEN_PTIME '\n'
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.175 2007-10-12 22:11:25 sshwarts Exp $
|
||||
// $Id: cpu.cc,v 1.176 2007-10-14 19:04:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -50,24 +50,16 @@ bxPageWriteStampTable pageWriteStampTable;
|
||||
|
||||
void purgeICaches(void)
|
||||
{
|
||||
#if BX_SUPPORT_SMP
|
||||
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++)
|
||||
BX_CPU(i)->iCache.purgeICacheEntries();
|
||||
#else
|
||||
BX_CPU(0)->iCache.purgeICacheEntries();
|
||||
#endif
|
||||
|
||||
pageWriteStampTable.purgeWriteStamps();
|
||||
}
|
||||
|
||||
void flushICaches(void)
|
||||
{
|
||||
#if BX_SUPPORT_SMP
|
||||
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++)
|
||||
BX_CPU(i)->iCache.flushICacheEntries();
|
||||
#else
|
||||
BX_CPU(0)->iCache.flushICacheEntries();
|
||||
#endif
|
||||
|
||||
pageWriteStampTable.resetWriteStamps();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.334 2007-10-12 19:30:51 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.335 2007-10-14 19:04:49 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1263,8 +1263,11 @@ public: // for now...
|
||||
~BX_CPU_C();
|
||||
#endif
|
||||
void initialize(BX_MEM_C *addrspace);
|
||||
void register_state(void);
|
||||
void after_restore_state(void);
|
||||
void register_state(void);
|
||||
#if BX_WITH_WX
|
||||
void register_wx_state(void);
|
||||
#endif
|
||||
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
|
||||
@ -2726,7 +2729,6 @@ public: // for now...
|
||||
BX_SMF void dbg_force_interrupt(unsigned vector);
|
||||
BX_SMF void dbg_take_dma(void);
|
||||
BX_SMF bx_bool dbg_get_cpu(bx_dbg_cpu_t *cpu);
|
||||
BX_SMF bx_bool dbg_set_cpu(bx_dbg_cpu_t *cpu);
|
||||
BX_SMF bx_bool dbg_set_reg(unsigned reg, Bit32u val);
|
||||
BX_SMF Bit32u dbg_get_reg(unsigned reg);
|
||||
BX_SMF bx_bool dbg_get_sreg(bx_dbg_sreg_t *sreg, unsigned sreg_no);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: debugstuff.cc,v 1.78 2007-10-11 18:11:59 sshwarts Exp $
|
||||
// $Id: debugstuff.cc,v 1.79 2007-10-14 19:04:50 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -511,366 +511,6 @@ bx_bool BX_CPU_C::dbg_get_cpu(bx_dbg_cpu_t *cpu)
|
||||
return(1);
|
||||
}
|
||||
|
||||
bx_bool BX_CPU_C::dbg_set_cpu(bx_dbg_cpu_t *cpu)
|
||||
{
|
||||
// returns 1=OK, 0=Error
|
||||
Bit32u type;
|
||||
|
||||
// =================================================
|
||||
// Do checks first, before setting any CPU registers
|
||||
// =================================================
|
||||
|
||||
// CS, SS, DS, ES, FS, GS descriptor checks
|
||||
if (!cpu->cs.valid) {
|
||||
BX_ERROR(("Error: CS not valid"));
|
||||
return(0); // error
|
||||
}
|
||||
if ((cpu->cs.des_h & 0x1000) == 0) {
|
||||
BX_ERROR(("Error: CS not application type"));
|
||||
return(0); // error
|
||||
}
|
||||
if ((cpu->cs.des_h & 0x0800) == 0) {
|
||||
BX_ERROR(("Error: CS not executable"));
|
||||
return(0); // error
|
||||
}
|
||||
|
||||
if (!cpu->ss.valid) {
|
||||
BX_ERROR(("Error: SS not valid"));
|
||||
return(0); // error
|
||||
}
|
||||
if ((cpu->ss.des_h & 0x1000) == 0) {
|
||||
BX_ERROR(("Error: SS not application type"));
|
||||
return(0); // error
|
||||
}
|
||||
|
||||
if (cpu->ds.valid) {
|
||||
if ((cpu->ds.des_h & 0x1000) == 0) {
|
||||
BX_ERROR(("Error: DS not application type"));
|
||||
return(0); // error
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu->es.valid) {
|
||||
if ((cpu->es.des_h & 0x1000) == 0) {
|
||||
BX_ERROR(("Error: ES not application type"));
|
||||
return(0); // error
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu->fs.valid) {
|
||||
if ((cpu->fs.des_h & 0x1000) == 0) {
|
||||
BX_ERROR(("Error: FS not application type"));
|
||||
return(0); // error
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu->gs.valid) {
|
||||
if ((cpu->gs.des_h & 0x1000) == 0) {
|
||||
BX_ERROR(("Error: GS not application type"));
|
||||
return(0); // error
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu->ldtr.valid) {
|
||||
if (cpu->ldtr.des_h & 0x1000) {
|
||||
BX_ERROR(("Error: LDTR not system type"));
|
||||
return(0); // error
|
||||
}
|
||||
if (((cpu->ldtr.des_h >> 8) & 0x0f) != BX_SYS_SEGMENT_LDT) {
|
||||
BX_ERROR(("Error: LDTR descriptor type not LDT"));
|
||||
return(0); // error
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu->tr.valid) {
|
||||
if (cpu->tr.des_h & 0x1000) {
|
||||
BX_ERROR(("Error: TR not system type"));
|
||||
return(0); // error
|
||||
}
|
||||
type = (cpu->tr.des_h >> 8) & 0x0f;
|
||||
|
||||
if ((type != 1) && (type != 9)) {
|
||||
BX_ERROR(("Error: TR descriptor type not TSS"));
|
||||
return(0); // error
|
||||
}
|
||||
}
|
||||
|
||||
// =============
|
||||
// end of checks
|
||||
// =============
|
||||
|
||||
EAX = cpu->eax;
|
||||
EBX = cpu->ebx;
|
||||
ECX = cpu->ecx;
|
||||
EDX = cpu->edx;
|
||||
EBP = cpu->ebp;
|
||||
ESI = cpu->esi;
|
||||
EDI = cpu->edi;
|
||||
ESP = cpu->esp;
|
||||
EIP = cpu->eip;
|
||||
|
||||
setEFlags(cpu->eflags);
|
||||
|
||||
// CS:
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value = cpu->cs.sel;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.index = cpu->cs.sel >> 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.ti = (cpu->cs.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl = cpu->cs.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = cpu->cs.valid;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = (cpu->cs.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = (cpu->cs.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = (cpu->cs.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.type = (cpu->cs.des_h >> 8) & 0x0f;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.base = (cpu->cs.des_l >> 16);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.base |= (cpu->cs.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.base |= (cpu->cs.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit = (cpu->cs.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit |= (cpu->cs.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.g = (cpu->cs.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b = (cpu->cs.des_h >> 22) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.avl = (cpu->cs.des_h >> 20) & 0x01;
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.g)
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled =
|
||||
(BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled =
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit;
|
||||
|
||||
#if BX_SUPPORT_ICACHE
|
||||
BX_CPU_THIS_PTR updateFetchModeMask();
|
||||
#endif
|
||||
|
||||
// SS:
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value = cpu->ss.sel;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.index = cpu->ss.sel >> 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.ti = (cpu->ss.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.rpl = cpu->ss.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = cpu->ss.valid;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p = (cpu->ss.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl = (cpu->ss.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment = (cpu->ss.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.type = (cpu->ss.des_h >> 8) & 0x0f;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.base = (cpu->ss.des_l >> 16);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.base |= (cpu->ss.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.base |= (cpu->ss.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit = (cpu->ss.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit |= (cpu->ss.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.g = (cpu->ss.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b = (cpu->ss.des_h >> 22) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.avl = (cpu->ss.des_h >> 20) & 0x01;
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.g)
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled =
|
||||
(BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled =
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit;
|
||||
|
||||
// DS:
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.value = cpu->ds.sel;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.index = cpu->ds.sel >> 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.ti = (cpu->ds.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.rpl = cpu->ds.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.valid = cpu->ds.valid;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.p = (cpu->ds.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.dpl = (cpu->ds.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.segment = (cpu->ds.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.type = (cpu->ds.des_h >> 8) & 0x0f;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.base = (cpu->ds.des_l >> 16);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.base |= (cpu->ds.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.base |= (cpu->ds.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.limit = (cpu->ds.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.limit |= (cpu->ds.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.g = (cpu->ds.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.d_b = (cpu->ds.des_h >> 22) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.avl = (cpu->ds.des_h >> 20) & 0x01;
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.g)
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.limit_scaled =
|
||||
(BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.limit_scaled =
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.limit;
|
||||
|
||||
// ES:
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.value = cpu->es.sel;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.index = cpu->es.sel >> 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.ti = (cpu->es.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.rpl = cpu->es.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.valid = cpu->es.valid;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.p = (cpu->es.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.dpl = (cpu->es.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.segment = (cpu->es.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.type = (cpu->es.des_h >> 8) & 0x0f;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.base = (cpu->es.des_l >> 16);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.base |= (cpu->es.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.base |= (cpu->es.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.limit = (cpu->es.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.limit |= (cpu->es.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.g = (cpu->es.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.d_b = (cpu->es.des_h >> 22) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.avl = (cpu->es.des_h >> 20) & 0x01;
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.g)
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.limit_scaled =
|
||||
(BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.limit_scaled =
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.limit;
|
||||
|
||||
// FS:
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value = cpu->fs.sel;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.index = cpu->fs.sel >> 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.ti = (cpu->fs.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.rpl = cpu->fs.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.valid = cpu->fs.valid;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.p = (cpu->fs.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.dpl = (cpu->fs.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.segment = (cpu->fs.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.type = (cpu->fs.des_h >> 8) & 0x0f;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.base = (cpu->fs.des_l >> 16);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.base |= (cpu->fs.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.base |= (cpu->fs.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.limit = (cpu->fs.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.limit |= (cpu->fs.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.g = (cpu->fs.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.d_b = (cpu->fs.des_h >> 22) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.avl = (cpu->fs.des_h >> 20) & 0x01;
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.g)
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.limit_scaled =
|
||||
(BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.limit_scaled =
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.limit;
|
||||
|
||||
// GS:
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value = cpu->gs.sel;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.index = cpu->gs.sel >> 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.ti = (cpu->gs.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.rpl = cpu->gs.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.valid = cpu->gs.valid;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.p = (cpu->gs.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.dpl = (cpu->gs.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.segment = (cpu->gs.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.type = (cpu->gs.des_h >> 8) & 0x0f;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.base = (cpu->gs.des_l >> 16);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.base |= (cpu->gs.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.base |= (cpu->gs.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.limit = (cpu->gs.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.limit |= (cpu->gs.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.g = (cpu->gs.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.d_b = (cpu->gs.des_h >> 22) & 0x01;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.avl = (cpu->gs.des_h >> 20) & 0x01;
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.g)
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.limit_scaled =
|
||||
(BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.limit_scaled =
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.limit;
|
||||
|
||||
// LDTR
|
||||
BX_CPU_THIS_PTR ldtr.selector.value = cpu->ldtr.sel;
|
||||
BX_CPU_THIS_PTR ldtr.selector.index = cpu->ldtr.sel >> 3;
|
||||
BX_CPU_THIS_PTR ldtr.selector.ti = (cpu->ldtr.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR ldtr.selector.rpl = cpu->ldtr.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR ldtr.cache.valid = cpu->ldtr.valid;
|
||||
BX_CPU_THIS_PTR ldtr.cache.p = (cpu->ldtr.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR ldtr.cache.dpl = (cpu->ldtr.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR ldtr.cache.segment = (cpu->ldtr.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR ldtr.cache.type = (cpu->ldtr.des_h >> 8) & 0x0f;
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.base = (cpu->ldtr.des_l >> 16);
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.base |= (cpu->ldtr.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.base |= (cpu->ldtr.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.limit = (cpu->ldtr.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.limit |= (cpu->ldtr.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.g = (cpu->ldtr.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.avl = (cpu->ldtr.des_h >> 20) & 0x01;
|
||||
|
||||
if (BX_CPU_THIS_PTR ldtr.cache.u.system.g)
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.limit_scaled =
|
||||
(BX_CPU_THIS_PTR ldtr.cache.u.system.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR ldtr.cache.u.system.limit_scaled =
|
||||
(BX_CPU_THIS_PTR ldtr.cache.u.system.limit);
|
||||
|
||||
// TR
|
||||
type = (cpu->tr.des_h >> 8) & 0x0f;
|
||||
type &= ~2; // never allow busy bit in tr.cache.type
|
||||
BX_CPU_THIS_PTR tr.selector.value = cpu->tr.sel;
|
||||
BX_CPU_THIS_PTR tr.selector.index = cpu->tr.sel >> 3;
|
||||
BX_CPU_THIS_PTR tr.selector.ti = (cpu->tr.sel >> 2) & 0x01;
|
||||
BX_CPU_THIS_PTR tr.selector.rpl = cpu->tr.sel & 0x03;
|
||||
|
||||
BX_CPU_THIS_PTR tr.cache.valid = cpu->tr.valid;
|
||||
BX_CPU_THIS_PTR tr.cache.p = (cpu->tr.des_h >> 15) & 0x01;
|
||||
BX_CPU_THIS_PTR tr.cache.dpl = (cpu->tr.des_h >> 13) & 0x03;
|
||||
BX_CPU_THIS_PTR tr.cache.segment = (cpu->tr.des_h >> 12) & 0x01;
|
||||
BX_CPU_THIS_PTR tr.cache.type = type;
|
||||
if (type == BX_SYS_SEGMENT_AVAIL_286_TSS) {
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.base = (cpu->tr.des_l >> 16);
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.base |= (cpu->tr.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.limit = (cpu->tr.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.g = 0;
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.avl = 0;
|
||||
}
|
||||
else { // type == BX_SYS_SEGMENT_AVAIL_386_TSS
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.base = (cpu->tr.des_l >> 16);
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.base |= (cpu->tr.des_h & 0xff) << 16;
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.base |= (cpu->tr.des_h & 0xff000000);
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.limit = (cpu->tr.des_l & 0xffff);
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.limit |= (cpu->tr.des_h & 0x000f0000);
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.g = (cpu->tr.des_h >> 23) & 0x01;
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.avl = (cpu->tr.des_h >> 20) & 0x01;
|
||||
}
|
||||
|
||||
if (BX_CPU_THIS_PTR tr.cache.u.system.g)
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.limit_scaled =
|
||||
(BX_CPU_THIS_PTR tr.cache.u.system.limit << 12) | 0x0fff;
|
||||
else
|
||||
BX_CPU_THIS_PTR tr.cache.u.system.limit_scaled =
|
||||
(BX_CPU_THIS_PTR tr.cache.u.system.limit);
|
||||
|
||||
// GDTR
|
||||
BX_CPU_THIS_PTR gdtr.base = cpu->gdtr.base;
|
||||
BX_CPU_THIS_PTR gdtr.limit = cpu->gdtr.limit;
|
||||
|
||||
// IDTR
|
||||
BX_CPU_THIS_PTR idtr.base = cpu->idtr.base;
|
||||
BX_CPU_THIS_PTR idtr.limit = cpu->idtr.limit;
|
||||
|
||||
|
||||
BX_CPU_THIS_PTR dr0 = cpu->dr0;
|
||||
BX_CPU_THIS_PTR dr1 = cpu->dr1;
|
||||
BX_CPU_THIS_PTR dr2 = cpu->dr2;
|
||||
BX_CPU_THIS_PTR dr3 = cpu->dr3;
|
||||
BX_CPU_THIS_PTR dr6 = cpu->dr6;
|
||||
BX_CPU_THIS_PTR dr7 = cpu->dr7;
|
||||
|
||||
#if BX_CPU_LEVEL >= 2
|
||||
// Control registers
|
||||
SetCR0(cpu->cr0);
|
||||
BX_CPU_THIS_PTR cr2 = cpu->cr2;
|
||||
CR3_change(cpu->cr3);
|
||||
#if BX_CPU_LEVEL >= 4
|
||||
BX_CPU_THIS_PTR cr4.setRegister(cpu->cr4);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
BX_CPU_THIS_PTR inhibit_mask = cpu->inhibit_mask;
|
||||
|
||||
//
|
||||
// flush cached items, prefetch, paging, etc
|
||||
//
|
||||
BX_CPU_THIS_PTR invalidate_prefetch_q();
|
||||
BX_CPU_THIS_PTR async_event = 1;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
#endif // #if BX_DEBUGGER
|
||||
|
||||
void BX_CPU_C::atexit(void)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: init.cc,v 1.137 2007-10-14 00:22:07 sshwarts Exp $
|
||||
// $Id: init.cc,v 1.138 2007-10-14 19:04:50 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -23,6 +23,8 @@
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define NEED_CPU_REG_SHORTCUTS 1
|
||||
@ -35,7 +37,6 @@
|
||||
#define RIP EIP
|
||||
#endif
|
||||
|
||||
|
||||
BX_CPU_C::BX_CPU_C(unsigned id): bx_cpuid(id)
|
||||
#if BX_SUPPORT_APIC
|
||||
,local_apic (this)
|
||||
@ -253,6 +254,13 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
sprintf(name, "CPU %d", BX_CPU_ID);
|
||||
|
||||
#if BX_WITH_WX
|
||||
register_wx_state();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BX_WITH_WX
|
||||
void BX_CPU_C::register_wx_state(void)
|
||||
{
|
||||
if (SIM->get_param(BXPN_WX_CPU_STATE) != NULL) {
|
||||
// Register some of the CPUs variables as shadow parameters so that
|
||||
// they can be visible in the config interface.
|
||||
@ -375,19 +383,21 @@ void BX_CPU_C::initialize(BX_MEM_C *addrspace)
|
||||
bx_param_num_c::set_default_format(oldfmt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// save/restore functionality
|
||||
void BX_CPU_C::register_state(void)
|
||||
{
|
||||
unsigned i;
|
||||
char cpu_name[10], cpu_title[10], name[10];
|
||||
char name[10];
|
||||
|
||||
sprintf(cpu_name, "%d", BX_CPU_ID);
|
||||
sprintf(cpu_title, "CPU %d", BX_CPU_ID);
|
||||
bx_list_c *cpu = new bx_list_c(SIM->get_param("bochs.cpu"),
|
||||
cpu_name, cpu_title, 60);
|
||||
if (BX_SMP_PROCESSORS < 2)
|
||||
sprintf(name, "cpu");
|
||||
else
|
||||
sprintf(name, "cpu%d", BX_CPU_ID);
|
||||
|
||||
bx_list_c *cpu = new bx_list_c(SIM->get_bochs_root(), name, name, 60);
|
||||
|
||||
BXRS_PARAM_SPECIAL32(cpu, cpu_version, param_save_handler, param_restore_handler);
|
||||
BXRS_PARAM_SPECIAL32(cpu, cpuid_std, param_save_handler, param_restore_handler);
|
||||
@ -395,6 +405,7 @@ void BX_CPU_C::register_state(void)
|
||||
BXRS_DEC_PARAM_SIMPLE(cpu, cpu_mode);
|
||||
BXRS_DEC_PARAM_SIMPLE(cpu, cpu_state);
|
||||
BXRS_HEX_PARAM_SIMPLE(cpu, inhibit_mask);
|
||||
BXRS_HEX_PARAM_SIMPLE(cpu, debug_trap);
|
||||
#if BX_SUPPORT_X86_64
|
||||
BXRS_HEX_PARAM_SIMPLE(cpu, RAX);
|
||||
BXRS_HEX_PARAM_SIMPLE(cpu, RBX);
|
||||
@ -544,7 +555,7 @@ void BX_CPU_C::register_state(void)
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_FPU || BX_SUPPORT_MMX
|
||||
bx_list_c *fpu = new bx_list_c(cpu, "fpu", 17);
|
||||
bx_list_c *fpu = new bx_list_c(cpu, "FPU", 17);
|
||||
BXRS_HEX_PARAM_FIELD(fpu, cwd, the_i387.cwd);
|
||||
BXRS_HEX_PARAM_FIELD(fpu, swd, the_i387.swd);
|
||||
BXRS_HEX_PARAM_FIELD(fpu, twd, the_i387.twd);
|
||||
@ -563,7 +574,7 @@ void BX_CPU_C::register_state(void)
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_SSE
|
||||
bx_list_c *sse = new bx_list_c(cpu, "sse", 2*BX_XMM_REGISTERS+1);
|
||||
bx_list_c *sse = new bx_list_c(cpu, "SSE", 2*BX_XMM_REGISTERS+1);
|
||||
BXRS_HEX_PARAM_FIELD(sse, mxcsr, mxcsr.mxcsr);
|
||||
for (i=0; i<BX_XMM_REGISTERS; i++) {
|
||||
sprintf(name, "xmm%02d_hi", i);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.cc,v 1.177 2007-10-14 00:20:30 sshwarts Exp $
|
||||
// $Id: siminterface.cc,v 1.178 2007-10-14 19:04:51 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// See siminterface.h for description of the siminterface concept.
|
||||
@ -58,7 +58,7 @@ public:
|
||||
virtual bx_param_string_c *get_param_string(const char *pname, bx_param_c *base=NULL);
|
||||
virtual bx_param_bool_c *get_param_bool(const char *pname, bx_param_c *base=NULL);
|
||||
virtual bx_param_enum_c *get_param_enum(const char *pname, bx_param_c *base=NULL);
|
||||
virtual Bit32u gen_param_id();
|
||||
virtual Bit32u gen_param_id() { return param_id++; }
|
||||
virtual int get_n_log_modules();
|
||||
virtual char *get_prefix(int mod);
|
||||
virtual int get_log_action(int mod, int level);
|
||||
@ -71,7 +71,7 @@ public:
|
||||
logfunctions::set_default_action(level, action);
|
||||
}
|
||||
virtual const char *get_log_level_name(int level);
|
||||
virtual int get_max_log_level();
|
||||
virtual int get_max_log_level() { return N_LOGLEV; }
|
||||
virtual void quit_sim(int code);
|
||||
virtual int get_exit_code() { return exit_code; }
|
||||
virtual int get_default_rc(char *path, int len);
|
||||
@ -153,9 +153,10 @@ public:
|
||||
virtual bx_list_c *get_bochs_root() {
|
||||
return (bx_list_c*)get_param("bochs", NULL);
|
||||
}
|
||||
virtual bx_bool restore_bochs_param(bx_list_c *root, const char *sr_path, const char *restore_name);
|
||||
|
||||
private:
|
||||
bx_bool save_sr_param(FILE *fp, bx_param_c *node, const char *sr_path, int level);
|
||||
bx_bool restore_sr_param(bx_list_c *root, const char *sr_path, const char *restore_name);
|
||||
};
|
||||
|
||||
// recursive function to find parameters from the path
|
||||
@ -259,11 +260,6 @@ bx_param_enum_c *bx_real_sim_c::get_param_enum(const char *pname, bx_param_c *ba
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Bit32u bx_real_sim_c::gen_param_id()
|
||||
{
|
||||
return param_id++;
|
||||
}
|
||||
|
||||
void bx_init_siminterface()
|
||||
{
|
||||
siminterface_log = new logfunctions();
|
||||
@ -342,11 +338,6 @@ const char *bx_real_sim_c::get_log_level_name(int level)
|
||||
return io->getlevel(level);
|
||||
}
|
||||
|
||||
int bx_real_sim_c::get_max_log_level()
|
||||
{
|
||||
return N_LOGLEV;
|
||||
}
|
||||
|
||||
void bx_real_sim_c::quit_sim(int code) {
|
||||
BX_INFO(("quit_sim called with exit code %d", code));
|
||||
exit_code = code;
|
||||
@ -842,12 +833,8 @@ void bx_real_sim_c::init_save_restore()
|
||||
list = new bx_list_c(root_param,
|
||||
"bochs",
|
||||
"subtree for save/restore",
|
||||
30);
|
||||
30 + BX_MAX_SMP_THREADS_SUPPORTED);
|
||||
}
|
||||
new bx_list_c(list,
|
||||
"cpu",
|
||||
"CPU State",
|
||||
BX_MAX_SMP_THREADS_SUPPORTED);
|
||||
}
|
||||
|
||||
bx_bool bx_real_sim_c::save_state(const char *checkpoint_path)
|
||||
@ -981,7 +968,7 @@ bx_bool bx_real_sim_c::restore_logopts()
|
||||
return 1;
|
||||
}
|
||||
|
||||
bx_bool bx_real_sim_c::restore_sr_param(bx_list_c *root, const char *sr_path, const char *restore_name)
|
||||
bx_bool bx_real_sim_c::restore_bochs_param(bx_list_c *root, const char *sr_path, const char *restore_name)
|
||||
{
|
||||
char devstate[BX_PATHNAME_LEN], devdata[BX_PATHNAME_LEN];
|
||||
char line[512], buf[512], pname[80];
|
||||
@ -991,6 +978,11 @@ bx_bool bx_real_sim_c::restore_sr_param(bx_list_c *root, const char *sr_path, co
|
||||
bx_param_c *param = NULL;
|
||||
FILE *fp, *fp2;
|
||||
|
||||
if (root->get_by_name(restore_name) == NULL) {
|
||||
BX_ERROR(("restore_bochs_param(): unknown parameter to restore"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
sprintf(devstate, "%s/%s", sr_path, restore_name);
|
||||
BX_INFO(("restoring '%s'", devstate));
|
||||
bx_list_c *base = root;
|
||||
@ -1071,6 +1063,7 @@ bx_bool bx_real_sim_c::restore_sr_param(bx_list_c *root, const char *sr_path, co
|
||||
} while (!feof(fp));
|
||||
fclose(fp);
|
||||
} else {
|
||||
BX_ERROR(("restore_bochs_param(): error in file open"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1082,7 +1075,7 @@ bx_bool bx_real_sim_c::restore_hardware()
|
||||
bx_list_c *sr_list = get_bochs_root();
|
||||
int ndev = sr_list->get_size();
|
||||
for (int dev=0; dev<ndev; dev++) {
|
||||
if (!restore_sr_param(sr_list, get_param_string(BXPN_RESTORE_PATH)->getptr(), sr_list->get(dev)->get_name()))
|
||||
if (!restore_bochs_param(sr_list, get_param_string(BXPN_RESTORE_PATH)->getptr(), sr_list->get(dev)->get_name()))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@ -1343,11 +1336,6 @@ Bit32u bx_param_num_c::set_default_base(Bit32u val)
|
||||
return old;
|
||||
}
|
||||
|
||||
void bx_param_num_c::reset()
|
||||
{
|
||||
this->val.number = initial_val;
|
||||
}
|
||||
|
||||
void bx_param_num_c::set_handler(param_event_handler handler)
|
||||
{
|
||||
this->handler = handler;
|
||||
@ -1362,12 +1350,8 @@ void bx_param_num_c::set_sr_handlers(void *devptr, param_sr_handler save, param_
|
||||
this->restore_handler = restore;
|
||||
}
|
||||
|
||||
void bx_param_num_c::set_enable_handler(param_enable_handler handler)
|
||||
{
|
||||
this->enable_handler = handler;
|
||||
}
|
||||
|
||||
void bx_param_num_c::set_dependent_list(bx_list_c *l) {
|
||||
void bx_param_num_c::set_dependent_list(bx_list_c *l)
|
||||
{
|
||||
dependent_list = l;
|
||||
update_dependents();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.212 2007-09-28 19:51:48 sshwarts Exp $
|
||||
// $Id: siminterface.h,v 1.213 2007-10-14 19:04:51 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Intro to siminterface by Bryce Denney:
|
||||
@ -680,10 +680,10 @@ public:
|
||||
const char *description,
|
||||
Bit64s min, Bit64s max, Bit64s initial_val,
|
||||
bx_bool is_shadow = 0);
|
||||
virtual void reset();
|
||||
virtual void reset() { val.number = initial_val; }
|
||||
void set_handler(param_event_handler handler);
|
||||
void set_sr_handlers(void *devptr, param_sr_handler save, param_sr_handler restore);
|
||||
void set_enable_handler(param_enable_handler handler);
|
||||
void set_enable_handler(param_enable_handler handler) { enable_handler = handler; }
|
||||
virtual bx_list_c *get_dependent_list() { return dependent_list; }
|
||||
void set_dependent_list(bx_list_c *l);
|
||||
virtual void set_enabled(int enabled);
|
||||
@ -1216,6 +1216,7 @@ public:
|
||||
virtual bx_bool restore_logopts() {return 0;}
|
||||
virtual bx_bool restore_hardware() {return 0;}
|
||||
virtual bx_list_c *get_bochs_root() {return NULL;}
|
||||
virtual bx_bool restore_bochs_param(bx_list_c *root, const char *sr_path, const char *restore_name) { return 0; }
|
||||
};
|
||||
|
||||
BOCHSAPI extern bx_simulator_interface_c *SIM;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: win32dialog.cc,v 1.59 2007-09-28 19:51:57 sshwarts Exp $
|
||||
// $Id: win32dialog.cc,v 1.60 2007-10-14 19:04:51 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "config.h"
|
||||
@ -916,32 +916,32 @@ static BOOL CALLBACK DebuggerDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
|
||||
case WM_INITDIALOG:
|
||||
GetWindowRect(hDlg, &R);
|
||||
#if BX_SUPPORT_X86_64
|
||||
cpu_param[0] = SIM->get_param_num("cpu.0.RAX", SIM->get_bochs_root());
|
||||
cpu_param[1] = SIM->get_param_num("cpu.0.RBX", SIM->get_bochs_root());
|
||||
cpu_param[2] = SIM->get_param_num("cpu.0.RCX", SIM->get_bochs_root());
|
||||
cpu_param[3] = SIM->get_param_num("cpu.0.RDX", SIM->get_bochs_root());
|
||||
cpu_param[4] = SIM->get_param_num("cpu.0.RSP", SIM->get_bochs_root());
|
||||
cpu_param[5] = SIM->get_param_num("cpu.0.RBP", SIM->get_bochs_root());
|
||||
cpu_param[6] = SIM->get_param_num("cpu.0.RSI", SIM->get_bochs_root());
|
||||
cpu_param[7] = SIM->get_param_num("cpu.0.RDI", SIM->get_bochs_root());
|
||||
cpu_param[8] = SIM->get_param_num("cpu.0.RIP", SIM->get_bochs_root());
|
||||
cpu_param[0] = SIM->get_param_num("cpu0.RAX", SIM->get_bochs_root());
|
||||
cpu_param[1] = SIM->get_param_num("cpu0.RBX", SIM->get_bochs_root());
|
||||
cpu_param[2] = SIM->get_param_num("cpu0.RCX", SIM->get_bochs_root());
|
||||
cpu_param[3] = SIM->get_param_num("cpu0.RDX", SIM->get_bochs_root());
|
||||
cpu_param[4] = SIM->get_param_num("cpu0.RSP", SIM->get_bochs_root());
|
||||
cpu_param[5] = SIM->get_param_num("cpu0.RBP", SIM->get_bochs_root());
|
||||
cpu_param[6] = SIM->get_param_num("cpu0.RSI", SIM->get_bochs_root());
|
||||
cpu_param[7] = SIM->get_param_num("cpu0.RDI", SIM->get_bochs_root());
|
||||
cpu_param[8] = SIM->get_param_num("cpu0.RIP", SIM->get_bochs_root());
|
||||
#else
|
||||
cpu_param[0] = SIM->get_param_num("cpu.0.EAX", SIM->get_bochs_root());
|
||||
cpu_param[1] = SIM->get_param_num("cpu.0.EBX", SIM->get_bochs_root());
|
||||
cpu_param[2] = SIM->get_param_num("cpu.0.ECX", SIM->get_bochs_root());
|
||||
cpu_param[3] = SIM->get_param_num("cpu.0.EDX", SIM->get_bochs_root());
|
||||
cpu_param[4] = SIM->get_param_num("cpu.0.ESP", SIM->get_bochs_root());
|
||||
cpu_param[5] = SIM->get_param_num("cpu.0.EBP", SIM->get_bochs_root());
|
||||
cpu_param[6] = SIM->get_param_num("cpu.0.ESI", SIM->get_bochs_root());
|
||||
cpu_param[7] = SIM->get_param_num("cpu.0.EDI", SIM->get_bochs_root());
|
||||
cpu_param[8] = SIM->get_param_num("cpu.0.EIP", SIM->get_bochs_root());
|
||||
cpu_param[0] = SIM->get_param_num("cpu0.EAX", SIM->get_bochs_root());
|
||||
cpu_param[1] = SIM->get_param_num("cpu0.EBX", SIM->get_bochs_root());
|
||||
cpu_param[2] = SIM->get_param_num("cpu0.ECX", SIM->get_bochs_root());
|
||||
cpu_param[3] = SIM->get_param_num("cpu0.EDX", SIM->get_bochs_root());
|
||||
cpu_param[4] = SIM->get_param_num("cpu0.ESP", SIM->get_bochs_root());
|
||||
cpu_param[5] = SIM->get_param_num("cpu0.EBP", SIM->get_bochs_root());
|
||||
cpu_param[6] = SIM->get_param_num("cpu0.ESI", SIM->get_bochs_root());
|
||||
cpu_param[7] = SIM->get_param_num("cpu0.EDI", SIM->get_bochs_root());
|
||||
cpu_param[8] = SIM->get_param_num("cpu0.EIP", SIM->get_bochs_root());
|
||||
#endif
|
||||
cpu_param[9] = SIM->get_param_num("cpu.0.CS.selector", SIM->get_bochs_root());
|
||||
cpu_param[10] = SIM->get_param_num("cpu.0.DS.selector", SIM->get_bochs_root());
|
||||
cpu_param[11] = SIM->get_param_num("cpu.0.ES.selector", SIM->get_bochs_root());
|
||||
cpu_param[12] = SIM->get_param_num("cpu.0.FS.selector", SIM->get_bochs_root());
|
||||
cpu_param[13] = SIM->get_param_num("cpu.0.GS.selector", SIM->get_bochs_root());
|
||||
cpu_param[14] = SIM->get_param_num("cpu.0.EFLAGS", SIM->get_bochs_root());
|
||||
cpu_param[9] = SIM->get_param_num("cpu0.CS.selector", SIM->get_bochs_root());
|
||||
cpu_param[10] = SIM->get_param_num("cpu0.DS.selector", SIM->get_bochs_root());
|
||||
cpu_param[11] = SIM->get_param_num("cpu0.ES.selector", SIM->get_bochs_root());
|
||||
cpu_param[12] = SIM->get_param_num("cpu0.FS.selector", SIM->get_bochs_root());
|
||||
cpu_param[13] = SIM->get_param_num("cpu0.GS.selector", SIM->get_bochs_root());
|
||||
cpu_param[14] = SIM->get_param_num("cpu0.EFLAGS", SIM->get_bochs_root());
|
||||
return TRUE;
|
||||
case WM_CLOSE:
|
||||
bx_user_quit = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user