From de57eccd12a59b2ccb9700dca5c6e86d5c6425ad Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 8 Dec 1999 02:51:13 +0000 Subject: [PATCH] import gdb-1999-12-07 snapshot --- gdb/ChangeLog | 97 ++++++++--- gdb/Makefile.in | 2 +- gdb/config/i386/linux.mh | 2 +- gdb/config/i386/tm-i386.h | 7 + gdb/corelow.c | 115 +++++++------ gdb/gdbcore.h | 12 +- gdb/gdbserver/low-linux.c | 261 ----------------------------- gdb/i386-linux-nat.c | 95 +++++++++++ gdb/i386v-nat.c | 85 ---------- gdb/i387-tdep.c | 259 +++++++++++++++++++++++++++- gdb/testsuite/ChangeLog | 8 + gdb/testsuite/gdb.base/default.exp | 4 +- sim/common/ChangeLog | 30 ++++ sim/common/cgen-par.c | 136 +++++++++++++++ sim/common/cgen-par.h | 41 ++++- sim/m32r/ChangeLog | 69 -------- sim/m32r/Makefile.in | 32 ---- 17 files changed, 714 insertions(+), 541 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ab232fb29d9..43a507c60c4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,31 @@ +1999-12-07 Jim Blandy + + Add support for SSE registers in core files. + * corelow.c (get_core_register_section): New function. + (get_core_registers): Fetch the new ".reg-xfp" sections, + in addition to the traditional ".reg" and ".reg2" sections. + Check for per-thread variants of all three. Use + get_core_register_section, instead of writing it out over and over + again. + * i386-linux-nat.c (i386_linux_fetch_core_registers): New function. + (i386_linux_nat_core_fns): New core_fns structure. We do our own + core handling now, instead of using the generic code in core-regset.c. + (_initialize_i386_linux_nat): New function, needed to register + i386_linux_nat_core_fns. + * config/i386/linux.mh (NATDEPFILES): Remove core-regset.o; + i386-linux-nat.c has its own sniffer now. + * gdbcore.h: (struct core_fns): Doc fix. + + * i386v-nat.c (i386_float_info): Definition is #if 0'd; delete it + altogether. This should use the function i387-tdep.c. + + Patch from Mark Kettenis : + + * config/i386/tm-i386.h (FLOAT_INFO): New define. + * i387-tdep.c (print_i387_value, print_i387_ext, + print_i387_status_word, print_i387_control_word, i387_float_info): + New functions, used to implement generic `info float' command. + 1999-12-06 Christopher Faylor * dcache.c (set_dcache_state): New function. @@ -55,6 +83,23 @@ Thu Dec 2 17:14:53 1999 Andrew Cagney * ser-pipe.c: Include for memset(). +1999-12-01 Jim Blandy + + * gdbtypes.c (builtin_type_v4si, builtin_type_v8qi, + builtin_type_v4hi, builtin_type_v2si): New SIMD types. + (build_gdbtypes): Initialize them. + (_initialize_gdbtypes): Gdbarch_swap them. + * gdbtypes.h (builtin_type_v4si, builtin_type_v8qi, + builtin_type_v4hi, builtin_type_v2si): Declare them. + + * findvar.c (read_register_bytes, write_register_bytes): Correctly + determine how the region the caller is writing overlaps with each + register's bytes. + + * value.h (struct value): Doc fixes. + + * valops.c (value_assign): Clarify error message. + 1999-12-01 Christopher Faylor * config/i386/tm-cygwin.h: Change tm-i386.h include back to tm-i386v.h. @@ -187,7 +232,7 @@ Mon Nov 29 11:28:21 1999 Andrew Cagney * stabsread.c: Revert 1999-11-09 Jim Blandy and 1999-11-08 Jim Blandy - . Broken on non-Linux targets. + . Broken on non-Linux targets. 1999-11-26 Elena Zannoni @@ -231,7 +276,7 @@ Wed Nov 17 17:01:06 1999 Andrew Cagney * Makefile.in (i386-tdep.o): Update list of dependencies. -1999-11-22 Jim Blandy +1999-11-22 Jim Blandy * config/i386/tm-i386v.h (NUM_REGS, REGISTER_NAMES, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE, @@ -272,7 +317,7 @@ Mon Nov 22 12:02:47 1999 Andrew Cagney arguments. (print_percentage): Make function void. -1999-11-21 Jim Blandy +1999-11-21 Jim Blandy Make the bcache hash table grow. * bcache.h (BCACHE_NUM_BUCKETS): Delete definition. @@ -292,7 +337,7 @@ Mon Nov 22 12:02:47 1999 Andrew Cagney freeing the bcache's obstack directly. * symfile.c (reread_symbols): Same. -1999-11-20 Jim Blandy +1999-11-20 Jim Blandy * bcache.c, bcache.h: Rewritten. New version imposes less memory overhead, and has a more effective hash function, so it's probably @@ -526,7 +571,7 @@ Tue Nov 9 15:33:43 1999 Andrew Cagney statement. (info_cb): Use paddr when printing addresses. -1999-11-08 Jim Blandy +1999-11-08 Jim Blandy * defs.h (ULONGEST_MAX, LONGEST_MAX): New definitions. * stabsread.c (read_huge_number): Parse and return LONGEST values. @@ -951,7 +996,7 @@ Thu Nov 4 17:36:27 1999 Andrew Cagney * infcmd.c: Fix typo. -1999-10-28 Jim Blandy +1999-10-28 Jim Blandy * gdbtypes.c (init_simd_type): The upper bound to create_range_type is inclusive, not exclusive. @@ -1096,12 +1141,12 @@ Sat Oct 23 16:39:34 1999 Andrew Cagney to avoid compiler warnings. (catch_fork_command_1): Ditto. -1999-10-20 Jim Blandy +1999-10-20 Jim Blandy * Makefile.in (dwarf2read.o): Note that this depends on bfd/elf-bfd.h. (elf_bfd_h): New variable. -1999-10-19 Jim Blandy +1999-10-19 Jim Blandy * config/i386/tm-i386.h (REGISTER_NAMES): Change names of FPU instruction and operand pointer registers to improve consistency, @@ -1133,7 +1178,7 @@ Mon Oct 18 17:32:51 1999 Andrew Cagney chunk/block write a run-time option. Check for quit_flag. Use target_write_memory_partial for downloads. -1999-10-18 Jim Blandy +1999-10-18 Jim Blandy Change Linux x86 register support to use the new tm-i386.h layout. * config/i386/tm-linux.h (HAVE_I387_REGS): #define this, so we get @@ -1247,7 +1292,7 @@ Sun Oct 17 13:58:56 1999 Andrew Cagney (generic_load): Don't cast the result of bfd_get_section_name. Replace ``sect'' with ``sect_name'', use consistently. -1999-10-15 Jim Blandy +1999-10-15 Jim Blandy Add beginnings of support for SIMD register types. * gdbtypes.c (init_simd_type): New function for building @@ -1268,7 +1313,7 @@ Fri Oct 15 17:46:39 1999 Andrew Cagney (_initialize_dcache): Fix description of ``set remotecache''. Cache is OFF by default. -1999-10-13 Jim Blandy +1999-10-13 Jim Blandy * valops.c (value_push): Don't forget to initialize container_len. @@ -1331,7 +1376,7 @@ Tue Oct 12 12:19:07 1999 David Taylor * config/pa/tm-hppa.h (SYMBOLS_CAN_START_WITH_DOLLAR): It's not enough to #define this; you have to give it a non-zero value. -1999-10-11 Jim Blandy +1999-10-11 Jim Blandy Fix from Jim Kingdon , with tweaks to make it gdbarch- and bigendian-friendly: @@ -1958,7 +2003,7 @@ Tue Sep 28 11:08:34 1999 Jeffrey A Law (law@cygnus.com) remote.c, top.c, tracepoint.c, utils.c (async_p): Change var name to event_loop_p. -1999-09-28 Jim Blandy +1999-09-28 Jim Blandy * hppa-tdep.c (skip_prologue_hard_way): Recognize ldo insns which generate pointers into the argument list. @@ -2278,7 +2323,7 @@ Fri Sep 17 19:28:17 1999 Andrew Cagney * breakpoints.c (delete_command): Move declaration from here. * breakpoints.h (delete_command): To here. -1999-09-18 Jim Blandy +1999-09-18 Jim Blandy * hppa-tdep.c (in_solib_call_trampoline): If we can't recognize the instruction we're at, we're not in a stub. @@ -2331,7 +2376,7 @@ Sat Sep 18 07:13:03 1999 Jeffrey A Law (law@cygnus.com) (inferior_event_handler): New function. Smarter inferior event handling. -1999-09-18 Jim Blandy +1999-09-18 Jim Blandy * pa64solib.c (pa64_solib_create_inferior_hook): Remove code which tries to set __d_pid; it's not relevant to PA64 shared libraries. @@ -2358,7 +2403,7 @@ Sat Sep 18 07:13:03 1999 Jeffrey A Law (law@cygnus.com) * breakpoint.c (permanent_breakpoint_here_p): Delete. Accidentally left over from previous changes. -1999-09-17 Jim Blandy +1999-09-17 Jim Blandy * config/pa/tm-hppa64.h (ARGS_GROW_DOWNWARD): Deleted. There are many more differences between the 32- and 64-bit ABI's than the @@ -2484,11 +2529,11 @@ Thu Sep 16 09:04:53 1999 Andrew Cagney * remote-d10v.c: Remove. * config/d10v/d10v.mt (TDEPFILES): Remove remote-d10v.o. -1999-09-15 Jim Blandy +1999-09-15 Jim Blandy * breakpoint.c (remove_breakpoint): Return zero, not nothing. -1999-09-14 Jim Blandy +1999-09-14 Jim Blandy * hppa-tdep.c (frame_chain): If the unwind info says we've saved r3, don't trust it. Call get_frame_saved_regs and see if we can @@ -2509,7 +2554,7 @@ Tue Sep 14 14:34:28 1999 Andrew Cagney * remote-st.c (connect_command), remote-os9k.c (connect_command): Fix. Call FD_SET et.al. with FD instead of serial_t. -1999-09-14 Jim Blandy +1999-09-14 Jim Blandy * hppa-tdep.c (hppa_frame_find_saved_regs): The two possible instructions for saving the return pointer (32- and 64-bit) save @@ -2716,7 +2761,7 @@ Mon Sep 13 18:54:05 1999 Andrew Cagney Mon Sep 13 17:51:28 1999 Andrew Cagney - From 1999-09-12 Jim Blandy : + From 1999-09-12 Jim Blandy : * gdbarch.sh (generating setters): Use sed to generate the proper indentation, not tr; tr's behavior is notoriously unportable. @@ -4236,11 +4281,11 @@ Wed Aug 4 10:42:58 1999 Fred Fish to a CORE_ADDR look like an subtraction expression. (add_symbol_file_command): Ditto. -1999-07-30 Jim Blandy +1999-07-30 Jim Blandy * hppa-tdep.c (pa_print_registers): Frob register output some more. -1999-07-29 Jim Blandy +1999-07-29 Jim Blandy * config/pa/nm-hppah.h (PTRACE_ARG3_TYPE): After more consideration, make this a CORE_ADDR, like WDB did. @@ -4280,7 +4325,7 @@ Wed Aug 4 10:42:58 1999 Fred Fish * hppah-nat.c (child_xfer_memory): Correctly compute mask to round address to an int boundary. -1999-07-29 Jim Blandy +1999-07-29 Jim Blandy Change from Ian Lance Taylor . The i386_linux_sigtramp* functions should be moved to @@ -4303,7 +4348,7 @@ Wed Aug 4 10:42:58 1999 Fred Fish (i386_linux_sigtramp_saved_pc): Likewise. (i386_linux_sigtramp_saved_sp): Likewise. -1999-07-28 Jim Blandy +1999-07-28 Jim Blandy * infrun.c (handle_inferior_event): Don't try to use the code for stepping over a function call to also handle stepping out of a @@ -4318,7 +4363,7 @@ Wed Aug 4 10:42:58 1999 Fred Fish from readline the same way as a multiline command. This avoids missing detecting when the user presses just 'enter'. -1999-07-28 Jim Blandy +1999-07-28 Jim Blandy Provide more sanity checking: * infrun.c (handle_inferior_event): Before assigning a new @@ -4365,7 +4410,7 @@ Mon Jul 26 17:13:39 1999 Andrew Cagney * remote.c (_initialize_remote): "remotebreak" should be a var_boolean. -1999-07-15 Jim Blandy +1999-07-15 Jim Blandy Make the output from "info registers" fit withinin 80 columns. * hppa-tdep.c (pa_print_registers): Make it easy to change row and diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 9ae47468b32..b7e548d79d5 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -229,7 +229,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION = 19991206 +VERSION = 19991207 DIST=gdb LINT=/usr/5bin/lint diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh index 1fe1e364cbe..8464934ef95 100644 --- a/gdb/config/i386/linux.mh +++ b/gdb/config/i386/linux.mh @@ -5,4 +5,4 @@ XDEPFILES= ser-tcp.o NAT_FILE= nm-linux.h NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \ - core-aout.o core-regset.o i386v-nat.o i386-linux-nat.o linux-thread.o + core-aout.o i386v-nat.o i386-linux-nat.o linux-thread.o diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h index efc3f417491..51818453ad4 100644 --- a/gdb/config/i386/tm-i386.h +++ b/gdb/config/i386/tm-i386.h @@ -259,6 +259,13 @@ extern void double_to_i387 (char *, char *); double_to_i387((char *)&val, (TO)); \ } +/* Print out the i387 floating point state. */ +#ifdef HAVE_I387_REGS +extern void i387_float_info (void); +#define FLOAT_INFO { i387_float_info (); } +#endif + + /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. */ diff --git a/gdb/corelow.c b/gdb/corelow.c index 9e4a0f5b04a..d5998f4c42d 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -373,6 +373,62 @@ core_detach (args, from_tty) printf_filtered ("No core file now.\n"); } + +/* Try to retrieve registers from a section in core_bfd, and supply + them to core_vec->core_read_registers, as the register set numbered + WHICH. + + If inferior_pid is zero, do the single-threaded thing: look for a + section named NAME. If inferior_pid is non-zero, do the + multi-threaded thing: look for a section named "NAME/PID", where + PID is the shortest ASCII decimal representation of inferior_pid. + + HUMAN_NAME is a human-readable name for the kind of registers the + NAME section contains, for use in error messages. + + If REQUIRED is non-zero, print an error if the core file doesn't + have a section by the appropriate name. Otherwise, just do nothing. */ + +static void +get_core_register_section (char *name, + int which, + char *human_name, + int required) +{ + char section_name[100]; + sec_ptr section; + bfd_size_type size; + char *contents; + + if (inferior_pid) + sprintf (section_name, "%s/%d", name, inferior_pid); + else + strcpy (section_name, name); + + section = bfd_get_section_by_name (core_bfd, section_name); + if (! section) + { + if (required) + warning ("Couldn't find %s registers in core file.\n", human_name); + return; + } + + size = bfd_section_size (core_bfd, section); + contents = alloca (size); + if (! bfd_get_section_contents (core_bfd, section, contents, + (file_ptr) 0, size)) + { + warning ("Couldn't read %s registers from `%s' section in core file.\n", + human_name, name); + return; + } + + core_vec->core_read_registers (contents, size, which, + ((CORE_ADDR) + bfd_section_vma (core_bfd, section))); +} + + /* Get the registers out of a core file. This is the machine- independent part. Fetch_core_registers is the machine-dependent part, typically implemented in the xm-file for each architecture. */ @@ -384,67 +440,20 @@ static void get_core_registers (regno) int regno; { - sec_ptr reg_sec; - unsigned size; - char *the_regs; - char secname[30]; + int status; - if (core_vec == NULL) + if (core_vec == NULL + || core_vec->core_read_registers == NULL) { fprintf_filtered (gdb_stderr, "Can't fetch registers from this type of core file\n"); return; } - /* Thread support. If inferior_pid is non-zero, then we have found a core - file with threads (or multiple processes). In that case, we need to - use the appropriate register section, else we just use `.reg'. */ + get_core_register_section (".reg", 0, "general-purpose", 1); + get_core_register_section (".reg2", 2, "floating-point", 0); + get_core_register_section (".reg-xfp", 3, "extended floating-point", 0); - /* XXX - same thing needs to be done for floating-point (.reg2) sections. */ - - if (inferior_pid) - sprintf (secname, ".reg/%d", inferior_pid); - else - strcpy (secname, ".reg"); - - reg_sec = bfd_get_section_by_name (core_bfd, secname); - if (!reg_sec) - goto cant; - size = bfd_section_size (core_bfd, reg_sec); - the_regs = alloca (size); - if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr) 0, size) && - core_vec->core_read_registers != NULL) - { - (core_vec->core_read_registers (the_regs, size, 0, - (unsigned) bfd_section_vma (abfd, reg_sec))); - } - else - { - cant: - fprintf_filtered (gdb_stderr, - "Couldn't fetch registers from core file: %s\n", - bfd_errmsg (bfd_get_error ())); - } - - /* Now do it again for the float registers, if they exist. */ - reg_sec = bfd_get_section_by_name (core_bfd, ".reg2"); - if (reg_sec) - { - size = bfd_section_size (core_bfd, reg_sec); - the_regs = alloca (size); - if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr) 0, size) && - core_vec->core_read_registers != NULL) - { - (core_vec->core_read_registers (the_regs, size, 2, - (unsigned) bfd_section_vma (abfd, reg_sec))); - } - else - { - fprintf_filtered (gdb_stderr, - "Couldn't fetch register set 2 from core file: %s\n", - bfd_errmsg (bfd_get_error ())); - } - } registers_fetched (); } diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index 0db61f992d7..e8e395384f9 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -163,15 +163,21 @@ struct core_fns CORE_REG_SIZE is the size of that area. - WHICH says which set of registers we are handling (0 = int, 2 = float on - machines where they are discontiguous). + WHICH says which set of registers we are handling: + 0 --- integer registers + 2 --- floating-point registers, on machines where they are + discontiguous + 3 --- extended floating-point registers, on machines where + these are present in yet a third area. (GNU/Linux uses + this to get at the SSE registers.) REG_ADDR is the offset from u.u_ar0 to the register values relative to core_reg_sect. This is used with old-fashioned core files to locate the registers in a large upage-plus-stack ".reg" section. Original upage address X is at location core_reg_sect+x+reg_addr. */ - void (*core_read_registers) PARAMS ((char *core_reg_sect, unsigned core_reg_size, + void (*core_read_registers) PARAMS ((char *core_reg_sect, + unsigned core_reg_size, int which, CORE_ADDR reg_addr)); /* Finds the next struct core_fns. They are allocated and initialized diff --git a/gdb/gdbserver/low-linux.c b/gdb/gdbserver/low-linux.c index 3b3e2871466..d8ff5d53e50 100644 --- a/gdb/gdbserver/low-linux.c +++ b/gdb/gdbserver/low-linux.c @@ -274,267 +274,6 @@ m68k_linux_register_u_addr (blockend, regnum) { return (blockend + 4 * regmap[regnum]); } -/* start-sanitize-ia64 */ -#elif defined(IA64_GNULINUX_TARGET) -#undef NUM_FREGS -#define NUM_FREGS 0 - -#include - -static int u_offsets[] = - { - /* general registers */ - -1, /* gr0 not available; i.e, it's always zero */ - PT_R1, - PT_R2, - PT_R3, - PT_R4, - PT_R5, - PT_R6, - PT_R7, - PT_R8, - PT_R9, - PT_R10, - PT_R11, - PT_R12, - PT_R13, - PT_R14, - PT_R15, - PT_R16, - PT_R17, - PT_R18, - PT_R19, - PT_R20, - PT_R21, - PT_R22, - PT_R23, - PT_R24, - PT_R25, - PT_R26, - PT_R27, - PT_R28, - PT_R29, - PT_R30, - PT_R31, - /* gr32 through gr127 not directly available via the ptrace interface */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* Floating point registers */ - -1, -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0) */ - PT_F2, - PT_F3, - PT_F4, - PT_F5, - PT_F6, - PT_F7, - PT_F8, - PT_F9, - PT_F10, - PT_F11, - PT_F12, - PT_F13, - PT_F14, - PT_F15, - PT_F16, - PT_F17, - PT_F18, - PT_F19, - PT_F20, - PT_F21, - PT_F22, - PT_F23, - PT_F24, - PT_F25, - PT_F26, - PT_F27, - PT_F28, - PT_F29, - PT_F30, - PT_F31, - PT_F32, - PT_F33, - PT_F34, - PT_F35, - PT_F36, - PT_F37, - PT_F38, - PT_F39, - PT_F40, - PT_F41, - PT_F42, - PT_F43, - PT_F44, - PT_F45, - PT_F46, - PT_F47, - PT_F48, - PT_F49, - PT_F50, - PT_F51, - PT_F52, - PT_F53, - PT_F54, - PT_F55, - PT_F56, - PT_F57, - PT_F58, - PT_F59, - PT_F60, - PT_F61, - PT_F62, - PT_F63, - PT_F64, - PT_F65, - PT_F66, - PT_F67, - PT_F68, - PT_F69, - PT_F70, - PT_F71, - PT_F72, - PT_F73, - PT_F74, - PT_F75, - PT_F76, - PT_F77, - PT_F78, - PT_F79, - PT_F80, - PT_F81, - PT_F82, - PT_F83, - PT_F84, - PT_F85, - PT_F86, - PT_F87, - PT_F88, - PT_F89, - PT_F90, - PT_F91, - PT_F92, - PT_F93, - PT_F94, - PT_F95, - PT_F96, - PT_F97, - PT_F98, - PT_F99, - PT_F100, - PT_F101, - PT_F102, - PT_F103, - PT_F104, - PT_F105, - PT_F106, - PT_F107, - PT_F108, - PT_F109, - PT_F110, - PT_F111, - PT_F112, - PT_F113, - PT_F114, - PT_F115, - PT_F116, - PT_F117, - PT_F118, - PT_F119, - PT_F120, - PT_F121, - PT_F122, - PT_F123, - PT_F124, - PT_F125, - PT_F126, - PT_F127, - /* predicate registers - we don't fetch these individually */ - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - /* branch registers */ - PT_B0, - PT_B1, - PT_B2, - PT_B3, - PT_B4, - PT_B5, - PT_B6, - PT_B7, - /* virtual frame pointer and virtual return address pointer */ - -1, -1, - /* other registers */ - PT_PR, - PT_CR_IIP, - PT_CR_IPSR, - /* kernel registers not visible via ptrace interface (?) */ - -1, -1, -1, -1, -1, -1, -1, -1, - /* hole */ - -1, -1, -1, -1, -1, -1, -1, -1, - PT_AR_RSC, - PT_AR_BSP, - PT_AR_BSPSTORE, - PT_AR_RNAT, - -1, - -1, /* Not available: FCR, IA32 floating control register */ - -1, -1, - -1, /* Not available: EFLAG */ - -1, /* Not available: CSD */ - -1, /* Not available: SSD */ - -1, /* Not available: CFLG */ - -1, /* Not available: FSR */ - -1, /* Not available: FIR */ - -1, /* Not available: FDR */ - -1, - PT_AR_CCV, - -1, -1, -1, - PT_AR_UNAT, - -1, -1, -1, - PT_AR_FPSR, - -1, -1, -1, - -1, /* Not available: ITC */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, - PT_CR_IFS, /* was PT_AR_PFS, but it seemed bogus */ - PT_AR_LC, - -1, /* Not available: EC, the Epilog Count register */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, - }; - -int -ia64_register_u_addr (int blockend, int regnum) -{ - int addr; - - if (regnum < 0 || regnum >= NUM_REGS) - error ("Invalid register number %d.", regnum); - - addr = u_offsets[regnum]; - if (addr == -1) - addr = 0; - - return addr; -} - -initialize_arch() -{ - return; -} -/* end-sanitize-ia64 */ #endif CORE_ADDR diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index ba1f9d28d1e..cec0f8ebb11 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -611,6 +611,91 @@ store_inferior_registers (regno) } + +/* Interpreting register set info found in core files. */ + +/* Provide registers to GDB from a core file. + + (We can't use the generic version of this function in + core-regset.c, because Linux has *three* different kinds of + register set notes. core-regset.c would have to call + supply_xfpregset, which most platforms don't have.) + + CORE_REG_SECT points to an array of bytes, which are the contents + of a `note' from a core file which BFD thinks might contain + register contents. CORE_REG_SIZE is its size. + + WHICH says which register set corelow suspects this is: + 0 --- the general register set, in gregset format + 2 --- the floating-point register set, in fpregset format + 3 --- the extended floating-point register set, in struct + user_xfpregs_struct format + + DUMMY isn't used on Linux. */ +static void +i386_linux_fetch_core_registers (char *core_reg_sect, + unsigned core_reg_size, + int which, + CORE_ADDR dummy) +{ + gregset_t gregset; + fpregset_t fpregset; + + switch (which) + { + case 0: + if (core_reg_size != sizeof (gregset)) + warning ("wrong size gregset struct in core file"); + else + { + memcpy (&gregset, core_reg_sect, sizeof (gregset)); + supply_gregset (&gregset); + } + break; + + case 2: + if (core_reg_size != sizeof (fpregset)) + warning ("wrong size fpregset struct in core file"); + else + { + memcpy (&fpregset, core_reg_sect, sizeof (fpregset)); + supply_fpregset (&fpregset); + } + break; + +#ifdef HAVE_PTRACE_GETXFPREGS + { + struct user_xfpregs_struct xfpregset; + case 3: + if (core_reg_size != sizeof (struct user_xfpregs_struct)) + warning ("wrong size user_xfpregs_struct in core file"); + else + { + memcpy (&xfpregset, core_reg_sect, sizeof (xfpregset)); + supply_xfpregset (&xfpregset); + } + break; + } +#endif + + default: + /* We've covered all the kinds of registers we know about here, + so this must be something we wouldn't know what to do with + anyway. Just ignore it. */ + break; + } +} + + +static struct core_fns i386_linux_nat_core_fns = +{ + bfd_target_elf_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + i386_linux_fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + /* Calling functions in shared libraries. */ @@ -700,3 +785,13 @@ i386_linux_skip_solib_resolver (CORE_ADDR pc) return 0; } + + + +/* Module initialization. */ + +void +_initialize_i386_linux_nat () +{ + add_core_fns (&i386_linux_nat_core_fns); +} diff --git a/gdb/i386v-nat.c b/gdb/i386v-nat.c index e160385cccf..0bf702c368c 100644 --- a/gdb/i386v-nat.c +++ b/gdb/i386v-nat.c @@ -307,88 +307,3 @@ i386_stopped_by_watchpoint (pid) } #endif /* TARGET_HAS_HARDWARE_WATCHPOINTS */ - -#if 0 -/* using FLOAT_INFO as is would be a problem. FLOAT_INFO is called - via a command xxx and eventually calls ptrace without ever having - traversed the target vector. This would be terribly impolite - behaviour for a sun4 hosted remote gdb. - - A fix might be to move this code into the "info registers" command. - rich@cygnus.com 15 Sept 92. */ -i386_float_info () -{ - struct user u; /* just for address computations */ - int i; - /* fpstate defined in */ - struct fpstate *fpstatep; - char buf[sizeof (struct fpstate) + 2 * sizeof (int)]; - unsigned int uaddr; - char fpvalid = 0; - unsigned int rounded_addr; - unsigned int rounded_size; - extern int corechan; - int skip; - - uaddr = (char *) &u.u_fpvalid - (char *) &u; - if (target_has_execution) - { - unsigned int data; - unsigned int mask; - - rounded_addr = uaddr & -sizeof (int); - data = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - mask = 0xff << ((uaddr - rounded_addr) * 8); - - fpvalid = ((data & mask) != 0); - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror ("seek on core file"); - if (myread (corechan, &fpvalid, 1) < 0) - perror ("read on core file"); - - } -#endif /* no core support yet */ - - if (fpvalid == 0) - { - printf_unfiltered ("no floating point status saved\n"); - return; - } - - uaddr = (char *) &U_FPSTATE (u) - (char *) &u; - if (target_has_execution) - { - int *ip; - - rounded_addr = uaddr & -sizeof (int); - rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) + - sizeof (int) - 1) / sizeof (int); - skip = uaddr - rounded_addr; - - ip = (int *) buf; - for (i = 0; i < rounded_size; i++) - { - *ip++ = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - rounded_addr += sizeof (int); - } - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror_with_name ("seek on core file"); - if (myread (corechan, buf, sizeof (struct fpstate)) < 0) - perror_with_name ("read from core file"); - skip = 0; - } -#endif /* 0 */ - - fpstatep = (struct fpstate *) (buf + skip); - print_387_status (fpstatep->status, (struct env387 *) fpstatep->state); -} - -#endif /* never */ diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index aac013c79a4..0bb16319abe 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -1,5 +1,5 @@ /* Intel 387 floating point stuff. - Copyright (C) 1988, 1989, 1991, 1998 Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1991, 1998, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -26,14 +26,12 @@ #include "gdbcore.h" #include "floatformat.h" -void i387_to_double PARAMS ((char *, char *)); -void double_to_i387 PARAMS ((char *, char *)); -static void print_387_control_bits PARAMS ((unsigned int control)); -static void print_387_status_bits PARAMS ((unsigned int status)); +/* FIXME: Eliminate the next two functions when we have the time to + change all the callers. */ -/* FIXME: Eliminate these routines when we have the time to change all - the callers. */ +void i387_to_double PARAMS ((char *from, char *to)); +void double_to_i387 PARAMS ((char *from, char *to)); void i387_to_double (from, to) @@ -51,6 +49,16 @@ double_to_i387 (from, to) floatformat_from_double (&floatformat_i387_ext, (double *) from, to); } + +/* FIXME: The functions on this page are used by the old `info float' + implementations that a few of the i386 targets provide. These + functions should be removed if all of these have been converted to + use the generic implementation based on the new register file + layout. */ + +static void print_387_control_bits PARAMS ((unsigned int control)); +static void print_387_status_bits PARAMS ((unsigned int status)); + static void print_387_control_bits (control) unsigned int control; @@ -149,6 +157,243 @@ print_387_status_word (status) puts_unfiltered ("\n"); } + +/* Implement the `info float' layout based on the register definitions + in `tm-i386.h'. */ + +/* Print the floating point number specified by RAW. */ +static void +print_i387_value (char *raw) +{ + DOUBLEST value; + + floatformat_to_doublest (&floatformat_i387_ext, raw, &value); + + /* We try to print 19 digits. The last digit may or may not contain + garbage, but we'd better print one too many. We need enough room + to print the value, 1 position for the sign, 1 for the decimal + point, 19 for the digits and 6 for the exponent adds up to 27. */ +#ifdef PRINTF_HAS_LONG_DOUBLE + printf_filtered (" %-+27.19Lg", (long double) value); +#else + printf_filtered (" %-+27.19g", (double) value); +#endif +} + +/* Print the classification for the register contents RAW. */ +static void +print_i387_ext (unsigned char *raw) +{ + int sign; + int integer; + unsigned int exponent; + unsigned long fraction[2]; + + sign = raw[9] & 0x80; + integer = raw[7] & 0x80; + exponent = (((raw[9] & 0x7f) << 8) | raw[8]); + fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]); + fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16) + | (raw[5] << 8) | raw[4]); + + if (exponent == 0x7fff && integer) + { + if (fraction[0] == 0x00000000 && fraction[1] == 0x00000000) + /* Infinity. */ + printf_filtered (" %cInf", (sign ? '-' : '+')); + else if (sign && fraction[0] == 0x00000000 && fraction[1] == 0x40000000) + /* Real Indefinite (QNaN). */ + puts_unfiltered (" Real Indefinite (QNaN)"); + else if (fraction[1] & 0x40000000) + /* QNaN. */ + puts_filtered (" QNaN"); + else + /* SNaN. */ + puts_filtered (" SNaN"); + } + else if (exponent < 0x7fff && exponent > 0x0000 && integer) + /* Normal. */ + print_i387_value (raw); + else if (exponent == 0x0000) + { + /* Denormal or zero. */ + print_i387_value (raw); + + if (integer) + /* Pseudo-denormal. */ + puts_filtered (" Pseudo-denormal"); + else if (fraction[0] || fraction[1]) + /* Denormal. */ + puts_filtered (" Denormal"); + } + else + /* Unsupported. */ + puts_filtered (" Unsupported"); +} + +/* Print the status word STATUS. */ +static void +print_i387_status_word (unsigned int status) +{ + printf_filtered ("Status Word: %s", + local_hex_string_custom (status, "04")); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0001) ? "IE" : " "); + printf_filtered (" %s", (status & 0x0002) ? "DE" : " "); + printf_filtered (" %s", (status & 0x0004) ? "ZE" : " "); + printf_filtered (" %s", (status & 0x0008) ? "OE" : " "); + printf_filtered (" %s", (status & 0x0010) ? "UE" : " "); + printf_filtered (" %s", (status & 0x0020) ? "PE" : " "); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0080) ? "ES" : " "); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0080) ? "SF" : " "); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0100) ? "C0" : " "); + printf_filtered (" %s", (status & 0x0200) ? "C1" : " "); + printf_filtered (" %s", (status & 0x0400) ? "C2" : " "); + printf_filtered (" %s", (status & 0x4000) ? "C3" : " "); + + puts_filtered ("\n"); + + printf_filtered (" TOP: %d\n", ((status >> 11) & 7)); +} + +/* Print the control word CONTROL. */ +static void +print_i387_control_word (unsigned int control) +{ + printf_filtered ("Control Word: %s", + local_hex_string_custom (control, "04")); + puts_filtered (" "); + printf_filtered (" %s", (control & 0x0001) ? "IM" : " "); + printf_filtered (" %s", (control & 0x0002) ? "DM" : " "); + printf_filtered (" %s", (control & 0x0004) ? "ZM" : " "); + printf_filtered (" %s", (control & 0x0008) ? "OM" : " "); + printf_filtered (" %s", (control & 0x0010) ? "UM" : " "); + printf_filtered (" %s", (control & 0x0020) ? "PM" : " "); + + puts_filtered ("\n"); + + puts_filtered (" PC: "); + switch ((control >> 8) & 3) + { + case 0: + puts_filtered ("Single Precision (24-bits)\n"); + break; + case 1: + puts_filtered ("Reserved\n"); + break; + case 2: + puts_filtered ("Double Precision (53-bits)\n"); + break; + case 3: + puts_filtered ("Extended Precision (64-bits)\n"); + break; + } + + puts_filtered (" RC: "); + switch ((control >> 10) & 3) + { + case 0: + puts_filtered ("Round to nearest\n"); + break; + case 1: + puts_filtered ("Round down\n"); + break; + case 2: + puts_filtered ("Round up\n"); + break; + case 3: + puts_filtered ("Round toward zero\n"); + break; + } +} + +/* Print out the i387 floating poin state. */ +void +i387_float_info (void) +{ + unsigned int fctrl; + unsigned int fstat; + unsigned int ftag; + unsigned int fiseg; + unsigned int fioff; + unsigned int foseg; + unsigned int fooff; + unsigned int fop; + int fpreg; + int top; + + fctrl = read_register (FCTRL_REGNUM); + fstat = read_register (FSTAT_REGNUM); + ftag = read_register (FTAG_REGNUM); + fiseg = read_register (FCS_REGNUM); + fioff = read_register (FCOFF_REGNUM); + foseg = read_register (FDS_REGNUM); + fooff = read_register (FDOFF_REGNUM); + fop = read_register (FOP_REGNUM); + + top = ((fstat >> 11) & 7); + + for (fpreg = 7; fpreg >= 0; fpreg--) + { + unsigned char raw[FPU_REG_RAW_SIZE]; + int tag = (ftag >> (fpreg * 2)) & 3; + int i; + + printf_filtered ("%sR%d: ", fpreg == top ? "=>" : " ", fpreg); + + switch (tag) + { + case 0: + puts_filtered ("Valid "); + break; + case 1: + puts_filtered ("Zero "); + break; + case 2: + puts_filtered ("Special "); + break; + case 3: + puts_filtered ("Empty "); + break; + } + + read_register_gen ((fpreg + 8 - top) % 8 + FP0_REGNUM, raw); + + puts_filtered ("0x"); + for (i = 9; i >= 0; i--) + printf_filtered ("%02x", raw[i]); + + if (tag != 3) + print_i387_ext (raw); + + puts_filtered ("\n"); + } + + puts_filtered ("\n"); + + print_i387_status_word (fstat); + print_i387_control_word (fctrl); + printf_filtered ("Tag Word: %s\n", + local_hex_string_custom (ftag, "04")); + printf_filtered ("Instruction Pointer: %s:", + local_hex_string_custom (fiseg, "02")); + printf_filtered ("%s\n", local_hex_string_custom (fioff, "08")); + printf_filtered ("Operand Pointer: %s:", + local_hex_string_custom (foseg, "02")); + printf_filtered ("%s\n", local_hex_string_custom (fooff, "08")); + printf_filtered ("Opcode: %s\n", + local_hex_string_custom (fop ? (fop | 0xd800) : 0, "04")); +} + + +/* FIXME: The functions on this page are used to provide `long double' + support for Linux. However, the approach does not seem to be the + right one, and we are planning to solve this in a way that should + work for all i386 targets. These functions will disappear in the + near future, so please don't use them. */ #ifdef LD_I387 int i387_extract_floating (PTR addr, int len, DOUBLEST *dretptr) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0bd354b7672..30308c89e20 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +1999-12-06 Jim Blandy + + * gdb.base/default.exp: Expect the new 'info float' command on + all i386 platforms. + + * gdb.threads/linux-dp.exp: Expand our ability to recognize + LinuxThreads libraries that don't support debugging. + Sat Dec 4 15:21:18 1999 Andrew Cagney * gdb.base/remote.c: Fill the buffer with truely random data. diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index f73a6d70431..6f109fe9072 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -304,8 +304,8 @@ if [istarget "arm-*-*"] then { gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" } elseif [istarget "strongarm-*-*"] then { gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" -} elseif [istarget "i\[3456\]86-*-linux-gnu"] then { - gdb_test "info float" "No registers." +} elseif [istarget "i\[3456\]86-*-*"] then { + gdb_test "info float" "R7:.*Status Word:.*Opcode:.*" "info float" } else { gdb_test "info float" "No floating point info available for this processor." "info float" } diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 1aa9ecc42c4..6b7290ea3d1 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,33 @@ +1999-12-07 Dave Brolley + + * cgen-par.h (CGEN_FN_MEM_QI_WRITE): New enumerator. + (CGEN_FN_MEM_HI_WRITE): New enumerator. + (CGEN_FN_MEM_SI_WRITE): New enumerator. + (CGEN_FN_MEM_DI_WRITE): New enumerator. + (CGEN_FN_MEM_DF_WRITE): New enumerator. + (CGEN_FN_MEM_XI_WRITE): New enumerator. + (fn_mem_qi_write): New union members. + (fn_mem_hi_write): New union members. + (fn_mem_si_write): New union members. + (fn_mem_di_write): New union members. + (fn_mem_df_write): New union members. + (fn_mem_xi_write): New union members. + (sim_queue_fn_mem_qi_write): New function. + (sim_queue_fn_mem_hi_write): New function. + (sim_queue_fn_mem_si_write): New function. + (sim_queue_fn_mem_di_write): New function. + (sim_queue_fn_mem_df_write): New function. + (sim_queue_fn_mem_xi_write): New function. + * cgen-par.c (sim_queue_fn_mem_qi_write): New function. + (sim_queue_fn_mem_hi_write): New function. + (sim_queue_fn_mem_si_write): New function. + (sim_queue_fn_mem_di_write): New function. + (sim_queue_fn_mem_df_write): New function. + (sim_queue_fn_mem_xi_write): New function. + (cgen_write_queue_element_execute): Handle CGEN_FN_MEM_QI_WRITE, + CGEN_FN_MEM_HI_WRITE, CGEN_FN_MEM_SI_WRITE, CGEN_FN_MEM_DI_WRITE, + CGEN_FN_MEM_DF_WRITE, CGEN_FN_MEM_XI_WRITE. + 1999-12-01 Dave Brolley * cgen-accfp.c (subsf): Check status code. diff --git a/sim/common/cgen-par.c b/sim/common/cgen-par.c index 44cc50f005a..baf9f586464 100644 --- a/sim/common/cgen-par.c +++ b/sim/common/cgen-par.c @@ -233,6 +233,105 @@ void sim_queue_mem_xi_write (SIM_CPU *cpu, SI address, SI *value) element->kinds.mem_xi_write.value[3] = value[3]; } +void sim_queue_fn_mem_qi_write ( + SIM_CPU *cpu, + void (*write_function)(SIM_CPU *cpu, IADDR, SI, QI), + SI address, + QI value +) +{ + CGEN_WRITE_QUEUE *q = CPU_WRITE_QUEUE (cpu); + CGEN_WRITE_QUEUE_ELEMENT *element = CGEN_WRITE_QUEUE_NEXT (q); + element->kind = CGEN_FN_MEM_QI_WRITE; + element->insn_address = CPU_PC_GET (cpu); + element->kinds.fn_mem_qi_write.function = write_function; + element->kinds.fn_mem_qi_write.address = address; + element->kinds.fn_mem_qi_write.value = value; +} + +void sim_queue_fn_mem_hi_write ( + SIM_CPU *cpu, + void (*write_function)(SIM_CPU *cpu, IADDR, SI, HI), + SI address, + HI value +) +{ + CGEN_WRITE_QUEUE *q = CPU_WRITE_QUEUE (cpu); + CGEN_WRITE_QUEUE_ELEMENT *element = CGEN_WRITE_QUEUE_NEXT (q); + element->kind = CGEN_FN_MEM_HI_WRITE; + element->insn_address = CPU_PC_GET (cpu); + element->kinds.fn_mem_hi_write.function = write_function; + element->kinds.fn_mem_hi_write.address = address; + element->kinds.fn_mem_hi_write.value = value; +} + +void sim_queue_fn_mem_si_write ( + SIM_CPU *cpu, + void (*write_function)(SIM_CPU *cpu, IADDR, SI, SI), + SI address, + SI value +) +{ + CGEN_WRITE_QUEUE *q = CPU_WRITE_QUEUE (cpu); + CGEN_WRITE_QUEUE_ELEMENT *element = CGEN_WRITE_QUEUE_NEXT (q); + element->kind = CGEN_FN_MEM_SI_WRITE; + element->insn_address = CPU_PC_GET (cpu); + element->kinds.fn_mem_si_write.function = write_function; + element->kinds.fn_mem_si_write.address = address; + element->kinds.fn_mem_si_write.value = value; +} + +void sim_queue_fn_mem_di_write ( + SIM_CPU *cpu, + void (*write_function)(SIM_CPU *cpu, IADDR, SI, DI), + SI address, + DI value +) +{ + CGEN_WRITE_QUEUE *q = CPU_WRITE_QUEUE (cpu); + CGEN_WRITE_QUEUE_ELEMENT *element = CGEN_WRITE_QUEUE_NEXT (q); + element->kind = CGEN_FN_MEM_DI_WRITE; + element->insn_address = CPU_PC_GET (cpu); + element->kinds.fn_mem_di_write.function = write_function; + element->kinds.fn_mem_di_write.address = address; + element->kinds.fn_mem_di_write.value = value; +} + +void sim_queue_fn_mem_df_write ( + SIM_CPU *cpu, + void (*write_function)(SIM_CPU *cpu, IADDR, SI, DF), + SI address, + DF value +) +{ + CGEN_WRITE_QUEUE *q = CPU_WRITE_QUEUE (cpu); + CGEN_WRITE_QUEUE_ELEMENT *element = CGEN_WRITE_QUEUE_NEXT (q); + element->kind = CGEN_FN_MEM_DF_WRITE; + element->insn_address = CPU_PC_GET (cpu); + element->kinds.fn_mem_df_write.function = write_function; + element->kinds.fn_mem_df_write.address = address; + element->kinds.fn_mem_df_write.value = value; +} + +void sim_queue_fn_mem_xi_write ( + SIM_CPU *cpu, + void (*write_function)(SIM_CPU *cpu, IADDR, SI, SI *), + SI address, + SI *value +) +{ + CGEN_WRITE_QUEUE *q = CPU_WRITE_QUEUE (cpu); + CGEN_WRITE_QUEUE_ELEMENT *element = CGEN_WRITE_QUEUE_NEXT (q); + element->kind = CGEN_FN_MEM_XI_WRITE; + element->insn_address = CPU_PC_GET (cpu); + element->kinds.fn_mem_xi_write.function = write_function; + element->kinds.fn_mem_xi_write.address = address; + element->kinds.fn_mem_xi_write.value[0] = value[0]; + element->kinds.fn_mem_xi_write.value[1] = value[1]; + element->kinds.fn_mem_xi_write.value[2] = value[2]; + element->kinds.fn_mem_xi_write.value[3] = value[3]; +} + /* Execute a write stored on the write queue. */ void cgen_write_queue_element_execute (SIM_CPU *cpu, CGEN_WRITE_QUEUE_ELEMENT *item) @@ -319,7 +418,44 @@ cgen_write_queue_element_execute (SIM_CPU *cpu, CGEN_WRITE_QUEUE_ELEMENT *item) SETMEMSI (cpu, pc, item->kinds.mem_xi_write.address + 12, item->kinds.mem_xi_write.value[3]); break; + case CGEN_FN_MEM_QI_WRITE: + pc = item->insn_address; + item->kinds.fn_mem_qi_write.function (cpu, pc, + item->kinds.fn_mem_qi_write.address, + item->kinds.fn_mem_qi_write.value); + break; + case CGEN_FN_MEM_HI_WRITE: + pc = item->insn_address; + item->kinds.fn_mem_hi_write.function (cpu, pc, + item->kinds.fn_mem_hi_write.address, + item->kinds.fn_mem_hi_write.value); + break; + case CGEN_FN_MEM_SI_WRITE: + pc = item->insn_address; + item->kinds.fn_mem_si_write.function (cpu, pc, + item->kinds.fn_mem_si_write.address, + item->kinds.fn_mem_si_write.value); + break; + case CGEN_FN_MEM_DI_WRITE: + pc = item->insn_address; + item->kinds.fn_mem_di_write.function (cpu, pc, + item->kinds.fn_mem_di_write.address, + item->kinds.fn_mem_di_write.value); + break; + case CGEN_FN_MEM_DF_WRITE: + pc = item->insn_address; + item->kinds.fn_mem_df_write.function (cpu, pc, + item->kinds.fn_mem_df_write.address, + item->kinds.fn_mem_df_write.value); + break; + case CGEN_FN_MEM_XI_WRITE: + pc = item->insn_address; + item->kinds.fn_mem_xi_write.function (cpu, pc, + item->kinds.fn_mem_xi_write.address, + item->kinds.fn_mem_xi_write.value); + break; default: + abort (); break; /* FIXME: for now....print message later. */ } } diff --git a/sim/common/cgen-par.h b/sim/common/cgen-par.h index 3748d947ffd..4e0257a98fa 100644 --- a/sim/common/cgen-par.h +++ b/sim/common/cgen-par.h @@ -29,6 +29,8 @@ enum cgen_write_queue_kind { CGEN_FN_XI_WRITE, CGEN_FN_PC_WRITE, CGEN_MEM_QI_WRITE, CGEN_MEM_HI_WRITE, CGEN_MEM_SI_WRITE, CGEN_MEM_DI_WRITE, CGEN_MEM_DF_WRITE, CGEN_MEM_XI_WRITE, + CGEN_FN_MEM_QI_WRITE, CGEN_FN_MEM_HI_WRITE, CGEN_FN_MEM_SI_WRITE, + CGEN_FN_MEM_DI_WRITE, CGEN_FN_MEM_DF_WRITE, CGEN_FN_MEM_XI_WRITE, CGEN_NUM_WRITE_KINDS }; @@ -103,12 +105,42 @@ typedef struct { } mem_di_write; struct { SI address; - DI value; + DF value; } mem_df_write; struct { SI address; SI value[4]; } mem_xi_write; + struct { + SI address; + QI value; + void (*function)(SIM_CPU *, IADDR, SI, QI); + } fn_mem_qi_write; + struct { + SI address; + HI value; + void (*function)(SIM_CPU *, IADDR, SI, HI); + } fn_mem_hi_write; + struct { + SI address; + SI value; + void (*function)(SIM_CPU *, IADDR, SI, SI); + } fn_mem_si_write; + struct { + SI address; + DI value; + void (*function)(SIM_CPU *, IADDR, SI, DI); + } fn_mem_di_write; + struct { + SI address; + DF value; + void (*function)(SIM_CPU *, IADDR, SI, DF); + } fn_mem_df_write; + struct { + SI address; + SI value[4]; + void (*function)(SIM_CPU *, IADDR, SI, SI *); + } fn_mem_xi_write; } kinds; } CGEN_WRITE_QUEUE_ELEMENT; @@ -162,4 +194,11 @@ extern void sim_queue_mem_di_write (SIM_CPU *, SI, DI); extern void sim_queue_mem_df_write (SIM_CPU *, SI, DF); extern void sim_queue_mem_xi_write (SIM_CPU *, SI, SI *); +extern void sim_queue_fn_mem_qi_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, QI), SI, QI); +extern void sim_queue_fn_mem_hi_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, HI), SI, HI); +extern void sim_queue_fn_mem_si_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, SI), SI, SI); +extern void sim_queue_fn_mem_di_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, DI), SI, DI); +extern void sim_queue_fn_mem_df_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, DF), SI, DF); +extern void sim_queue_fn_mem_xi_write (SIM_CPU *, void (*)(SIM_CPU *, IADDR, SI, SI *), SI, SI *); + #endif /* CGEN_PAR_H */ diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index b740b761907..d4a49d8c8f9 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -93,21 +93,10 @@ Fri Apr 16 16:47:43 1999 Doug Evans * cpu.c,cpu.h: Rebuild. -start-sanitize-cygnus -1999-02-12 Doug Evans - - * Makefile.in (stamp-arch,stamp-cpu,stamp-xcpu): CGEN_MAIN_SCM - renamed to CGEN_READ_SCM. - -end-sanitize-cygnus 1999-02-09 Doug Evans * Makefile.in (SIM_EXTRA_DEPS): Add m32r-desc.h, delete cpu-opc.h. (stamp-xmloop): s/-parallel/-parallel-write/. -start-sanitize-cygnus - (stamp-arch,stamp-cpu): Update FLAGS variable, option syntax changed. - (stamp-xcpu): Update FLAGS variable, option syntax changed. -end-sanitize-cygnus * configure.in (sim_link_files,sim_link_links): Delete. * configure: Rebuild. * decode.c,decode.h,model.c,sem-switch.c,sem.c: Rebuild. @@ -135,9 +124,6 @@ Thu Feb 4 16:04:26 1999 Doug Evans 1999-01-14 Doug Evans -start-sanitize-cygnus - * Makefile.in (stamp-arch): Pass FLAGS to cgen. -end-sanitize-cygnus * arch.c,arch.h,cpuall.h: Regenerate. * cpu.c,cpu.h,decode.c,decode.h,model.c,sem-switch.c,sem.c: Regenerate. * traps.c (sim_engine_invalid_insn): PCADDR->IADDR. @@ -164,9 +150,6 @@ end-sanitize-cygnus (M32RBF_INCLUDE_DEPS): Use CGEN_MAIN_CPU_DEPS. (m32r.o,mloop.o,cpu.o,decode.o,sem.o,model.o): Simplify dependencies. (m32rx.o,mloopx.o,cpux.o,decodex.o,semx.o,modelx.o): Ditto. -start-sanitize-cygnus - (stamp-arch): Pass mach=all to cgen-arch. -end-sanitize-cygnus * cpu.c,cpu.h,decode.c,model.c,sem-switch.c,sem.c: Regenerate. * m32r-sim.h (m32rbf_h_cr_[gs]et_handler): Declare. ([GS]ET_H_CR): Define. @@ -230,19 +213,10 @@ end-sanitize-cygnus * Makefile.in (M32R_OBJS): Delete extract.o. (extract.o): Delete. -start-sanitize-cygnus - (stamp-arch): Depend on $(CGEN_ARCH_SCM). - (stamp-cpu): Don't build extract.c. -end-sanitize-cygnus * cpu.c,cpu.h,decode.c,decode.h,sem-switch.c,sem.c: Rebuild. * mloop.in (extract16): Update type of `insn' arg. Delete call to d->extract. (extract32): Ditto. -start-sanitize-cygnus - * Makefile.in (M32RX_OBJS): Delete extractx.o. - (extractx.o): Delete. - (stamp-xcpu): Don't build extractx.c. -end-sanitize-cygnus * cpux.c,cpux.h,decodex.c,decodex.h,semx-switch.c: Rebuild. * mloopx.in (extractx16): Update type of `insn' arg. Delete call to d->extract. Delete arg pbb_p. All callers updated. @@ -282,14 +256,6 @@ Fri Oct 16 09:15:29 1998 Doug Evans * sim-if.c (sim_do_command): Handle "sim info reg {bbpsw,bbpc}". -start-sanitize-cygnus -Wed Oct 14 14:49:50 1998 Doug Evans - - * Makefile.in (mloop.o): Don't depend on stamp-cpu, depend on - explicit files. - (mloopx.o): Ditto for stamp-xcpu. - -end-sanitize-cygnus Fri Oct 9 16:11:58 1998 Doug Evans Add pseudo-basic-block execution support. @@ -297,9 +263,6 @@ Fri Oct 9 16:11:58 1998 Doug Evans (SIM_EXTRA_DEPS): Add include/opcode/cgen.h. (INCLUDE_DEPS): Delete cpu-sim.h, include/opcode/cgen.h. (mloop.c): Build pseudo-basic-block version. Depend on stamp-cpu. -start-sanitize-cygnus - (stamp-decode): Delete, build decode files with other cpu files. -end-sanitize-cygnus * arch.c,arch.h,cpuall.h: Regenerate. * cpu.c,cpu.h,decode.c,decode.h,extract.c,model.c: Regenerate. * sem-switch.c,sem.c: Regenerate. @@ -330,14 +293,8 @@ end-sanitize-cygnus * configure: Regenerate. * Makefile.in (M32RX_OBJS): Delete semx.o, add extract.o. (mloopx.c): Build pseudo-basic-block version. -start-sanitize-cygnus - Depend on stamp-xcpu. -end-sanitize-cygnus (semx.o): Delete. (extractx.o): Add. -start-sanitize-cygnus - (stamp-xdecode): Delete, build decode files with other cpu files. -end-sanitize-cygnus * cpux.c,cpux.h,decodex.c,decodex.h,modelx.c: Regenerate. * readx.c: Delete. * semx.c: Delete. @@ -390,9 +347,6 @@ Mon Aug 3 12:59:17 1998 Doug Evans Rename cpu m32r to m32rb to distinguish from architecture name. * Makefile.in (mloop.c): cpu m32r renamed to m32rb. -start-sanitize-cygnus - (stamp-cpu): Ditto. -end-sanitize-cygnus * sim-main.h (WANT_CPU_M32RB): Renamed from WANT_CPU_M32R. * tconfig.in (WANT_CPU_M32RB): Ditto. * m32r.c (WANT_CPU_M32RB): Ditto. @@ -457,14 +411,6 @@ Sat Jun 13 07:49:23 1998 Doug Evans * mloopx.in: Call cycle init/update fns. * modelx.c: Regenerate. -start-sanitize-cygnus -Thu Jun 11 23:39:53 1998 Doug Evans - - * Makefile.in (stamp-{arch,cpu,decode}): Pass CGEN_FLAGS_TO_PASS - to recursive makes. - (stamp-{xcpu,xdecode}): Ditto. - -end-sanitize-cygnus Wed Jun 10 17:39:29 1998 Doug Evans * traps.c: New file. Trap support moved here from sim-if.c. @@ -545,9 +491,6 @@ Wed May 6 14:51:39 1998 Doug Evans * readx.c: Regenerate. Redo computed goto label handling. * semx.c: Regenerate. Call PROFILE_COUNT_INSN. Finish profiling support. -start-sanitize-cygnus - * Makefile.in (stamp-xcpu): Turn on profiling support. -end-sanitize-cygnus * m32r.c (m32r_fetch_register): Change result type and args to conform to sim_fetch_register interface. @@ -571,15 +514,6 @@ end-sanitize-cygnus * sim-main.h (sim_cia): Change to USI. (sim_cpu): Move m32r_misc_profile before machine generated part. -start-sanitize-cygnus -Fri May 1 18:25:41 1998 Doug Evans - - * Makefile.in: Replace @MAINT@ with $(CGEN_MAINT). - (CGEN_MAINT): New variable. - * configure.in: Add support for --enable-cgen-maint. - * configure: Regenerate. - -end-sanitize-cygnus Tue Apr 28 18:33:31 1998 Geoffrey Noer * configure: Regenerated to track ../common/aclocal.m4 changes. @@ -830,9 +764,6 @@ Mon Jan 19 14:13:40 1998 Doug Evans * Makefile.in: Update. * sem-ops.h: Deleted. * mem-ops.h: Deleted. -start-sanitize-cygnus - Add cgen support for generating files. -end-sanitize-cygnus (arch): Renamed from CPU. * cpu.h: New file. * decode.c: Redone. diff --git a/sim/m32r/Makefile.in b/sim/m32r/Makefile.in index 256c3e3fddb..71296e52c20 100644 --- a/sim/m32r/Makefile.in +++ b/sim/m32r/Makefile.in @@ -116,37 +116,5 @@ modelx.o: modelx.c $(M32RXF_INCLUDE_DEPS) m32r-clean: rm -f mloop.c eng.h stamp-mloop rm -f mloopx.c engx.h stamp-xmloop -# start-sanitize-cygnus - rm -f stamp-arch stamp-cpu stamp-xcpu -# end-sanitize-cygnus rm -f tmp-* -# start-sanitize-cygnus -# cgen support, enable with --enable-cgen-maint -CGEN_MAINT = ; @true -# The following line is commented in or out depending upon --enable-cgen-maint. -@CGEN_MAINT@CGEN_MAINT = - -stamp-arch: $(CGEN_READ_SCM) $(CGEN_ARCH_SCM) $(srccgen)/m32r.cpu - $(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) mach=all \ - FLAGS="with-scache with-profile=fn" - touch stamp-arch -arch.h arch.c cpuall.h: $(CGEN_MAINT) stamp-arch - @true - -stamp-cpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(srccgen)/m32r.cpu - $(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \ - cpu=m32rbf mach=m32r SUFFIX= \ - FLAGS="with-scache with-profile=fn" \ - EXTRAFILES="$(CGEN_CPU_SEM) $(CGEN_CPU_SEMSW)" - touch stamp-cpu -cpu.h sem.c sem-switch.c model.c decode.c decode.h: $(CGEN_MAINT) stamp-cpu - @true - -stamp-xcpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(srccgen)/m32r.cpu - $(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \ - cpu=m32rxf mach=m32rx SUFFIX=x FLAGS="with-scache with-profile=fn" EXTRAFILES="$(CGEN_CPU_SEMSW)" - touch stamp-xcpu -cpux.h semx-switch.c modelx.c decodex.c decodex.h: $(CGEN_MAINT) stamp-xcpu - @true -# end-sanitize-cygnus -- 2.30.2