From: John Gilmore Date: Tue, 11 Aug 1992 09:54:24 +0000 (+0000) Subject: Changes to make MIPS x 29K compile. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6872cfda60efd427da90039b51a1dada52280cc9;p=binutils-gdb.git Changes to make MIPS x 29K compile. * am29k-tdep.c: Lint from DECstation compiler. * mem-break.c: Restore test of BREAKPOINT size that Fred removed. As the man page says, "Sometimes you just can't get lint to shut up". That doesn't mean you should blow away the code it won't shut up about. * mips-xdep.c: Revise stubbing-out of code until Rich cleans it up over the next few weeks. Make mips x 29k build. * tm-29k.h (CALL_DUMMY): Make it work on cross-endian hosts. (FIX_CALL_DUMMY): Comment in the patching of the breakpoint, but leave it as a comment because the breakpoint instruction is not easily accessible at this moment (it's static, and if we define one here, it goes into every file compiled). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 33710ee1f8a..54df4ab94fd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +Tue Aug 11 02:49:39 1992 John Gilmore (gnu at cygnus.com) + + * am29k-tdep.c: Lint from DECstation compiler. + * mem-break.c: Restore test of BREAKPOINT size that Fred removed. + As the man page says, "Sometimes you just can't get lint to shut + up". That doesn't mean you should blow away the code it won't + shut up about. + * mips-xdep.c: Revise stubbing-out of code until Rich cleans + it up over the next few weeks. Make mips x 29k build. + * tm-29k.h (CALL_DUMMY): Make it work on cross-endian hosts. + (FIX_CALL_DUMMY): Comment in the patching of the breakpoint, + but leave it as a comment because the breakpoint instruction + is not easily accessible at this moment (it's static, and if + we define one here, it goes into every file compiled). + Mon Aug 10 22:27:19 1992 Fred Fish (fnf@cygnus.com) * Makefile.in (VERSION): Bump to 4.6.3. diff --git a/gdb/am29k-tdep.c b/gdb/am29k-tdep.c index e7b699f779f..d5399b74602 100644 --- a/gdb/am29k-tdep.c +++ b/gdb/am29k-tdep.c @@ -513,7 +513,7 @@ read_register_stack (memaddr, myaddr, actual_mem_addr, lval) /* If we don't do this 'info register' stops in the middle. */ if (memaddr >= rstack_high_address) { - int val=-1; /* a bogus value */ + int val = -1; /* a bogus value */ /* It's in a local register, but off the end of the stack. */ int regnum = (memaddr - rsp) / 4 + LR0_REGNUM; if (myaddr != NULL) diff --git a/gdb/mips-xdep.c b/gdb/mips-xdep.c index 4052a9c4bd9..806d1564891 100644 --- a/gdb/mips-xdep.c +++ b/gdb/mips-xdep.c @@ -23,10 +23,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "inferior.h" #include "gdbcore.h" -/* For now we stub this out; sgi format is super-hairy (and completely - different in the new release) */ +/* For now we stub this out; sgi core format is super-hairy (and completely + different in the new release). + For most mips systems, this function is defined in coredep.c. */ -#if defined(sgi) || !defined(GDB_TARGET_IS_MIPS) +#if defined(sgi) void fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) char *core_reg_sect; @@ -36,6 +37,12 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) { return; } +#endif + +/* Access to the inferior is only good for native systems, not cross. + I am not sure why this is stubbed out on SGI... --gnu@cygnus.com */ + +#if defined(sgi) || !defined(GDB_TARGET_IS_MIPS) /* ARGSUSED */ void @@ -143,26 +150,3 @@ store_inferior_registers (regno) } #endif /* sgi */ - -#if 0 -void -fetch_core_registers () -{ - register int regno; - int val; - - for (regno = 1; regno < NUM_REGS; regno++) { - char buf[MAX_REGISTER_RAW_SIZE]; - - val = bfd_seek (core_bfd, register_addr (regno, 0)); - if (val < 0 || (val = bfd_read (core_bfd, buf, sizeof buf)) < 0) { - char buffer[50]; - strcpy (buffer, "Reading register "); - strcat (buffer, reg_names[regno]); - - perror_with_name (buffer); - } - supply_register (regno, buf); - } -} -#endif /* 0 */ diff --git a/gdb/tm-29k.h b/gdb/tm-29k.h index c1c30ca3b74..51736371235 100644 --- a/gdb/tm-29k.h +++ b/gdb/tm-29k.h @@ -620,24 +620,36 @@ extern void pop_frame (); mtsrim cr, 15 loadm 0, 0, lr2, msp ; load first 16 words of arguments into registers add msp, msp, 16 * 4 ; point to the remaining arguments - CONST_INSN: - const lr0,inf - consth lr0,inf + CONST_INSN: + const lr0,inf ; (replaced by half of target addr) + consth lr0,inf ; (replaced by other half of target addr) calli lr0, lr0 aseq 0x40,gr1,gr1 ; nop - asneq 0x50,gr1,gr1 ; breakpoint + BREAKPT_INSN: + asneq 0x50,gr1,gr1 ; breakpoint (replaced by local breakpoint insn) */ -/* Position of the "const" instruction within CALL_DUMMY in bytes. */ -#define CONST_INSN (3 * 4) #if TARGET_BYTE_ORDER == HOST_BYTE_ORDER -#define CALL_DUMMY {0x0400870f,\ - 0x36008200|(MSP_HW_REGNUM), \ - 0x15000040|(MSP_HW_REGNUM<<8)|(MSP_HW_REGNUM<<16), \ - 0x03ff80ff, 0x02ff80ff, 0xc8008080, 0x70400101, 0x72500101} -#else /* Byte order differs. */ - you lose -#endif /* Byte order differs. */ +#define BS(const) const +#else +#define BS(const) (((const) & 0xff) << 24) | \ + (((const) & 0xff00) << 8) | \ + (((const) & 0xff0000) >> 8) | \ + (((const) & 0xff000000) >> 24) +#endif + +/* Position of the "const" and blkt instructions within CALL_DUMMY in bytes. */ +#define CONST_INSN (3 * 4) +#define BREAKPT_INSN (7 * 4) +#define CALL_DUMMY { \ + BS(0x0400870f),\ + BS(0x36008200|(MSP_HW_REGNUM)), \ + BS(0x15000040|(MSP_HW_REGNUM<<8)|(MSP_HW_REGNUM<<16)), \ + BS(0x03ff80ff), \ + BS(0x02ff80ff), \ + BS(0xc8008080), \ + BS(0x70400101), \ + BS(0x72500101)} #define CALL_DUMMY_LENGTH (8 * 4) #define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */ @@ -664,14 +676,15 @@ extern void pop_frame (); into a call sequence of the above form stored at DUMMYNAME. */ /* Currently this stuffs in the address of the function that we are calling. - If different 29k systems use different breakpoint instructions, it - could also stuff BREAKPOINT in the right place (to avoid having to + Since different 29k systems use different breakpoint instructions, it + also stuffs BREAKPOINT in the right place (to avoid having to duplicate CALL_DUMMY in each tm-*.h file). */ #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ {\ - STUFF_I16((char *)dummyname + CONST_INSN, fun);\ - STUFF_I16((char *)dummyname + CONST_INSN + 4, fun >> 16);\ + STUFF_I16((char *)dummyname + CONST_INSN, fun); \ + STUFF_I16((char *)dummyname + CONST_INSN + 4, fun >> 16); \ + /* FIXME memcpy ((char *)(dummyname) + BREAKPT_INSN, break_insn, 4); */ \ } /* 29k architecture has separate data & instruction memories -- wired to