OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [config/] [tic80/] [tm-tic80.h] - Diff between revs 107 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
/* Parameters for execution on a TI TMS320C80 (MVP) processor.
/* Parameters for execution on a TI TMS320C80 (MVP) processor.
   Copyright 1997
   Copyright 1997
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   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
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */
   Boston, MA 02111-1307, USA.  */
 
 
#ifndef TM_TIC80_H
#ifndef TM_TIC80_H
#define TM_TIC80_H
#define TM_TIC80_H
 
 
/* Forward declare structs used in prototypes */
/* Forward declare structs used in prototypes */
struct frame_info;
struct frame_info;
struct type;
struct type;
struct value;
struct value;
struct symbol;
struct symbol;
struct frame_saved_regs;
struct frame_saved_regs;
 
 
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
 
 
#define NUM_REGS 38
#define NUM_REGS 38
 
 
#define REGISTER_NAMES \
#define REGISTER_NAMES \
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
  "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
  "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
  "pc", "npc", \
  "pc", "npc", \
  "a0", "a1", "a2", "a3", \
  "a0", "a1", "a2", "a3", \
}
}
 
 
/* Various dedicated register numbers
/* Various dedicated register numbers
   FIXME: Shadow updates in sim/tic80/sim-calls.c */
   FIXME: Shadow updates in sim/tic80/sim-calls.c */
 
 
#define SP_REGNUM 1             /* Contains address of top of stack */
#define SP_REGNUM 1             /* Contains address of top of stack */
#define ARG0_REGNUM 2           /* Contains argument 1 (r3 has high word) */
#define ARG0_REGNUM 2           /* Contains argument 1 (r3 has high word) */
#define RET_REGNUM  2           /* Contains function return value */
#define RET_REGNUM  2           /* Contains function return value */
#define ARGLAST_REGNUM 12       /* Contains argument 6 (r13 has high word) */
#define ARGLAST_REGNUM 12       /* Contains argument 6 (r13 has high word) */
#define FP_REGNUM 30            /* Contains address of executing stack frame */
#define FP_REGNUM 30            /* Contains address of executing stack frame */
#define LR_REGNUM 31            /* Contains address of caller (link register) */
#define LR_REGNUM 31            /* Contains address of caller (link register) */
#define PC_REGNUM 32            /* Contains program counter (FIXME?) */
#define PC_REGNUM 32            /* Contains program counter (FIXME?) */
#define NPC_REGNUM 33           /* Contains the next program counter (FIXME?) */
#define NPC_REGNUM 33           /* Contains the next program counter (FIXME?) */
#define A0_REGNUM 34            /* Accumulator register 0 */
#define A0_REGNUM 34            /* Accumulator register 0 */
#define A3_REGNUM 37            /* Accumulator register 1 */
#define A3_REGNUM 37            /* Accumulator register 1 */
 
 
#define R0_REGNUM 0             /* General Purpose Register 0 - for sim */
#define R0_REGNUM 0             /* General Purpose Register 0 - for sim */
#define Rn_REGNUM 31            /* Last General Purpose Register - for sim */
#define Rn_REGNUM 31            /* Last General Purpose Register - for sim */
#define An_REGNUM A3_REGNUM     /* Last Accumulator register - for sim */
#define An_REGNUM A3_REGNUM     /* Last Accumulator register - for sim */
 
 
/* Total amount of space needed to store our copies of the machine's
/* Total amount of space needed to store our copies of the machine's
   register state, the array `registers'.  */
   register state, the array `registers'.  */
 
 
#define REGISTER_BYTES (((NUM_REGS - 4) * 4) + (4 * 8))
#define REGISTER_BYTES (((NUM_REGS - 4) * 4) + (4 * 8))
 
 
/* Index within `registers' of the first byte of the space for
/* Index within `registers' of the first byte of the space for
   register N.  */
   register N.  */
 
 
#define REGISTER_BYTE(N) \
#define REGISTER_BYTE(N) \
   (((N) >= A0_REGNUM) ? (((N) - A0_REGNUM) * 8 + A0_REGNUM * 4) : ((N) * 4))
   (((N) >= A0_REGNUM) ? (((N) - A0_REGNUM) * 8 + A0_REGNUM * 4) : ((N) * 4))
 
 
