From d3cf2359a47305822773661a6a5fc9ac80a9874e Mon Sep 17 00:00:00 2001 From: adrian Date: Thu, 17 Jan 2013 13:41:03 +0000 Subject: [PATCH] FIXMEs and comments updated due to last architecture-related changes git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2005 8c4709b5-6ec9-48aa-a5cd-a96041d1645a --- src/core/sal/CPU.cc | 3 --- src/core/sal/CPUState.cc | 7 +++++-- src/core/sal/Event.hpp | 12 ++++++------ src/core/sal/SimulatorController.hpp | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/sal/CPU.cc b/src/core/sal/CPU.cc index 2e021991..dc7ee74c 100644 --- a/src/core/sal/CPU.cc +++ b/src/core/sal/CPU.cc @@ -2,9 +2,6 @@ namespace fail { -// FIXME: Bochs specific? If not, at least get rid of this global variable. -int interrupt_to_fire = -1; - void CPUArchitecture::addRegister(Register* reg) { assert(!reg->isAssigned() && "FATAL ERROR: The register is already assigned!"); diff --git a/src/core/sal/CPUState.cc b/src/core/sal/CPUState.cc index cdcb61e5..1bd5688e 100644 --- a/src/core/sal/CPUState.cc +++ b/src/core/sal/CPUState.cc @@ -2,7 +2,6 @@ namespace fail { -// FIXME: Bochs specific? If not, at least get rid of this global variable. int interrupt_to_fire = -1; bool CPUState::isSuppressedInterrupt(unsigned interruptNum) @@ -11,12 +10,14 @@ bool CPUState::isSuppressedInterrupt(unsigned interruptNum) if ((m_SuppressedInterrupts[i] == interruptNum || m_SuppressedInterrupts[i] == ANY_INTERRUPT) && interruptNum != (unsigned)interrupt_to_fire + 32) { + // FIXME: This should be dead code...(?) if ((int)interruptNum == interrupt_to_fire + 32) { interrupt_to_fire = -1; return true; } return true; } + // FIXME: This is simulator-(x86)-specific stuff... (?) return false; } @@ -25,7 +26,9 @@ bool CPUState::addSuppressedInterrupt(unsigned interruptNum) // Check if already existing: if (isSuppressedInterrupt(interruptNum+32)) return false; // already added: nothing to do here - + + // FIXME: addSuppressedInterrupt(ANY_INTERRUPT) can still be called more + // than once. This is not handled by the if-statement above. if (interruptNum == ANY_INTERRUPT) m_SuppressedInterrupts.push_back(interruptNum); else diff --git a/src/core/sal/Event.hpp b/src/core/sal/Event.hpp index 9f015f38..f47b9fd4 100644 --- a/src/core/sal/Event.hpp +++ b/src/core/sal/Event.hpp @@ -19,10 +19,11 @@ namespace fail { * about an event reported by the simulator backend. */ class BaseEvent { +protected: + ConcreteCPU* m_CPU; //!< the CPU object that triggered the event public: BaseEvent(ConcreteCPU* cpu = NULL) : m_CPU(cpu) { } virtual ~BaseEvent() { } - /** * Returns a pointer to the CPU that triggered this event. * @return triggering CPU @@ -33,8 +34,6 @@ public: * @param cpu new CPU which caused this event */ void setTriggerCPU(ConcreteCPU* cpu) { m_CPU = cpu; } -protected: - ConcreteCPU* m_CPU; }; // ---------------------------------------------------------------------------- // Specialized events: @@ -54,6 +53,7 @@ public: * the subclasses. * @param trigger the triggering address of the breakpoint event * @param address_space the address space identifier for this event + * @param cpu the Fail* CPU object that triggered the breakpoint */ BPEvent(address_t trigger, address_t address_space, ConcreteCPU* cpu = NULL) : BaseEvent(cpu), m_TriggerInstrPtr(trigger), m_AddressSpace(address_space) { } @@ -114,7 +114,7 @@ public: * @param width width of memory access (= # Bytes) * @param triggerIP the instruction pointer that actually triggered the memory access * @param type the type of memory access (r, w, rw) - * @param cpu the cpu that triggered the event + * @param cpu the CPU that triggered the event */ MemAccessEvent(address_t triggerAddr, size_t width, address_t triggerIP, access_type_t type, ConcreteCPU* cpu = NULL) @@ -221,7 +221,7 @@ public: * @param nmi the new NMI (non maskable interrupt) flag state * @param triggerNum system and type specific number identifying the requestet * "trouble-type" - * @param cpu the cpu that triggered the event + * @param cpu the CPU that triggered the event */ InterruptEvent(bool nmi, int triggerNum, ConcreteCPU* cpu = NULL) : TroubleEvent(triggerNum, cpu), m_IsNMI(nmi) { } @@ -277,7 +277,7 @@ public: /** * Initialises an IOPortEvent * @param data the data which has been communicated through the I/O port - * @param cpu the cpu that triggered the event + * @param cpu the CPU that triggered the event */ IOPortEvent(unsigned char data = 0, ConcreteCPU* cpu = NULL) : BaseEvent(cpu), m_Data(data) { } /** diff --git a/src/core/sal/SimulatorController.hpp b/src/core/sal/SimulatorController.hpp index 8c9aa62e..88ac55cb 100644 --- a/src/core/sal/SimulatorController.hpp +++ b/src/core/sal/SimulatorController.hpp @@ -105,6 +105,7 @@ public: * @param port the port used for communications */ void onGuestSystem(char data, unsigned port); + // FIXME: ConcreteCPU* cpu is missing here... /** * (Conditional) Jump-instruction handler. * @param cpu the CPU that did the jump