From: "H.J. Lu" <hongjiu.lu@intel.com>
To: GDB <gdb-patches@sourceware.org>
Subject: PATCH: Add regcache_raw_supply_part/regcache_raw_collect_part
Date: Wed, 03 Feb 2010 03:31:00 -0000 [thread overview]
Message-ID: <20100203033131.GA21501@lucon.org> (raw)
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
next reply other threads:[~2010-02-03 3:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 3:31 H.J. Lu [this message]
2010-02-03 9:14 ` Mark Kettenis
2010-02-03 13:46 ` H.J. Lu
2010-02-03 14:00 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100203033131.GA21501@lucon.org \
--to=hongjiu.lu@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox