preparations for future 64-bit physical address support

This commit is contained in:
Stanislav Shwartsman 2008-05-10 20:39:53 +00:00
parent d3528cccd6
commit 3fd4a09bbc
3 changed files with 33 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.229 2008-05-10 18:04:37 sshwarts Exp $
// $Id: bochs.h,v 1.230 2008-05-10 20:39:53 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -198,9 +198,9 @@ void print_tree(bx_param_c *node, int level = 0);
#define BX_GET_ENABLE_A20() bx_pc_system.get_enable_a20()
#if BX_SUPPORT_A20
# define A20ADDR(x) ((bx_phy_address)(x) & bx_pc_system.a20_mask)
# define A20ADDR(x) (bx_phy_address(x) & bx_pc_system.a20_mask)
#else
# define A20ADDR(x) ((bx_phy_address)(x))
# define A20ADDR(x) (bx_phy_address(x))
#endif
#if BX_SUPPORT_SMP
@ -420,7 +420,12 @@ BOCHSAPI extern logfunc_t *genlog;
#define FMT_ADDRX FMT_ADDRX32
#endif
#define FMT_PHY_ADDRX FMT_ADDRX32
#if BX_PHY_ADDRESS_LONG
#define FMT_PHY_ADDRX FMT_ADDRX64
#else
#define FMT_PHY_ADDRX FMT_ADDRX32
#endif
#define FMT_LIN_ADDRX FMT_ADDRX
#if BX_GDBSTUB

View File

@ -133,6 +133,9 @@
// emulate x86-64 instruction set?
#define BX_SUPPORT_X86_64 0
// emulate long physical address (>32 bit)
#define BX_PHY_ADDRESS_LONG 0
#define BX_HAVE_SLEEP 0
#define BX_HAVE_MSLEEP 0
#define BX_HAVE_USLEEP 0
@ -480,16 +483,22 @@ typedef Bit32u bx_address;
#endif
// define physical and linear address types
typedef Bit32u bx_phy_address;
typedef bx_address bx_lin_address;
#define BX_PHY_ADDRESS_WIDTH 32
#if BX_SUPPORT_X86_64
#define BX_LIN_ADDRESS_WIDTH 48
#else
#define BX_LIN_ADDRESS_WIDTH 32
#endif
#if BX_PHY_ADDRESS_LONG
typedef Bit64u bx_phy_address;
#define BX_PHY_ADDRESS_WIDTH 40
#else
typedef Bit32u bx_phy_address;
#define BX_PHY_ADDRESS_WIDTH 32
#endif
// technically, in an 8 bit signed the real minimum is -128, not -127.
// But if you decide to negate -128 you tend to get -128 again, so it's
// better not to use the absolute maximum in the signed range.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pc_system.cc,v 1.70 2008-04-06 18:27:24 sshwarts Exp $
// $Id: pc_system.cc,v 1.71 2008-05-10 20:39:53 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -135,16 +135,23 @@ void bx_pc_system_c::set_enable_a20(bx_bool value)
if (value) {
enable_a20 = 1;
#if BX_CPU_LEVEL < 2
a20_mask = 0xfffff;
a20_mask = 0xfffff;
#elif BX_CPU_LEVEL == 2
a20_mask = 0xffffff;
#else /* 386+ */
a20_mask = 0xffffffff;
a20_mask = 0xffffff;
#elif BX_PHY_ADDRESS_LONG
a20_mask = BX_CONST64(0xffffffffffffffff);
#else /* 386+ */
a20_mask = 0xffffffff;
#endif
}
else {
enable_a20 = 0;
a20_mask = 0xffefffff; /* mask off A20 address line */
/* mask off A20 address line */
#if BX_PHY_ADDRESS_LONG
a20_mask = BX_CONST64(0xffffffffffefffff);
#else
a20_mask = 0xffefffff;
#endif
}
BX_DBG_A20_REPORT(enable_a20);