From b6fba57065d42f12274e83d885a3af048e2daa78 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Wed, 28 Jan 2004 18:12:52 -0500 Subject: [PATCH] our first interrupt cpu/exetrace.cc: added looking for symbols at PC+4 and PC+8 thanks to gcc skiping setting the gp where it can and jumping +8 dev/console.cc: commented out weird interrupt per nate's suggestion dev/tsunami_cchip.cc: moved rtc flag to correct bit dev/tsunami_io.cc: time interrupt will be 1024Hz and at some point be configurable by linux dev/tsunami_io.hh: Timer interrupt will be 1024hz for now and in the future be configurable by linux --HG-- extra : convert_revision : 2fcc924c8848eb3c6166d9d517617ed193a2b89a --- cpu/exetrace.cc | 6 +++++- dev/console.cc | 4 ++-- dev/tsunami_cchip.cc | 5 +++-- dev/tsunami_io.cc | 14 +++++--------- dev/tsunami_io.hh | 9 +++++---- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/cpu/exetrace.cc b/cpu/exetrace.cc index a72242232..4d3a70f37 100644 --- a/cpu/exetrace.cc +++ b/cpu/exetrace.cc @@ -67,8 +67,12 @@ Trace::InstRecord::dump(ostream &outs) std::string str; - if(debugSymbolTable->findSymbol(data.as_int, str)) + if(debugSymbolTable->findSymbol(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/console.cc b/dev/console.cc index f4156207d..08b169bc4 100644 --- a/dev/console.cc +++ b/dev/console.cc @@ -388,8 +388,8 @@ CREATE_SIM_OBJECT(SimConsole) SimConsole *console = new SimConsole(getInstanceName(), filename, number); ((ConsoleListener *)listener)->add(console); ((SimConsole *)console)->initInt(intr_control); - ((SimConsole *)console)->setInt(SimConsole::TransmitInterrupt | - SimConsole::ReceiveInterrupt); +// ((SimConsole *)console)->setInt(SimConsole::TransmitInterrupt | +// SimConsole::ReceiveInterrupt); return console; } diff --git a/dev/tsunami_cchip.cc b/dev/tsunami_cchip.cc index 6559f3809..ffde4da98 100644 --- a/dev/tsunami_cchip.cc +++ b/dev/tsunami_cchip.cc @@ -148,10 +148,11 @@ TsunamiCChip::write(MemReqPtr req, const uint8_t *data) return No_Fault; case TSDEV_CC_MISC: //If it is the seventh bit, clear the RTC interrupt - if ((*(uint64_t*) data) & (1<<7)) { + if ((*(uint64_t*) data) & (1<<4)) { RTCInterrupting = false; tsunami->intrctrl->clear(0, TheISA::INTLEVEL_IRQ2, 0); - misc &= ~(1<<7); + DPRINTF(Tsunami, "clearing rtc interrupt\n"); + misc &= ~(1<<4); } else panic("TSDEV_CC_MISC write not implemented\n"); return No_Fault; case TSDEV_CC_AAR0: diff --git a/dev/tsunami_io.cc b/dev/tsunami_io.cc index 611496e58..87f997e9e 100644 --- a/dev/tsunami_io.cc +++ b/dev/tsunami_io.cc @@ -25,8 +25,6 @@ using namespace std; #define UNIX_YEAR_OFFSET 52 -//This will have to be dynamic if we want support usermode access of the RTC -#define RTC_RATE 1024 // Timer Event for Periodic interrupt of RTC TsunamiIO::RTCEvent::RTCEvent(Tsunami* t) @@ -39,7 +37,7 @@ TsunamiIO::RTCEvent::RTCEvent(Tsunami* t) void TsunamiIO::RTCEvent::process() { - DPRINTF(MC146818, "Timer Interrupt\n"); + DPRINTF(MC146818, "RTC Timer Interrupt\n"); schedule(curTick + ticksPerSecond/RTC_RATE); //Actually interrupt the processor here if (!tsunami->cchip->RTCInterrupting) { @@ -105,8 +103,8 @@ TsunamiIO::ClockEvent::Status() TsunamiIO::TsunamiIO(const string &name, Tsunami *t, time_t init_time, - Addr addr, Addr mask, uint32_t f, MemoryController *mmu) - : MmapDevice(name, addr, mask, mmu), tsunami(t), rtc(t), freq(f) + Addr addr, Addr mask, MemoryController *mmu) + : MmapDevice(name, addr, mask, mmu), tsunami(t), rtc(t) { timerData = 0; set_time(init_time == 0 ? time(NULL) : init_time); @@ -300,7 +298,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO) SimObjectParam mmu; Param addr; Param mask; - Param frequency; END_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO) @@ -311,15 +308,14 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(TsunamiIO) "(0 for actual time, default is 1/1/06", ULL(1136073600)), INIT_PARAM(mmu, "Memory Controller"), INIT_PARAM(addr, "Device Address"), - INIT_PARAM(mask, "Address Mask"), - INIT_PARAM(frequency, "clock interrupt frequency") + INIT_PARAM(mask, "Address Mask") END_INIT_SIM_OBJECT_PARAMS(TsunamiIO) CREATE_SIM_OBJECT(TsunamiIO) { return new TsunamiIO(getInstanceName(), tsunami, time, addr, - mask, frequency, mmu); + mask, mmu); } REGISTER_SIM_OBJECT("TsunamiIO", TsunamiIO) diff --git a/dev/tsunami_io.hh b/dev/tsunami_io.hh index e945eb53d..9706dea25 100644 --- a/dev/tsunami_io.hh +++ b/dev/tsunami_io.hh @@ -27,12 +27,14 @@ */ /* @file - * Tsunnami Fake DMA memory map + * Tsunami Fake I/O Space mapping including RTC/timer interrupts */ #ifndef __TSUNAMI_DMA_HH__ #define __TSUNAMI_DMA_HH__ +#define RTC_RATE 1024 + #include "mem/functional_mem/mmap_device.hh" #include "dev/tsunami.hh" @@ -107,13 +109,12 @@ class TsunamiIO : public MmapDevice uint32_t timerData; - uint32_t freq; public: - uint32_t frequency() const { return freq; } + uint32_t frequency() const { return RTC_RATE; } TsunamiIO(const std::string &name, Tsunami *t, time_t init_time, - Addr addr, Addr mask, uint32_t f, MemoryController *mmu); + Addr addr, Addr mask, MemoryController *mmu); void set_time(time_t t); -- 2.30.2