Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/55697 )

Change subject: arch-x86,dev: Use default initializers in the I8259.
......................................................................

arch-x86,dev: Use default initializers in the I8259.

There were several uninitialized members in the I8259 class. Set default
initializers for everything, instead of relying on the constructor which
might miss something which isn't immediately obvious.

Change-Id: Ifaf99e81fd64bbf28fc9ed6cd3de54c445435fa1
---
M src/dev/x86/i8259.cc
M src/dev/x86/i8259.hh
2 files changed, 29 insertions(+), 23 deletions(-)



diff --git a/src/dev/x86/i8259.cc b/src/dev/x86/i8259.cc
index c78e129..9596eee 100644
--- a/src/dev/x86/i8259.cc
+++ b/src/dev/x86/i8259.cc
@@ -39,12 +39,8 @@
 namespace gem5
 {

-X86ISA::I8259::I8259(const Params &p)
-    : BasicPioDevice(p, 2),
-      latency(p.pio_latency),
-      mode(p.mode), slave(p.slave),
-      IRR(0), ISR(0), IMR(0),
-      readIRR(true), initControlWord(0), autoEOI(false)
+X86ISA::I8259::I8259(const Params &p) : BasicPioDevice(p, 2),
+      latency(p.pio_latency), mode(p.mode), slave(p.slave)
 {
     for (int i = 0; i < p.port_output_connection_count; i++) {
         output.push_back(new IntSourcePin<I8259>(
@@ -58,9 +54,6 @@
         inputs.push_back(new IntSinkPin<I8259>(
                     csprintf("%s.inputs[%d]", name(), i), i, this));
     }
-
-    for (bool &state: pinStates)
-        state = false;
 }

 AddrRangeList
diff --git a/src/dev/x86/i8259.hh b/src/dev/x86/i8259.hh
index afd4894..485664d 100644
--- a/src/dev/x86/i8259.hh
+++ b/src/dev/x86/i8259.hh
@@ -43,8 +43,8 @@
 class I8259 : public BasicPioDevice
 {
   protected:
-    static const int NumLines = 8;
-    bool pinStates[NumLines];
+    static const inline int NumLines = 8;
+    bool pinStates[NumLines] = {};

     void init() override;

@@ -52,33 +52,33 @@
     std::vector<IntSourcePin<I8259> *> output;
     std::vector<IntSinkPin<I8259> *> inputs;
     enums::X86I8259CascadeMode mode;
-    I8259 *slave;
+    I8259 *slave = nullptr;

     // Interrupt Request Register
-    uint8_t IRR;
+    uint8_t IRR = 0;
     // In Service Register
-    uint8_t ISR;
+    uint8_t ISR = 0;
     // Interrupt Mask Register
-    uint8_t IMR;
+    uint8_t IMR = 0;

     // The higher order bits of the vector to return
-    uint8_t vectorOffset;
+    uint8_t vectorOffset = 0;

-    bool cascadeMode;
+    bool cascadeMode = false;
     // A bit vector of lines with responders attached, or the
     // responder id, depending
     // on if this is a requestor or responder PIC.
-    uint8_t cascadeBits;
+    uint8_t cascadeBits = 0;

-    bool edgeTriggered;
-    bool readIRR;
+    bool edgeTriggered = true;
+    bool readIRR = true;

// State machine information for reading in initialization control words.
-    bool expectICW4;
-    int initControlWord;
+    bool expectICW4 = false;
+    int initControlWord = 0;

     // Whether or not the PIC is in auto EOI mode.
-    bool autoEOI;
+    bool autoEOI = false;

     void requestInterrupt(int line);
     void handleEOI(int line);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55697
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ifaf99e81fd64bbf28fc9ed6cd3de54c445435fa1
Gerrit-Change-Number: 55697
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to