1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

83 void clear_all()
84 {
85 DPRINTF(Interrupt, "Interrupts all cleared\n");
86
87 memset(interrupts, 0, sizeof(interrupts));
88 intstatus = 0;
89 }
90
91 bool check_interrupt(int int_num) const {
92 if (int_num > NumInterruptLevels)
93 panic("int_num out of bounds\n");
94
95 return interrupts[int_num] != 0;
96 }
97
98 bool check_interrupts() const { return intstatus != 0; }
99
91 void serialize(std::ostream &os)
92 {
93 SERIALIZE_ARRAY(interrupts, NumInterruptLevels);
94 SERIALIZE_SCALAR(intstatus);
95 }
96
97 void unserialize(Checkpoint *cp, const std::string &section)
98 {
99 UNSERIALIZE_ARRAY(interrupts, NumInterruptLevels);
100 UNSERIALIZE_SCALAR(intstatus);
101 }
102
103 bool check_interrupts(ThreadContext * tc) const
104 {
105 return (intstatus != 0) && !(tc->readPC() & 0x3);
106 }
107
108 Fault getInterrupt(ThreadContext * tc)
109 {
110 int ipl = 0;
111 int summary = 0;
112
113 if (tc->readMiscReg(IPR_ASTRR))
114 panic("asynchronous traps not implemented\n");
115

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

154
155 return new InterruptFault;
156 } else {
157 return NoFault;
158 }
159 }
160
161 private:
166 uint64_t intr_status() const { return intstatus; }
162 };
163}
164
165#endif
166