diff mbox

[9/11] Add MN10300_MAX_REGISTER_SIZE

Message ID 466CF7AB-4D05-4A4B-9FB9-80513E7ABF1C@arm.com
State New
Headers show

Commit Message

Alan Hayward April 4, 2017, 10:15 a.m. UTC
Max size set to 32bits, which I determined using mn10300_register_type()

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

I do not have a MN10300 machine to test on.

Ok to commit?

Alan.

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

	* mn10300-linux-tdep.c (am33_supply_gregset_method): Use MN10300_MAX_REGISTER_SIZE.
	* mn10300-tdep.c (mn10300_extract_return_value): Likewise
	(mn10300_push_dummy_call): Likewise.
	* mn10300-tdep.h (MN10300_MAX_REGISTER_SIZE): Add.
diff mbox

Patch

diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index 8c23f02b2b58b29b10a65df5ae0b4bcdce2925cd..ad7bdeea84c730dfb26a77d11ec4dcc87c6585c1 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -86,7 +86,7 @@  am33_supply_gregset_method (const struct regset *regset,
 			    struct regcache *regcache,
 			    int regnum, const void *gregs, size_t len)
 {
-  char zerobuf[MAX_REGISTER_SIZE];
+  char zerobuf[MN10300_MAX_REGISTER_SIZE];
   const mn10300_elf_greg_t *regp = (const mn10300_elf_greg_t *) gregs;
   int i;

@@ -188,15 +188,15 @@  am33_supply_gregset_method (const struct regset *regset,

     /* ssp, msp, and usp are inaccessible.  */
   case E_E8_REGNUM:
-    memset (zerobuf, 0, MAX_REGISTER_SIZE);
+    memset (zerobuf, 0, MN10300_MAX_REGISTER_SIZE);
     regcache_raw_supply (regcache, E_E8_REGNUM, zerobuf);
     break;
   case E_E9_REGNUM:
-    memset (zerobuf, 0, MAX_REGISTER_SIZE);
+    memset (zerobuf, 0, MN10300_MAX_REGISTER_SIZE);
     regcache_raw_supply (regcache, E_E9_REGNUM, zerobuf);
     break;
   case E_E10_REGNUM:
-    memset (zerobuf, 0, MAX_REGISTER_SIZE);
+    memset (zerobuf, 0, MN10300_MAX_REGISTER_SIZE);
     regcache_raw_supply (regcache, E_E10_REGNUM, zerobuf);

     break;
@@ -218,11 +218,11 @@  am33_supply_gregset_method (const struct regset *regset,
     break;
   case E_FPCR_REGNUM + 1:
     /* The two unused registers beyond fpcr are inaccessible.  */
-    memset (zerobuf, 0, MAX_REGISTER_SIZE);
+    memset (zerobuf, 0, MN10300_MAX_REGISTER_SIZE);
     regcache_raw_supply (regcache, E_FPCR_REGNUM + 1, zerobuf);
     break;
   case E_FPCR_REGNUM + 2:
-    memset (zerobuf, 0, MAX_REGISTER_SIZE);
+    memset (zerobuf, 0, MN10300_MAX_REGISTER_SIZE);
     regcache_raw_supply (regcache, E_FPCR_REGNUM + 2, zerobuf);
     break;
   default:	/* An error, obviously, but should we error out?  */
diff --git a/gdb/mn10300-tdep.h b/gdb/mn10300-tdep.h
index 37dcb453b011b8a4dccc461c682b301354b2db22..18bfc18812675f9be6f915e39e07cb1aaac08681 100644
--- a/gdb/mn10300-tdep.h
+++ b/gdb/mn10300-tdep.h
@@ -51,6 +51,9 @@  enum {
   E_FS0_REGNUM = 32
 };

+/* Big enough to hold the size of the largest register in bytes.  */
+#define MN10300_MAX_REGISTER_SIZE	4
+
 enum movm_register_bits {
   movm_exother_bit = 0x01,
   movm_exreg1_bit  = 0x02,
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 5f5d5ca87b811d66da272036a515210cf2f17134..eecf92f8c95db5c03ba13b2268e36aa4f8b2a63a 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -195,7 +195,7 @@  static void
 mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
 			      struct regcache *regcache, void *valbuf)
 {
-  gdb_byte buf[MAX_REGISTER_SIZE];
+  gdb_byte buf[MN10300_MAX_REGISTER_SIZE];
   int len = TYPE_LENGTH (type);
   int reg, regsz;

@@ -1223,7 +1223,7 @@  mn10300_push_dummy_call (struct gdbarch *gdbarch,
   int stack_offset = 0;
   int argnum;
   const gdb_byte *val;
-  gdb_byte valbuf[MAX_REGISTER_SIZE];
+  gdb_byte valbuf[MN10300_MAX_REGISTER_SIZE];

   /* This should be a nop, but align the stack just in case something
      went wrong.  Stacks are four byte aligned on the mn10300.  */