2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
// $Id: memory.cc,v 1.20 2002-09-05 02:31:24 kevinlawton Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2001-04-10 06:20:02 +04:00
|
|
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// MandrakeSoft S.A.
|
|
|
|
// 43, rue d'Aboukir
|
|
|
|
// 75002 Paris - France
|
|
|
|
// http://www.linux-mandrake.com/
|
|
|
|
// http://www.mandrakesoft.com/
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "bochs.h"
|
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00
|
|
|
#define LOG_THIS BX_MEM_THIS
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
#if BX_PROVIDE_CPU_MEMORY
|
|
|
|
|
|
|
|
void
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
BX_MEM_C::writePhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
Bit8u *data_ptr;
|
|
|
|
Bit32u a20addr;
|
|
|
|
|
2001-09-15 03:02:56 +04:00
|
|
|
#if BX_IODEBUG_SUPPORT
|
|
|
|
bx_iodebug_c::mem_write( cpu, addr, len, data);
|
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
a20addr = A20ADDR(addr);
|
|
|
|
BX_INSTR_PHY_WRITE(a20addr, len);
|
|
|
|
|
|
|
|
#if BX_DEBUGGER
|
|
|
|
// (mch) Check for physical write break points, TODO
|
2001-05-23 12:02:15 +04:00
|
|
|
// (bbd) Each breakpoint should have an associated CPU#, TODO
|
2001-04-10 05:04:59 +04:00
|
|
|
for (int i = 0; i < num_write_watchpoints; i++)
|
|
|
|
if (write_watchpoint[i] == a20addr) {
|
2002-04-01 08:43:26 +04:00
|
|
|
BX_CPU(0)->watchpoint = a20addr;
|
2001-05-23 12:02:15 +04:00
|
|
|
BX_CPU(0)->break_point = BREAK_POINT_WRITE;
|
2001-04-10 05:04:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if ( (a20addr + len) <= BX_MEM_THIS len ) {
|
|
|
|
// all of data is within limits of physical memory
|
|
|
|
if ( (a20addr & 0xfff80000) != 0x00080000 ) {
|
|
|
|
if (len == 4) {
|
|
|
|
if ((a20addr & 0x00000003) == 0) {
|
|
|
|
// write 4byte data to aligned memory location
|
|
|
|
Bit32u data32;
|
|
|
|
|
|
|
|
data32 = * (Bit32u *) data;
|
|
|
|
#ifdef BX_BIG_ENDIAN
|
|
|
|
data32 = (data32 << 24) | (data32 >> 24) |
|
|
|
|
((data32&0x00ff0000)>>8) | ((data32&0x0000ff00)<<8);
|
|
|
|
#endif
|
2001-05-23 12:02:15 +04:00
|
|
|
* ((Bit32u *) (&vector[a20addr])) = data32;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Bit32u data32;
|
|
|
|
|
|
|
|
data32 = * (Bit32u *) data;
|
2001-05-23 12:02:15 +04:00
|
|
|
* ((Bit8u *) (&vector[a20addr])) = data32; data32 >>= 8;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
* ((Bit8u *) (&vector[addr+1])) = data32; data32 >>= 8;
|
|
|
|
* ((Bit8u *) (&vector[addr+2])) = data32; data32 >>= 8;
|
|
|
|
* ((Bit8u *) (&vector[addr+3])) = data32;
|
2001-04-10 05:04:59 +04:00
|
|
|
// worst case, last byte is in different page; possible extra dirty page
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
BX_DBG_DIRTY_PAGE((addr+3) >> 12);
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (len == 2) {
|
|
|
|
if ((a20addr & 0x00000001) == 0) {
|
|
|
|
// write 2-byte data to aligned memory location
|
|
|
|
Bit16u data16;
|
|
|
|
|
|
|
|
data16 = * (Bit16u *) data;
|
|
|
|
#ifdef BX_BIG_ENDIAN
|
|
|
|
data16 = (data16 >> 8) | (data16 << 8);
|
|
|
|
#endif
|
2001-05-23 12:02:15 +04:00
|
|
|
* ((Bit16u *) (&vector[a20addr])) = data16;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Bit16u data16;
|
|
|
|
|
|
|
|
data16 = * (Bit16u *) data;
|
2001-05-23 12:02:15 +04:00
|
|
|
* ((Bit8u *) (&vector[a20addr])) = (Bit8u) data16;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
* ((Bit8u *) (&vector[a20addr+1])) = (data16 >> 8);
|
|
|
|
BX_DBG_DIRTY_PAGE((a20addr+1) >> 12);
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (len == 1) {
|
|
|
|
Bit8u data8;
|
|
|
|
|
|
|
|
data8 = * (Bit8u *) data;
|
2001-05-23 12:02:15 +04:00
|
|
|
* ((Bit8u *) (&vector[a20addr])) = data8;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// len == 3 case can just fall thru to special cases handling
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data + (len - 1);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
write_one:
|
|
|
|
if ( (a20addr & 0xfff80000) != 0x00080000 ) {
|
|
|
|
// addr *not* in range 00080000 .. 000FFFFF
|
2001-05-23 12:02:15 +04:00
|
|
|
vector[a20addr] = *data_ptr;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
inc_one:
|
|
|
|
if (len == 1) return;
|
|
|
|
len--;
|
|
|
|
addr++;
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
a20addr = (addr);
|
2001-04-10 05:04:59 +04:00
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr++;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr--;
|
|
|
|
#endif
|
|
|
|
goto write_one;
|
|
|
|
}
|
|
|
|
|
|
|
|
// addr in range 00080000 .. 000FFFFF
|
|
|
|
|
|
|
|
if (a20addr <= 0x0009ffff) {
|
|
|
|
// regular memory 80000 .. 9FFFF
|
2001-05-23 12:02:15 +04:00
|
|
|
vector[a20addr] = *data_ptr;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
if (a20addr <= 0x000bffff) {
|
|
|
|
// VGA memory A0000 .. BFFFF
|
|
|
|
BX_VGA_MEM_WRITE(a20addr, *data_ptr);
|
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DBG_UCMEM_REPORT(a20addr, 1, BX_WRITE, *data_ptr); // obsolete
|
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
// adapter ROM C0000 .. DFFFF
|
|
|
|
// ROM BIOS memory E0000 .. FFFFF
|
|
|
|
// (ignore write)
|
2001-05-30 22:56:02 +04:00
|
|
|
//BX_INFO(("ROM lock %08x: len=%u",
|
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00
|
|
|
// (unsigned) a20addr, (unsigned) len));
|
2001-04-10 05:04:59 +04:00
|
|
|
#if BX_PCI_SUPPORT == 0
|
|
|
|
#if BX_SHADOW_RAM
|
|
|
|
// Write it since its in shadow RAM
|
2001-05-23 12:02:15 +04:00
|
|
|
vector[a20addr] = *data_ptr;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
#else
|
|
|
|
// ignore write to ROM
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
// Write Based on 440fx Programming
|
2001-06-21 18:56:43 +04:00
|
|
|
if (bx_options.Oi440FXSupport->get () &&
|
2001-04-10 05:04:59 +04:00
|
|
|
((a20addr >= 0xC0000) && (a20addr <= 0xFFFFF))) {
|
2001-05-23 12:02:15 +04:00
|
|
|
switch (bx_devices.pci->wr_memType(a20addr & 0xFC000)) {
|
2002-08-31 19:35:51 +04:00
|
|
|
case 0x1: // Writes to ShadowRAM
|
2001-05-30 22:56:02 +04:00
|
|
|
// BX_INFO(("Writing to ShadowRAM %08x, len %u ! ", (unsigned) a20addr, (unsigned) len));
|
2002-08-31 16:24:41 +04:00
|
|
|
shadow[a20addr - 0xc0000] = *data_ptr;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
goto inc_one;
|
|
|
|
|
2002-08-31 19:35:51 +04:00
|
|
|
case 0x0: // Writes to ROM, Inhibit
|
2002-08-17 13:23:42 +04:00
|
|
|
BX_DEBUG(("Write to ROM ignored: address %08x, data %02x", (unsigned) a20addr, *data_ptr));
|
2001-04-10 05:04:59 +04:00
|
|
|
goto inc_one;
|
|
|
|
default:
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
BX_PANIC(("writePhysicalPage: default case"));
|
2001-04-10 05:04:59 +04:00
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
// some or all of data is outside limits of physical memory
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data + (len - 1);
|
|
|
|
#endif
|
|
|
|
|
2002-04-03 20:48:15 +04:00
|
|
|
|
|
|
|
#if BX_SUPPORT_VBE
|
|
|
|
// Check VBE LFB support
|
|
|
|
|
|
|
|
if (a20addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS)
|
|
|
|
{
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
// FIXME: check for max VBE video memory size
|
|
|
|
|
|
|
|
//if (a20addr < BX_MEM_THIS len) {
|
|
|
|
//vector[a20addr] = *data_ptr;
|
|
|
|
//BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
//BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_VGA_MEM_WRITE(a20addr, *data_ptr);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// otherwise ignore byte, since it overruns memory
|
|
|
|
addr++;
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
a20addr = (addr);
|
2002-04-03 20:48:15 +04:00
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr++;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr--;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-06-12 17:07:43 +04:00
|
|
|
#if BX_SUPPORT_APIC
|
2001-05-23 12:02:15 +04:00
|
|
|
bx_generic_apic_c *local_apic = &cpu->local_apic;
|
|
|
|
bx_generic_apic_c *ioapic = bx_devices.ioapic;
|
|
|
|
if (local_apic->is_selected (a20addr, len)) {
|
|
|
|
local_apic->write (a20addr, (Bit32u *)data, len);
|
|
|
|
return;
|
|
|
|
} else if (ioapic->is_selected (a20addr, len)) {
|
|
|
|
ioapic->write (a20addr, (Bit32u *)data, len);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
if (a20addr < BX_MEM_THIS len) {
|
2001-05-23 12:02:15 +04:00
|
|
|
vector[a20addr] = *data_ptr;
|
2001-04-10 05:04:59 +04:00
|
|
|
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
}
|
|
|
|
// otherwise ignore byte, since it overruns memory
|
|
|
|
addr++;
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
a20addr = (addr);
|
2001-04-10 05:04:59 +04:00
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr++;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr--;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
BX_MEM_C::readPhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
Bit8u *data_ptr;
|
|
|
|
Bit32u a20addr;
|
|
|
|
|
2001-09-15 03:02:56 +04:00
|
|
|
#if BX_IODEBUG_SUPPORT
|
|
|
|
bx_iodebug_c::mem_read( cpu, addr, len, data);
|
|
|
|
#endif
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
a20addr = A20ADDR(addr);
|
|
|
|
BX_INSTR_PHY_READ(a20addr, len);
|
|
|
|
|
|
|
|
#if BX_DEBUGGER
|
|
|
|
// (mch) Check for physical read break points, TODO
|
2001-05-23 12:02:15 +04:00
|
|
|
// (bbd) Each breakpoint should have an associated CPU#, TODO
|
2001-04-10 05:04:59 +04:00
|
|
|
for (int i = 0; i < num_read_watchpoints; i++)
|
|
|
|
if (read_watchpoint[i] == a20addr) {
|
2002-04-01 08:43:26 +04:00
|
|
|
BX_CPU(0)->watchpoint = a20addr;
|
2001-05-23 12:02:15 +04:00
|
|
|
BX_CPU(0)->break_point = BREAK_POINT_READ;
|
2001-04-10 05:04:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ( (a20addr + len) <= BX_MEM_THIS len ) {
|
|
|
|
// all of data is within limits of physical memory
|
|
|
|
if ( (a20addr & 0xfff80000) != 0x00080000 ) {
|
|
|
|
if (len == 4) {
|
|
|
|
if ((a20addr & 0x00000003) == 0) {
|
|
|
|
// read 4-byte data from aligned memory location
|
|
|
|
Bit32u data32;
|
|
|
|
|
2001-05-23 12:02:15 +04:00
|
|
|
data32 = * ((Bit32u *) (&vector[a20addr]));
|
2001-04-10 05:04:59 +04:00
|
|
|
#ifdef BX_BIG_ENDIAN
|
|
|
|
data32 = (data32 << 24) | (data32 >> 24) |
|
|
|
|
((data32&0x00ff0000)>>8) | ((data32&0x0000ff00)<<8);
|
|
|
|
#endif
|
|
|
|
* (Bit32u *) data = data32;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Bit32u data32;
|
|
|
|
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
data32 = * ((Bit8u *) (&vector[addr+3])); data32 <<= 8;
|
|
|
|
data32 |= * ((Bit8u *) (&vector[addr+2])); data32 <<= 8;
|
|
|
|
data32 |= * ((Bit8u *) (&vector[addr+1])); data32 <<= 8;
|
2001-05-23 12:02:15 +04:00
|
|
|
data32 |= * ((Bit8u *) (&vector[a20addr]));
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
* (Bit32u *) data = data32;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (len == 2) {
|
|
|
|
if ((a20addr & 0x00000001) == 0) {
|
|
|
|
// read 2-byte data from aligned memory location
|
|
|
|
Bit16u data16;
|
|
|
|
|
2001-05-23 12:02:15 +04:00
|
|
|
data16 = * ((Bit16u *) (&vector[a20addr]));
|
2001-04-10 05:04:59 +04:00
|
|
|
#ifdef BX_BIG_ENDIAN
|
|
|
|
data16 = (data16 >> 8) | (data16 << 8);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
* (Bit16u *) data = data16;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Bit16u data16;
|
|
|
|
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
data16 = * ((Bit8u *) (&vector[addr+1])); data16 <<= 8;
|
2001-05-23 12:02:15 +04:00
|
|
|
data16 |= * ((Bit8u *) (&vector[a20addr]));
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
* (Bit16u *) data = data16;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (len == 1) {
|
|
|
|
Bit8u data8;
|
|
|
|
|
2001-05-23 12:02:15 +04:00
|
|
|
data8 = * ((Bit8u *) (&vector[a20addr]));
|
2001-04-10 05:04:59 +04:00
|
|
|
* (Bit8u *) data = data8;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// len == 3 case can just fall thru to special cases handling
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data + (len - 1);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
read_one:
|
|
|
|
if ( (a20addr & 0xfff80000) != 0x00080000 ) {
|
|
|
|
// addr *not* in range 00080000 .. 000FFFFF
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-04-10 05:04:59 +04:00
|
|
|
inc_one:
|
|
|
|
if (len == 1) return;
|
|
|
|
len--;
|
|
|
|
addr++;
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
a20addr = (addr);
|
2001-04-10 05:04:59 +04:00
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr++;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr--;
|
|
|
|
#endif
|
|
|
|
goto read_one;
|
|
|
|
}
|
|
|
|
|
|
|
|
// addr in range 00080000 .. 000FFFFF
|
|
|
|
#if BX_PCI_SUPPORT == 0
|
|
|
|
if ((a20addr <= 0x0009ffff) || (a20addr >= 0x000c0000) ) {
|
|
|
|
// regular memory 80000 .. 9FFFF, C0000 .. F0000
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-04-10 05:04:59 +04:00
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
// VGA memory A0000 .. BFFFF
|
|
|
|
*data_ptr = BX_VGA_MEM_READ(a20addr);
|
|
|
|
BX_DBG_UCMEM_REPORT(a20addr, 1, BX_READ, *data_ptr); // obsolete
|
|
|
|
goto inc_one;
|
|
|
|
#else // #if BX_PCI_SUPPORT == 0
|
|
|
|
if (a20addr <= 0x0009ffff) {
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-04-10 05:04:59 +04:00
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
if (a20addr <= 0x000BFFFF) {
|
|
|
|
// VGA memory A0000 .. BFFFF
|
|
|
|
*data_ptr = BX_VGA_MEM_READ(a20addr);
|
|
|
|
BX_DBG_UCMEM_REPORT(a20addr, 1, BX_READ, *data_ptr);
|
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
|
|
|
|
// a20addr in C0000 .. FFFFF
|
2001-06-21 18:56:43 +04:00
|
|
|
if (!bx_options.Oi440FXSupport->get ()) {
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-04-10 05:04:59 +04:00
|
|
|
goto inc_one;
|
|
|
|
}
|
|
|
|
else {
|
2001-05-23 12:02:15 +04:00
|
|
|
switch (bx_devices.pci->rd_memType(a20addr & 0xFC000)) {
|
2002-08-31 19:35:51 +04:00
|
|
|
case 0x1: // Read from ShadowRAM
|
2002-08-31 16:24:41 +04:00
|
|
|
*data_ptr = shadow[a20addr - 0xc0000];
|
2001-05-30 22:56:02 +04:00
|
|
|
BX_INFO(("Reading from ShadowRAM %08x, Data %02x ", (unsigned) a20addr, *data_ptr));
|
2001-04-10 05:04:59 +04:00
|
|
|
goto inc_one;
|
|
|
|
|
2002-08-31 19:35:51 +04:00
|
|
|
case 0x0: // Read from ROM
|
2002-08-31 16:24:41 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-05-30 22:56:02 +04:00
|
|
|
//BX_INFO(("Reading from ROM %08x, Data %02x ", (unsigned) a20addr, *data_ptr));
|
2001-04-10 05:04:59 +04:00
|
|
|
goto inc_one;
|
|
|
|
default:
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
BX_PANIC(("::readPhysicalPage: default case"));
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
goto inc_one;
|
|
|
|
#endif // #if BX_PCI_SUPPORT == 0
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// some or all of data is outside limits of physical memory
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr = (Bit8u *) data + (len - 1);
|
|
|
|
#endif
|
|
|
|
|
2002-04-03 20:48:15 +04:00
|
|
|
#if BX_SUPPORT_VBE
|
|
|
|
// Check VBE LFB support
|
|
|
|
|
|
|
|
if (a20addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS)
|
|
|
|
{
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
// FIXME: check for max VBE video memory size
|
|
|
|
|
|
|
|
//if (a20addr < BX_MEM_THIS len) {
|
|
|
|
//vector[a20addr] = *data_ptr;
|
|
|
|
//BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
//BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
|
|
|
*data_ptr = BX_VGA_MEM_READ(a20addr);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// otherwise ignore byte, since it overruns memory
|
|
|
|
addr++;
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
a20addr = (addr);
|
2002-04-03 20:48:15 +04:00
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr++;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr--;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-06-12 17:07:43 +04:00
|
|
|
#if BX_SUPPORT_APIC
|
2001-05-23 12:02:15 +04:00
|
|
|
bx_generic_apic_c *local_apic = &cpu->local_apic;
|
|
|
|
bx_generic_apic_c *ioapic = bx_devices.ioapic;
|
|
|
|
if (local_apic->is_selected (addr, len)) {
|
|
|
|
local_apic->read (addr, data, len);
|
|
|
|
return;
|
|
|
|
} else if (ioapic->is_selected (addr, len)) {
|
|
|
|
ioapic->read (addr, data, len);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
#if BX_PCI_SUPPORT == 0
|
|
|
|
if (a20addr < BX_MEM_THIS len)
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-04-10 05:04:59 +04:00
|
|
|
else
|
|
|
|
*data_ptr = 0xff;
|
|
|
|
#else // BX_PCI_SUPPORT == 0
|
|
|
|
if (a20addr < BX_MEM_THIS len) {
|
|
|
|
if ((a20addr >= 0x000C0000) && (a20addr <= 0x000FFFFF)) {
|
2001-06-21 18:56:43 +04:00
|
|
|
if (!bx_options.Oi440FXSupport->get ())
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-04-10 05:04:59 +04:00
|
|
|
else {
|
2001-05-23 12:02:15 +04:00
|
|
|
switch (bx_devices.pci->rd_memType(a20addr & 0xFC000)) {
|
2001-04-10 05:04:59 +04:00
|
|
|
case 0x0: // Read from ROM
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-05-30 22:56:02 +04:00
|
|
|
//BX_INFO(("Reading from ROM %08x, Data %02x ", (unsigned) a20addr, *data_ptr));
|
2001-04-10 05:04:59 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x1: // Read from Shadow RAM
|
2002-08-31 16:24:41 +04:00
|
|
|
*data_ptr = shadow[a20addr - 0xc0000];
|
2001-05-30 22:56:02 +04:00
|
|
|
BX_INFO(("Reading from ShadowRAM %08x, Data %02x ", (unsigned) a20addr, *data_ptr));
|
2001-04-10 05:04:59 +04:00
|
|
|
break;
|
|
|
|
default:
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
BX_PANIC(("readPhysicalPage: default case"));
|
2001-04-10 05:04:59 +04:00
|
|
|
} // Switch
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2001-05-23 12:02:15 +04:00
|
|
|
*data_ptr = vector[a20addr];
|
2001-05-30 22:56:02 +04:00
|
|
|
BX_INFO(("Reading from Norm %08x, Data %02x ", (unsigned) a20addr, *data_ptr));
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
|
|
|
}
|
2001-05-23 12:02:15 +04:00
|
|
|
else
|
2001-04-10 05:04:59 +04:00
|
|
|
*data_ptr = 0xff;
|
|
|
|
#endif // BX_PCI_SUPPORT == 0
|
|
|
|
addr++;
|
Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB. This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.
Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on. Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.
I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 06:31:24 +04:00
|
|
|
a20addr = (addr);
|
2001-04-10 05:04:59 +04:00
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
|
|
|
data_ptr++;
|
|
|
|
#else // BX_BIG_ENDIAN
|
|
|
|
data_ptr--;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // #if BX_PROVIDE_CPU_MEMORY
|