/* Most registers are 4 bytes */
/* Most registers are 4 bytes */
 
 
#define REGISTER_SIZE 4
#define REGISTER_SIZE 4
 
 
/* Some registers are 8 bytes.  */
/* Some registers are 8 bytes.  */
 
 
#define REGISTER_RAW_SIZE(N) \
#define REGISTER_RAW_SIZE(N) \
     (((N) >= A0_REGNUM) ? 8 : 4)
     (((N) >= A0_REGNUM) ? 8 : 4)
 
 
/* Largest value REGISTER_RAW_SIZE can have.  */
/* Largest value REGISTER_RAW_SIZE can have.  */
 
 
#define MAX_REGISTER_RAW_SIZE (8)
#define MAX_REGISTER_RAW_SIZE (8)
 
 
/* All regs are 4 bytes.  */
/* All regs are 4 bytes.  */
 
 
#define REGISTER_VIRTUAL_SIZE(N) (REGISTER_RAW_SIZE(N))
#define REGISTER_VIRTUAL_SIZE(N) (REGISTER_RAW_SIZE(N))
 
 
/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 
 
#define MAX_REGISTER_VIRTUAL_SIZE (MAX_REGISTER_RAW_SIZE)
#define MAX_REGISTER_VIRTUAL_SIZE (MAX_REGISTER_RAW_SIZE)
 
 
/* Return the GDB type object for the "standard" data type
/* Return the GDB type object for the "standard" data type
   of data in register N.  */
   of data in register N.  */
 
 
#define REGISTER_VIRTUAL_TYPE(N) /* FIXME? */ \
#define REGISTER_VIRTUAL_TYPE(N) /* FIXME? */ \
        (((N) >= A0_REGNUM) ? builtin_type_float : builtin_type_int)
        (((N) >= A0_REGNUM) ? builtin_type_float : builtin_type_int)
 
 
/* Offset from address of function to start of its code.
/* Offset from address of function to start of its code.
   Zero on most machines.  */
   Zero on most machines.  */
 
 
#define FUNCTION_START_OFFSET 0
#define FUNCTION_START_OFFSET 0
 
 
/* Stack grows downward.  */
/* Stack grows downward.  */
 
 
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
 
 
/* Sequence of bytes for breakpoint instruction.
/* Sequence of bytes for breakpoint instruction.
   This is padded out to the size of a machine word. */
   This is padded out to the size of a machine word. */
 
 
#define BREAKPOINT              {0x49, 0x80, 0x00, 0x00}        /* FIXME! */
#define BREAKPOINT              {0x49, 0x80, 0x00, 0x00}        /* FIXME! */
 
 
/* Amount PC must be decremented by after a breakpoint.
/* Amount PC must be decremented by after a breakpoint.
   This is often the number of bytes in BREAKPOINT
   This is often the number of bytes in BREAKPOINT
   but not always.  */
   but not always.  */
 
 
#define DECR_PC_AFTER_BREAK     0        /* FIXME! */
#define DECR_PC_AFTER_BREAK     0        /* FIXME! */
 
 
/* Discard from the stack the innermost frame, restoring all registers.  */
/* Discard from the stack the innermost frame, restoring all registers.  */
 
 
#define POP_FRAME tic80_pop_frame(get_current_frame ())
#define POP_FRAME tic80_pop_frame(get_current_frame ())
extern struct frame_info *tic80_pop_frame PARAMS ((struct frame_info * frame));
extern struct frame_info *tic80_pop_frame PARAMS ((struct frame_info * frame));
 
 
/* Return number of bytes at start of arglist that are not really args.  */
/* Return number of bytes at start of arglist that are not really args.  */
 
 
#define FRAME_ARGS_SKIP 0
#define FRAME_ARGS_SKIP 0
 
 
/* Set VAL to the number of args passed to frame described by FI.
/* Set VAL to the number of args passed to frame described by FI.
   Can set VAL to -1, meaning no way to tell.  */
   Can set VAL to -1, meaning no way to tell.  */
