interrupts.hh (5647:b06b49498c79) interrupts.hh (5648:e8abda6e0980)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 47 unchanged lines hidden (view full) ---

56 */
57
58#ifndef __ARCH_X86_INTERRUPTS_HH__
59#define __ARCH_X86_INTERRUPTS_HH__
60
61#include "arch/x86/apicregs.hh"
62#include "arch/x86/faults.hh"
63#include "cpu/thread_context.hh"
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 47 unchanged lines hidden (view full) ---

56 */
57
58#ifndef __ARCH_X86_INTERRUPTS_HH__
59#define __ARCH_X86_INTERRUPTS_HH__
60
61#include "arch/x86/apicregs.hh"
62#include "arch/x86/faults.hh"
63#include "cpu/thread_context.hh"
64#include "dev/io_device.hh"
64#include "params/X86LocalApic.hh"
65#include "sim/eventq.hh"
66#include "sim/sim_object.hh"
67
68class ThreadContext;
69
70namespace X86ISA
71{
72
65#include "params/X86LocalApic.hh"
66#include "sim/eventq.hh"
67#include "sim/sim_object.hh"
68
69class ThreadContext;
70
71namespace X86ISA
72{
73
73class Interrupts : public SimObject
74class Interrupts : public BasicPioDevice
74{
75 protected:
76 uint32_t regs[NUM_APIC_REGS];
75{
76 protected:
77 uint32_t regs[NUM_APIC_REGS];
78 Tick latency;
79 Tick clock;
77
78 class ApicTimerEvent : public Event
79 {
80 public:
81 ApicTimerEvent() : Event()
82 {}
83
84 void process()
85 {
86 warn("Local APIC timer event doesn't do anything!\n");
87 }
88 };
89
90 ApicTimerEvent apicTimerEvent;
91
92 public:
93 typedef X86LocalApicParams Params;
94
80
81 class ApicTimerEvent : public Event
82 {
83 public:
84 ApicTimerEvent() : Event()
85 {}
86
87 void process()
88 {
89 warn("Local APIC timer event doesn't do anything!\n");
90 }
91 };
92
93 ApicTimerEvent apicTimerEvent;
94
95 public:
96 typedef X86LocalApicParams Params;
97
98 void setClock(Tick newClock)
99 {
100 clock = newClock;
101 }
102
95 const Params *
96 params() const
97 {
98 return dynamic_cast<const Params *>(_params);
99 }
100
103 const Params *
104 params() const
105 {
106 return dynamic_cast<const Params *>(_params);
107 }
108
101 uint32_t readRegNoEffect(ApicRegIndex reg);
102 uint32_t readReg(ApicRegIndex miscReg, ThreadContext *tc);
109 Tick read(PacketPtr pkt);
110 Tick write(PacketPtr pkt);
103
111
104 void setRegNoEffect(ApicRegIndex reg, uint32_t val);
105 void setReg(ApicRegIndex reg, uint32_t val, ThreadContext *tc);
112 void addressRanges(AddrRangeList &range_list)
113 {
114 range_list.clear();
115 range_list.push_back(RangeEx(x86LocalAPICAddress(0, 0),
116 x86LocalAPICAddress(0, 0) + PageBytes));
117 }
106
118
107 Interrupts(Params * p) : SimObject(p)
119 uint32_t readReg(ApicRegIndex miscReg);
120 void setReg(ApicRegIndex reg, uint32_t val);
121 void setRegNoEffect(ApicRegIndex reg, uint32_t val)
108 {
122 {
123 regs[reg] = val;
124 }
125
126 Interrupts(Params * p) : BasicPioDevice(p),
127 latency(p->pio_latency), clock(0)
128 {
129 pioSize = PageBytes;
109 //Set the local apic DFR to the flat model.
110 regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
111 memset(regs, 0, sizeof(regs));
112 clear_all();
113 }
114
115 int InterruptLevel(uint64_t softint)
116 {

--- 48 unchanged lines hidden ---
130 //Set the local apic DFR to the flat model.
131 regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
132 memset(regs, 0, sizeof(regs));
133 clear_all();
134 }
135
136 int InterruptLevel(uint64_t softint)
137 {

--- 48 unchanged lines hidden ---