arch-power: Add function to Write in physical memory
authorkajoljain379 <kajoljain797@gmail.com>
Tue, 19 Mar 2019 08:39:55 +0000 (14:09 +0530)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 24 Jan 2021 03:59:29 +0000 (03:59 +0000)
* Add a helper to write to the physical memory.
* This will be used in the subsequent patches to update the
  "Reference" and the "Change" bits on the page-table entry
  whenever a page is accessed.

Change-Id: I89c732be5884341ae0d33801a63578dbd2e08815
Signed-off-by: kajoljain379 <kajoljain797@gmail.com>
src/arch/power/radixwalk.cc
src/arch/power/radixwalk.hh

index 7bc671684dc16496e7d72c866f250d0eb011afe3..295f4a9553ca391e78eff2af73427326f7ade68e 100644 (file)
@@ -69,6 +69,23 @@ RadixWalk::readPhysMem(uint64_t addr, uint64_t dataSize)
     return ret;
 }
 
+uint64_t
+RadixWalk::writePhysMem(uint64_t addr, uint64_t dataSize)
+{
+    uint64_t ret;
+    Request::Flags flags = Request::PHYSICAL;
+
+    RequestPtr request = new Request(addr, dataSize, flags, this->masterId);
+    Packet *write = new Packet(request, MemCmd::WriteReq);
+    write->allocate();
+    this->port.sendAtomic(write);
+    ret = write->get<uint64_t>();
+
+    delete write->req;
+
+    return ret;
+}
+
 uint32_t geteffLPID(ThreadContext *tc)
 {
     Msr msr = tc->readIntReg(INTREG_MSR);
index 8c9cd3813af65ece5b37ade229506b951f6784f9..dae379bfffd808124146b4c41aa653da9e336646 100644 (file)
@@ -38,6 +38,7 @@ namespace PowerISA
       uint64_t readPhysMem(uint64_t addr, uint64_t dataSize);
 
       public:
+        uint64_t writePhysMem(uint64_t addr, uint64_t dataSize);
 
         BitUnion64(Rpde)
                 Bitfield<63> valid;