/* We can't tell how many args there are */
/* We can't tell how many args there are */
 
 
#define FRAME_NUM_ARGS(fi) (-1)
#define FRAME_NUM_ARGS(fi) (-1)
 
 
#define FRAME_ARGS_SKIP 0
#define FRAME_ARGS_SKIP 0
#define FRAME_ARGS_ADDRESS(fi)   (fi)->frame
#define FRAME_ARGS_ADDRESS(fi)   (fi)->frame
#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
 
 
/* Define other aspects of the stack frame.
/* Define other aspects of the stack frame.
   We keep the offsets of all saved registers, 'cause we need 'em a lot!
   We keep the offsets of all saved registers, 'cause we need 'em a lot!
   We also keep the current size of the stack frame, and the offset of
   We also keep the current size of the stack frame, and the offset of
   the frame pointer from the stack pointer (for frameless functions, and
   the frame pointer from the stack pointer (for frameless functions, and
   when we're still in the prologue of a function with a frame) */
   when we're still in the prologue of a function with a frame) */
 
 
#define EXTRA_FRAME_INFO        \
#define EXTRA_FRAME_INFO        \
  struct frame_saved_regs fsr;  \
  struct frame_saved_regs fsr;  \
  int framesize;                \
  int framesize;                \
  int frameoffset;              \
  int frameoffset;              \
  int framereg;
  int framereg;
 
 
extern void tic80_init_extra_frame_info PARAMS ((struct frame_info * fi));
extern void tic80_init_extra_frame_info PARAMS ((struct frame_info * fi));
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) tic80_init_extra_frame_info (fi)
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) tic80_init_extra_frame_info (fi)
#define INIT_FRAME_PC           /* Not necessary */
#define INIT_FRAME_PC           /* Not necessary */
 
 
/* Put here the code to store, into a struct frame_saved_regs,
/* Put here the code to store, into a struct frame_saved_regs,
   the addresses of the saved registers of frame described by FRAME_INFO.
   the addresses of the saved registers of frame described by FRAME_INFO.
   This includes special registers such as pc and fp saved in special
   This includes special registers such as pc and fp saved in special
   ways in the stack frame.  sp is even more special:
   ways in the stack frame.  sp is even more special:
   the address we return for it IS the sp for the next frame.  */
   the address we return for it IS the sp for the next frame.  */
 
 
#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)         \
#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)         \
   tic80_frame_find_saved_regs(frame_info, &(frame_saved_regs))
   tic80_frame_find_saved_regs(frame_info, &(frame_saved_regs))
extern void tic80_frame_find_saved_regs PARAMS ((struct frame_info *, struct frame_saved_regs *));
extern void tic80_frame_find_saved_regs PARAMS ((struct frame_info *, struct frame_saved_regs *));
 
 
/* Advance PC across any function entry prologue instructions
/* Advance PC across any function entry prologue instructions
   to reach some "real" code.  */
   to reach some "real" code.  */
 
 
#define SKIP_PROLOGUE(pc) (tic80_skip_prologue (pc))
#define SKIP_PROLOGUE(pc) (tic80_skip_prologue (pc))
extern CORE_ADDR tic80_skip_prologue PARAMS ((CORE_ADDR pc));
extern CORE_ADDR tic80_skip_prologue PARAMS ((CORE_ADDR pc));
 
 
/* Immediately after a function call, return the saved pc.
/* Immediately after a function call, return the saved pc.
   Can't always go through the frames for this because on some machines
   Can't always go through the frames for this because on some machines
   the new frame is not set up until the new function executes
   the new frame is not set up until the new function executes
   some instructions.  */
   some instructions.  */
 
 
#define SAVED_PC_AFTER_CALL(frame) read_register (LR_REGNUM)
#define SAVED_PC_AFTER_CALL(frame) read_register (LR_REGNUM)
 
 
/* Describe the pointer in each stack frame to the previous stack frame
/* Describe the pointer in each stack frame to the previous stack frame
   (its caller).  */
   (its caller).  */
 
 
/* FRAME_CHAIN takes a frame's nominal address
/* FRAME_CHAIN takes a frame's nominal address
   and produces the frame's chain-pointer. */
   and produces the frame's chain-pointer. */
 
 
