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

Change subject: misc: Replace scalar TypedBufferArg with VPtr.
......................................................................

misc: Replace scalar TypedBufferArg with VPtr.

Change-Id: Ic8460ad133e3512c103b14820d90ee3df987d78d
---
M src/arch/arm/aapcs32.hh
M src/arch/arm/aapcs64.hh
M src/dev/hsa/hsa_driver.cc
M src/dev/hsa/hsa_packet_processor.cc
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
6 files changed, 21 insertions(+), 36 deletions(-)



diff --git a/src/arch/arm/aapcs32.hh b/src/arch/arm/aapcs32.hh
index e2e5d09..01663ff 100644
--- a/src/arch/arm/aapcs32.hh
+++ b/src/arch/arm/aapcs32.hh
@@ -38,7 +38,7 @@
 #include "base/intmath.hh"
 #include "cpu/thread_context.hh"
 #include "sim/guest_abi.hh"
-#include "sim/syscall_emul_buf.hh"
+#include "sim/proxy_ptr.hh"

 class ThreadContext;

@@ -113,8 +113,7 @@
         state.nsaa = roundUp(state.nsaa, align);

         // Extract the value from it.
-        TypedBufferArg<T> val(state.nsaa);
-        val.copyIn(tc->getVirtProxy());
+        ConstVPtr<T> val(state.nsaa, tc);

         // Move the nsaa past this argument.
         state.nsaa += size;
@@ -284,9 +283,8 @@
             val = gtoh(val, ArmISA::byteOrder(tc));
             tc->setIntReg(ArmISA::INTREG_R0, val);
         } else {
-            TypedBufferArg<Composite> cp(state.retAddr);
-            cp = htog(composite, ArmISA::byteOrder(tc));
-            cp.copyOut(tc->getVirtProxy());
+            VPtr<Composite> cp(state.retAddr, tc);
+            *cp = htog(composite, ArmISA::byteOrder(tc));
         }
     }

diff --git a/src/arch/arm/aapcs64.hh b/src/arch/arm/aapcs64.hh
index 30597f5..0c11215 100644
--- a/src/arch/arm/aapcs64.hh
+++ b/src/arch/arm/aapcs64.hh
@@ -38,7 +38,7 @@
 #include "base/intmath.hh"
 #include "cpu/thread_context.hh"
 #include "sim/guest_abi.hh"
-#include "sim/syscall_emul_buf.hh"
+#include "sim/proxy_ptr.hh"

 class ThreadContext;

@@ -158,8 +158,7 @@
         state.nsaa = roundUp(state.nsaa, align);

         // Extract the value from it.
-        TypedBufferArg<T> val(state.nsaa);
-        val.copyIn(tc->getVirtProxy());
+        ConstVPtr<T> val(state.nsaa, tc);

         // Move the nsaa past this argument.
         state.nsaa += size;
@@ -350,8 +349,7 @@
// kept in a buffer, and the argument is actually a pointer to that
             // buffer.
             Addr addr = Argument<Aapcs64, Addr>::get(tc, state);
-            TypedBufferArg<Composite> composite(addr);
-            composite.copyIn(tc->getVirtProxy());
+            ConstVPtr<Composite> composite(addr, tc);
             return gtoh(*composite, ArmISA::byteOrder(tc));
         }

