diff options
Diffstat (limited to 'gdb/config/d10v/tm-d10v.h')
-rw-r--r-- | gdb/config/d10v/tm-d10v.h | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/gdb/config/d10v/tm-d10v.h b/gdb/config/d10v/tm-d10v.h index d0c1a50..f0760dc 100644 --- a/gdb/config/d10v/tm-d10v.h +++ b/gdb/config/d10v/tm-d10v.h @@ -50,24 +50,19 @@ struct value; extern CORE_ADDR d10v_skip_prologue (); #define SKIP_PROLOGUE(ip) (d10v_skip_prologue (ip)) - /* Stack grows downward. */ -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) +#define INNER_THAN(lhs,rhs) (core_addr_lessthan ((lhs), (rhs))) /* for a breakpoint, use "dbt || nop" */ -#define BREAKPOINT {0x2f, 0x90, 0x5e, 0x00} +extern breakpoint_from_pc_fn d10v_breakpoint_from_pc; +#define BREAKPOINT_FROM_PC(PCPTR,LENPTR) (d10v_breakpoint_from_pc ((PCPTR), (LENPTR))) /* If your kernel resets the pc after the trap happens you may need to define this before including this file. */ #define DECR_PC_AFTER_BREAK 4 -#define REGISTER_NAMES \ -{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ - "r8", "r9", "r10","r11","r12", "r13", "r14","r15",\ - "psw","bpsw","pc","bpc", "cr4", "cr5", "cr6", "rpt_c",\ - "rpt_s","rpt_e", "mod_s", "mod_e", "cr12", "cr13", "iba", "cr15",\ - "imap0","imap1","dmap","a0", "a1"\ - } +extern char *d10v_register_name PARAMS ((int reg_nr)); +#define REGISTER_NAME(NR) (d10v_register_name (NR)) #define NUM_REGS 37 @@ -94,18 +89,18 @@ extern CORE_ADDR d10v_skip_prologue (); /* Index within `registers' of the first byte of the space for register N. */ - -#define REGISTER_BYTE(N) \ -( ((N) > A0_REGNUM) ? ( ((N)-A0_REGNUM)*8 + A0_REGNUM*2 ) : ((N) * 2) ) +extern int d10v_register_byte PARAMS ((int reg_nr)); +#define REGISTER_BYTE(N) (d10v_register_byte (N)) /* Number of bytes of storage in the actual machine representation for register N. */ - -#define REGISTER_RAW_SIZE(N) ( ((N) >= A0_REGNUM) ? 8 : 2 ) +extern int d10v_register_raw_size PARAMS ((int reg_nr)); +#define REGISTER_RAW_SIZE(N) (d10v_register_raw_size (N)) /* Number of bytes of storage in the program's representation for register N. */ -#define REGISTER_VIRTUAL_SIZE(N) ( ((N) >= A0_REGNUM) ? 8 : ( ((N) == PC_REGNUM || (N) == SP_REGNUM) ? 4 : 2 )) +extern int d10v_register_virtual_size PARAMS ((int reg_nr)); +#define REGISTER_VIRTUAL_SIZE(N) (d10v_register_virtual_size (N)) /* Largest value REGISTER_RAW_SIZE can have. */ @@ -118,8 +113,8 @@ extern CORE_ADDR d10v_skip_prologue (); /* Return the GDB type object for the "standard" data type of data in register N. */ -#define REGISTER_VIRTUAL_TYPE(N) \ -( ((N) < A0_REGNUM ) ? ((N) == PC_REGNUM || (N) == SP_REGNUM ? builtin_type_long : builtin_type_short) : builtin_type_long_long) +extern struct type *d10v_register_virtual_type PARAMS ((int reg_nr)); +#define REGISTER_VIRTUAL_TYPE(N) (d10v_register_virtual_type (N)) /* convert $pc and $sp to/from virtual addresses */ @@ -139,14 +134,20 @@ extern CORE_ADDR d10v_skip_prologue (); store_unsigned_integer ((TO), 2, x); \ } -#define D10V_MAKE_DADDR(x) ((x) | DMEM_START) -#define D10V_MAKE_IADDR(x) (((x) << 2) | IMEM_START) +extern CORE_ADDR d10v_make_daddr PARAMS ((CORE_ADDR x)); +#define D10V_MAKE_DADDR(x) (d10v_make_daddr (x)) +extern CORE_ADDR d10v_make_iaddr PARAMS ((CORE_ADDR x)); +#define D10V_MAKE_IADDR(x) (d10v_make_iaddr (x)) -#define D10V_DADDR_P(X) (((X) & 0x3000000) == DMEM_START) -#define D10V_IADDR_P(X) (((X) & 0x3000000) == IMEM_START) +extern int d10v_daddr_p PARAMS ((CORE_ADDR x)); +#define D10V_DADDR_P(X) (d10v_daddr_p (X)) +extern int d10v_iaddr_p PARAMS ((CORE_ADDR x)); +#define D10V_IADDR_P(X) (d10v_iaddr_p (X)) -#define D10V_CONVERT_IADDR_TO_RAW(X) (((X) >> 2) & 0xffff) -#define D10V_CONVERT_DADDR_TO_RAW(X) ((X) & 0xffff) +extern CORE_ADDR d10v_convert_daddr_to_raw PARAMS ((CORE_ADDR x)); +#define D10V_CONVERT_DADDR_TO_RAW(X) (d10v_convert_daddr_to_raw (X)) +extern CORE_ADDR d10v_convert_iaddr_to_raw PARAMS ((CORE_ADDR x)); +#define D10V_CONVERT_IADDR_TO_RAW(X) (d10v_convert_iaddr_to_raw (X)) #define ARG1_REGNUM R0_REGNUM #define ARGN_REGNUM 3 @@ -158,8 +159,8 @@ extern CORE_ADDR d10v_skip_prologue (); We store structs through a pointer passed in the first Argument register. */ -#define STORE_STRUCT_RETURN(ADDR, SP) \ - { write_register (ARG1_REGNUM, (ADDR)); } +extern void d10v_store_struct_return PARAMS ((CORE_ADDR addr, CORE_ADDR sp)); +#define STORE_STRUCT_RETURN(ADDR, SP) d10v_store_struct_return ((ADDR), (SP)) /* Write into appropriate registers a function return value @@ -167,16 +168,16 @@ extern CORE_ADDR d10v_skip_prologue (); Things always get returned in RET1_REGNUM, RET2_REGNUM, ... */ -#define STORE_RETURN_VALUE(TYPE,VALBUF) \ - write_register_bytes (REGISTER_BYTE(RET1_REGNUM), VALBUF, TYPE_LENGTH (TYPE)) +extern void d10v_store_return_value PARAMS ((struct type *type, char *valbuf)); +#define STORE_RETURN_VALUE(TYPE,VALBUF) d10v_store_return_value ((TYPE), (VALBUF)) /* 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 (ARG1_REGNUM), REGISTER_RAW_SIZE (ARG1_REGNUM)) | DMEM_START) +extern CORE_ADDR d10v_extract_struct_value_address PARAMS ((char *regbuf)); +#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (d10v_extract_struct_value_address ((REGBUF))) /* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc @@ -208,27 +209,32 @@ extern void d10v_init_extra_frame_info PARAMS (( int fromleaf, struct frame_info by FI does not have a frame on the stack associated with it. If it does not, FRAMELESS is set to 1, else 0. */ -#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ - (FRAMELESS) = frameless_look_for_prologue(FI) +#define FRAMELESS_FUNCTION_INVOCATION(FI) \ + (frameless_look_for_prologue (FI)) +extern CORE_ADDR d10v_frame_chain PARAMS ((struct frame_info *frame)); #define FRAME_CHAIN(FRAME) d10v_frame_chain(FRAME) extern int d10v_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); #define FRAME_CHAIN_VALID(chain, thisframe) d10v_frame_chain_valid (chain, thisframe) -#define FRAME_SAVED_PC(FRAME) ((FRAME)->return_pc) -#define FRAME_ARGS_ADDRESS(fi) (fi)->frame -#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame +extern CORE_ADDR d10v_frame_saved_pc PARAMS ((struct frame_info *fi)); +#define FRAME_SAVED_PC(fi) (d10v_frame_saved_pc ((fi))) +extern CORE_ADDR d10v_frame_args_address PARAMS ((struct frame_info *fi)); +#define FRAME_ARGS_ADDRESS(fi) (d10v_frame_args_address ((fi))) +extern CORE_ADDR d10v_frame_locals_address PARAMS ((struct frame_info *fi)); +#define FRAME_LOCALS_ADDRESS(fi) (d10v_frame_locals_address ((fi))) /* Immediately after a function call, return the saved pc. We can't */ /* use frame->return_pc beause that is determined by reading R13 off the */ /*stack and that may not be written yet. */ -#define SAVED_PC_AFTER_CALL(frame) ((read_register(LR_REGNUM) << 2) | IMEM_START) +extern CORE_ADDR d10v_saved_pc_after_call PARAMS ((struct frame_info *frame)); +#define SAVED_PC_AFTER_CALL(frame) (d10v_saved_pc_after_call ((frame))) /* Set VAL to the number of args passed to frame described by FI. Can set VAL to -1, meaning no way to tell. */ /* We can't tell how many args there are */ -#define FRAME_NUM_ARGS(val,fi) (val = -1) +#define FRAME_NUM_ARGS(fi) (-1) /* Return number of bytes at start of arglist that are not really args. */ @@ -282,7 +288,7 @@ extern CORE_ADDR d10v_push_return_address PARAMS ((CORE_ADDR pc, CORE_ADDR sp)); generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ - sp = d10v_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)) + (d10v_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))) extern CORE_ADDR d10v_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR)); @@ -330,7 +336,7 @@ CORE_ADDR d10v_read_fp PARAMS ((void)); need to be translated into a format that the d10v rom monitor understands. */ -int remote_d10v_translate_xfer_address PARAMS ((CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr)); +extern void remote_d10v_translate_xfer_address PARAMS ((CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)); #define REMOTE_TRANSLATE_XFER_ADDRESS(GDB_ADDR, GDB_LEN, REM_ADDR, REM_LEN) \ -(REM_LEN) = remote_d10v_translate_xfer_address ((GDB_ADDR), (GDB_LEN), &(REM_ADDR)) + remote_d10v_translate_xfer_address ((GDB_ADDR), (GDB_LEN), (REM_ADDR), (REM_LEN)) |