gem5
[DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
arch
arm
fastmodel
iris
interrupts.cc
Go to the documentation of this file.
1
/*
2
* Copyright 2019 Google Inc.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are
6
* met: redistributions of source code must retain the above copyright
7
* notice, this list of conditions and the following disclaimer;
8
* redistributions in binary form must reproduce the above copyright
9
* notice, this list of conditions and the following disclaimer in the
10
* documentation and/or other materials provided with the distribution;
11
* neither the name of the copyright holders nor the names of its
12
* contributors may be used to endorse or promote products derived from
13
* this software without specific prior written permission.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
#include "
arch/arm/fastmodel/iris/interrupts.hh
"
29
30
#include "
arch/arm/fastmodel/iris/thread_context.hh
"
31
#include "
arch/arm/interrupts.hh
"
32
#include "
arch/arm/regs/misc.hh
"
33
#include "
arch/arm/regs/misc_types.hh
"
34
#include "
arch/arm/types.hh
"
35
#include "params/IrisInterrupts.hh"
36
37
namespace
gem5
38
{
39
40
void
41
Iris::Interrupts::serialize
(
CheckpointOut
&
cp
)
const
42
{
43
using namespace
ArmISA
;
44
45
CPSR cpsr =
tc
->readMiscRegNoEffect(
MISCREG_CPSR
);
46
CPSR orig_cpsr = cpsr;
47
SCR scr =
tc
->readMiscRegNoEffect(
MISCREG_SCR_EL3
);
48
SCR orig_scr = scr;
49
HCR hcr =
tc
->readMiscRegNoEffect(
MISCREG_HCR_EL2
);
50
HCR orig_hcr = hcr;
51
52
// Set up state so we can get either physical or virtual interrupt bits.
53
cpsr.mode = 0;
54
cpsr.width = 0;
55
cpsr.el =
EL1
;
56
tc
->setMiscReg(
MISCREG_CPSR
, cpsr);
57
scr.eel2 = 1;
58
tc
->setMiscReg(
MISCREG_SCR
, scr);
59
60
// Get the virtual bits.
61
hcr.imo = 1;
62
hcr.fmo = 1;
63
hcr.amo = 1;
64
tc
->setMiscReg(
MISCREG_HCR_EL2
, hcr);
65
66
RegVal
isr_el1 =
tc
->readMiscRegNoEffect(
MISCREG_ISR_EL1
);
67
// There is also a virtual abort, but it's not used by gem5.
68
bool
virt_irq =
bits
(7, isr_el1);
69
bool
virt_fiq =
bits
(6, isr_el1);
70
71
// Get the physical bits.
72
hcr.imo = 0;
73
hcr.fmo = 0;
74
hcr.amo = 0;
75
tc
->setMiscReg(
MISCREG_HCR_EL2
, hcr);
76
77
isr_el1 =
tc
->readMiscRegNoEffect(
MISCREG_ISR_EL1
);
78
bool
phys_abort =
bits
(8, isr_el1);
79
bool
phys_irq =
bits
(7, isr_el1);
80
bool
phys_fiq =
bits
(6, isr_el1);
81
82
tc
->setMiscReg(
MISCREG_CPSR
, orig_cpsr);
83
tc
->setMiscReg(
MISCREG_SCR_EL3
, orig_scr);
84
tc
->setMiscReg(
MISCREG_HCR_EL2
, orig_hcr);
85
86
bool
interrupts[
ArmISA::NumInterruptTypes
];
87
uint64_t intStatus = 0;
88
89
for
(
bool
&
i
: interrupts)
90
i
=
false
;
91
92
interrupts[
ArmISA::INT_ABT
] = phys_abort;
93
interrupts[
ArmISA::INT_IRQ
] = phys_irq;
94
interrupts[
ArmISA::INT_FIQ
] = phys_fiq;
95
interrupts[
ArmISA::INT_SEV
] =
tc
->readMiscReg(
MISCREG_SEV_MAILBOX
);
96
interrupts[
ArmISA::INT_VIRT_IRQ
] = virt_irq;
97
interrupts[
ArmISA::INT_VIRT_FIQ
] = virt_fiq;
98
99
for
(
int
i
= 0;
i
<
NumInterruptTypes
;
i
++) {
100
if
(interrupts[
i
])
101
intStatus |= (0x1ULL <<
i
);
102
}
103
104
SERIALIZE_ARRAY
(interrupts,
NumInterruptTypes
);
105
SERIALIZE_SCALAR
(intStatus);
106
}
107
108
void
109
Iris::Interrupts::unserialize
(
CheckpointIn
&
cp
)
110
{
111
}
112
113
}
// namespace gem5
thread_context.hh
misc.hh
types.hh
interrupts.hh
interrupts.hh
gem5::BaseInterrupts::tc
ThreadContext * tc
Definition
interrupts.hh:44
gem5::CheckpointIn
Definition
serialize.hh:69
gem5::Iris::Interrupts::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition
interrupts.cc:109
gem5::Iris::Interrupts::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition
interrupts.cc:41
gem5::bits
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition
bitfield.hh:79
SERIALIZE_ARRAY
#define SERIALIZE_ARRAY(member, size)
Definition
serialize.hh:610
misc_types.hh
gem5::ArmISA
Definition
decoder.cc:54
gem5::ArmISA::INT_ABT
@ INT_ABT
Definition
interrupts.hh:62
gem5::ArmISA::INT_VIRT_IRQ
@ INT_VIRT_IRQ
Definition
interrupts.hh:66
gem5::ArmISA::INT_FIQ
@ INT_FIQ
Definition
interrupts.hh:64
gem5::ArmISA::NumInterruptTypes
@ NumInterruptTypes
Definition
interrupts.hh:68
gem5::ArmISA::INT_IRQ
@ INT_IRQ
Definition
interrupts.hh:63
gem5::ArmISA::INT_SEV
@ INT_SEV
Definition
interrupts.hh:65
gem5::ArmISA::INT_VIRT_FIQ
@ INT_VIRT_FIQ
Definition
interrupts.hh:67
gem5::ArmISA::i
Bitfield< 7 > i
Definition
misc_types.hh:67
gem5::ArmISA::EL1
@ EL1
Definition
types.hh:303
gem5::ArmISA::MISCREG_SCR_EL3
@ MISCREG_SCR_EL3
Definition
misc.hh:628
gem5::ArmISA::MISCREG_CPSR
@ MISCREG_CPSR
Definition
misc.hh:79
gem5::ArmISA::MISCREG_SEV_MAILBOX
@ MISCREG_SEV_MAILBOX
Definition
misc.hh:109
gem5::ArmISA::MISCREG_SCR
@ MISCREG_SCR
Definition
misc.hh:261
gem5::ArmISA::MISCREG_HCR_EL2
@ MISCREG_HCR_EL2
Definition
misc.hh:619
gem5::ArmISA::MISCREG_ISR_EL1
@ MISCREG_ISR_EL1
Definition
misc.hh:823
gem5::cp
Definition
cprintf.cc:41
gem5
Copyright (c) 2024 Arm Limited All rights reserved.
Definition
binary32.hh:36
gem5::RegVal
uint64_t RegVal
Definition
types.hh:173
gem5::CheckpointOut
std::ostream CheckpointOut
Definition
serialize.hh:66
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition
serialize.hh:568
Generated on Mon May 26 2025 09:18:58 for gem5 by
doxygen
1.13.2