@@ -393,7 +391,7 @@
     {
         if (sizeof(Composite) > 16) {
             Addr addr = tc->readIntReg(ArmISA::INTREG_X8);
-            TypedBufferArg<Composite> composite(addr);
+            VPtr<Composite> composite(addr, tc);
             *composite = htog(c, ArmISA::byteOrder(tc));
             return;
         }
diff --git a/src/dev/hsa/hsa_driver.cc b/src/dev/hsa/hsa_driver.cc
index 459043d..a1215c4 100644
--- a/src/dev/hsa/hsa_driver.cc
+++ b/src/dev/hsa/hsa_driver.cc
@@ -42,7 +42,7 @@
 #include "dev/hsa/kfd_ioctl.h"
 #include "params/HSADriver.hh"
 #include "sim/process.hh"
-#include "sim/syscall_emul_buf.hh"
+#include "sim/proxy_ptr.hh"

 HSADriver::HSADriver(HSADriverParams *p)
     : EmulatedDriver(p), device(p->device), queueId(0)
diff --git a/src/dev/hsa/hsa_packet_processor.cc b/src/dev/hsa/hsa_packet_processor.cc
index 4143019..f6da9cb 100644
--- a/src/dev/hsa/hsa_packet_processor.cc
+++ b/src/dev/hsa/hsa_packet_processor.cc
@@ -47,7 +47,7 @@
 #include "mem/packet_access.hh"
 #include "mem/page_table.hh"
 #include "sim/process.hh"
-#include "sim/syscall_emul_buf.hh"
+#include "sim/proxy_ptr.hh"
 #include "sim/system.hh"

 #define HSAPP_EVENT_DESCRIPTION_GENERATOR(XEVENT) \
@@ -408,13 +408,10 @@
                  * The reason for this is that the DMASequencer does
                  * not support atomic operations.
                  */
-                auto tc = sys->threads[0];
-                auto &virt_proxy = tc->getVirtProxy();
-                TypedBufferArg<uint64_t> prev_signal(signal_addr);
-                prev_signal.copyIn(virt_proxy);
+                VPtr<uint64_t> prev_signal(signal_addr, sys->threads[0]);

                 hsa_signal_value_t *new_signal = new hsa_signal_value_t;
-                *new_signal = (hsa_signal_value_t) *prev_signal - 1;
+                *new_signal = (hsa_signal_value_t)*prev_signal - 1;

                 dmaWriteVirt(signal_addr,
sizeof(hsa_signal_value_t), NULL, new_signal, 0);
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 4a41609..b271a5f 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -47,6 +47,7 @@
 #include "mem/page_table.hh"
 #include "sim/byteswap.hh"
 #include "sim/process.hh"
+#include "sim/proxy_ptr.hh"
 #include "sim/sim_exit.hh"
 #include "sim/syscall_debug_macros.hh"
 #include "sim/syscall_desc.hh"
@@ -1636,24 +1637,17 @@

 SyscallReturn
 getcpuFunc(SyscallDesc *desc, ThreadContext *tc,
-           Addr cpu_ptr, Addr node_ptr, Addr tcache_ptr)
+           VPtr<uint32_t> cpu, VPtr<uint32_t> node, VPtr<uint32_t> tcache)
 {
     bool error = false;

     // unsigned is the same size (4) on all Linux supported ISAs.
-    if (cpu_ptr != 0) {
-        TypedBufferArg<uint32_t> result(cpu_ptr);
-        *result = htog(tc->contextId(),
-            tc->getSystemPtr()->getGuestByteOrder());
-        error |= !result.copyOut(tc->getVirtProxy());
-    }
+    if (cpu)
+ *cpu = htog(tc->contextId(), tc->getSystemPtr()->getGuestByteOrder());

     // Set a fixed NUMA node 0.
-    if (node_ptr != 0) {
-        TypedBufferArg<uint32_t> result(node_ptr);
-        *result = 0;
-        error |= !result.copyOut(tc->getVirtProxy());
-    }
+    if (node != 0)
+        *node = 0;

-    return error ? -EFAULT : 0;
+    return 0;
 }
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index f793dfd..31c1d4c 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1933,7 +1933,8 @@
 /// Target utimes() handler.
 template <class OS>
 SyscallReturn
-utimesFunc(SyscallDesc *desc, ThreadContext *tc, Addr pathname, Addr times)
+utimesFunc(SyscallDesc *desc, ThreadContext *tc, Addr pathname,
+           VPtr<typename OS::timeval [2]> tp)
 {
     std::string path;
     auto process = tc->getProcessPtr();
@@ -1941,9 +1942,6 @@
     if (!tc->getVirtProxy().tryReadString(path, pathname))
         return -EFAULT;

-    TypedBufferArg<typename OS::timeval [2]> tp(times);
-    tp.copyIn(tc->getVirtProxy());
-
     struct timeval hostTimeval[2];
     for (int i = 0; i < 2; ++i) {
         hostTimeval[i].tv_sec = gtoh((*tp)[i].tv_sec, OS::byteOrder);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/31755
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: Ic8460ad133e3512c103b14820d90ee3df987d78d
Gerrit-Change-Number: 31755
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.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