added cpu state param - for future use and for dbg info

started to move debugger to info bx_param interface -> info sse and info mmx commands modified
This commit is contained in:
Stanislav Shwartsman 2007-10-11 18:12:00 +00:00
parent fbcdfa49c2
commit f6ed95785f
14 changed files with 2168 additions and 2062 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.98 2007-10-09 19:49:23 sshwarts Exp $
// $Id: dbg_main.cc,v 1.99 2007-10-11 18:11:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -49,6 +49,7 @@ extern "C" {
// default CPU in the debugger. For commands like "dump_cpu" it will
// use the default instead of always dumping all cpus.
unsigned dbg_cpu = 0;
bx_list_c *dbg_cpu_list = 0;
extern const char* cpu_mode_string(unsigned cpu_mode);
@ -147,8 +148,6 @@ int bx_dbg_set_rcfile(const char *rcfile)
int bx_dbg_main(void)
{
int i;
setbuf(stdout, NULL);
setbuf(stderr, NULL);
@ -167,6 +166,8 @@ 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());
// Open debugger log file if needed
if ((strlen(SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr()) > 0)
&& (strcmp(SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr(), "-") != 0)) {
@ -203,7 +204,7 @@ int bx_dbg_main(void)
// Print disassembly of the first instruction... you wouldn't think it
// would have to be so hard. First initialize guard_found, since it is used
// in the disassembly code to decide what instruction to print.
for (i=0; i<BX_SMP_PROCESSORS; i++) {
for (int i=0; i<BX_SMP_PROCESSORS; i++) {
BX_CPU(i)->guard_found.cs = BX_CPU(i)->sregs[BX_SEG_REG_CS].selector.value;
BX_CPU(i)->guard_found.eip = BX_CPU(i)->prev_eip;
BX_CPU(i)->guard_found.laddr =
@ -492,6 +493,76 @@ void bx_dbg_exit(int code)
BX_EXIT(code);
}
//
// functions for browsing of cpu state
//
void bx_dbg_print_sse_state(void)
{
#if BX_SUPPORT_SSE
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);
Bit64u hi = SIM->get_param_num(param_name, dbg_cpu_list)->get();
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));
}
#else
dbg_printf("The CPU doesn't support SSE state !");
#endif
}
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);
Bit64u mmreg = SIM->get_param_num(param_name, dbg_cpu_list)->get();
dbg_printf("MM[%d]: %08x:%08x\n", i, GET32H(mmreg), GET32L(mmreg));
}
#else
dbg_printf("The CPU doesn't support MMX state !");
#endif
}
void bx_dbg_print_fpu_state(void)
{
#if BX_SUPPORT_FPU
BX_CPU(dbg_cpu)->print_state_FPU();
#else
dbg_printf("The CPU doesn't support FPU state !");
#endif
}
void bx_dbg_info_flags(void)
{
dbg_printf("IOPL=%1u %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
BX_CPU(dbg_cpu)->get_IOPL(),
BX_CPU(dbg_cpu)->get_ID() ? "ID" : "id",
BX_CPU(dbg_cpu)->get_VIP() ? "VIP" : "vip",
BX_CPU(dbg_cpu)->get_VIF() ? "VIF" : "vif",
BX_CPU(dbg_cpu)->get_AC() ? "AC" : "ac",
BX_CPU(dbg_cpu)->get_VM() ? "VM" : "vm",
BX_CPU(dbg_cpu)->get_RF() ? "RF" : "rf",
BX_CPU(dbg_cpu)->get_NT() ? "NT" : "nt",
BX_CPU(dbg_cpu)->get_OF() ? "OF" : "of",
BX_CPU(dbg_cpu)->get_DF() ? "DF" : "df",
BX_CPU(dbg_cpu)->get_IF() ? "IF" : "if",
BX_CPU(dbg_cpu)->get_TF() ? "TF" : "tf",
BX_CPU(dbg_cpu)->get_SF() ? "SF" : "sf",
BX_CPU(dbg_cpu)->get_ZF() ? "ZF" : "zf",
BX_CPU(dbg_cpu)->get_AF() ? "AF" : "af",
BX_CPU(dbg_cpu)->get_PF() ? "PF" : "pf",
BX_CPU(dbg_cpu)->get_CF() ? "CF" : "cf");
}
//
// commands invoked from parser
//
@ -1845,16 +1916,20 @@ void bx_dbg_info_registers_command(int which_regs_mask)
dbg_printf("eflags 0x%08x\n", (unsigned) reg);
bx_dbg_info_flags();
}
#if BX_SUPPORT_FPU
if (which_regs_mask & BX_INFO_FPU_REGS) {
BX_CPU(dbg_cpu)->print_state_FPU();
bx_dbg_print_fpu_state();
}
#endif
#if BX_SUPPORT_SSE
if (which_regs_mask & BX_INFO_MMX_REGS) {
bx_dbg_print_mmx_state();
}
if (which_regs_mask & BX_INFO_SSE_REGS) {
BX_CPU(dbg_cpu)->print_state_SSE();
bx_dbg_print_sse_state();
}
#endif
}
void bx_dbg_dump_cpu_command(void)
@ -2283,6 +2358,9 @@ void bx_dbg_set_symbol_command(char *symbol, Bit32u val)
dbg_printf("invalid cpu id number %d\n", val);
return;
}
char cpu_param_name[10];
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;
}
@ -3576,26 +3654,4 @@ void bx_dbg_step_over_command()
bx_dbg_breakpoint_changed();
}
void bx_dbg_info_flags(void)
{
dbg_printf("IOPL=%1u %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
BX_CPU(dbg_cpu)->get_IOPL(),
BX_CPU(dbg_cpu)->get_ID() ? "ID" : "id",
BX_CPU(dbg_cpu)->get_VIP() ? "VIP" : "vip",
BX_CPU(dbg_cpu)->get_VIF() ? "VIF" : "vif",
BX_CPU(dbg_cpu)->get_AC() ? "AC" : "ac",
BX_CPU(dbg_cpu)->get_VM() ? "VM" : "vm",
BX_CPU(dbg_cpu)->get_RF() ? "RF" : "rf",
BX_CPU(dbg_cpu)->get_NT() ? "NT" : "nt",
BX_CPU(dbg_cpu)->get_OF() ? "OF" : "of",
BX_CPU(dbg_cpu)->get_DF() ? "DF" : "df",
BX_CPU(dbg_cpu)->get_IF() ? "IF" : "if",
BX_CPU(dbg_cpu)->get_TF() ? "TF" : "tf",
BX_CPU(dbg_cpu)->get_SF() ? "SF" : "sf",
BX_CPU(dbg_cpu)->get_ZF() ? "ZF" : "zf",
BX_CPU(dbg_cpu)->get_AF() ? "AF" : "af",
BX_CPU(dbg_cpu)->get_PF() ? "PF" : "pf",
BX_CPU(dbg_cpu)->get_CF() ? "CF" : "cf");
}
#endif /* if BX_DEBUGGER */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debug.h,v 1.32 2007-10-09 19:49:23 sshwarts Exp $
// $Id: debug.h,v 1.33 2007-10-11 18:11:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -260,7 +260,8 @@ void bx_dbg_info_bpoints_command(void);
void bx_dbg_quit_command(void);
#define BX_INFO_CPU_REGS 1 /* bitmasks - choices for bx_dbg_info_registers_command */
#define BX_INFO_FPU_REGS 2
#define BX_INFO_SSE_REGS 4
#define BX_INFO_MMX_REGS 4
#define BX_INFO_SSE_REGS 8
void bx_dbg_info_registers_command(int);
void bx_dbg_info_dirty_command(void);
void bx_dbg_info_ivt_command(unsigned from, unsigned to);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
%{
/////////////////////////////////////////////////////////////////////////
// $Id: lexer.l,v 1.19 2006-10-19 17:51:58 sshwarts Exp $
// $Id: lexer.l,v 1.20 2007-10-11 18:11:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
@ -74,6 +74,7 @@ regs |
registers { bxlval.sval = strdup(bxtext); return(BX_TOKEN_REGISTERS); }
fpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FPU); }
sse { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SSE); }
mmx { bxlval.sval = strdup(bxtext); return(BX_TOKEN_MMX); }
cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CPU); }
all { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ALL); }
idt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IDT); }

