x86: Use little endian packet accessors.
authorGabe Black <gabeblack@google.com>
Fri, 12 Oct 2018 11:57:29 +0000 (04:57 -0700)
committerGabe Black <gabeblack@google.com>
Fri, 12 Oct 2018 23:44:38 +0000 (23:44 +0000)
We know data is little endian, so we can use those accessors
explicitly.

Change-Id: I09aa7f1e525ad1346e932ce4a772b64bf59dc350
Reviewed-on: https://gem5-review.googlesource.com/c/13456
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/arch/x86/interrupts.cc
src/arch/x86/intmessage.hh
src/arch/x86/memhelpers.hh
src/arch/x86/pagetable_walker.cc
src/dev/x86/cmos.cc
src/dev/x86/i8042.cc
src/dev/x86/i82094aa.cc
src/dev/x86/i8237.cc
src/dev/x86/i8254.cc
src/dev/x86/i8259.cc
src/dev/x86/speaker.cc

index 0ef79a472d4b7718622aec6d3844d8533fdf0e39..8ba1819482c3d6ddcebe502d648d7008fa5a09b7 100644 (file)
@@ -312,7 +312,7 @@ X86ISA::Interrupts::recvMessage(PacketPtr pkt)
     {
       case 0:
         {
-            TriggerIntMessage message = pkt->get<TriggerIntMessage>();
+            TriggerIntMessage message = pkt->getRaw<TriggerIntMessage>();
             DPRINTF(LocalApic,
                     "Got Trigger Interrupt message with vector %#x.\n",
                     message.vector);
index 83d80bb941967de8da802a9ce22320aea44bb6f6..8ec60b2aaf9d6bffc208a6f3f9639cc557d887ad 100644 (file)
@@ -94,7 +94,7 @@ namespace X86ISA
     buildIntRequest(const uint8_t id, T payload, Addr offset, Addr size)
     {
         PacketPtr pkt = prepIntRequest(id, offset, size);
-        pkt->set<T>(payload);
+        pkt->setRaw<T>(payload);
         return pkt;
     }
 
index aa3617b43b1ae4cb6a8ae51bdae1cdd03993c291..416439b9e3c9719184a1150543d4d49917ea9b74 100644 (file)
@@ -56,16 +56,16 @@ getMem(PacketPtr pkt, uint64_t &mem, unsigned dataSize,
 {
     switch (dataSize) {
       case 1:
-        mem = pkt->get<uint8_t>();
+        mem = pkt->getLE<uint8_t>();
         break;
       case 2:
-        mem = pkt->get<uint16_t>();
+        mem = pkt->getLE<uint16_t>();
         break;
       case 4:
-        mem = pkt->get<uint32_t>();
+        mem = pkt->getLE<uint32_t>();
         break;
       case 8:
-        mem = pkt->get<uint64_t>();
+        mem = pkt->getLE<uint64_t>();
         break;
       default:
         panic("Unhandled size in getMem.\n");
@@ -78,7 +78,7 @@ template <typename T, size_t N>
 static void
 getPackedMem(PacketPtr pkt, std::array<uint64_t, N> &mem, unsigned dataSize)
 {
-    std::array<T, N> real_mem = pkt->get<std::array<T, N> >();
+    std::array<T, N> real_mem = pkt->getLE<std::array<T, N> >();
     for (int i = 0; i < N; i++)
         mem[i] = real_mem[i];
 }
index 11ec122456baa321ad167812eb490d1aceeb9ccc..4a405f25f70829d7568bb464210d9043261482f4 100644 (file)
@@ -279,9 +279,9 @@ Walker::WalkerState::stepWalk(PacketPtr &write)
     write = NULL;
     PageTableEntry pte;
     if (dataSize == 8)
-        pte = read->get<uint64_t>();
+        pte = read->getLE<uint64_t>();
     else
-        pte = read->get<uint32_t>();
+        pte = read->getLE<uint32_t>();
     VAddr vaddr = entry.vaddr;
     bool uncacheable = pte.pcd;
     Addr nextRead = 0;
@@ -522,7 +522,7 @@ Walker::WalkerState::stepWalk(PacketPtr &write)
         // value back to memory.
         if (doWrite) {
             write = oldRead;
-            write->set<uint64_t>(pte);
+            write->setLE<uint64_t>(pte);
             write->cmd = MemCmd::WriteReq;
         } else {
             write = NULL;
index 16286f07e9a53732fe80245292b32cd796b2c8ed..41009c6d116fa66cee86a3a02f3bec1ebd3aa8e2 100644 (file)
@@ -50,10 +50,10 @@ X86ISA::Cmos::read(PacketPtr pkt)
     switch(pkt->getAddr() - pioAddr)
     {
       case 0x0:
-        pkt->set(address);
+        pkt->setLE(address);
         break;
       case 0x1:
-        pkt->set(readRegister(address));
+        pkt->setLE(readRegister(address));
         break;
       default:
         panic("Read from undefined CMOS port.\n");
@@ -69,10 +69,10 @@ X86ISA::Cmos::write(PacketPtr pkt)
     switch(pkt->getAddr() - pioAddr)
     {
       case 0x0:
-        address = pkt->get<uint8_t>();
+        address = pkt->getLE<uint8_t>();
         break;
       case 0x1:
-        writeRegister(address, pkt->get<uint8_t>());
+        writeRegister(address, pkt->getLE<uint8_t>());
         break;
       default:
         panic("Write to undefined CMOS port.\n");
index 8ab0d4047fd49f3ec98eb07631268016c93bddf3..692f4afa0eec7d3bae7d3a0d7d8ade5186ed6f06 100644 (file)
@@ -118,10 +118,10 @@ X86ISA::I8042::read(PacketPtr pkt)
     if (addr == dataPort) {
         uint8_t data = readDataOut();
         //DPRINTF(I8042, "Read from data port got %#02x.\n", data);
-        pkt->set<uint8_t>(data);
+        pkt->setLE<uint8_t>(data);
     } else if (addr == commandPort) {
         //DPRINTF(I8042, "Read status as %#02x.\n", (uint8_t)statusReg);
-        pkt->set<uint8_t>((uint8_t)statusReg);
+        pkt->setLE<uint8_t>((uint8_t)statusReg);
     } else {
         panic("Read from unrecognized port %#x.\n", addr);
     }
@@ -134,7 +134,7 @@ X86ISA::I8042::write(PacketPtr pkt)
 {
     assert(pkt->getSize() == 1);
     Addr addr = pkt->getAddr();
-    uint8_t data = pkt->get<uint8_t>();
+    uint8_t data = pkt->getLE<uint8_t>();
     if (addr == dataPort) {
         statusReg.commandLast = 0;
         switch (lastCommand) {
index 51304f25a45eaf69379e75c50837b5def3ecdf9c..2b09f14a59334f583558939b5e22487c2a9f1be3 100644 (file)
@@ -103,10 +103,10 @@ X86ISA::I82094AA::read(PacketPtr pkt)
     Addr offset = pkt->getAddr() - pioAddr;
     switch(offset) {
       case 0:
-        pkt->set<uint32_t>(regSel);
+        pkt->setLE<uint32_t>(regSel);
         break;
       case 16:
-        pkt->set<uint32_t>(readReg(regSel));
+        pkt->setLE<uint32_t>(readReg(regSel));
         break;
       default:
         panic("Illegal read from I/O APIC.\n");
@@ -122,10 +122,10 @@ X86ISA::I82094AA::write(PacketPtr pkt)
     Addr offset = pkt->getAddr() - pioAddr;
     switch(offset) {
       case 0:
-        regSel = pkt->get<uint32_t>();
+        regSel = pkt->getLE<uint32_t>();
         break;
       case 16:
-        writeReg(regSel, pkt->get<uint32_t>());
+        writeReg(regSel, pkt->getLE<uint32_t>());
         break;
       default:
         panic("Illegal write to I/O APIC.\n");
index a9ef53c2cd22507aa703681fe3e742bcf739a36c..2f17fae4a67a4e17d3a4e573efffe4b4ab250235 100644 (file)
@@ -100,7 +100,7 @@ X86ISA::I8237::write(PacketPtr pkt)
         panic("Write to i8237 request register unimplemented.\n");
       case 0xa:
         {
-            uint8_t command = pkt->get<uint8_t>();
+            uint8_t command = pkt->getLE<uint8_t>();
             uint8_t select = bits(command, 1, 0);
             uint8_t bitVal = bits(command, 2);
             if (!bitVal)
index 457db13f7f02d2d371e54302c7de1e9ae8c6683e..1c2780ab6a2e3bc0aaa52b96ac27a7b325a77c8d 100644 (file)
@@ -52,9 +52,9 @@ X86ISA::I8254::read(PacketPtr pkt)
     assert(pkt->getSize() == 1);
     Addr offset = pkt->getAddr() - pioAddr;
     if (offset < 3) {
-        pkt->set(pit.readCounter(offset));
+        pkt->setLE(pit.readCounter(offset));
     } else if (offset == 3) {
-        pkt->set(uint8_t(-1));
+        pkt->setLE(uint8_t(-1));
     } else {
         panic("Read from undefined i8254 register.\n");
     }
@@ -68,9 +68,9 @@ X86ISA::I8254::write(PacketPtr pkt)
     assert(pkt->getSize() == 1);
     Addr offset = pkt->getAddr() - pioAddr;
     if (offset < 3) {
-        pit.writeCounter(offset, pkt->get<uint8_t>());
+        pit.writeCounter(offset, pkt->getLE<uint8_t>());
     } else if (offset == 3) {
-        pit.writeControl(pkt->get<uint8_t>());
+        pit.writeControl(pkt->getLE<uint8_t>());
     } else {
         panic("Write to undefined i8254 register.\n");
     }
index 03c5cb9485a228e7cd9d896a3852493f14b66049..4c3b9b272c59228772c441526e6ea38fc17644ef 100644 (file)
@@ -56,15 +56,15 @@ X86ISA::I8259::read(PacketPtr pkt)
       case 0x0:
         if (readIRR) {
             DPRINTF(I8259, "Reading IRR as %#x.\n", IRR);
-            pkt->set(IRR);
+            pkt->setLE(IRR);
         } else {
             DPRINTF(I8259, "Reading ISR as %#x.\n", ISR);
-            pkt->set(ISR);
+            pkt->setLE(ISR);
         }
         break;
       case 0x1:
         DPRINTF(I8259, "Reading IMR as %#x.\n", IMR);
-        pkt->set(IMR);
+        pkt->setLE(IMR);
         break;
     }
     pkt->makeAtomicResponse();
@@ -75,7 +75,7 @@ Tick
 X86ISA::I8259::write(PacketPtr pkt)
 {
     assert(pkt->getSize() == 1);
-    uint8_t val = pkt->get<uint8_t>();
+    uint8_t val = pkt->getLE<uint8_t>();
     switch (pkt->getAddr() - pioAddr) {
       case 0x0:
         if (bits(val, 4)) {
index 4d39903e2a650781cec9ad10ac3e646405c1529e..d41f83ac57a702036e399bfeb07145b2822b84e1 100644 (file)
@@ -48,7 +48,7 @@ X86ISA::Speaker::read(PacketPtr pkt)
             controlVal.gate ? "on" : "off",
             controlVal.speaker ? "on" : "off",
             controlVal.timer ? "on" : "off");
-    pkt->set((uint8_t)controlVal);
+    pkt->setLE((uint8_t)controlVal);
     pkt->makeAtomicResponse();
     return latency;
 }
@@ -58,7 +58,7 @@ X86ISA::Speaker::write(PacketPtr pkt)
 {
     assert(pkt->getAddr() == pioAddr);
     assert(pkt->getSize() == 1);
-    SpeakerControl val = pkt->get<uint8_t>();
+    SpeakerControl val = pkt->getLE<uint8_t>();
     controlVal.gate = val.gate;
     //Change the gate value in the timer.
     if (!val.gate)