diff options
author | IanJiangICT <ianjiang.ict@gmail.com> | 2019-11-06 22:00:03 +0800 |
---|---|---|
committer | Ian Jiang <ianjiang.ict@gmail.com> | 2019-11-22 09:13:08 +0000 |
commit | 0b39303f1c4dae8cb933e3eeac1a7e4be0cfe3ce (patch) | |
tree | 1ecad2bc85bbe4d72b5beb39dd8ab6ecede5dbb2 /src/arch/riscv/interrupts.hh | |
parent | 80283488ff763fbe1a6e82109ea74c7c5a898527 (diff) | |
download | gem5-0b39303f1c4dae8cb933e3eeac1a7e4be0cfe3ce.tar.xz |
arch-riscv: Fix bug in serialize and unserialize of Interrutps
When serialize and unserialize an variable, the parameters passed to
SERIALIZE_SCALAR() and UNSERIALIZE_SCALAR() must be the same and should be a
general variable name. If not, the expected item would not be found with
UNSERIALIZE_SCALAR() and a fatal error would be introduced.
This patch fix the bug in class Interrupts of RISCV.
Change-Id: I7dd7ab6805651149304959bdf7ee9f3be9d9eaff
Signed-off-by: Ian Jiang <ianjiang.ict@gmail.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22643
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alec Roelke <alec.roelke@gmail.com>
Maintainer: Alec Roelke <alec.roelke@gmail.com>
Diffstat (limited to 'src/arch/riscv/interrupts.hh')
-rw-r--r-- | src/arch/riscv/interrupts.hh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/arch/riscv/interrupts.hh b/src/arch/riscv/interrupts.hh index 509b48391..77079e11a 100644 --- a/src/arch/riscv/interrupts.hh +++ b/src/arch/riscv/interrupts.hh @@ -134,18 +134,21 @@ class Interrupts : public BaseInterrupts void serialize(CheckpointOut &cp) const { - SERIALIZE_SCALAR(ip.to_ulong()); - SERIALIZE_SCALAR(ie.to_ulong()); + unsigned long ip_ulong = ip.to_ulong(); + unsigned long ie_ulong = ie.to_ulong(); + SERIALIZE_SCALAR(ip_ulong); + SERIALIZE_SCALAR(ie_ulong); } void unserialize(CheckpointIn &cp) { - long reg; - UNSERIALIZE_SCALAR(reg); - ip = reg; - UNSERIALIZE_SCALAR(reg); - ie = reg; + unsigned long ip_ulong; + unsigned long ie_ulong; + UNSERIALIZE_SCALAR(ip_ulong); + ip = ip_ulong; + UNSERIALIZE_SCALAR(ie_ulong); + ie = ie_ulong; } }; |