Whole mess'o'changes.. see individual files
arch/alpha/vtophys.cc: Removed buggy code that tries to fix PAL addresses (may cause problems while trying to debug in PAL code, but that should do this fix outside of vtophys) base/loader/symtab.cc: base/loader/symtab.hh: cpu/exetrace.cc: Changed InstExec traces to always print a symbol name dev/ide_ctrl.cc: dev/ide_disk.cc: Tabs dev/ide_disk.hh: Change buffer size dev/tsunami_pchip.cc: Fix translatePciToDma to support scatter gather mapping kern/linux/linux_system.cc: Force simulator to wait until remote debugger attaches (should be removed or turned on/off with a flag) --HG-- extra : convert_revision : 1d08aebe3f448c87a963dd613de3e2e0cff0d48d
This commit is contained in:
parent
8538ffdb36
commit
4a5dcc37bf
|
@ -96,9 +96,9 @@ vtophys(ExecContext *xc, Addr vaddr)
|
||||||
{
|
{
|
||||||
Addr ptbr = xc->regs.ipr[AlphaISA::IPR_PALtemp20];
|
Addr ptbr = xc->regs.ipr[AlphaISA::IPR_PALtemp20];
|
||||||
Addr paddr = 0;
|
Addr paddr = 0;
|
||||||
if (PC_PAL(vaddr)) {
|
// if (PC_PAL(vaddr)) {
|
||||||
paddr = vaddr & ~ULL(1);
|
// paddr = vaddr & ~ULL(1);
|
||||||
} else {
|
// } else {
|
||||||
if (vaddr >= ALPHA_K0SEG_BASE && vaddr <= ALPHA_K0SEG_END) {
|
if (vaddr >= ALPHA_K0SEG_BASE && vaddr <= ALPHA_K0SEG_END) {
|
||||||
paddr = ALPHA_K0SEG_TO_PHYS(vaddr);
|
paddr = ALPHA_K0SEG_TO_PHYS(vaddr);
|
||||||
} else if (!ptbr) {
|
} else if (!ptbr) {
|
||||||
|
@ -109,7 +109,7 @@ vtophys(ExecContext *xc, Addr vaddr)
|
||||||
if (pte && entry_valid(entry))
|
if (pte && entry_valid(entry))
|
||||||
paddr = PMAP_PTE_PA(entry) | (vaddr & PGOFSET);
|
paddr = PMAP_PTE_PA(entry) | (vaddr & PGOFSET);
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr);
|
DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr);
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,31 @@ SymbolTable::load(const string &filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SymbolTable::findNearestSymbol(Addr address, string &symbol) const
|
||||||
|
{
|
||||||
|
ATable::const_iterator i = addrTable.lower_bound(address);
|
||||||
|
|
||||||
|
// check for PALCode
|
||||||
|
if (address & 0x1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// first check for the end
|
||||||
|
if (i == addrTable.end())
|
||||||
|
i--;
|
||||||
|
else if (i == addrTable.begin() && (*i).first != address)
|
||||||
|
return false;
|
||||||
|
else if ((*i).first != address)
|
||||||
|
i--;
|
||||||
|
|
||||||
|
symbol = (*i).second;
|
||||||
|
|
||||||
|
if (address != (*i).first)
|
||||||
|
symbol += csprintf("+%d", address - (*i).first);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SymbolTable::findSymbol(Addr address, string &symbol) const
|
SymbolTable::findSymbol(Addr address, string &symbol) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,14 +29,14 @@
|
||||||
#ifndef __SYMTAB_HH__
|
#ifndef __SYMTAB_HH__
|
||||||
#define __SYMTAB_HH__
|
#define __SYMTAB_HH__
|
||||||
|
|
||||||
#include "base/hashmap.hh"
|
#include <map>
|
||||||
#include "targetarch/isa_traits.hh" // for Addr
|
#include "targetarch/isa_traits.hh" // for Addr
|
||||||
|
|
||||||
class SymbolTable
|
class SymbolTable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef m5::hash_map<Addr, std::string> ATable;
|
typedef std::map<Addr, std::string> ATable;
|
||||||
typedef m5::hash_map<std::string, Addr> STable;
|
typedef std::map<std::string, Addr> STable;
|
||||||
|
|
||||||
ATable addrTable;
|
ATable addrTable;
|
||||||
STable symbolTable;
|
STable symbolTable;
|
||||||
|
@ -49,6 +49,7 @@ class SymbolTable
|
||||||
bool insert(Addr address, std::string symbol);
|
bool insert(Addr address, std::string symbol);
|
||||||
bool load(const std::string &file);
|
bool load(const std::string &file);
|
||||||
|
|
||||||
|
bool findNearestSymbol(Addr address, std::string &symbol) const;
|
||||||
bool findSymbol(Addr address, std::string &symbol) const;
|
bool findSymbol(Addr address, std::string &symbol) const;
|
||||||
bool findAddress(const std::string &symbol, Addr &address) const;
|
bool findAddress(const std::string &symbol, Addr &address) const;
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,8 @@ Trace::InstRecord::dump(ostream &outs)
|
||||||
|
|
||||||
|
|
||||||
std::string str;
|
std::string str;
|
||||||
if(debugSymbolTable->findSymbol(PC, str))
|
if (debugSymbolTable->findNearestSymbol(PC, str))
|
||||||
outs << "@" << setw(17) << str << " : ";
|
outs << "@" << setw(17) << str << " : ";
|
||||||
else if(debugSymbolTable->findSymbol(PC - 4, str))
|
|
||||||
outs << "@" << setw(15) << str << "+4 : ";
|
|
||||||
else if(debugSymbolTable->findSymbol(PC - 8, str))
|
|
||||||
outs << "@" << setw(15) << str << "+8 : ";
|
|
||||||
else
|
else
|
||||||
outs << "0x" << hex << PC << " : ";
|
outs << "0x" << hex << PC << " : ";
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,9 @@ using namespace std;
|
||||||
|
|
||||||
IdeDisk::IdeDisk(const string &name, DiskImage *img, PhysicalMemory *phys,
|
IdeDisk::IdeDisk(const string &name, DiskImage *img, PhysicalMemory *phys,
|
||||||
int id, int delay)
|
int id, int delay)
|
||||||
: SimObject(name), ctrl(NULL), image(img), physmem(phys), dmaTransferEvent(this),
|
: SimObject(name), ctrl(NULL), image(img), physmem(phys),
|
||||||
dmaReadWaitEvent(this), dmaWriteWaitEvent(this), dmaPrdReadEvent(this),
|
dmaTransferEvent(this), dmaReadWaitEvent(this),
|
||||||
|
dmaWriteWaitEvent(this), dmaPrdReadEvent(this),
|
||||||
dmaReadEvent(this), dmaWriteEvent(this)
|
dmaReadEvent(this), dmaWriteEvent(this)
|
||||||
{
|
{
|
||||||
diskDelay = (delay * ticksPerSecond / 1000) / image->size();
|
diskDelay = (delay * ticksPerSecond / 1000) / image->size();
|
||||||
|
@ -379,8 +380,9 @@ IdeDisk::dmaWriteDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the data to memory
|
// copy the data to memory
|
||||||
Addr dmaAddr =
|
Addr dmaAddr = ctrl->tsunami->pchip->
|
||||||
ctrl->tsunami->pchip->translatePciToDma(curPrd.getBaseAddr());
|
translatePciToDma(curPrd.getBaseAddr());
|
||||||
|
|
||||||
memcpy(physmem->dma_addr(dmaAddr, curPrd.getByteCount()),
|
memcpy(physmem->dma_addr(dmaAddr, curPrd.getByteCount()),
|
||||||
(void *)dataBuffer, curPrd.getByteCount());
|
(void *)dataBuffer, curPrd.getByteCount());
|
||||||
|
|
||||||
|
@ -665,7 +667,9 @@ IdeDisk::updateState(DevAction_t action)
|
||||||
cmdReg.status |= STATUS_DRQ_BIT;
|
cmdReg.status |= STATUS_DRQ_BIT;
|
||||||
|
|
||||||
// put the first two bytes into the data register
|
// put the first two bytes into the data register
|
||||||
memcpy((void *)&cmdReg.data0, (void *)dataBuffer, sizeof(uint16_t));
|
memcpy((void *)&cmdReg.data0, (void *)dataBuffer,
|
||||||
|
sizeof(uint16_t));
|
||||||
|
|
||||||
// copy the data into the data buffer
|
// copy the data into the data buffer
|
||||||
if (curCommand == WIN_IDENTIFY)
|
if (curCommand == WIN_IDENTIFY)
|
||||||
memcpy((void *)dataBuffer, (void *)&driveID,
|
memcpy((void *)dataBuffer, (void *)&driveID,
|
||||||
|
@ -753,7 +757,9 @@ IdeDisk::updateState(DevAction_t action)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Transfer_Data_Out:
|
case Transfer_Data_Out:
|
||||||
if (action == ACT_DATA_WRITE_BYTE || action == ACT_DATA_WRITE_SHORT) {
|
if (action == ACT_DATA_WRITE_BYTE ||
|
||||||
|
action == ACT_DATA_WRITE_SHORT) {
|
||||||
|
|
||||||
if (action == ACT_DATA_READ_BYTE) {
|
if (action == ACT_DATA_READ_BYTE) {
|
||||||
panic("DEBUG: WRITING DATA ONE BYTE AT A TIME!\n");
|
panic("DEBUG: WRITING DATA ONE BYTE AT A TIME!\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -863,7 +869,8 @@ END_INIT_SIM_OBJECT_PARAMS(IdeDisk)
|
||||||
|
|
||||||
CREATE_SIM_OBJECT(IdeDisk)
|
CREATE_SIM_OBJECT(IdeDisk)
|
||||||
{
|
{
|
||||||
return new IdeDisk(getInstanceName(), image, physmem, driveID, disk_delay);
|
return new IdeDisk(getInstanceName(), image, physmem, driveID,
|
||||||
|
disk_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_SIM_OBJECT("IdeDisk", IdeDisk)
|
REGISTER_SIM_OBJECT("IdeDisk", IdeDisk)
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
|
|
||||||
#define DMA_BACKOFF_PERIOD 200
|
#define DMA_BACKOFF_PERIOD 200
|
||||||
|
|
||||||
#define MAX_DMA_SIZE (16384)
|
#define MAX_DMA_SIZE (131072) // 256 * SectorSize (512)
|
||||||
#define MAX_MULTSECT (32)
|
#define MAX_MULTSECT (128)
|
||||||
|
|
||||||
#define PRD_BASE_MASK 0xfffffffe
|
#define PRD_BASE_MASK 0xfffffffe
|
||||||
#define PRD_COUNT_MASK 0xfffe
|
#define PRD_COUNT_MASK 0xfffe
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "dev/tsunamireg.h"
|
#include "dev/tsunamireg.h"
|
||||||
#include "dev/tsunami.hh"
|
#include "dev/tsunami.hh"
|
||||||
#include "mem/functional_mem/memory_control.hh"
|
#include "mem/functional_mem/memory_control.hh"
|
||||||
|
#include "mem/functional_mem/physical_memory.hh"
|
||||||
#include "sim/builder.hh"
|
#include "sim/builder.hh"
|
||||||
#include "sim/system.hh"
|
#include "sim/system.hh"
|
||||||
|
|
||||||
|
@ -217,12 +218,21 @@ TsunamiPChip::write(MemReqPtr &req, const uint8_t *data)
|
||||||
return No_Fault;
|
return No_Fault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DMA_ADDR_MASK ULL(0x3ffffffff)
|
||||||
|
|
||||||
Addr
|
Addr
|
||||||
TsunamiPChip::translatePciToDma(Addr busAddr)
|
TsunamiPChip::translatePciToDma(Addr busAddr)
|
||||||
{
|
{
|
||||||
// compare the address to the window base registers
|
// compare the address to the window base registers
|
||||||
|
uint64_t tbaMask = 0;
|
||||||
|
uint64_t baMask = 0;
|
||||||
|
|
||||||
uint64_t windowMask = 0;
|
uint64_t windowMask = 0;
|
||||||
uint64_t windowBase = 0;
|
uint64_t windowBase = 0;
|
||||||
|
|
||||||
|
uint64_t pteEntry = 0;
|
||||||
|
|
||||||
|
Addr pteAddr;
|
||||||
Addr dmaAddr;
|
Addr dmaAddr;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -230,15 +240,38 @@ TsunamiPChip::translatePciToDma(Addr busAddr)
|
||||||
windowMask = ~wsm[i] & (0x7ff << 20);
|
windowMask = ~wsm[i] & (0x7ff << 20);
|
||||||
|
|
||||||
if ((busAddr & windowMask) == (windowBase & windowMask)) {
|
if ((busAddr & windowMask) == (windowBase & windowMask)) {
|
||||||
windowMask = (wsm[i] & (0x7ff << 20)) | 0xfffff;
|
|
||||||
|
|
||||||
if (wsba[i] & 0x1) { // see if enabled
|
if (wsba[i] & 0x1) { // see if enabled
|
||||||
if (wsba[i] & 0x2) // see if SG bit is set
|
if (wsba[i] & 0x2) { // see if SG bit is set
|
||||||
panic("PCI to system SG mapping not currently implemented!\n");
|
/** @todo
|
||||||
else
|
This currently is faked by just doing a direct
|
||||||
dmaAddr = (tba[i] & ~windowMask) | (busAddr & windowMask);
|
read from memory, however, to be realistic, this
|
||||||
|
needs to actually do a bus transaction. The process
|
||||||
|
is explained in the tsunami documentation on page
|
||||||
|
10-12 and basically munges the address to look up a
|
||||||
|
PTE from a table in memory and then uses that mapping
|
||||||
|
to create an address for the SG page
|
||||||
|
*/
|
||||||
|
|
||||||
return dmaAddr;
|
tbaMask = ~(((wsm[i] & (0x7ff << 20)) >> 10) | 0x3ff);
|
||||||
|
baMask = (wsm[i] & (0x7ff << 20)) | (0x7f << 13);
|
||||||
|
pteAddr = (tba[i] & tbaMask) | ((busAddr & baMask) >> 10);
|
||||||
|
|
||||||
|
memcpy((void *)&pteEntry,
|
||||||
|
tsunami->system->
|
||||||
|
physmem->dma_addr(pteAddr, sizeof(uint64_t)),
|
||||||
|
sizeof(uint64_t));
|
||||||
|
|
||||||
|
dmaAddr = ((pteEntry & ~0x1) << 12) | (busAddr & 0xfff);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
baMask = (wsm[i] & (0x7ff << 20)) | 0xfffff;
|
||||||
|
tbaMask = ~baMask;
|
||||||
|
dmaAddr = (tba[i] & tbaMask) | (busAddr & baMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (dmaAddr & DMA_ADDR_MASK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -653,6 +653,7 @@ LinuxSystem::registerExecContext(ExecContext *xc)
|
||||||
RemoteGDB *rgdb = new RemoteGDB(this, xc);
|
RemoteGDB *rgdb = new RemoteGDB(this, xc);
|
||||||
GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex);
|
GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex);
|
||||||
gdbl->listen();
|
gdbl->listen();
|
||||||
|
gdbl->accept();
|
||||||
|
|
||||||
if (remoteGDB.size() <= xcIndex) {
|
if (remoteGDB.size() <= xcIndex) {
|
||||||
remoteGDB.resize(xcIndex+1);
|
remoteGDB.resize(xcIndex+1);
|
||||||
|
|
Loading…
Reference in a new issue