This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Add regcache_raw_supply_part/regcache_raw_collect_part


Hi,

Intel AVX saves a 256bit YMM register in lower 128bit and upper 128bit
separately. This patch adds regcache_raw_supply_part and
regcache_raw_collect_part. They will be used in AVX gdb patches . OK
to install?

Thanks.


H.J.
----
2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>

	* regcache.c (regcache_raw_supply_part): New.
	(regcache_raw_collect_part): Likewise.
	* regcache.h (regcache_raw_supply_part): Likewise.
	(regcache_raw_collect_part): Likewise.

diff --git a/gdb/regcache.c b/gdb/regcache.c
index d6f58fe..f01b090 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -874,6 +874,48 @@ regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
   memcpy (buf, regbuf, size);
 }
 
+/* Supply SIZE bytes of register REGNUM, whose contents are stored in
+   BUF, to REGCACHE at OFFSET in byte, relative to register REGNUM,
+   and mark register REGNUM with VALID.  */
+
+void
+regcache_raw_supply_part (struct regcache *regcache, int regnum,
+			  const void *buf, int offset, size_t size,
+			  int valid)
+{
+  char *regbuf;
+
+  gdb_assert (regcache != NULL);
+  gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+  gdb_assert (!regcache->readonly_p);
+
+  regbuf = ((char *) register_buffer (regcache, regnum)) + offset;
+
+  if (buf)
+    memcpy (regbuf, buf, size);
+  else
+    memset (regbuf, 0, size);
+
+  /* Mark the register.  */
+  regcache->register_valid_p[regnum] = valid;
+}
+
+/* Collect SIZE bytes of register REGNUM from REGCACHE from OFFSET in
+   byte, relative to register REGNUM, and store its contents in BUF.  */
+
+void
+regcache_raw_collect_part (const struct regcache *regcache, int regnum,
+			   void *buf, int offset, size_t size)
+{
+  const char *regbuf;
+
+  gdb_assert (regcache != NULL && buf != NULL);
+  gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+
+  regbuf = ((char *) register_buffer (regcache, regnum)) + offset;
+  memcpy (buf, regbuf, size);
+}
+
 
 /* Special handling for register PC.  */
 
diff --git a/gdb/regcache.h b/gdb/regcache.h
index d870960..e31e1f9 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -114,6 +114,13 @@ extern void regcache_raw_supply (struct regcache *regcache,
 				 int regnum, const void *buf);
 extern void regcache_raw_collect (const struct regcache *regcache,
 				  int regnum, void *buf);
+extern void regcache_raw_supply_part (struct regcache *regcache,
+				      int regnum, const void *buf,
+				      int offset, size_t size,
+				      int valid);
+extern void regcache_raw_collect_part (const struct regcache *regcache,
+				       int regnum, void *buf,
+				       int offset, size_t size);
 
 
 /* The type of a register.  This function is slightly more efficient


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]