File diff suppressed because it is too large Load Diff

View File

@ -72,72 +72,73 @@
BX_TOKEN_CPU = 288,
BX_TOKEN_FPU = 289,
BX_TOKEN_SSE = 290,
BX_TOKEN_ALL = 291,
BX_TOKEN_IDT = 292,
BX_TOKEN_IVT = 293,
BX_TOKEN_GDT = 294,
BX_TOKEN_LDT = 295,
BX_TOKEN_TSS = 296,
BX_TOKEN_TAB = 297,
BX_TOKEN_DIRTY = 298,
BX_TOKEN_LINUX = 299,
BX_TOKEN_CONTROL_REGS = 300,
BX_TOKEN_EXAMINE = 301,
BX_TOKEN_XFORMAT = 302,
BX_TOKEN_DISFORMAT = 303,
BX_TOKEN_SETPMEM = 304,
BX_TOKEN_SYMBOLNAME = 305,
BX_TOKEN_QUERY = 306,
BX_TOKEN_PENDING = 307,
BX_TOKEN_TAKE = 308,
BX_TOKEN_DMA = 309,
BX_TOKEN_IRQ = 310,
BX_TOKEN_DUMP_CPU = 311,
BX_TOKEN_SET_CPU = 312,
BX_TOKEN_DISASSEMBLE = 313,
BX_TOKEN_INSTRUMENT = 314,
BX_TOKEN_STRING = 315,
BX_TOKEN_STOP = 316,
BX_TOKEN_DOIT = 317,
BX_TOKEN_CRC = 318,
BX_TOKEN_TRACE = 319,
BX_TOKEN_TRACEREG = 320,
BX_TOKEN_SWITCH_MODE = 321,
BX_TOKEN_SIZE = 322,
BX_TOKEN_PTIME = 323,
BX_TOKEN_TIMEBP_ABSOLUTE = 324,
BX_TOKEN_TIMEBP = 325,
BX_TOKEN_RECORD = 326,
BX_TOKEN_PLAYBACK = 327,
BX_TOKEN_MODEBP = 328,
BX_TOKEN_PRINT_STACK = 329,
BX_TOKEN_WATCH = 330,
BX_TOKEN_UNWATCH = 331,
BX_TOKEN_READ = 332,
BX_TOKEN_WRITE = 333,
BX_TOKEN_SHOW = 334,
BX_TOKEN_LOAD_SYMBOLS = 335,
BX_TOKEN_SYMBOLS = 336,
BX_TOKEN_LIST_SYMBOLS = 337,
BX_TOKEN_GLOBAL = 338,
BX_TOKEN_WHERE = 339,
BX_TOKEN_PRINT_STRING = 340,
BX_TOKEN_NUMERIC = 341,
BX_TOKEN_NE2000 = 342,
BX_TOKEN_PIC = 343,
BX_TOKEN_PAGE = 344,
BX_TOKEN_HELP = 345,
BX_TOKEN_CALC = 346,
BX_TOKEN_VGA = 347,
BX_TOKEN_COMMAND = 348,
BX_TOKEN_GENERIC = 349,
BX_TOKEN_RSHIFT = 350,
BX_TOKEN_LSHIFT = 351,
BX_TOKEN_REG_IP = 352,
BX_TOKEN_REG_EIP = 353,
BX_TOKEN_REG_RIP = 354,
NEG = 355,
NOT = 356
BX_TOKEN_MMX = 291,
BX_TOKEN_ALL = 292,
BX_TOKEN_IDT = 293,
BX_TOKEN_IVT = 294,
BX_TOKEN_GDT = 295,
BX_TOKEN_LDT = 296,
BX_TOKEN_TSS = 297,
BX_TOKEN_TAB = 298,
BX_TOKEN_DIRTY = 299,
BX_TOKEN_LINUX = 300,
BX_TOKEN_CONTROL_REGS = 301,
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_DISASSEMBLE = 314,
BX_TOKEN_INSTRUMENT = 315,
BX_TOKEN_STRING = 316,
BX_TOKEN_STOP = 317,
BX_TOKEN_DOIT = 318,
BX_TOKEN_CRC = 319,
BX_TOKEN_TRACE = 320,
BX_TOKEN_TRACEREG = 321,
BX_TOKEN_SWITCH_MODE = 322,
BX_TOKEN_SIZE = 323,
BX_TOKEN_PTIME = 324,
BX_TOKEN_TIMEBP_ABSOLUTE = 325,
BX_TOKEN_TIMEBP = 326,
BX_TOKEN_RECORD = 327,
BX_TOKEN_PLAYBACK = 328,
BX_TOKEN_MODEBP = 329,
BX_TOKEN_PRINT_STACK = 330,
BX_TOKEN_WATCH = 331,
BX_TOKEN_UNWATCH = 332,
BX_TOKEN_READ = 333,
BX_TOKEN_WRITE = 334,
BX_TOKEN_SHOW = 335,
BX_TOKEN_LOAD_SYMBOLS = 336,
BX_TOKEN_SYMBOLS = 337,
BX_TOKEN_LIST_SYMBOLS = 338,
BX_TOKEN_GLOBAL = 339,
BX_TOKEN_WHERE = 340,
BX_TOKEN_PRINT_STRING = 341,
BX_TOKEN_NUMERIC = 342,
BX_TOKEN_NE2000 = 343,
BX_TOKEN_PIC = 344,
BX_TOKEN_PAGE = 345,
BX_TOKEN_HELP = 346,
BX_TOKEN_CALC = 347,
BX_TOKEN_VGA = 348,
BX_TOKEN_COMMAND = 349,
BX_TOKEN_GENERIC = 350,
BX_TOKEN_RSHIFT = 351,
BX_TOKEN_LSHIFT = 352,
BX_TOKEN_REG_IP = 353,
BX_TOKEN_REG_EIP = 354,
BX_TOKEN_REG_RIP = 355,
NEG = 356,
NOT = 357
};
#endif
/* Tokens. */
@ -174,72 +175,73 @@
#define BX_TOKEN_CPU 288
#define BX_TOKEN_FPU 289
#define BX_TOKEN_SSE 290
#define BX_TOKEN_ALL 291
#define BX_TOKEN_IDT 292
#define BX_TOKEN_IVT 293
#define BX_TOKEN_GDT 294
#define BX_TOKEN_LDT 295
#define BX_TOKEN_TSS 296
#define BX_TOKEN_TAB 297
#define BX_TOKEN_DIRTY 298
#define BX_TOKEN_LINUX 299
#define BX_TOKEN_CONTROL_REGS 300
#define BX_TOKEN_EXAMINE 301
#define BX_TOKEN_XFORMAT 302
#define BX_TOKEN_DISFORMAT 303
#define BX_TOKEN_SETPMEM 304
#define BX_TOKEN_SYMBOLNAME 305
#define BX_TOKEN_QUERY 306
#define BX_TOKEN_PENDING 307
#define BX_TOKEN_TAKE 308
#define BX_TOKEN_DMA 309
#define BX_TOKEN_IRQ 310
#define BX_TOKEN_DUMP_CPU 311
#define BX_TOKEN_SET_CPU 312
#define BX_TOKEN_DISASSEMBLE 313
#define BX_TOKEN_INSTRUMENT 314
#define BX_TOKEN_STRING 315
#define BX_TOKEN_STOP 316
#define BX_TOKEN_DOIT 317
#define BX_TOKEN_CRC 318
#define BX_TOKEN_TRACE 319
#define BX_TOKEN_TRACEREG 320
#define BX_TOKEN_SWITCH_MODE 321
#define BX_TOKEN_SIZE 322
#define BX_TOKEN_PTIME 323
#define BX_TOKEN_TIMEBP_ABSOLUTE 324
#define BX_TOKEN_TIMEBP 325
#define BX_TOKEN_RECORD 326
#define BX_TOKEN_PLAYBACK 327
#define BX_TOKEN_MODEBP 328
#define BX_TOKEN_PRINT_STACK 329
#define BX_TOKEN_WATCH 330
#define BX_TOKEN_UNWATCH 331
#define BX_TOKEN_READ 332
#define BX_TOKEN_WRITE 333
#define BX_TOKEN_SHOW 334
#define BX_TOKEN_LOAD_SYMBOLS 335
#define BX_TOKEN_SYMBOLS 336
#define BX_TOKEN_LIST_SYMBOLS 337
#define BX_TOKEN_GLOBAL 338
#define BX_TOKEN_WHERE 339
#define BX_TOKEN_PRINT_STRING 340
#define BX_TOKEN_NUMERIC 341
#define BX_TOKEN_NE2000 342
#define BX_TOKEN_PIC 343
#define BX_TOKEN_PAGE 344
#define BX_TOKEN_HELP 345
#define BX_TOKEN_CALC 346
#define BX_TOKEN_VGA 347
#define BX_TOKEN_COMMAND 348
#define BX_TOKEN_GENERIC 349
#define BX_TOKEN_RSHIFT 350
#define BX_TOKEN_LSHIFT 351
#define BX_TOKEN_REG_IP 352
#define BX_TOKEN_REG_EIP 353
#define BX_TOKEN_REG_RIP 354
#define NEG 355
#define NOT 356
#define BX_TOKEN_MMX 291
#define BX_TOKEN_ALL 292
#define BX_TOKEN_IDT 293
#define BX_TOKEN_IVT 294
#define BX_TOKEN_GDT 295
#define BX_TOKEN_LDT 296
#define BX_TOKEN_TSS 297
#define BX_TOKEN_TAB 298
#define BX_TOKEN_DIRTY 299
#define BX_TOKEN_LINUX 300
#define BX_TOKEN_CONTROL_REGS 301
#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_DISASSEMBLE 314
#define BX_TOKEN_INSTRUMENT 315
#define BX_TOKEN_STRING 316
#define BX_TOKEN_STOP 317
#define BX_TOKEN_DOIT 318
#define BX_TOKEN_CRC 319
#define BX_TOKEN_TRACE 320
#define BX_TOKEN_TRACEREG 321
#define BX_TOKEN_SWITCH_MODE 322
#define BX_TOKEN_SIZE 323
#define BX_TOKEN_PTIME 324
#define BX_TOKEN_TIMEBP_ABSOLUTE 325
#define BX_TOKEN_TIMEBP 326
#define BX_TOKEN_RECORD 327
#define BX_TOKEN_PLAYBACK 328
#define BX_TOKEN_MODEBP 329
#define BX_TOKEN_PRINT_STACK 330
#define BX_TOKEN_WATCH 331
#define BX_TOKEN_UNWATCH 332
#define BX_TOKEN_READ 333
#define BX_TOKEN_WRITE 334
#define BX_TOKEN_SHOW 335
#define BX_TOKEN_LOAD_SYMBOLS 336
#define BX_TOKEN_SYMBOLS 337
#define BX_TOKEN_LIST_SYMBOLS 338
#define BX_TOKEN_GLOBAL 339
#define BX_TOKEN_WHERE 340
#define BX_TOKEN_PRINT_STRING 341
#define BX_TOKEN_NUMERIC 342
#define BX_TOKEN_NE2000 343
#define BX_TOKEN_PIC 344
#define BX_TOKEN_PAGE 345
#define BX_TOKEN_HELP 346
#define BX_TOKEN_CALC 347
#define BX_TOKEN_VGA 348
#define BX_TOKEN_COMMAND 349
#define BX_TOKEN_GENERIC 350
#define BX_TOKEN_RSHIFT 351
#define BX_TOKEN_LSHIFT 352
#define BX_TOKEN_REG_IP 353
#define BX_TOKEN_REG_EIP 354
#define BX_TOKEN_REG_RIP 355
#define NEG 356
#define NOT 357
@ -253,7 +255,7 @@ typedef union YYSTYPE
bx_bool bval;
}
/* Line 1489 of yacc.c. */
#line 257 "y.tab.h"
#line 259 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parser.y,v 1.21 2007-09-23 21:10:06 sshwarts Exp $
// $Id: parser.y,v 1.22 2007-10-11 18:11:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
%{
@ -54,6 +54,7 @@
%token <sval> BX_TOKEN_CPU
%token <sval> BX_TOKEN_FPU
%token <sval> BX_TOKEN_SSE
%token <sval> BX_TOKEN_MMX
%token <sval> BX_TOKEN_ALL
%token <sval> BX_TOKEN_IDT
%token <sval> BX_TOKEN_IVT
@ -522,6 +523,11 @@ info_command:
bx_dbg_info_registers_command(BX_INFO_FPU_REGS);
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_MMX '\n'
{
bx_dbg_info_registers_command(BX_INFO_MMX_REGS);
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_SSE '\n'
{
bx_dbg_info_registers_command(BX_INFO_SSE_REGS);
@ -1013,6 +1019,7 @@ help_command:
dbg_printf("info r|reg|regs|registers - list of CPU integer registers and their contents\n");
dbg_printf("info cpu - list of CPU registers and their contents\n");
dbg_printf("info fpu - list of FPU registers and their contents\n");
dbg_printf("info mmx - list of MMX registers and their contents\n");
dbg_printf("info sse - list of SSE registers and their contents\n");
dbg_printf("info idt - show interrupt descriptor table\n");
dbg_printf("info ivt - show interrupt vector table\n");

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: apic.cc,v 1.97 2007-09-28 19:51:44 sshwarts Exp $
// $Id: apic.cc,v 1.98 2007-10-11 18:11:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -515,6 +515,7 @@ void bx_local_apic_c::startup_msg(Bit32u vector)
{
if(cpu->debug_trap & BX_DEBUG_TRAP_HALT_STATE) {
cpu->debug_trap &= ~BX_DEBUG_TRAP_HALT_STATE;
cpu->cpu_state = BX_CPU_STATE_ACTIVE;
cpu->dword.eip = 0;
cpu->load_seg_reg(&cpu->sregs[BX_SEG_REG_CS], vector*0x100);
BX_INFO(("%s started up at %04X:%08X by APIC", cpu->name, vector*0x100, cpu->dword.eip));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.331 2007-10-10 21:48:46 sshwarts Exp $
// $Id: cpu.h,v 1.332 2007-10-11 18:11:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -339,7 +339,15 @@
#define BX_MODE_LONG_COMPAT 0x3 // EFER.LMA = 1, CR0.PE=1, CS.L=0
#define BX_MODE_LONG_64 0x4 // EFER.LMA = 1, CR0.PE=1, CS.L=1
const char* cpu_mode_string(unsigned cpu_mode);
extern const char* cpu_mode_string(unsigned cpu_mode);
#define BX_CPU_STATE_ACTIVE 0x0
#define BX_CPU_STATE_HLT 0x1
#define BX_CPU_STATE_SHUTDOWN 0x2
#define BX_CPU_STATE_WAIT_FOR_SIPI 0x3
#define BX_CPU_STATE_MWAIT 0x4
extern const char* cpu_state_string(unsigned cpu_state);
#if BX_SUPPORT_X86_64
#define IsCanonical(offset) ((Bit64u)((((Bit64s)(offset)) >> (BX_LIN_ADDRESS_WIDTH-1)) + 1) < 2)
@ -1133,7 +1141,7 @@ public: // for now...
#if BX_SUPPORT_ICACHE
const Bit32u *currPageWriteStampPtr;
#endif
unsigned cpu_mode;
unsigned cpu_mode, cpu_state;
bx_bool in_smm;
bx_bool nmi_disable;
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debugstuff.cc,v 1.77 2006-10-02 17:40:19 vruppert Exp $
// $Id: debugstuff.cc,v 1.78 2007-10-11 18:11:59 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -91,9 +91,25 @@ const char* cpu_mode_string(unsigned cpu_mode)
return cpu_mode_name[cpu_mode];
}
const char* cpu_state_string(unsigned cpu_state)
{
static const char *cpu_state_name[] = {
"active",
"halted",
"in shutdown",
"waiting for SIPI",
"executing mwait",
"unknown state"
};
if(cpu_state >= 5) cpu_state = 5;
return cpu_state_name[cpu_state];
}
void BX_CPU_C::debug(bx_address offset)
{
BX_INFO(("%s", cpu_mode_string(BX_CPU_THIS_PTR cpu_mode)));
BX_INFO(("CPU is in %s (%s)", cpu_mode_string(BX_CPU_THIS_PTR cpu_mode),
cpu_state_string(BX_CPU_THIS_PTR cpu_state)));
BX_INFO(("CS.d_b = %u bit",
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b ? 32 : 16));
BX_INFO(("SS.d_b = %u bit",
@ -243,7 +259,6 @@ void BX_CPU_C::debug(bx_address offset)
#endif // BX_SUPPORT_X86_64
#if BX_DISASM
debug_disasm_instruction(offset);
#endif // #if BX_DISASM

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: init.cc,v 1.133 2007-09-28 19:51:44 sshwarts Exp $
// $Id: init.cc,v 1.134 2007-10-11 18:11:59 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -393,6 +393,7 @@ void BX_CPU_C::register_state(void)
BXRS_PARAM_SPECIAL32(cpu, cpuid_std, param_save_handler, param_restore_handler);
BXRS_PARAM_SPECIAL32(cpu, cpuid_ext, param_save_handler, param_restore_handler);
BXRS_DEC_PARAM_SIMPLE(cpu, cpu_mode);
BXRS_DEC_PARAM_SIMPLE(cpu, cpu_state);
BXRS_HEX_PARAM_SIMPLE(cpu, inhibit_mask);
#if BX_SUPPORT_X86_64
BXRS_HEX_PARAM_SIMPLE(cpu, RAX);
@ -459,13 +460,13 @@ void BX_CPU_C::register_state(void)
}
#if BX_CPU_LEVEL >= 2
BXRS_HEX_PARAM_FIELD(cpu, GDTR_BASE, BX_CPU_THIS_PTR gdtr.base);
BXRS_HEX_PARAM_FIELD(cpu, GDTR_LIMIT, BX_CPU_THIS_PTR gdtr.limit);
BXRS_HEX_PARAM_FIELD(cpu, IDTR_BASE, BX_CPU_THIS_PTR idtr.base);
BXRS_HEX_PARAM_FIELD(cpu, IDTR_LIMIT, BX_CPU_THIS_PTR idtr.limit);
BXRS_HEX_PARAM_FIELD(cpu, gdtr_base, BX_CPU_THIS_PTR gdtr.base);
BXRS_HEX_PARAM_FIELD(cpu, gdtr_limit, BX_CPU_THIS_PTR gdtr.limit);
BXRS_HEX_PARAM_FIELD(cpu, idtr_base, BX_CPU_THIS_PTR idtr.base);
BXRS_HEX_PARAM_FIELD(cpu, idtr_limit, BX_CPU_THIS_PTR idtr.limit);
#endif
bx_list_c *LDTR = new bx_list_c (cpu, "LDTR", 7);
bx_list_c *LDTR = new bx_list_c (cpu, "ldtr", 7);
BXRS_PARAM_SPECIAL16(LDTR, selector, param_save_handler, param_restore_handler);
BXRS_HEX_PARAM_FIELD(LDTR, base, ldtr.cache.u.system.base);
BXRS_HEX_PARAM_FIELD(LDTR, limit, ldtr.cache.u.system.limit);
@ -474,7 +475,7 @@ void BX_CPU_C::register_state(void)
BXRS_PARAM_BOOL(LDTR, granularity, ldtr.cache.u.system.g);
BXRS_PARAM_BOOL(LDTR, avl, ldtr.cache.u.system.avl);
bx_list_c *TR = new bx_list_c (cpu, "TR", 7);
bx_list_c *TR = new bx_list_c (cpu, "tr", 7);
BXRS_PARAM_SPECIAL16(TR, selector, param_save_handler, param_restore_handler);
BXRS_HEX_PARAM_FIELD(TR, base, tr.cache.u.system.base);
BXRS_HEX_PARAM_FIELD(TR, limit, tr.cache.u.system.limit);
@ -486,7 +487,7 @@ void BX_CPU_C::register_state(void)
BXRS_HEX_PARAM_SIMPLE(cpu, smbase);
#if BX_CPU_LEVEL >= 5
bx_list_c *MSR = new bx_list_c(cpu, "MSR", 45);
bx_list_c *MSR = new bx_list_c(cpu, "msr", 45);
#if BX_SUPPORT_APIC
BXRS_HEX_PARAM_FIELD(MSR, apicbase, msr.apicbase);
@ -543,7 +544,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);
@ -562,7 +563,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);
@ -936,6 +937,7 @@ void BX_CPU_C::reset(unsigned source)
#endif
BX_CPU_THIS_PTR cpu_mode = BX_MODE_IA32_REAL;
BX_CPU_THIS_PTR cpu_state = BX_CPU_STATE_ACTIVE;
BX_CPU_THIS_PTR smi_pending = 0;
BX_CPU_THIS_PTR nmi_pending = 0;
@ -1066,6 +1068,7 @@ void BX_CPU_C::reset(unsigned source)
// it's an application processor, halt until IPI is heard.
BX_CPU_THIS_PTR msr.apicbase &= ~0x0100; /* clear bit 8 BSP */
BX_INFO(("CPU[%d] is an application processor. Halting until IPI.", apic_id));
BX_CPU_THIS_PTR cpu_state = BX_CPU_STATE_ACTIVE;
debug_trap |= BX_DEBUG_TRAP_HALT_STATE;
async_event = 1;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: mmx.cc,v 1.61 2007-07-09 15:16:12 sshwarts Exp $
// $Id: mmx.cc,v 1.62 2007-10-11 18:11:59 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Stanislav Shwartsman
@ -88,7 +88,7 @@ void BX_CPU_C::print_state_MMX(void)
{
for(int i=0;i<8;i++) {
BxPackedMmxRegister mm = BX_READ_MMX_REG(i);
fprintf(stderr, "MM%d: %08x%08x\n", i, MMXUD1(mm), MMXUD0(mm));
BX_DEBUG(("MM%d: %08x%08x\n", i, MMXUD1(mm), MMXUD0(mm)));
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.172 2007-10-10 21:48:46 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.173 2007-10-11 18:12:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -23,14 +23,14 @@
// 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
#include "bochs.h"
#include "cpu.h"
#define LOG_THIS BX_CPU_THIS_PTR
#if BX_SUPPORT_X86_64==0
// Make life easier for merging code.
#define RAX EAX
@ -77,6 +77,7 @@ void BX_CPU_C::shutdown(void)
BX_CPU_THIS_PTR clear_IF();
// artificial trap bit, why use another variable.
BX_CPU_THIS_PTR cpu_state = BX_CPU_STATE_SHUTDOWN;
BX_CPU_THIS_PTR debug_trap |= BX_DEBUG_TRAP_HALT_STATE; // artificial trap
BX_CPU_THIS_PTR async_event = 1; // so processor knows to check
// Execution of this instruction completes. The processor
@ -86,8 +87,8 @@ void BX_CPU_C::shutdown(void)
BX_INSTR_HLT(BX_CPU_ID);
#if BX_USE_IDLE_HACK
bx_gui->sim_is_idle ();
#endif /* BX_USE_IDLE_HACK */
bx_gui->sim_is_idle();
#endif
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
}
@ -98,7 +99,6 @@ void BX_CPU_C::HLT(bxInstruction_c *i)
BX_DEBUG(("HLT: %s priveledge check failed, CPL=%d, generate #GP(0)",
cpu_mode_string(BX_CPU_THIS_PTR cpu_mode), CPL));
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
if (! BX_CPU_THIS_PTR get_IF()) {
@ -112,6 +112,7 @@ void BX_CPU_C::HLT(bxInstruction_c *i)
// following HLT.
// artificial trap bit, why use another variable.
BX_CPU_THIS_PTR cpu_state = BX_CPU_STATE_HLT;
BX_CPU_THIS_PTR debug_trap |= BX_DEBUG_TRAP_HALT_STATE; // artificial trap
BX_CPU_THIS_PTR async_event = 1; // so processor knows to check
// Execution of this instruction completes. The processor
@ -121,13 +122,12 @@ void BX_CPU_C::HLT(bxInstruction_c *i)
BX_INSTR_HLT(BX_CPU_ID);
#if BX_USE_IDLE_HACK
bx_gui->sim_is_idle ();
#endif /* BX_USE_IDLE_HACK */
bx_gui->sim_is_idle();
#endif
}
void BX_CPU_C::CLTS(bxInstruction_c *i)
{
// #GP(0) if CPL is not 0
if (!real_mode() && CPL!=0) {
BX_ERROR(("CLTS: priveledge check failed, generate #GP(0)"));
exception(BX_GP_EXCEPTION, 0, 0);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_move.cc,v 1.61 2007-08-31 18:09:34 sshwarts Exp $
// $Id: sse_move.cc,v 1.62 2007-10-11 18:12:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -45,11 +45,11 @@ void BX_CPU_C::prepareSSE(void)
void BX_CPU_C::print_state_SSE(void)
{
fprintf(stderr, "MXCSR: %08x\n", BX_MXCSR_REGISTER);
BX_DEBUG(("MXCSR: 0x%08x\n", BX_MXCSR_REGISTER));
for(unsigned i=0;i<BX_XMM_REGISTERS;i++) {
BxPackedXmmRegister xmm = BX_READ_XMM_REG(i);
fprintf(stderr, "XMM%02u: %08x%08x:%08x%08x\n", i,
xmm.xmm32u(3), xmm.xmm32u(2), xmm.xmm32u(1), xmm.xmm32u(0));
BX_DEBUG(("XMM%02u: %08x%08x:%08x%08x\n", i,
xmm.xmm32u(3), xmm.xmm32u(2), xmm.xmm32u(1), xmm.xmm32u(0)));
}
}