From 27bfc1d1c2cbcafccddef51ef82b309ef147c4a8 Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Mon, 8 May 2017 09:37:26 +0100 Subject: [PATCH] Remove some uses of MAX_REGISTER_SIZE from mips-linux-tdep.c gdb/ * mips-linux-tdep.c (mips_supply_gregset): Use raw_supply_zeroed. (mips_supply_fpregset): Likewise. (mips64_supply_gregset): Likewise. --- gdb/ChangeLog | 6 ++++++ gdb/mips-linux-tdep.c | 18 ++++-------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8979e759bb3..1f3f6cbd186 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-05-08 Alan Hayward + + * mips-linux-tdep.c (mips_supply_gregset): Use raw_supply_zeroed. + (mips_supply_fpregset): Likewise. + (mips64_supply_gregset): Likewise. + 2017-05-08 Alan Hayward * mn10300-linux-tdep.c (am33_supply_gregset_method): Use diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 57e75b5343e..48a582a16c9 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -133,11 +133,8 @@ mips_supply_gregset (struct regcache *regcache, { int regi; const mips_elf_greg_t *regp = *gregsetp; - char zerobuf[MAX_REGISTER_SIZE]; struct gdbarch *gdbarch = get_regcache_arch (regcache); - memset (zerobuf, 0, MAX_REGISTER_SIZE); - for (regi = EF_REG0 + 1; regi <= EF_REG31; regi++) supply_32bit_reg (regcache, regi - EF_REG0, regp + regi); @@ -156,7 +153,7 @@ mips_supply_gregset (struct regcache *regcache, regp + EF_CP0_CAUSE); /* Fill the inaccessible zero register with zero. */ - regcache_raw_supply (regcache, MIPS_ZERO_REGNUM, zerobuf); + regcache->raw_supply_zeroed (MIPS_ZERO_REGNUM); } static void @@ -245,9 +242,6 @@ mips_supply_fpregset (struct regcache *regcache, { struct gdbarch *gdbarch = get_regcache_arch (regcache); int regi; - char zerobuf[MAX_REGISTER_SIZE]; - - memset (zerobuf, 0, MAX_REGISTER_SIZE); for (regi = 0; regi < 32; regi++) regcache_raw_supply (regcache, @@ -259,9 +253,8 @@ mips_supply_fpregset (struct regcache *regcache, *fpregsetp + 32); /* FIXME: how can we supply FCRIR? The ABI doesn't tell us. */ - regcache_raw_supply (regcache, - mips_regnum (gdbarch)->fp_implementation_revision, - zerobuf); + regcache->raw_supply_zeroed + (mips_regnum (gdbarch)->fp_implementation_revision); } static void @@ -379,11 +372,8 @@ mips64_supply_gregset (struct regcache *regcache, { int regi; const mips64_elf_greg_t *regp = *gregsetp; - gdb_byte zerobuf[MAX_REGISTER_SIZE]; struct gdbarch *gdbarch = get_regcache_arch (regcache); - memset (zerobuf, 0, MAX_REGISTER_SIZE); - for (regi = MIPS64_EF_REG0 + 1; regi <= MIPS64_EF_REG31; regi++) supply_64bit_reg (regcache, regi - MIPS64_EF_REG0, (const gdb_byte *) (regp + regi)); @@ -407,7 +397,7 @@ mips64_supply_gregset (struct regcache *regcache, (const gdb_byte *) (regp + MIPS64_EF_CP0_CAUSE)); /* Fill the inaccessible zero register with zero. */ - regcache_raw_supply (regcache, MIPS_ZERO_REGNUM, zerobuf); + regcache->raw_supply_zeroed (MIPS_ZERO_REGNUM); } static void -- 2.30.2