Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rom_present is not need to be BX_MEM_C member
  • Loading branch information
sshwarts committed May 17, 2010
1 parent e92ce51 commit 8cc4d77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions memory/memory.h
@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: memory.h,v 1.68 2010/03/07 09:16:24 sshwarts Exp $
// $Id: memory.h,v 1.69 2010/05/17 19:42:30 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
Expand Down Expand Up @@ -58,7 +58,6 @@ struct memory_handler_struct {
class BOCHSAPI BX_MEM_C : public logfunctions {
private:
struct memory_handler_struct **memory_handlers;
bx_bool rom_present[65];
bx_bool pci_enabled;
bx_bool smram_available;
bx_bool smram_enable;
Expand Down
14 changes: 7 additions & 7 deletions memory/misc_mem.cc
@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: misc_mem.cc,v 1.144 2010/03/16 14:51:20 sshwarts Exp $
// $Id: misc_mem.cc,v 1.145 2010/05/17 19:42:30 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
Expand Down Expand Up @@ -73,7 +73,7 @@ void BX_MEM_C::init_memory(Bit64u guest, Bit64u host)
{
unsigned idx;

BX_DEBUG(("Init $Id: misc_mem.cc,v 1.144 2010/03/16 14:51:20 sshwarts Exp $"));
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.145 2010/05/17 19:42:30 sshwarts Exp $"));

// accept only memory size which is multiply of 1M
BX_ASSERT((host & 0xfffff) == 0);
Expand All @@ -95,8 +95,6 @@ void BX_MEM_C::init_memory(Bit64u guest, Bit64u host)
BX_MEM_THIS rom = &BX_MEM_THIS vector[host];
BX_MEM_THIS bogus = &BX_MEM_THIS vector[host + BIOSROMSZ + EXROMSIZE];
memset(BX_MEM_THIS rom, 0xff, BIOSROMSZ + EXROMSIZE + 4096);
for (idx = 0; idx < 65; idx++)
BX_MEM_THIS rom_present[idx] = 0;

// block must be large enough to fit num_blocks in 32-bit
BX_ASSERT((BX_MEM_THIS len / BX_MEM_BLOCK_LEN) <= 0xffffffff);
Expand Down Expand Up @@ -231,6 +229,8 @@ void BX_MEM_C::cleanup_memory()
//
void BX_MEM_C::load_ROM(const char *path, bx_phy_address romaddress, Bit8u type)
{
static bx_bool rom_present[65];

struct stat stat_buf;
int fd, ret, i, start_idx, end_idx;
unsigned long size, max_size, offset;
Expand Down Expand Up @@ -298,7 +298,7 @@ void BX_MEM_C::load_ROM(const char *path, bx_phy_address romaddress, Bit8u type)
}
offset = romaddress & BIOS_MASK;
if ((romaddress & 0xf0000) < 0xf0000) {
BX_MEM_THIS rom_present[64] = 1;
rom_present[64] = 1;
}
is_bochs_bios = (strstr(path, "BIOS-bochs-latest") != NULL);
} else {
Expand Down Expand Up @@ -328,12 +328,12 @@ void BX_MEM_C::load_ROM(const char *path, bx_phy_address romaddress, Bit8u type)
end_idx = 64;
}
for (i = start_idx; i < end_idx; i++) {
if (BX_MEM_THIS rom_present[i]) {
if (rom_present[i]) {
close(fd);
BX_PANIC(("ROM: address space 0x%x already in use", (i * 2048) + 0xc0000));
return;
} else {
BX_MEM_THIS rom_present[i] = 1;
rom_present[i] = 1;
}
}
}
Expand Down

0 comments on commit 8cc4d77

Please sign in to comment.