changeset 949a8304e7f9 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=949a8304e7f9
description:
        X86: Set the local APIC ID to something meaningful.

diffstat:

2 files changed, 54 insertions(+), 35 deletions(-)
src/arch/x86/interrupts.cc |   51 +++++++++++++++++++++++++++++++++++++++++++-
src/arch/x86/interrupts.hh |   38 +++-----------------------------

diffs (140 lines):

diff -r 818914aeebc1 -r 949a8304e7f9 src/arch/x86/interrupts.cc
--- a/src/arch/x86/interrupts.cc        Sun Apr 19 02:06:51 2009 -0700
+++ b/src/arch/x86/interrupts.cc        Sun Apr 19 02:16:49 2009 -0700
@@ -286,10 +286,20 @@
     cpu->wakeup();
 }
 
+
+void
+X86ISA::Interrupts::setCPU(BaseCPU * newCPU)
+{
+    cpu = newCPU;
+    assert(cpu);
+    regs[APIC_ID] = (cpu->cpuId() << 24);
+}
+
+
 Tick
 X86ISA::Interrupts::recvMessage(PacketPtr pkt)
 {
-    uint8_t id = 0;
+    uint8_t id = (regs[APIC_ID] >> 24);
     Addr offset = pkt->getAddr() - x86InterruptAddress(id, 0);
     assert(pkt->cmd == MemCmd::MessageReq);
     switch(offset)
@@ -319,6 +329,26 @@
 }
 
 
+void
+X86ISA::Interrupts::addressRanges(AddrRangeList &range_list)
+{
+    uint8_t id = (regs[APIC_ID] >> 24);
+    range_list.clear();
+    range_list.push_back(RangeEx(x86LocalAPICAddress(id, 0),
+                                 x86LocalAPICAddress(id, 0) + PageBytes));
+}
+
+
+void
+X86ISA::Interrupts::getIntAddrRange(AddrRangeList &range_list)
+{
+    uint8_t id = (regs[APIC_ID] >> 24);
+    range_list.clear();
+    range_list.push_back(RangeEx(x86InterruptAddress(id, 0),
+                x86InterruptAddress(id, 0) + PhysAddrAPICRangeSize));
+}
+
+
 uint32_t
 X86ISA::Interrupts::readReg(ApicRegIndex reg)
 {
@@ -479,6 +509,25 @@
     return;
 }
 
+
+X86ISA::Interrupts::Interrupts(Params * p) :
+    BasicPioDevice(p), IntDev(this), latency(p->pio_latency), clock(0),
+    apicTimerEvent(this),
+    pendingSmi(false), smiVector(0),
+    pendingNmi(false), nmiVector(0),
+    pendingExtInt(false), extIntVector(0),
+    pendingInit(false), initVector(0),
+    pendingUnmaskableInt(false)
+{
+    pioSize = PageBytes;
+    memset(regs, 0, sizeof(regs));
+    //Set the local apic DFR to the flat model.
+    regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
+    ISRV = 0;
+    IRRV = 0;
+}
+
+
 bool
 X86ISA::Interrupts::checkInterrupts(ThreadContext *tc) const
 {
diff -r 818914aeebc1 -r 949a8304e7f9 src/arch/x86/interrupts.hh
--- a/src/arch/x86/interrupts.hh        Sun Apr 19 02:06:51 2009 -0700
+++ b/src/arch/x86/interrupts.hh        Sun Apr 19 02:16:49 2009 -0700
@@ -191,11 +191,7 @@
      */
     typedef X86LocalApicParams Params;
 
-    void
-    setCPU(BaseCPU * newCPU)
-    {
-        cpu = newCPU;
-    }
+    void setCPU(BaseCPU * newCPU);
 
     void
     setClock(Tick newClock)
@@ -225,19 +221,8 @@
         return entry.periodic;
     }
 
-    void addressRanges(AddrRangeList &range_list)
-    {
-        range_list.clear();
-        range_list.push_back(RangeEx(x86LocalAPICAddress(0, 0),
-                                     x86LocalAPICAddress(0, 0) + PageBytes));
-    }
-
-    void getIntAddrRange(AddrRangeList &range_list)
-    {
-        range_list.clear();
-        range_list.push_back(RangeEx(x86InterruptAddress(0, 0),
-                    x86InterruptAddress(0, 0) + PhysAddrAPICRangeSize));
-    }
+    void addressRanges(AddrRangeList &range_list);
+    void getIntAddrRange(AddrRangeList &range_list);
 
     Port *getPort(const std::string &if_name, int idx = -1)
     {
@@ -262,22 +247,7 @@
      * Constructor.
      */
 
-    Interrupts(Params * p)
-        : BasicPioDevice(p), IntDev(this), latency(p->pio_latency), clock(0),
-          apicTimerEvent(this),
-          pendingSmi(false), smiVector(0),
-          pendingNmi(false), nmiVector(0),
-          pendingExtInt(false), extIntVector(0),
-          pendingInit(false), initVector(0),
-          pendingUnmaskableInt(false)
-    {
-        pioSize = PageBytes;
-        memset(regs, 0, sizeof(regs));
-        //Set the local apic DFR to the flat model.
-        regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
-        ISRV = 0;
-        IRRV = 0;
-    }
+    Interrupts(Params * p);
 
     /*
      * Functions for retrieving interrupts for the CPU to handle.
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to