Fixed segfault with bochs debugger but reported today
This commit is contained in:
parent
34061a2f22
commit
594b8cce47
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dbg_main.cc,v 1.66 2006-05-30 19:46:31 sshwarts Exp $
|
||||
// $Id: dbg_main.cc,v 1.67 2006-05-31 17:20:52 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -2650,7 +2650,7 @@ void bx_dbg_crc_command(Bit32u addr1, Bit32u addr2)
|
||||
void bx_dbg_info_dirty_command(void)
|
||||
{
|
||||
unsigned char *page_tbl = BX_MEM(0)->dbg_dirty_pages;
|
||||
unsigned page_tbl_size = BX_MEM(0)->dbg_count_dirty_pages ();
|
||||
Bit32u page_tbl_size = BX_MEM(0)->get_num_allocated_pages();
|
||||
|
||||
for (unsigned i=0; i<page_tbl_size; i++) {
|
||||
if (page_tbl[i]) {
|
||||
|
@ -318,8 +318,6 @@
|
||||
// is not used, and this section can be ignored.
|
||||
// =================================================================
|
||||
|
||||
#define BX_MAX_DIRTY_PAGE_TABLE_MEGS 1024
|
||||
|
||||
// Compile in support for virtual/linear/physical breakpoints.
|
||||
// Set to 1, only those you need. Recommend using only linear
|
||||
// breakpoints, unless you need others. Less supported means
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: memory.h,v 1.37 2006-03-28 16:53:02 sshwarts Exp $
|
||||
// $Id: memory.h,v 1.38 2006-05-31 17:20:52 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -80,10 +80,7 @@ public:
|
||||
Bit8u *rom; // 512k BIOS rom space + 128k expansion rom space
|
||||
Bit8u *bogus; // 4k for unexisting memory
|
||||
#if BX_DEBUGGER
|
||||
unsigned char dbg_dirty_pages[(BX_MAX_DIRTY_PAGE_TABLE_MEGS * 1024 * 1024) / 4096];
|
||||
Bit32u dbg_count_dirty_pages () {
|
||||
return (BX_MAX_DIRTY_PAGE_TABLE_MEGS * 1024 * 1024) / 4096;
|
||||
}
|
||||
Bit8u *dbg_dirty_pages;
|
||||
#endif
|
||||
|
||||
BX_MEM_C();
|
||||
@ -108,7 +105,8 @@ public:
|
||||
memory_handler_t write_handler, bx_phy_address begin_addr, bx_phy_address end_addr);
|
||||
BX_MEM_SMF bx_bool unregisterMemoryHandlers(memory_handler_t read_handler, memory_handler_t write_handler,
|
||||
bx_phy_address begin_addr, bx_phy_address end_addr);
|
||||
};
|
||||
BX_MEM_SMF Bit32u get_num_allocated_pages(void);
|
||||
};
|
||||
|
||||
#if BX_PROVIDE_CPU_MEMORY==1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: misc_mem.cc,v 1.91 2006-05-27 15:54:49 sshwarts Exp $
|
||||
// $Id: misc_mem.cc,v 1.92 2006-05-31 17:20:52 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -38,6 +38,11 @@ Bit32u BX_MEM_C::get_memory_in_k(void)
|
||||
return(BX_MEM_THIS megabytes * 1024);
|
||||
}
|
||||
|
||||
Bit32u BX_MEM_C::get_num_allocated_pages(void)
|
||||
{
|
||||
return(BX_MEM_THIS len / 4096);
|
||||
}
|
||||
|
||||
BX_MEM_C::BX_MEM_C()
|
||||
{
|
||||
char mem[6];
|
||||
@ -92,9 +97,9 @@ BX_MEM_C::~BX_MEM_C()
|
||||
|
||||
void BX_MEM_C::init_memory(int memsize)
|
||||
{
|
||||
int idx;
|
||||
unsigned idx;
|
||||
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.91 2006-05-27 15:54:49 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.92 2006-05-31 17:20:52 sshwarts Exp $"));
|
||||
// you can pass 0 if memory has been allocated already through
|
||||
// the constructor, or the desired size of memory if it hasn't
|
||||
|
||||
@ -106,6 +111,11 @@ void BX_MEM_C::init_memory(int memsize)
|
||||
BX_MEM_THIS memory_handlers = new struct memory_handler_struct *[1024 * 1024];
|
||||
BX_MEM_THIS rom = &BX_MEM_THIS vector[memsize];
|
||||
BX_MEM_THIS bogus = &BX_MEM_THIS vector[memsize + BIOSROMSZ + EXROMSIZE];
|
||||
#if BX_DEBUGGER
|
||||
unsigned pages = get_num_allocated_pages();
|
||||
BX_MEM_THIS dbg_dirty_pages = new Bit8u[pages];
|
||||
memset(BX_MEM_THIS dbg_dirty_pages, 0, pages);
|
||||
#endif
|
||||
memset(BX_MEM_THIS rom, 0xff, BIOSROMSZ + EXROMSIZE);
|
||||
memset(BX_MEM_THIS bogus, 0xff, 4096);
|
||||
for (idx = 0; idx < 1024 * 1024; idx++)
|
||||
@ -119,15 +129,8 @@ void BX_MEM_C::init_memory(int memsize)
|
||||
BX_MEM_THIS smram_enable = 0;
|
||||
BX_MEM_THIS smram_restricted = 0;
|
||||
|
||||
#if BX_DEBUGGER
|
||||
if (megabytes > BX_MAX_DIRTY_PAGE_TABLE_MEGS) {
|
||||
BX_INFO(("Error: memory larger than dirty page table can handle"));
|
||||
BX_PANIC(("Error: increase BX_MAX_DIRTY_PAGE_TABLE_MEGS"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// accept only memory size which is multiply of 1M
|
||||
BX_ASSERT((len & 0xfffff) == 0);
|
||||
BX_ASSERT((BX_MEM_THIS len & 0xfffff) == 0);
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "memory", "Memory State");
|
||||
@ -506,7 +509,7 @@ bx_bool BX_MEM_C::dbg_fetch_mem(bx_phy_address addr, unsigned len, Bit8u *buf)
|
||||
#if BX_DEBUGGER || BX_GDBSTUB
|
||||
bx_bool BX_MEM_C::dbg_set_mem(bx_phy_address addr, unsigned len, Bit8u *buf)
|
||||
{
|
||||
if ((addr + len) > BX_MEM_THIS len) {
|
||||
if ((addr + len - 1) > BX_MEM_THIS len) {
|
||||
return(0); // error, beyond limits of memory
|
||||
}
|
||||
for (; len>0; len--) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user