1999-04-16 01:35:26 +00:00
|
|
|
/* Parameters for execution on a Fujitsu FR30 processor.
|
2001-03-06 08:22:02 +00:00
|
|
|
Copyright 1999, 2000 Free Software Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
This file is part of GDB.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-03-14 23:23:16 +00:00
|
|
|
#include "regcache.h"
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
#define FR30_GENREGS 16
|
|
|
|
#define FR30_DEDICATEDREGS 8
|
|
|
|
#define FR30_REGSIZE 4 /* bytes */
|
|
|
|
|
|
|
|
#define NUM_REGS (FR30_GENREGS + FR30_DEDICATEDREGS)
|
|
|
|
#define REGISTER_BYTES ((FR30_GENREGS + FR30_DEDICATEDREGS)*FR30_REGSIZE)
|
|
|
|
|
|
|
|
/* Index within `registers' of the first byte of the space for
|
|
|
|
register N. */
|
|
|
|
#define REGISTER_BYTE(N) ((N) * FR30_REGSIZE)
|
|
|
|
|
|
|
|
/* Initializer for an array of names of registers.
|
|
|
|
There should be NUM_REGS strings in this initializer. */
|
|
|
|
#define REGISTER_NAMES \
|
|
|
|
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
|
|
|
|
"r9", "r10", "r11", "r12", "r13", "r14", "r15", \
|
|
|
|
"pc", "ps", "tbr", "rp", "ssp", "usp", "mdh", "mdl" }
|
|
|
|
|
|
|
|
/* Offset from address of function to start of its code.
|
|
|
|
Zero on most machines. */
|
|
|
|
#define FUNCTION_START_OFFSET 0
|
|
|
|
|
|
|
|
/* Amount PC must be decremented by after a breakpoint.
|
|
|
|
This is often the number of bytes in BREAKPOINT
|
|
|
|
but not always. */
|
|
|
|
|
|
|
|
#define DECR_PC_AFTER_BREAK 0
|
|
|
|
|
|
|
|
/* Stack grows downward. */
|
|
|
|
|
|
|
|
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
|
|
|
|
|
|
|
|
#define TARGET_BYTE_ORDER BIG_ENDIAN
|
|
|
|
|
|
|
|
#define R0_REGNUM 0
|
|
|
|
#define R1_REGNUM 1
|
|
|
|
#define R2_REGNUM 2
|
|
|
|
#define R3_REGNUM 3
|
|
|
|
#define R4_REGNUM 4
|
|
|
|
#define R5_REGNUM 5
|
|
|
|
#define R6_REGNUM 6
|
|
|
|
#define R7_REGNUM 7
|
|
|
|
#define R8_REGNUM 8
|
|
|
|
#define R9_REGNUM 9
|
|
|
|
#define R10_REGNUM 10
|
|
|
|
#define R11_REGNUM 11
|
|
|
|
#define R12_REGNUM 12
|
|
|
|
#define R13_REGNUM 13
|
|
|
|
#define FP_REGNUM 14 /* Frame pointer */
|
|
|
|
#define SP_REGNUM 15 /* Stack pointer */
|
|
|
|
#define PC_REGNUM 16 /* Program counter */
|
|
|
|
#define RP_REGNUM 19 /* Return pointer */
|
|
|
|
|
|
|
|
#define FIRST_ARGREG R4_REGNUM /* first arg (or struct ret val addr) */
|
|
|
|
#define LAST_ARGREG R7_REGNUM /* fourth (or third arg) */
|
|
|
|
#define RETVAL_REG R4_REGNUM /* return vaue */
|
|
|
|
|
|
|
|
/* Say how long (ordinary) registers are. This is a piece of bogosity
|
|
|
|
used in push_word and a few other places; REGISTER_RAW_SIZE is the
|
|
|
|
real way to know how big a register is. */
|
|
|
|
#define REGISTER_SIZE FR30_REGSIZE
|
|
|
|
|
|
|
|
/* Number of bytes of storage in the actual machine representation
|
|
|
|
for register N. */
|
|
|
|
#define REGISTER_RAW_SIZE(N) FR30_REGSIZE
|
|
|
|
|
|
|
|
/* Largest value REGISTER_RAW_SIZE can have. */
|
1999-07-07 20:19:36 +00:00
|
|
|
#define MAX_REGISTER_RAW_SIZE FR30_REGSIZE
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Number of bytes of storage in the program's representation
|
|
|
|
for register N. */
|
|
|
|
#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
|
|
|
|
|
|
|
|
/* Largest value REGISTER_VIRTUAL_SIZE can have. */
|
|
|
|
#define MAX_REGISTER_VIRTUAL_SIZE FR30_REGSIZE
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
extern void fr30_pop_frame (void);
|
1999-04-16 01:35:26 +00:00
|
|
|
#define POP_FRAME fr30_pop_frame()
|
|
|
|
|
1999-04-26 18:34:20 +00:00
|
|
|
#define USE_GENERIC_DUMMY_FRAMES 1
|
1999-04-16 01:35:26 +00:00
|
|
|
#define CALL_DUMMY {0}
|
|
|
|
#define CALL_DUMMY_START_OFFSET (0)
|
|
|
|
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
|
|
|
|
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
|
|
|
|
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
|
|
|
|
#define CALL_DUMMY_ADDRESS() entry_point_address ()
|
|
|
|
#define PUSH_RETURN_ADDRESS(PC, SP) (write_register(RP_REGNUM, CALL_DUMMY_ADDRESS()), SP)
|
|
|
|
#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
|
|
|
|
|
|
|
|
/* Number of bytes at start of arglist that are not really args. */
|
|
|
|
#define FRAME_ARGS_SKIP 0
|
|
|
|
|
|
|
|
/* Return the GDB type object for the "standard" data type
|
|
|
|
of data in register N. */
|
|
|
|
#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
|
|
|
|
|
|
|
|
/* Extract from an array REGBUF containing the (raw) register state
|
|
|
|
a function return value of type TYPE, and copy that, in virtual format,
|
|
|
|
into VALBUF. */
|
|
|
|
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
|
|
|
|
memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG) + \
|
|
|
|
(TYPE_LENGTH(TYPE) < 4 ? 4 - TYPE_LENGTH(TYPE) : 0), TYPE_LENGTH (TYPE))
|
|
|
|
|
|
|
|
/* Extract from an array REGBUF containing the (raw) register state
|
|
|
|
the address in which a function should return its structure value,
|
|
|
|
as a CORE_ADDR (or an expression that can be used as one). */
|
|
|
|
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
|
|
|
|
extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \
|
|
|
|
REGISTER_RAW_SIZE (RETVAL_REG))
|
|
|
|
|
|
|
|
#define STORE_STRUCT_RETURN(ADDR, SP) \
|
|
|
|
{ write_register (RETVAL_REG, (ADDR)); }
|
|
|
|
|
1999-04-26 18:34:20 +00:00
|
|
|
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
|
1999-04-16 01:35:26 +00:00
|
|
|
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
|
|
|
|
|
|
|
|
/* Return number of args passed to a frame.
|
|
|
|
Can return -1, meaning no way to tell. */
|
1999-05-25 18:09:09 +00:00
|
|
|
#define FRAME_NUM_ARGS(fi) (-1)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-08-31 01:14:27 +00:00
|
|
|
/* Forward decls for prototypes */
|
1999-04-16 01:35:26 +00:00
|
|
|
struct frame_info;
|
|
|
|
struct frame_saved_regs;
|
|
|
|
struct type;
|
|
|
|
struct value;
|
|
|
|
|
|
|
|
#define EXTRA_FRAME_INFO \
|
|
|
|
struct frame_saved_regs fsr; \
|
|
|
|
int framesize; \
|
|
|
|
int frameoffset; \
|
|
|
|
int framereg;
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
extern CORE_ADDR fr30_frame_chain (struct frame_info *fi);
|
1999-04-16 01:35:26 +00:00
|
|
|
#define FRAME_CHAIN(fi) fr30_frame_chain (fi)
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
extern CORE_ADDR fr30_frame_saved_pc (struct frame_info *);
|
1999-04-16 01:35:26 +00:00
|
|
|
#define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
|
|
|
|
|
|
|
|
#define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
extern CORE_ADDR fr30_skip_prologue (CORE_ADDR pc);
|
1999-05-05 14:45:51 +00:00
|
|
|
#define SKIP_PROLOGUE(pc) (fr30_skip_prologue (pc))
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-04-26 18:34:20 +00:00
|
|
|
/* Write into appropriate registers a function return value of type
|
|
|
|
TYPE, given in virtual format. VALBUF is in the target byte order;
|
|
|
|
it's typically the VALUE_CONTENTS of some struct value, and those
|
|
|
|
are in the target's byte order. */
|
2000-05-28 01:12:42 +00:00
|
|
|
extern void fr30_store_return_value (struct type *type, char *valbuf);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
|
1999-04-26 18:34:20 +00:00
|
|
|
(fr30_store_return_value ((TYPE), (VALBUF)))
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Put here the code to store, into a struct frame_saved_regs,
|
|
|
|
the addresses of the saved registers of frame described by FRAME_INFO.
|
|
|
|
This includes special registers such as pc and fp saved in special
|
|
|
|
ways in the stack frame. sp is even more special:
|
|
|
|
the address we return for it IS the sp for the next frame. */
|
|
|
|
#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
|
|
|
|
|
|
|
|
/* Use INT #BREAKPOINT_INTNUM instruction for breakpoint */
|
|
|
|
#define FR30_BREAKOP 0x1f /* opcode, type D instruction */
|
|
|
|
#define BREAKPOINT_INTNUM 9 /* one of the reserved traps */
|
|
|
|
#define BREAKPOINT {FR30_BREAKOP, BREAKPOINT_INTNUM}
|
|
|
|
|
|
|
|
/* Define this for Wingdb */
|
|
|
|
#define TARGET_FR30
|
|
|
|
|
|
|
|
/* IEEE format floating point */
|
Bring IEEE_FLOAT under gdbarch's control.
* gdbarch.sh (IEEE_FLOAT): New entry.
* gdbarch.c, gdbarch.h: Regenerated.
* valprint.c (IEEE_FLOAT): Provide a default #definition for this.
(print_floating): Use IEEE_FLOAT as if it were an expression; use
the code specific to IEEE-format numbers whenever the value of
IEEE_FLOAT is non-zero.
* config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/arc/tm-arc.h, config/arm/tm-arm.h, config/fr30/tm-fr30.h,
config/h8300/tm-h8300.h, config/i386/tm-i386.h,
config/i960/tm-i960.h, config/m88k/tm-m88k.h,
config/mips/tm-mips.h, config/pa/tm-hppa.h,
config/sparc/tm-sparc.h, config/delta/tm-delta.h,
config/frv/tm-frv.h (IEEE_FLOAT): For all ports that #define
IEEE_FLOAT, make sure they give it the value (1).
2000-04-14 19:14:19 +00:00
|
|
|
#define IEEE_FLOAT (1)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Define other aspects of the stack frame. */
|
|
|
|
|
1999-05-25 18:09:09 +00:00
|
|
|
/* An expression that tells us whether the function invocation represented
|
|
|
|
by FI does not have a frame on the stack associated with it. */
|
2000-05-28 01:12:42 +00:00
|
|
|
extern int fr30_frameless_function_invocation (struct frame_info *frame);
|
1999-05-25 18:09:09 +00:00
|
|
|
#define FRAMELESS_FUNCTION_INVOCATION(FI) (fr30_frameless_function_invocation (FI));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
extern void fr30_init_extra_frame_info (struct frame_info *fi);
|
1999-04-16 01:35:26 +00:00
|
|
|
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
|
|
|
|
|
1999-12-14 01:06:04 +00:00
|
|
|
#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid (FP, FI)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
extern CORE_ADDR
|
2000-05-28 01:12:42 +00:00
|
|
|
fr30_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|
|
|
int struct_return, CORE_ADDR struct_addr);
|
1999-04-16 01:35:26 +00:00
|
|
|
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
|
1999-05-25 18:09:09 +00:00
|
|
|
(fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-04-26 18:34:20 +00:00
|
|
|
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Fujitsu's ABI requires all structs to be passed using a pointer.
|
|
|
|
That is obviously not very efficient, so I am leaving the definitions
|
|
|
|
to make gdb work with GCC style struct passing, in case we decide
|
|
|
|
to go for better performance, rather than for compatibility with
|
|
|
|
Fujitsu (just change STRUCT_ALWAYS_BY_ADDR to 0) */
|
|
|
|
|
|
|
|
#define STRUCT_ALWAYS_BY_ADDR 1
|
|
|
|
|
|
|
|
#if(STRUCT_ALWAYS_BY_ADDR)
|
|
|
|
#define REG_STRUCT_HAS_ADDR(gcc_p,type) 1
|
|
|
|
#else
|
|
|
|
/* more standard GCC (optimized) */
|
|
|
|
#define REG_STRUCT_HAS_ADDR(gcc_p,type) \
|
|
|
|
((TYPE_LENGTH(type) > 4) && (TYPE_LENGTH(type) & 0x3))
|
|
|
|
#endif
|
|
|
|
/* alway return struct by value by input pointer */
|
|
|
|
#define USE_STRUCT_CONVENTION(GCC_P, TYPE) 1
|
1999-04-26 18:34:20 +00:00
|
|
|
|
|
|
|
/* The stack should always be aligned on a four-word boundary. */
|
|
|
|
#define STACK_ALIGN(len) (((len) + 3) & ~3)
|
|
|
|
|
|
|
|
/* I think the comment about this in value_arg_coerce is wrong; this
|
|
|
|
should be true on any system where you can rely on the prototyping
|
|
|
|
information. When this is true, value_arg_coerce will promote
|
|
|
|
floats to doubles iff the function is not prototyped. */
|
Bring COERCE_FLOAT_TO_DOUBLE under gdbarch's control.
* valops.c (COERCE_FLOAT_TO_DOUBLE): Rework definition to be
more function-like.
(default_coerce_float_to_double, standard_coerce_float_to_double):
New functions.
(value_arg_coerce): Adjust for new definition.
* value.h (default_coerce_float_to_double,
standard_coerce_float_to_double): New declarations for the above.
* gdbarch.sh (coerce_float_to_double): New entry, replacing macro.
* gdbarch.c, gdbarch.h: Regenerated.
* tm-alpha.h, tm-fr30.h, tm-m32r.h, tm-mips.h, tm-hppa.h,
tm-rs6000.h, tm-sh.h, tm-sparc.h (COERCE_FLOAT_TO_DOUBLE): Change
definitions.
* mips-tdep.c (mips_coerce_float_to_double): Supply our own custom
function here.
(mips_gdbarch_init): Install that as our coerce_float_to_double
function.
2000-02-22 19:18:53 +00:00
|
|
|
#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
|