62a63
> #include "base/bitfield.hh"
76a78
> // Storage for the APIC registers
77a80,83
>
> /*
> * Timing related stuff.
> */
94a101,148
> /*
> * IRR and ISR maintenance.
> */
> uint8_t IRRV;
> uint8_t ISRV;
>
> int
> findRegArrayMSB(ApicRegIndex base)
> {
> int offset = 7;
> do {
> if (regs[base + offset] != 0) {
> return offset * 32 + findMsbSet(regs[base + offset]);
> }
> } while (offset--);
> return 0;
> }
>
> void
> updateIRRV()
> {
> IRRV = findRegArrayMSB(APIC_INTERRUPT_REQUEST_BASE);
> }
>
> void
> updateISRV()
> {
> ISRV = findRegArrayMSB(APIC_IN_SERVICE_BASE);
> }
>
> void
> setRegArrayBit(ApicRegIndex base, uint8_t vector)
> {
> regs[base + (vector % 32)] |= (1 << (vector >> 5));
> }
>
> void
> clearRegArrayBit(ApicRegIndex base, uint8_t vector)
> {
> regs[base + (vector % 32)] &= ~(1 << (vector >> 5));
> }
>
> bool
> getRegArrayBit(ApicRegIndex base, uint8_t vector)
> {
> return bits(regs[base + (vector % 32)], vector >> 5);
> }
>
95a150,152
> /*
> * Params stuff.
> */
108a166,168
> /*
> * Functions to interact with the interrupt port from IntDev.
> */
126a187,197
> Port *getPort(const std::string &if_name, int idx = -1)
> {
> if (if_name == "int_port")
> return intPort;
> return BasicPioDevice::getPort(if_name, idx);
> }
>
> /*
> * Functions to access and manipulate the APIC's registers.
> */
>
133a205,208
> /*
> * Constructor.
> */
>
137a213
> memset(regs, 0, sizeof(regs));
140,141c216,217
< memset(regs, 0, sizeof(regs));
< clear_all();
---
> ISRV = 0;
> IRRV = 0;
144c220,232
< Port *getPort(const std::string &if_name, int idx = -1)
---
> /*
> * Functions for retrieving interrupts for the CPU to handle.
> */
>
> bool check_interrupts(ThreadContext * tc) const;
> Fault getInterrupt(ThreadContext * tc);
> void updateIntrInfo(ThreadContext * tc);
>
> /*
> * Serialization.
> */
>
> void serialize(std::ostream & os)
146,148c234
< if (if_name == "int_port")
< return intPort;
< return BasicPioDevice::getPort(if_name, idx);
---
> panic("Interrupts::serialize unimplemented!\n");
151c237
< int InterruptLevel(uint64_t softint)
---
> void unserialize(Checkpoint * cp, const std::string & section)
153,154c239
< panic("Interrupts::InterruptLevel unimplemented!\n");
< return 0;
---
> panic("Interrupts::unserialize unimplemented!\n");
156a242,245
> /*
> * Old functions needed for compatability but which will be phased out
> * eventually.
> */
164c253
< warn("Interrupts::clear unimplemented!\n");
---
> panic("Interrupts::clear unimplemented!\n");
169c258
< warn("Interrupts::clear_all unimplemented!\n");
---
> panic("Interrupts::clear_all unimplemented!\n");
171,195d259
<
< bool check_interrupts(ThreadContext * tc) const
< {
< return false;
< }
<
< Fault getInterrupt(ThreadContext * tc)
< {
< return NoFault;
< }
<
< void updateIntrInfo(ThreadContext * tc)
< {
< panic("Interrupts::updateIntrInfo unimplemented!\n");
< }
<
< void serialize(std::ostream & os)
< {
< panic("Interrupts::serialize unimplemented!\n");
< }
<
< void unserialize(Checkpoint * cp, const std::string & section)
< {
< panic("Interrupts::unserialize unimplemented!\n");
< }