From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30687 invoked by alias); 22 Nov 2003 23:23:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30638 invoked from network); 22 Nov 2003 23:22:50 -0000 Received: from unknown (HELO localhost.redhat.com) (205.151.10.29) by sources.redhat.com with SMTP; 22 Nov 2003 23:22:50 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 62F032B90 for ; Sat, 22 Nov 2003 18:22:06 -0500 (EST) Message-ID: <3FBFEF9E.6010003@gnu.org> Date: Sat, 22 Nov 2003 23:23:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [commit] Eliminate MIPS register convertible Content-Type: multipart/mixed; boundary="------------020102050809000706030609" X-SW-Source: 2003-11/txt/msg00476.txt.bz2 This is a multi-part message in MIME format. --------------020102050809000706030609 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 119 FYI, This moves the logic previously found in register convertible to pseudo register read/write. committed, Andrew --------------020102050809000706030609 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 4769 2003-11-22 Andrew Cagney * mips-tdep.c (mips_register_convertible): Delete function. (mips_register_convert_to_virtual): Delete function. (mips_register_convert_to_raw): Delete function. (mips_gdbarch_init): Do not set "deprecated_register_convertible", "deprecated_register_convert_to_virtual", or "deprecated_register_convert_to_raw". (mips_pseudo_register_write, mips_pseudo_register_read): Handle 32/64 cooked to raw register conversions. Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.257 diff -u -r1.257 mips-tdep.c --- mips-tdep.c 22 Nov 2003 22:32:28 -0000 1.257 +++ mips-tdep.c 22 Nov 2003 23:12:51 -0000 @@ -556,22 +556,46 @@ /* Map the symbol table registers which live in the range [1 * NUM_REGS .. 2 * NUM_REGS) back onto the corresponding raw - registers. */ + registers. Take care of alignment and size problems. */ static void mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf) { + int rawnum = cookednum % NUM_REGS; gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS); - return regcache_raw_read (regcache, cookednum % NUM_REGS, buf); + if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum)) + return regcache_raw_read (regcache, rawnum, buf); + else if (register_size (gdbarch, rawnum) > register_size (gdbarch, cookednum)) + { + if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p + || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + regcache_raw_read_part (regcache, rawnum, 0, 4, buf); + else + regcache_raw_read_part (regcache, rawnum, 4, 4, buf); + } + else + internal_error (__FILE__, __LINE__, "bad register size"); } static void mips_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf) { + int rawnum = cookednum % NUM_REGS; gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS); - return regcache_raw_write (regcache, cookednum % NUM_REGS, buf); + if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum)) + return regcache_raw_write (regcache, rawnum, buf); + else if (register_size (gdbarch, rawnum) > register_size (gdbarch, cookednum)) + { + if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p + || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + regcache_raw_write_part (regcache, rawnum, 0, 4, buf); + else + regcache_raw_write_part (regcache, rawnum, 4, 4, buf); + } + else + internal_error (__FILE__, __LINE__, "bad register size"); } /* Table to translate MIPS16 register field to actual register number. */ @@ -630,46 +654,7 @@ } } -/* Convert between RAW and VIRTUAL registers. The RAW register size - defines the remote-gdb packet. */ - -static int -mips_register_convertible (int reg_nr) -{ - if (gdbarch_tdep (current_gdbarch)->mips64_transfers_32bit_regs_p) - return 0; - else - return (register_size (current_gdbarch, reg_nr) > register_size (current_gdbarch, reg_nr)); -} - -static void -mips_register_convert_to_virtual (int n, struct type *virtual_type, - char *raw_buf, char *virt_buf) -{ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - memcpy (virt_buf, - raw_buf + (register_size (current_gdbarch, n) - TYPE_LENGTH (virtual_type)), - TYPE_LENGTH (virtual_type)); - else - memcpy (virt_buf, - raw_buf, - TYPE_LENGTH (virtual_type)); -} - -static void -mips_register_convert_to_raw (struct type *virtual_type, int n, - const char *virt_buf, char *raw_buf) -{ - memset (raw_buf, 0, register_size (current_gdbarch, n)); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - memcpy (raw_buf + (register_size (current_gdbarch, n) - TYPE_LENGTH (virtual_type)), - virt_buf, - TYPE_LENGTH (virtual_type)); - else - memcpy (raw_buf, - virt_buf, - TYPE_LENGTH (virtual_type)); -} +/* Convert to/from a register and the corresponding memory value. */ static int mips_convert_register_p (int regnum, struct type *type) @@ -6024,9 +6009,6 @@ set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame); set_gdbarch_frame_align (gdbarch, mips_frame_align); set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); - set_gdbarch_deprecated_register_convertible (gdbarch, mips_register_convertible); - set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, mips_register_convert_to_virtual); - set_gdbarch_deprecated_register_convert_to_raw (gdbarch, mips_register_convert_to_raw); set_gdbarch_deprecated_frame_chain (gdbarch, mips_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, --------------020102050809000706030609--