#define FRAME_CHAIN(thisframe) (CORE_ADDR) tic80_frame_chain (thisframe)
#define FRAME_CHAIN(thisframe) (CORE_ADDR) tic80_frame_chain (thisframe)
extern CORE_ADDR tic80_frame_chain PARAMS ((struct frame_info *));
extern CORE_ADDR tic80_frame_chain PARAMS ((struct frame_info *));
 
 
#define FRAME_SAVED_PC(FRAME)   tic80_frame_saved_pc (FRAME)
#define FRAME_SAVED_PC(FRAME)   tic80_frame_saved_pc (FRAME)
extern CORE_ADDR tic80_frame_saved_pc PARAMS ((struct frame_info *));
extern CORE_ADDR tic80_frame_saved_pc PARAMS ((struct frame_info *));
 
 
/* Store the address of the place in which to copy the structure the
/* Store the address of the place in which to copy the structure the
   subroutine will return.  This is called from call_function.
   subroutine will return.  This is called from call_function.
 
 
   We store structs through a pointer passed in R2 */
   We store structs through a pointer passed in R2 */
 
 
#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)    \
#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)    \
        write_register (ARG0_REGNUM, STRUCT_ADDR)
        write_register (ARG0_REGNUM, STRUCT_ADDR)
 
 
/* Extract from an array REGBUF containing the (raw) register state
/* Extract from an array REGBUF containing the (raw) register state
   a function return value of type TYPE, and copy that, in virtual format,
   a function return value of type TYPE, and copy that, in virtual format,
   into VALBUF.  */
   into VALBUF.  */
 
 
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
  memcpy ((VALBUF), \
  memcpy ((VALBUF), \
          (char *)(REGBUF) + REGISTER_BYTE (RET_REGNUM) + \
          (char *)(REGBUF) + REGISTER_BYTE (RET_REGNUM) + \
          ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
          ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
          TYPE_LENGTH (TYPE))
          TYPE_LENGTH (TYPE))
 
 
/* Write into appropriate registers a function return value
/* Write into appropriate registers a function return value
   of type TYPE, given in virtual format.  */
   of type TYPE, given in virtual format.  */
 
 
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
  write_register_bytes(REGISTER_BYTE (RET_REGNUM) + \
  write_register_bytes(REGISTER_BYTE (RET_REGNUM) + \
                       ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
                       ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
                       (VALBUF), TYPE_LENGTH (TYPE));
                       (VALBUF), TYPE_LENGTH (TYPE));
 
 
 
 
 
 
/* PUSH_ARGUMENTS */
/* PUSH_ARGUMENTS */
extern CORE_ADDR tic80_push_arguments PARAMS ((int nargs,
extern CORE_ADDR tic80_push_arguments PARAMS ((int nargs,
                                               struct value ** args,
                                               struct value ** args,
                                               CORE_ADDR sp,
                                               CORE_ADDR sp,
                                               unsigned char struct_return,
                                               unsigned char struct_return,
                                               CORE_ADDR struct_addr));
                                               CORE_ADDR struct_addr));
 
 
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
  (tic80_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
  (tic80_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
 
 
/* PUSH_RETURN_ADDRESS */
/* PUSH_RETURN_ADDRESS */
extern CORE_ADDR tic80_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
extern CORE_ADDR tic80_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
#define PUSH_RETURN_ADDRESS(PC, SP)     tic80_push_return_address (PC, SP)
#define PUSH_RETURN_ADDRESS(PC, SP)     tic80_push_return_address (PC, SP)
 
 
/* override the standard get_saved_register function with
/* override the standard get_saved_register function with
   one that takes account of generic CALL_DUMMY frames */
   one that takes account of generic CALL_DUMMY frames */
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
      generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
      generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
 
 
#define USE_GENERIC_DUMMY_FRAMES 1
#define USE_GENERIC_DUMMY_FRAMES 1
#define CALL_DUMMY                   {0}
#define CALL_DUMMY                   {0}
#define CALL_DUMMY_LENGTH            (0)
#define CALL_DUMMY_LENGTH            (0)
#define CALL_DUMMY_START_OFFSET      (0)
#define CALL_DUMMY_START_OFFSET      (0)
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
#define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
#define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
#define CALL_DUMMY_ADDRESS()         entry_point_address ()
#define CALL_DUMMY_ADDRESS()         entry_point_address ()
 
 
/* generic dummy frame stuff */
/* generic dummy frame stuff */
 
 
#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
 
 
#endif /* TM_TIC80_H */
#endif /* TM_TIC80_H */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.