summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/vtophys.cc8
-rw-r--r--base/loader/symtab.cc25
-rw-r--r--base/loader/symtab.hh7
-rw-r--r--cpu/exetrace.cc6
-rw-r--r--dev/ide_disk.cc21
-rw-r--r--dev/ide_disk.hh4
-rw-r--r--dev/tsunami_pchip.cc47
-rw-r--r--kern/linux/linux_system.cc1
8 files changed, 91 insertions, 28 deletions
diff --git a/arch/alpha/vtophys.cc b/arch/alpha/vtophys.cc
index c5fe8df10..d91d80c83 100644
--- a/arch/alpha/vtophys.cc
+++ b/arch/alpha/vtophys.cc
@@ -96,9 +96,9 @@ vtophys(ExecContext *xc, Addr vaddr)
{
Addr ptbr = xc->regs.ipr[AlphaISA::IPR_PALtemp20];
Addr paddr = 0;
- if (PC_PAL(vaddr)) {
- paddr = vaddr & ~ULL(1);
- } else {
+// if (PC_PAL(vaddr)) {
+// paddr = vaddr & ~ULL(1);
+// } else {
if (vaddr >= ALPHA_K0SEG_BASE && vaddr <= ALPHA_K0SEG_END) {
paddr = ALPHA_K0SEG_TO_PHYS(vaddr);
} else if (!ptbr) {
@@ -109,7 +109,7 @@ vtophys(ExecContext *xc, Addr vaddr)
if (pte && entry_valid(entry))
paddr = PMAP_PTE_PA(entry) | (vaddr & PGOFSET);
}
- }
+// }
DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr);
diff --git a/base/loader/symtab.cc b/base/loader/symtab.cc
index 075c197a6..cb18d499c 100644
--- a/base/loader/symtab.cc
+++ b/base/loader/symtab.cc
@@ -95,6 +95,31 @@ SymbolTable::load(const string &filename)
}
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
SymbolTable::findSymbol(Addr address, string &symbol) const
{
ATable::const_iterator i = addrTable.find(address);
diff --git a/base/loader/symtab.hh b/base/loader/symtab.hh
index 49a811018..1502e4250 100644
--- a/base/loader/symtab.hh
+++ b/base/loader/symtab.hh
@@ -29,14 +29,14 @@
#ifndef __SYMTAB_HH__
#define __SYMTAB_HH__
-#include "base/hashmap.hh"
+#include <map>
#include "targetarch/isa_traits.hh" // for Addr
class SymbolTable
{
private:
- typedef m5::hash_map<Addr, std::string> ATable;
- typedef m5::hash_map<std::string, Addr> STable;
+ typedef std::map<Addr, std::string> ATable;
+ typedef std::map<std::string, Addr> STable;
ATable addrTable;
STable symbolTable;
@@ -49,6 +49,7 @@ class SymbolTable
bool insert(Addr address, std::string symbol);
bool load(const std::string &file);
+ bool findNearestSymbol(Addr address, std::string &symbol) const;
bool findSymbol(Addr address, std::string &symbol) const;
bool findAddress(const std::string &symbol, Addr &address) const;
diff --git a/cpu/exetrace.cc b/cpu/exetrace.cc
index 4d3a70f37..0dd1d74d6 100644
--- a/cpu/exetrace.cc
+++ b/cpu/exetrace.cc
@@ -67,12 +67,8 @@ Trace::InstRecord::dump(ostream &outs)
std::string str;
- if(debugSymbolTable->findSymbol(PC, str))
+ if (debugSymbolTable->findNearestSymbol(PC, 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
outs << "0x" << hex << PC << " : ";
diff --git a/dev/ide_disk.cc b/dev/ide_disk.cc
index 77e809ee6..f4e73c833 100644
--- a/dev/ide_disk.cc
+++ b/dev/ide_disk.cc
@@ -55,8 +55,9 @@ using namespace std;
IdeDisk::IdeDisk(const string &name, DiskImage *img, PhysicalMemory *phys,
int id, int delay)
- : SimObject(name), ctrl(NULL), image(img), physmem(phys), dmaTransferEvent(this),
- dmaReadWaitEvent(this), dmaWriteWaitEvent(this), dmaPrdReadEvent(this),
+ : SimObject(name), ctrl(NULL), image(img), physmem(phys),
+ dmaTransferEvent(this), dmaReadWaitEvent(this),
+ dmaWriteWaitEvent(this), dmaPrdReadEvent(this),
dmaReadEvent(this), dmaWriteEvent(this)
{
diskDelay = (delay * ticksPerSecond / 1000) / image->size();
@@ -379,8 +380,9 @@ IdeDisk::dmaWriteDone()
}
// copy the data to memory
- Addr dmaAddr =
- ctrl->tsunami->pchip->translatePciToDma(curPrd.getBaseAddr());
+ Addr dmaAddr = ctrl->tsunami->pchip->
+ translatePciToDma(curPrd.getBaseAddr());
+
memcpy(physmem->dma_addr(dmaAddr, curPrd.getByteCount()),
(void *)dataBuffer, curPrd.getByteCount());
@@ -665,7 +667,9 @@ IdeDisk::updateState(DevAction_t action)
cmdReg.status |= STATUS_DRQ_BIT;
// 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
if (curCommand == WIN_IDENTIFY)
memcpy((void *)dataBuffer, (void *)&driveID,
@@ -753,7 +757,9 @@ IdeDisk::updateState(DevAction_t action)
break;
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) {
panic("DEBUG: WRITING DATA ONE BYTE AT A TIME!\n");
} else {
@@ -863,7 +869,8 @@ END_INIT_SIM_OBJECT_PARAMS(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)
diff --git a/dev/ide_disk.hh b/dev/ide_disk.hh
index 9bb695bee..016f827cc 100644
--- a/dev/ide_disk.hh
+++ b/dev/ide_disk.hh
@@ -40,8 +40,8 @@
#define DMA_BACKOFF_PERIOD 200
-#define MAX_DMA_SIZE (16384)
-#define MAX_MULTSECT (32)
+#define MAX_DMA_SIZE (131072) // 256 * SectorSize (512)
+#define MAX_MULTSECT (128)
#define PRD_BASE_MASK 0xfffffffe
#define PRD_COUNT_MASK 0xfffe
diff --git a/dev/tsunami_pchip.cc b/dev/tsunami_pchip.cc
index 5f0521a2e..ea23cce08 100644
--- a/dev/tsunami_pchip.cc
+++ b/dev/tsunami_pchip.cc
@@ -18,6 +18,7 @@
#include "dev/tsunamireg.h"
#include "dev/tsunami.hh"
#include "mem/functional_mem/memory_control.hh"
+#include "mem/functional_mem/physical_memory.hh"
#include "sim/builder.hh"
#include "sim/system.hh"
@@ -217,12 +218,21 @@ TsunamiPChip::write(MemReqPtr &req, const uint8_t *data)
return No_Fault;
}
+#define DMA_ADDR_MASK ULL(0x3ffffffff)
+
Addr
TsunamiPChip::translatePciToDma(Addr busAddr)
{
// compare the address to the window base registers
+ uint64_t tbaMask = 0;
+ uint64_t baMask = 0;
+
uint64_t windowMask = 0;
uint64_t windowBase = 0;
+
+ uint64_t pteEntry = 0;
+
+ Addr pteAddr;
Addr dmaAddr;
for (int i = 0; i < 4; i++) {
@@ -230,15 +240,38 @@ TsunamiPChip::translatePciToDma(Addr busAddr)
windowMask = ~wsm[i] & (0x7ff << 20);
if ((busAddr & windowMask) == (windowBase & windowMask)) {
- windowMask = (wsm[i] & (0x7ff << 20)) | 0xfffff;
- if (wsba[i] & 0x1) { // see if enabled
- if (wsba[i] & 0x2) // see if SG bit is set
- panic("PCI to system SG mapping not currently implemented!\n");
- else
- dmaAddr = (tba[i] & ~windowMask) | (busAddr & windowMask);
- return dmaAddr;
+ if (wsba[i] & 0x1) { // see if enabled
+ if (wsba[i] & 0x2) { // see if SG bit is set
+ /** @todo
+ This currently is faked by just doing a direct
+ 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
+ */
+
+ 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);
}
}
}
diff --git a/kern/linux/linux_system.cc b/kern/linux/linux_system.cc
index 587ba45cc..8bfad0996 100644
--- a/kern/linux/linux_system.cc
+++ b/kern/linux/linux_system.cc
@@ -653,6 +653,7 @@ LinuxSystem::registerExecContext(ExecContext *xc)
RemoteGDB *rgdb = new RemoteGDB(this, xc);
GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex);
gdbl->listen();
+ gdbl->accept();
if (remoteGDB.size() <= xcIndex) {
remoteGDB.resize(xcIndex+1);