bugfix with phy addr long

This commit is contained in:
Stanislav Shwartsman 2009-08-11 15:56:09 +00:00
parent 8a95120e12
commit 5880d7f49c
3 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: memory.cc,v 1.78 2009-08-10 08:08:25 sshwarts Exp $ // $Id: memory.cc,v 1.79 2009-08-11 15:56:08 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -326,7 +326,7 @@ inc_one:
else // access outside limits of physical memory else // access outside limits of physical memory
{ {
#if BX_PHY_ADDRESS_LONG #if BX_PHY_ADDRESS_LONG
if (a20addr >= BX_CONST64(0xffffffff)) { if (a20addr > BX_CONST64(0xffffffff)) {
memset(data, 0xFF, len); memset(data, 0xFF, len);
return; return;
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: memory.h,v 1.57 2009-08-10 08:08:25 sshwarts Exp $ // $Id: memory.h,v 1.58 2009-08-11 15:56:08 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -42,9 +42,8 @@
class BX_CPU_C; class BX_CPU_C;
// alignment of memory vector, must be a power of 2 #define BIOSROMSZ ((Bit32u)(1 << 19)) // 512KB BIOS ROM @0xfff80000, must be a power of 2
#define BIOSROMSZ (1 << 19) // 512KB BIOS ROM @0xfff80000, must be a power of 2 #define EXROMSIZE (0x20000) // ROMs 0xc0000-0xdffff (area 0xe0000-0xfffff=bios mapped)
#define EXROMSIZE 0x20000 // ROMs 0xc0000-0xdffff (area 0xe0000-0xfffff=bios mapped)
#define BIOS_MASK (BIOSROMSZ-1) #define BIOS_MASK (BIOSROMSZ-1)
#define EXROM_MASK (EXROMSIZE-1) #define EXROM_MASK (EXROMSIZE-1)

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: misc_mem.cc,v 1.130 2009-08-10 08:08:25 sshwarts Exp $ // $Id: misc_mem.cc,v 1.131 2009-08-11 15:56:09 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -33,6 +33,7 @@
#include "iodev/iodev.h" #include "iodev/iodev.h"
#define LOG_THIS BX_MEM(0)-> #define LOG_THIS BX_MEM(0)->
// alignment of memory vector, must be a power of 2
#define BX_MEM_VECTOR_ALIGN 4096 #define BX_MEM_VECTOR_ALIGN 4096
#define BX_MEM_HANDLERS ((BX_CONST64(1) << BX_PHY_ADDRESS_WIDTH) >> 20) /* one per megabyte */ #define BX_MEM_HANDLERS ((BX_CONST64(1) << BX_PHY_ADDRESS_WIDTH) >> 20) /* one per megabyte */
@ -71,7 +72,7 @@ void BX_MEM_C::init_memory(Bit32u memsize)
{ {
unsigned idx; unsigned idx;
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.130 2009-08-10 08:08:25 sshwarts Exp $")); BX_DEBUG(("Init $Id: misc_mem.cc,v 1.131 2009-08-11 15:56:09 sshwarts Exp $"));
if (BX_MEM_THIS actual_vector != NULL) { if (BX_MEM_THIS actual_vector != NULL) {
BX_INFO (("freeing existing memory vector")); BX_INFO (("freeing existing memory vector"));
@ -397,7 +398,7 @@ bx_bool BX_MEM_C::dbg_fetch_mem(BX_CPU_C *cpu, bx_phy_address addr, unsigned len
} }
} }
#if BX_PHY_ADDRESS_LONG #if BX_PHY_ADDRESS_LONG
else if (addr >= BX_CONST64(0xffffffff)) { else if (addr > BX_CONST64(0xffffffff)) {
*buf = 0xff; *buf = 0xff;
ret = 0; // error, beyond limits of memory ret = 0; // error, beyond limits of memory
} }
@ -579,7 +580,7 @@ Bit8u *BX_MEM_C::getHostMemAddr(BX_CPU_C *cpu, bx_phy_address addr, unsigned rw)
} }
} }
#if BX_PHY_ADDRESS_LONG #if BX_PHY_ADDRESS_LONG
else if (a20addr >= BX_CONST64(0xffffffff)) { else if (a20addr > BX_CONST64(0xffffffff)) {
// Error, requested addr is out of bounds. // Error, requested addr is out of bounds.
return (Bit8u *) &BX_MEM_THIS bogus[a20addr & 0xfff]; return (Bit8u *) &BX_MEM_THIS bogus[a20addr & 0xfff];
} }