Remove dump_cpu debugger function, CPI method and all related structures.

Extended 'info' command in debugger to have all functionality of dump_cpu if needed. Also param tree print always could be used !
This commit is contained in:
Stanislav Shwartsman 2007-10-23 21:51:44 +00:00
parent 292153b30e
commit 6d7134ef99
10 changed files with 1956 additions and 2122 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.102 2007-10-14 19:04:48 sshwarts Exp $
// $Id: dbg_main.cc,v 1.103 2007-10-23 21:51:42 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -565,9 +565,9 @@ void bx_dbg_info_flags(void)
void bx_dbg_info_control_regs_command(void)
{
Bit32u cr0 = BX_CPU(dbg_cpu)->dbg_get_reg(BX_DBG_REG_CR0);
bx_address cr2 = BX_CPU(dbg_cpu)->dbg_get_reg(BX_DBG_REG_CR2);
Bit32u cr3 = BX_CPU(dbg_cpu)->dbg_get_reg(BX_DBG_REG_CR3);
Bit32u cr0 = SIM->get_param_num("CR0", dbg_cpu_list)->get();
bx_address cr2 = SIM->get_param_num("CR2", dbg_cpu_list)->get();
Bit32u cr3 = SIM->get_param_num("CR3", dbg_cpu_list)->get();
dbg_printf("CR0=0x%08x\n", cr0);
dbg_printf(" PG=paging=%d\n", (cr0>>31) & 1);
dbg_printf(" CD=cache disable=%d\n", (cr0>>30) & 1);
@ -585,7 +585,7 @@ void bx_dbg_info_control_regs_command(void)
dbg_printf(" PCD=page-level cache disable=%d\n", (cr3>>4) & 1);
dbg_printf(" PWT=page-level writes transparent=%d\n", (cr3>>3) & 1);
#if BX_CPU_LEVEL >= 4
Bit32u cr4 = BX_CPU(dbg_cpu)->dbg_get_reg(BX_DBG_REG_CR4);
Bit32u cr4 = SIM->get_param_num("CR4", dbg_cpu_list)->get();
dbg_printf("CR4=0x%08x\n", cr4);
dbg_printf(" VME=virtual-8086 mode extensions=%d\n", (cr4>>0) & 1);
dbg_printf(" PVI=protected-mode virtual interrupts=%d\n", (cr4>>1) & 1);
@ -598,9 +598,9 @@ void bx_dbg_info_control_regs_command(void)
dbg_printf(" PCE=performance-monitor counter enable=%d\n", (cr4>>8) & 1);
dbg_printf(" OXFXSR=OS support for FXSAVE/FXRSTOR=%d\n", (cr4>>9) & 1);
dbg_printf(" OSXMMEXCPT=OS support for unmasked SIMD FP exceptions=%d\n", (cr4>>10) & 1);
#endif /* BX_CPU_LEVEL >= 4 */
#endif
#if BX_SUPPORT_X86_64
Bit32u efer = BX_CPU(dbg_cpu)->get_EFER();
Bit32u efer = SIM->get_param_num("MSR.EFER", dbg_cpu_list)->get();
dbg_printf("EFER=0x%08x\n", efer);
dbg_printf(" SCE=SYSCALL/SYSRET support=%d\n", (efer>>0) & 1);
dbg_printf(" LME=long mode enabled=%d\n", (efer>>8) & 1);
@ -610,6 +610,143 @@ void bx_dbg_info_control_regs_command(void)
#endif
}
void bx_dbg_info_segment_regs_command(void)
{
bx_dbg_sreg_t sreg;
bx_dbg_global_sreg_t global_sreg;
BX_CPU(dbg_cpu)->dbg_get_sreg(&sreg, BX_DBG_SREG_CS);
dbg_printf("cs:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_sreg(&sreg, BX_DBG_SREG_DS);
dbg_printf("ds:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_sreg(&sreg, BX_DBG_SREG_SS);
dbg_printf("ss:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_sreg(&sreg, BX_DBG_SREG_ES);
dbg_printf("es:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_sreg(&sreg, BX_DBG_SREG_FS);
dbg_printf("fs:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_sreg(&sreg, BX_DBG_SREG_GS);
dbg_printf("gs:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_ldtr(&sreg);
dbg_printf("ldtr:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_tr(&sreg);
dbg_printf("tr:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) sreg.sel, (unsigned) sreg.des_l,
(unsigned) sreg.des_h, (unsigned) sreg.valid);
BX_CPU(dbg_cpu)->dbg_get_gdtr(&global_sreg);
dbg_printf("gdtr:base=0x%08x, limit=0x%x\n",
(unsigned) global_sreg.base, (unsigned) global_sreg.limit);
BX_CPU(dbg_cpu)->dbg_get_idtr(&global_sreg);
dbg_printf("idtr:base=0x%08x, limit=0x%x\n",
(unsigned) global_sreg.base, (unsigned) global_sreg.limit);
}
void bx_dbg_info_registers_command(int which_regs_mask)
{
bx_address reg;
if (which_regs_mask & BX_INFO_GENERAL_PURPOSE_REGS) {
#if BX_SUPPORT_SMP
dbg_printf("%s:\n", BX_CPU(dbg_cpu)->name);
#endif
#if BX_SUPPORT_X86_64 == 0
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EAX);
dbg_printf("eax: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_ECX);
dbg_printf("ecx: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EDX);
dbg_printf("edx: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EBX);
dbg_printf("ebx: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_ESP);
dbg_printf("esp: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EBP);
dbg_printf("ebp: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_ESI);
dbg_printf("esi: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EDI);
dbg_printf("edi: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = bx_dbg_get_eip();
dbg_printf("eip: 0x%08x\n", (unsigned) reg);
#else
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RAX);
dbg_printf("rax: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RCX);
dbg_printf("rcx: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RDX);
dbg_printf("rdx: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RBX);
dbg_printf("rbx: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RSP);
dbg_printf("rsp: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RBP);
dbg_printf("rbp: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RSI);
dbg_printf("rsi: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RDI);
dbg_printf("rdi: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R8);
dbg_printf("r8 : 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R9);
dbg_printf("r9 : 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R10);
dbg_printf("r10: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R11);
dbg_printf("r11: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R12);
dbg_printf("r12: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R13);
dbg_printf("r13: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R14);
dbg_printf("r14: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R15);
dbg_printf("r15: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = bx_dbg_get_instruction_pointer();
dbg_printf("rip: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
#endif
reg = BX_CPU(dbg_cpu)->read_eflags();
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_dbg_print_fpu_state();
}
#endif
if (which_regs_mask & BX_INFO_MMX_REGS) {
bx_dbg_print_mmx_state();
}
if (which_regs_mask & BX_INFO_SSE_REGS) {
bx_dbg_print_sse_state();
}
}
//
// commands invoked from parser
//
@ -1442,7 +1579,7 @@ void bx_dbg_disassemble_current(int which_cpu, int print_time)
// in each cpu description (see cpu/cpu.h) and update/compare those "prev" values
// from here. (eks)
if(BX_CPU(dbg_cpu)->trace_reg)
bx_dbg_info_registers_command(BX_INFO_CPU_REGS);
bx_dbg_info_registers_command(BX_INFO_GENERAL_PURPOSE_REGS);
if (print_time)
dbg_printf("(%u).[" FMT_LL "d] ", which_cpu, bx_pc_system.time_ticks());
@ -1893,158 +2030,6 @@ void bx_dbg_take_command(const char *what, unsigned n)
}
}
void bx_dbg_info_registers_command(int which_regs_mask)
{
bx_address reg;
if (which_regs_mask & BX_INFO_CPU_REGS) {
#if BX_SUPPORT_SMP
dbg_printf("%s:\n", BX_CPU(dbg_cpu)->name);
#endif
#if BX_SUPPORT_X86_64 == 0
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EAX);
dbg_printf("eax: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_ECX);
dbg_printf("ecx: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EDX);
dbg_printf("edx: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EBX);
dbg_printf("ebx: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_ESP);
dbg_printf("esp: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EBP);
dbg_printf("ebp: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_ESI);
dbg_printf("esi: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = BX_CPU(dbg_cpu)->get_reg32(BX_32BIT_REG_EDI);
dbg_printf("edi: 0x%08x %d\n", (unsigned) reg, (int) reg);
reg = bx_dbg_get_eip();
dbg_printf("eip: 0x%08x\n", (unsigned) reg);
#else
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RAX);
dbg_printf("rax: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RCX);
dbg_printf("rcx: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RDX);
dbg_printf("rdx: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RBX);
dbg_printf("rbx: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RSP);
dbg_printf("rsp: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RBP);
dbg_printf("rbp: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RSI);
dbg_printf("rsi: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_RDI);
dbg_printf("rdi: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R8);
dbg_printf("r8 : 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R9);
dbg_printf("r9 : 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R10);
dbg_printf("r10: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R11);
dbg_printf("r11: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R12);
dbg_printf("r12: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R13);
dbg_printf("r13: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R14);
dbg_printf("r14: 0x%08x:%08x ", GET32H(reg), GET32L(reg));
reg = BX_CPU(dbg_cpu)->get_reg32(BX_64BIT_REG_R15);
dbg_printf("r15: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
reg = bx_dbg_get_instruction_pointer();
dbg_printf("rip: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
#endif
reg = BX_CPU(dbg_cpu)->read_eflags();
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_dbg_print_fpu_state();
}
#endif
if (which_regs_mask & BX_INFO_MMX_REGS) {
bx_dbg_print_mmx_state();
}
if (which_regs_mask & BX_INFO_SSE_REGS) {
bx_dbg_print_sse_state();
}
}
void bx_dbg_dump_cpu_command(void)
{
bx_dbg_cpu_t cpu;
BX_CPU(dbg_cpu)->dbg_get_cpu(&cpu);
#if BX_SUPPORT_SMP
dbg_printf("CPU#%u\n", dbg_cpu);
#endif
dbg_printf("eax:0x%08x, ebx:0x%08x, ecx:0x%08x, edx:0x%08x\n",
(unsigned) cpu.eax, (unsigned) cpu.ebx,
(unsigned) cpu.ecx, (unsigned) cpu.edx);
dbg_printf("ebp:0x%08x, esp:0x%08x, esi:0x%08x, edi:0x%08x\n",
(unsigned) cpu.ebp, (unsigned) cpu.esp,
(unsigned) cpu.esi, (unsigned) cpu.edi);
dbg_printf("eip:0x%08x, eflags:0x%08x, inhibit_mask:%u\n",
(unsigned) cpu.eip, (unsigned) cpu.eflags, cpu.inhibit_mask);
dbg_printf("cs:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.cs.sel, (unsigned) cpu.cs.des_l,
(unsigned) cpu.cs.des_h, (unsigned) cpu.cs.valid);
dbg_printf("ss:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.ss.sel, (unsigned) cpu.ss.des_l,
(unsigned) cpu.ss.des_h, (unsigned) cpu.ss.valid);
dbg_printf("ds:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.ds.sel, (unsigned) cpu.ds.des_l,
(unsigned) cpu.ds.des_h, (unsigned) cpu.ds.valid);
dbg_printf("es:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.es.sel, (unsigned) cpu.es.des_l,
(unsigned) cpu.es.des_h, (unsigned) cpu.es.valid);
dbg_printf("fs:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.fs.sel, (unsigned) cpu.fs.des_l,
(unsigned) cpu.fs.des_h, (unsigned) cpu.fs.valid);
dbg_printf("gs:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.gs.sel, (unsigned) cpu.gs.des_l,
(unsigned) cpu.gs.des_h, (unsigned) cpu.gs.valid);
dbg_printf("ldtr:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.ldtr.sel, (unsigned) cpu.ldtr.des_l,
(unsigned) cpu.ldtr.des_h, (unsigned) cpu.ldtr.valid);
dbg_printf("tr:s=0x%04x, dl=0x%08x, dh=0x%08x, valid=%u\n",
(unsigned) cpu.tr.sel, (unsigned) cpu.tr.des_l,
(unsigned) cpu.tr.des_h, (unsigned) cpu.tr.valid);
dbg_printf("gdtr:base=0x%08x, limit=0x%x\n",
(unsigned) cpu.gdtr.base, (unsigned) cpu.gdtr.limit);
dbg_printf("idtr:base=0x%08x, limit=0x%x\n",
(unsigned) cpu.idtr.base, (unsigned) cpu.idtr.limit);
dbg_printf("dr0:0x%08x, dr1:0x%08x, dr2:0x%08x\n",
(unsigned) cpu.dr0, (unsigned) cpu.dr1, (unsigned) cpu.dr2);
dbg_printf("dr3:0x%08x, dr6:0x%08x, dr7:0x%08x\n",
(unsigned) cpu.dr3, (unsigned) cpu.dr6, (unsigned) cpu.dr7);
dbg_printf("cr0:0x%08x, cr1:0x%08x, cr2:0x%08x\n",
(unsigned) cpu.cr0, (unsigned) cpu.cr1, (unsigned) cpu.cr2);
dbg_printf("cr3:0x%08x, cr4:0x%08x\n",
(unsigned) cpu.cr3, (unsigned) cpu.cr4);
#if BX_SUPPORT_PCI
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
DEV_pci_print_i440fx_state();
}
#endif
dbg_printf("done\n");
}
static void bx_print_char(Bit8u ch)
{
if (ch < 10)
@ -2938,7 +2923,7 @@ void bx_dbg_info_ne2k(int page, int reg)
#if BX_SUPPORT_NE2K
DEV_ne2k_print_info(stderr, page, reg, 0);
#else
dbg_printf("NE2000 support is not compiled in.\n");
dbg_printf("NE2000 support is not compiled in\n");
#endif
}
@ -2960,6 +2945,25 @@ void bx_dbg_info_vga()
DEV_vga_dump_status();
}
/*
* this implements the info pci command in the debugger.
* info pci - shows i440fx state
*/
void bx_dbg_info_pci()
{
#if BX_SUPPORT_PCI
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
DEV_pci_print_i440fx_state();
}
else {
dbg_printf("PCI support is disabled in .bochsrc\n");
}
#else
dbg_printf("PCI support is not compiled in\n");
#endif
}
//
// Reports from various events
//

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debug.h,v 1.35 2007-10-14 19:04:49 sshwarts Exp $
// $Id: debug.h,v 1.36 2007-10-23 21:51:42 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -257,7 +257,7 @@ int bx_dbg_lbreakpoint_command(BreakpointKind bk, bx_address laddress);
int bx_dbg_pbreakpoint_command(BreakpointKind bk, bx_phy_address paddress);
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_GENERAL_PURPOSE_REGS 1 /* bitmasks - choices for bx_dbg_info_registers_command */
#define BX_INFO_FPU_REGS 2
#define BX_INFO_MMX_REGS 4
#define BX_INFO_SSE_REGS 8
@ -269,6 +269,7 @@ void bx_dbg_info_gdt_command(unsigned from, unsigned to);
void bx_dbg_info_ldt_command(unsigned from, unsigned to);
void bx_dbg_info_tss_command(void);
void bx_dbg_info_control_regs_command(void);
void bx_dbg_info_segment_regs_command(void);
void bx_dbg_info_flags(void);
void bx_dbg_info_linux_command(void);
void bx_dbg_examine_command(char *command, char *format, bx_bool format_passed,
@ -276,7 +277,6 @@ void bx_dbg_examine_command(char *command, char *format, bx_bool format_passed,
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_disassemble_current(const char *);
void bx_dbg_disassemble_command(const char *, Bit64u from, Bit64u to);
void bx_dbg_instrument_command(const char *);
@ -287,6 +287,7 @@ void bx_dbg_linux_syscall(unsigned which_cpu);
void bx_dbg_info_ne2k(int page, int reg);
void bx_dbg_info_pic(void);
void bx_dbg_info_vga(void);
void bx_dbg_info_pci(void);
void bx_dbg_print_help(void);
void bx_dbg_calc_command(Bit64u value);
void bx_dbg_dump_table(void);
@ -477,32 +478,6 @@ typedef struct {
Bit16u limit;
} bx_dbg_global_sreg_t;
typedef struct {
Bit32u eax;
Bit32u ebx;
Bit32u ecx;
Bit32u edx;
Bit32u ebp;
Bit32u esi;
Bit32u edi;
Bit32u esp;
Bit32u eflags;
Bit32u eip;
bx_dbg_sreg_t cs;
bx_dbg_sreg_t ss;
bx_dbg_sreg_t ds;
bx_dbg_sreg_t es;
bx_dbg_sreg_t fs;
bx_dbg_sreg_t gs;
bx_dbg_sreg_t ldtr;
bx_dbg_sreg_t tr;
struct { Bit32u base, limit; } gdtr;
struct { Bit32u base, limit; } idtr;
Bit32u dr0, dr1, dr2, dr3, dr6, dr7;
Bit32u cr0, cr1, cr2, cr3, cr4;
unsigned inhibit_mask;
} bx_dbg_cpu_t;
void bx_dbg_dma_report(bx_phy_address addr, unsigned len, unsigned what, Bit32u val);
void bx_dbg_iac_report(unsigned vector, unsigned irq);
void bx_dbg_a20_report(unsigned val);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
%{
/////////////////////////////////////////////////////////////////////////
// $Id: lexer.l,v 1.21 2007-10-14 19:04:49 sshwarts Exp $
// $Id: lexer.l,v 1.22 2007-10-23 21:51:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
@ -68,6 +68,8 @@ info { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INFO); }
cr |
creg |
cregs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTROL_REGS); }
sreg |
sregs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SEGMENT_REGS); }
r |
reg |
regs |
@ -85,7 +87,6 @@ tss { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TSS); }
tab { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TAB); }
dirty { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DIRTY); }
linux { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LINUX); }
dump_cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DUMP_CPU); }
delete |
del |
d { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DEL_BREAKPOINT); }
@ -135,6 +136,7 @@ print-string { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PRINT_STRING); }
ne2k|ne2000 { bxlval.sval = strdup(bxtext); return(BX_TOKEN_NE2000); }
page { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PAGE); }
vga { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VGA); }
pci { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PCI); }
al { bxlval.uval = BX_DBG_REG8L_AL; return(BX_TOKEN_8BL_REG);}
bl { bxlval.uval = BX_DBG_REG8L_BL; return(BX_TOKEN_8BL_REG);}
cl { bxlval.uval = BX_DBG_REG8L_CL; return(BX_TOKEN_8BL_REG);}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: linux.cc,v 1.7 2006-09-26 19:16:10 sshwarts Exp $
// $Id: linux.cc,v 1.8 2007-10-23 21:51:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
#include <stdio.h>
@ -19,16 +19,17 @@
void bx_dbg_info_linux_command (void)
{
BX_INFO (("Info linux"));
bx_dbg_cpu_t cpu;
BX_CPU(dbg_cpu)->dbg_get_cpu(&cpu);
bx_dbg_sreg_t cs;
Bit32u cr0 = BX_CPU(dbg_cpu)->dbg_get_reg(BX_DBG_REG_CR0);
BX_CPU(dbg_cpu)->dbg_get_sreg(&cs, BX_DBG_SREG_CS);
int mode;
if (cpu.cr0 & 1) {
if (cr0 & 1) {
// protected mode
if (cpu.cs.sel == KERNEL_CS) {
if (cs.sel == KERNEL_CS) {
mode = 'k';
fprintf (stderr, "Processor mode: kernel\n");
} else if (cpu.cs.sel == USER_CS) {
} else if (cs.sel == USER_CS) {
fprintf (stderr, "Processor mode: user\n");
mode = 'u';
} else {
@ -41,72 +42,6 @@ void bx_dbg_info_linux_command (void)
}
if (mode != 'u') return;
/* user mode, look through registers and memory to find our process ID */
#if 0
fprintf(stderr, "eax:0x%x\n", (unsigned) cpu.eax);
fprintf(stderr, "ebx:0x%x\n", (unsigned) cpu.ebx);
fprintf(stderr, "ecx:0x%x\n", (unsigned) cpu.ecx);
fprintf(stderr, "edx:0x%x\n", (unsigned) cpu.edx);
fprintf(stderr, "ebp:0x%x\n", (unsigned) cpu.ebp);
fprintf(stderr, "esi:0x%x\n", (unsigned) cpu.esi);
fprintf(stderr, "edi:0x%x\n", (unsigned) cpu.edi);
fprintf(stderr, "esp:0x%x\n", (unsigned) cpu.esp);
fprintf(stderr, "eflags:0x%x\n", (unsigned) cpu.eflags);
fprintf(stderr, "eip:0x%x\n", (unsigned) cpu.eip);
fprintf(stderr, "cs:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.cs.sel, (unsigned) cpu.cs.des_l,
(unsigned) cpu.cs.des_h, (unsigned) cpu.cs.valid);
fprintf(stderr, "ss:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.ss.sel, (unsigned) cpu.ss.des_l,
(unsigned) cpu.ss.des_h, (unsigned) cpu.ss.valid);
fprintf(stderr, "ds:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.ds.sel, (unsigned) cpu.ds.des_l,
(unsigned) cpu.ds.des_h, (unsigned) cpu.ds.valid);
fprintf(stderr, "es:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.es.sel, (unsigned) cpu.es.des_l,
(unsigned) cpu.es.des_h, (unsigned) cpu.es.valid);
fprintf(stderr, "fs:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.fs.sel, (unsigned) cpu.fs.des_l,
(unsigned) cpu.fs.des_h, (unsigned) cpu.fs.valid);
fprintf(stderr, "gs:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.gs.sel, (unsigned) cpu.gs.des_l,
(unsigned) cpu.gs.des_h, (unsigned) cpu.gs.valid);
fprintf(stderr, "ldtr:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.ldtr.sel, (unsigned) cpu.ldtr.des_l,
(unsigned) cpu.ldtr.des_h, (unsigned) cpu.ldtr.valid);
fprintf(stderr, "tr:s=0x%x, dl=0x%x, dh=0x%x, valid=%u\n",
(unsigned) cpu.tr.sel, (unsigned) cpu.tr.des_l,
(unsigned) cpu.tr.des_h, (unsigned) cpu.tr.valid);
fprintf(stderr, "gdtr:base=0x%x, limit=0x%x\n",
(unsigned) cpu.gdtr.base, (unsigned) cpu.gdtr.limit);
fprintf(stderr, "idtr:base=0x%x, limit=0x%x\n",
(unsigned) cpu.idtr.base, (unsigned) cpu.idtr.limit);
fprintf(stderr, "dr0:0x%x\n", (unsigned) cpu.dr0);
fprintf(stderr, "dr1:0x%x\n", (unsigned) cpu.dr1);
fprintf(stderr, "dr2:0x%x\n", (unsigned) cpu.dr2);
fprintf(stderr, "dr3:0x%x\n", (unsigned) cpu.dr3);
fprintf(stderr, "dr6:0x%x\n", (unsigned) cpu.dr6);
fprintf(stderr, "dr7:0x%x\n", (unsigned) cpu.dr7);
fprintf(stderr, "cr0:0x%x\n", (unsigned) cpu.cr0);
fprintf(stderr, "cr1:0x%x\n", (unsigned) cpu.cr1);
fprintf(stderr, "cr2:0x%x\n", (unsigned) cpu.cr2);
fprintf(stderr, "cr3:0x%x\n", (unsigned) cpu.cr3);
fprintf(stderr, "cr4:0x%x\n", (unsigned) cpu.cr4);
fprintf(stderr, "inhibit_mask:%u\n", cpu.inhibit_mask);
#endif
}
class syscall_names_t {

File diff suppressed because it is too large Load Diff

View File

@ -83,18 +83,18 @@
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_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_SEGMENT_REGS = 302,
BX_TOKEN_EXAMINE = 303,
BX_TOKEN_XFORMAT = 304,
BX_TOKEN_DISFORMAT = 305,
BX_TOKEN_RESTORE = 306,
BX_TOKEN_SETPMEM = 307,
BX_TOKEN_SYMBOLNAME = 308,
BX_TOKEN_QUERY = 309,
BX_TOKEN_PENDING = 310,
BX_TOKEN_TAKE = 311,
BX_TOKEN_DMA = 312,
BX_TOKEN_IRQ = 313,
BX_TOKEN_DISASSEMBLE = 314,
BX_TOKEN_INSTRUMENT = 315,
BX_TOKEN_STRING = 316,
@ -130,15 +130,16 @@
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
BX_TOKEN_PCI = 349,
BX_TOKEN_COMMAND = 350,
BX_TOKEN_GENERIC = 351,
BX_TOKEN_RSHIFT = 352,
BX_TOKEN_LSHIFT = 353,
BX_TOKEN_REG_IP = 354,
BX_TOKEN_REG_EIP = 355,
BX_TOKEN_REG_RIP = 356,
NEG = 357,
NOT = 358
};
#endif
/* Tokens. */
@ -186,18 +187,18 @@
#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_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_SEGMENT_REGS 302
#define BX_TOKEN_EXAMINE 303
#define BX_TOKEN_XFORMAT 304
#define BX_TOKEN_DISFORMAT 305
#define BX_TOKEN_RESTORE 306
#define BX_TOKEN_SETPMEM 307
#define BX_TOKEN_SYMBOLNAME 308
#define BX_TOKEN_QUERY 309
#define BX_TOKEN_PENDING 310
#define BX_TOKEN_TAKE 311
#define BX_TOKEN_DMA 312
#define BX_TOKEN_IRQ 313
#define BX_TOKEN_DISASSEMBLE 314
#define BX_TOKEN_INSTRUMENT 315
#define BX_TOKEN_STRING 316
@ -233,15 +234,16 @@
#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
#define BX_TOKEN_PCI 349
#define BX_TOKEN_COMMAND 350
#define BX_TOKEN_GENERIC 351
#define BX_TOKEN_RSHIFT 352
#define BX_TOKEN_LSHIFT 353
#define BX_TOKEN_REG_IP 354
#define BX_TOKEN_REG_EIP 355
#define BX_TOKEN_REG_RIP 356
#define NEG 357
#define NOT 358
@ -255,7 +257,7 @@ typedef union YYSTYPE
bx_bool bval;
}
/* Line 1489 of yacc.c. */
#line 259 "y.tab.h"
#line 261 "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.23 2007-10-14 19:04:49 sshwarts Exp $
// $Id: parser.y,v 1.24 2007-10-23 21:51:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
%{
@ -65,6 +65,7 @@
%token <sval> BX_TOKEN_DIRTY
%token <sval> BX_TOKEN_LINUX
%token <sval> BX_TOKEN_CONTROL_REGS
%token <sval> BX_TOKEN_SEGMENT_REGS
%token <sval> BX_TOKEN_EXAMINE
%token <sval> BX_TOKEN_XFORMAT
%token <sval> BX_TOKEN_DISFORMAT
@ -76,7 +77,6 @@
%token <sval> BX_TOKEN_TAKE
%token <sval> BX_TOKEN_DMA
%token <sval> BX_TOKEN_IRQ
%token <sval> BX_TOKEN_DUMP_CPU
%token <sval> BX_TOKEN_DISASSEMBLE
%token <sval> BX_TOKEN_INSTRUMENT
%token <sval> BX_TOKEN_STRING
@ -112,6 +112,7 @@
%token <sval> BX_TOKEN_HELP
%token <sval> BX_TOKEN_CALC
%token <sval> BX_TOKEN_VGA
%token <sval> BX_TOKEN_PCI
%token <sval> BX_TOKEN_COMMAND
%token <sval> BX_TOKEN_GENERIC
%token BX_TOKEN_RSHIFT
@ -145,7 +146,6 @@ command:
| regs_command
| blist_command
| slist_command
| dump_cpu_command
| delete_command
| bpe_command
| bpd_command
@ -508,14 +508,9 @@ info_command:
bx_dbg_info_bpoints_command();
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_CPU '\n'
{
bx_dbg_dump_cpu_command();
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_REGISTERS '\n'
{
bx_dbg_info_registers_command(BX_INFO_CPU_REGS);
bx_dbg_info_registers_command(BX_INFO_GENERAL_PURPOSE_REGS);
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_FPU '\n'
@ -534,8 +529,9 @@ info_command:
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_ALL '\n'
| BX_TOKEN_INFO BX_TOKEN_CPU '\n'
{
bx_dbg_info_registers_command(BX_INFO_CPU_REGS | BX_INFO_FPU_REGS | BX_INFO_SSE_REGS);
bx_dbg_info_registers_command(BX_INFO_GENERAL_PURPOSE_REGS | BX_INFO_FPU_REGS | BX_INFO_SSE_REGS);
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_DIRTY '\n'
@ -598,6 +594,11 @@ info_command:
bx_dbg_info_control_regs_command();
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_SEGMENT_REGS '\n'
{
bx_dbg_info_segment_regs_command();
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_NE2000 '\n'
{
bx_dbg_info_ne2k(-1, -1);
@ -623,6 +624,11 @@ info_command:
bx_dbg_info_vga();
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_PCI '\n'
{
bx_dbg_info_pci();
free($1); free($2);
}
;
optional_numeric :
@ -632,15 +638,7 @@ optional_numeric :
regs_command:
BX_TOKEN_REGISTERS '\n'
{
bx_dbg_info_registers_command(BX_INFO_CPU_REGS);
free($1);
}
;
dump_cpu_command:
BX_TOKEN_DUMP_CPU '\n'
{
bx_dbg_dump_cpu_command();
bx_dbg_info_registers_command(BX_INFO_GENERAL_PURPOSE_REGS);
free($1);
}
;
@ -891,11 +889,6 @@ help_command:
dbg_printf("trace-reg off - disable registers state tracing\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_DUMP_CPU '\n'
{
dbg_printf("dump_cpu - dump complete cpu state\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_RESTORE '\n'
{
dbg_printf("restore <param_name> [path] - restore bochs root param from the file\n");
@ -1029,12 +1022,14 @@ help_command:
dbg_printf("info gdt - show global descriptor table\n");
dbg_printf("info tss - show current task state segment\n");
dbg_printf("info tab - show page tables\n");
dbg_printf("info cr - show CR0-4 registers\n");
dbg_printf("info creg - show CR0-CR4 registers\n");
dbg_printf("info sreg - show segment registers\n");
dbg_printf("info eflags - show decoded EFLAGS register\n");
dbg_printf("info symbols [string] - list symbols whose prefix is string\n");
dbg_printf("info pic - show PICs registers\n");
dbg_printf("info ne2000 - show NE2000 registers\n");
dbg_printf("info vga - show vga registers\n");
dbg_printf("info pci - show i440fx PCI state\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_SHOW '\n'

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.341 2007-10-22 17:41:41 sshwarts Exp $
// $Id: cpu.h,v 1.342 2007-10-23 21:51:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2773,7 +2773,6 @@ public: // for now...
BX_SMF void dbg_take_irq(void);
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_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);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debugstuff.cc,v 1.80 2007-10-18 22:44:39 sshwarts Exp $
// $Id: debugstuff.cc,v 1.81 2007-10-23 21:51:44 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -429,88 +429,6 @@ void BX_CPU_C::dbg_get_idtr(bx_dbg_global_sreg_t *sreg)
sreg->limit = BX_CPU_THIS_PTR idtr.limit;
}
bx_bool BX_CPU_C::dbg_get_cpu(bx_dbg_cpu_t *cpu)
{
cpu->eax = EAX;
cpu->ebx = EBX;
cpu->ecx = ECX;
cpu->edx = EDX;
cpu->ebp = EBP;
cpu->esi = ESI;
cpu->edi = EDI;
cpu->esp = ESP;
cpu->eip = EIP;
cpu->eflags = BX_CPU_THIS_PTR read_eflags();
cpu->cs.sel = BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value;
cpu->cs.des_l = get_descriptor_l(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache);
cpu->cs.des_h = get_descriptor_h(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache);
cpu->cs.valid = BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid;
cpu->ss.sel = BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value;
cpu->ss.des_l = get_descriptor_l(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache);
cpu->ss.des_h = get_descriptor_h(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache);
cpu->ss.valid = BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid;
cpu->ds.sel = BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.value;
cpu->ds.des_l = get_descriptor_l(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache);
cpu->ds.des_h = get_descriptor_h(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache);
cpu->ds.valid = BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.valid;
cpu->es.sel = BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.value;
cpu->es.des_l = get_descriptor_l(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache);
cpu->es.des_h = get_descriptor_h(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache);
cpu->es.valid = BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.valid;
cpu->fs.sel = BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value;
cpu->fs.des_l = get_descriptor_l(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache);
cpu->fs.des_h = get_descriptor_h(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache);
cpu->fs.valid = BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.valid;
cpu->gs.sel = BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value;
cpu->gs.des_l = get_descriptor_l(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache);
cpu->gs.des_h = get_descriptor_h(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache);
cpu->gs.valid = BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.valid;
cpu->ldtr.sel = BX_CPU_THIS_PTR ldtr.selector.value;
cpu->ldtr.des_l = get_descriptor_l(&BX_CPU_THIS_PTR ldtr.cache);
cpu->ldtr.des_h = get_descriptor_h(&BX_CPU_THIS_PTR ldtr.cache);
cpu->ldtr.valid = BX_CPU_THIS_PTR ldtr.cache.valid;
cpu->tr.sel = BX_CPU_THIS_PTR tr.selector.value;
cpu->tr.des_l = get_descriptor_l(&BX_CPU_THIS_PTR tr.cache);
cpu->tr.des_h = get_descriptor_h(&BX_CPU_THIS_PTR tr.cache);
cpu->tr.valid = BX_CPU_THIS_PTR tr.cache.valid;
cpu->gdtr.base = BX_CPU_THIS_PTR gdtr.base;
cpu->gdtr.limit = BX_CPU_THIS_PTR gdtr.limit;
cpu->idtr.base = BX_CPU_THIS_PTR idtr.base;
cpu->idtr.limit = BX_CPU_THIS_PTR idtr.limit;
cpu->dr0 = BX_CPU_THIS_PTR dr0;
cpu->dr1 = BX_CPU_THIS_PTR dr1;
cpu->dr2 = BX_CPU_THIS_PTR dr2;
cpu->dr3 = BX_CPU_THIS_PTR dr3;
cpu->dr6 = BX_CPU_THIS_PTR dr6;
cpu->dr7 = BX_CPU_THIS_PTR dr7;
#if BX_CPU_LEVEL >= 2
cpu->cr0 = BX_CPU_THIS_PTR cr0.val32;
cpu->cr1 = 0;
cpu->cr2 = BX_CPU_THIS_PTR cr2;
cpu->cr3 = BX_CPU_THIS_PTR cr3;
#endif
#if BX_CPU_LEVEL >= 4
cpu->cr4 = BX_CPU_THIS_PTR cr4.getRegister();
#endif
cpu->inhibit_mask = BX_CPU_THIS_PTR inhibit_mask;
return(1);
}
#endif // #if BX_DEBUGGER
void BX_CPU_C::atexit(void)