public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
@ 2017-04-04 10:16 Alan Hayward
  2017-04-05 10:23 ` Yao Qi
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Hayward @ 2017-04-04 10:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd

Max size set to 128bits, which I determined using xtensa_register_type()

Tested on a --enable-targets=all build using make check with board files
unix and native-gdbserver.

I do not have a XTENSA machine to test on.

Ok to commit?

Alan.

2017-04-04  Alan Hayward  <alan.hayward@arm.com>

	* xtensa-tdep.c (xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
	(xtensa_register_read_masked): Likewise.
	(xtensa_pseudo_register_read): Likewise.
	(xtensa_pseudo_register_write): Likewise.
	* xtensa-tdep.h (XTENSA_MAX_REGISTER_SIZE): Add.



diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 46aeecb35567930ac1497df3dae09d5ffe57e9e1..39abe1f8acb8fc508f48c7cf5bd81366e5f584be 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -222,6 +222,9 @@ struct gdbarch_tdep
   struct ctype_cache *type_entries;
 };

+/* Big enough to hold the size of the largest register in bytes.  */
+#define XTENSA_MAX_REGISTER_SIZE	16
+
 /* Macro to instantiate a gdbarch_tdep structure.  */

 #define XTENSA_GDBARCH_TDEP_INSTANTIATE(rmap,spillsz)			\
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 376f4c7340c3292273d5b0912b23ff7166382e8b..655f884926dfad88cb03b582f608788c049d3bad 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -370,7 +370,7 @@ static void
 xtensa_register_write_masked (struct regcache *regcache,
 			      xtensa_register_t *reg, const gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;		/* Shift for next mask (mod 32).  */
@@ -454,7 +454,7 @@ static enum register_status
 xtensa_register_read_masked (struct regcache *regcache,
 			     xtensa_register_t *reg, gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;
@@ -559,7 +559,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
-      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);
       enum register_status status;

       status = regcache_raw_read (regcache,
@@ -655,7 +655,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
-      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);

       regcache_raw_read (regcache,
 			 gdbarch_tdep (gdbarch)->wb_regnum, buf);

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-06-22 16:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 10:16 [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE Alan Hayward
2017-04-05 10:23 ` Yao Qi
2017-04-06 12:49   ` Alan Hayward
2017-04-25 15:39     ` Yao Qi
2017-04-26  9:59       ` Alan Hayward
2017-06-08  9:42         ` Alan Hayward
2017-06-12  9:54           ` Yao Qi
2017-06-21  9:36             ` Alan Hayward
2017-06-22 16:40               ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).