⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tm-sparc.h

📁 arm-linux-gcc编译器
💻 H
📖 第 1 页 / 共 2 页
字号:
   it ends.  Hence the following.  This part of the frame cache   structure should be checked before it is assumed that this frame's   bottom is in the stack pointer.   If there isn't a frame below this one, the bottom of this frame is   in the stack pointer.   If there is a frame below this one, and the frame pointers are   identical, it's a leaf frame and the bottoms are the same also.   Otherwise the bottom of this frame is the top of the next frame.   The bottom field is misnamed, since it might imply that memory from   bottom to frame contains this frame.  That need not be true if   stack frames are allocated in different segments (e.g. some on a   stack, some on a heap in the data segment).   GCC 2.6 and later can generate ``flat register window'' code that   makes frames by explicitly saving those registers that need to be   saved.  %i7 is used as the frame pointer, and the frame is laid out so   that flat and non-flat calls can be intermixed freely within a   program.  Unfortunately for GDB, this means it must detect and record   the flatness of frames.   Since the prologue in a flat frame also tells us where fp and pc   have been stashed (the frame is of variable size, so their location   is not fixed), it's convenient to record them in the frame info.  */#define EXTRA_FRAME_INFO  \  CORE_ADDR bottom;  \  int in_prologue; \  int flat;  \  /* Following fields only relevant for flat frames.  */ \  CORE_ADDR pc_addr;  \  CORE_ADDR fp_addr;  \  /* Add this to ->frame to get the value of the stack pointer at the */ \  /* time of the register saves.  */ \  int sp_offset;#define FRAME_INIT_SAVED_REGS(fp)	/*no-op */#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \  sparc_init_extra_frame_info (fromleaf, fci)extern void sparc_init_extra_frame_info PARAMS ((int, struct frame_info *));#define	PRINT_EXTRA_FRAME_INFO(fi) \  { \    if ((fi) && (fi)->flat) \      printf_filtered (" flat, pc saved at 0x%s, fp saved at 0x%s\n", \                       paddr_nz ((fi)->pc_addr), paddr_nz ((fi)->fp_addr)); \  }#define FRAME_CHAIN(thisframe) (sparc_frame_chain (thisframe))extern CORE_ADDR sparc_frame_chain PARAMS ((struct frame_info *));/* INIT_EXTRA_FRAME_INFO needs the PC to detect flat frames.  */#define	INIT_FRAME_PC(fromleaf, prev)	/* nothing */#define INIT_FRAME_PC_FIRST(fromleaf, prev) \  (prev)->pc = ((fromleaf) ? SAVED_PC_AFTER_CALL ((prev)->next) : \	      (prev)->next ? FRAME_SAVED_PC ((prev)->next) : read_pc ());/* Define other aspects of the stack frame.  *//* A macro that tells us whether the function invocation represented   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_look_for_prologue(FI))/* The location of I0 w.r.t SP.  This is actually dependent on how the system's   window overflow/underflow routines are written.  Most vendors save the L regs   followed by the I regs (at the higher address).  Some vendors get it wrong. */#define	FRAME_SAVED_L0	0#define	FRAME_SAVED_I0	(8 * REGISTER_RAW_SIZE (L0_REGNUM))/* Where is the PC for a specific frame */#define FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME)extern CORE_ADDR sparc_frame_saved_pc PARAMS ((struct frame_info *));/* If the argument is on the stack, it will be here.  */#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)#define FRAME_STRUCT_ARGS_ADDRESS(fi) ((fi)->frame)#define FRAME_LOCALS_ADDRESS(fi) ((fi)->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   now that the C compiler delays popping them.  */#define FRAME_NUM_ARGS(fi) (-1)/* Return number of bytes at start of arglist that are not really args.  */#define FRAME_ARGS_SKIP 68/* Things needed for making the inferior call functions.  *//* * First of all, let me give my opinion of what the DUMMY_FRAME * actually looks like. * *               |                                 | *               |                                 | *               + - - - - - - - - - - - - - - - - +<-- fp (level 0) *               |                                 | *               |                                 | *               |                                 | *               |                                 | *               |  Frame of innermost program     | *               |           function              | *               |                                 | *               |                                 | *               |                                 | *               |                                 | *               |                                 | *               |---------------------------------|<-- sp (level 0), fp (c) *               |                                 | *     DUMMY     |             fp0-31              | *               |                                 | *               |             ------              |<-- fp - 0x80 *     FRAME     |              g0-7               |<-- fp - 0xa0 *               |              i0-7               |<-- fp - 0xc0 *               |             other               |<-- fp - 0xe0 *               |               ?                 | *               |               ?                 | *               |---------------------------------|<-- sp' = fp - 0x140 *               |                                 | * xcution start |                                 | * sp' + 0x94 -->|        CALL_DUMMY (x code)      | *               |                                 | *               |                                 | *               |---------------------------------|<-- sp'' = fp - 0x200 *               |  align sp to 8 byte boundary    | *               |     ==> args to fn <==          | *  Room for     |                                 | * i & l's + agg | CALL_DUMMY_STACK_ADJUST = 0x0x44| *               |---------------------------------|<-- final sp (variable) *               |                                 | *               |   Where function called will    | *               |           build frame.          | *               |                                 | *               |                                 | * *   I understand everything in this picture except what the space * between fp - 0xe0 and fp - 0x140 is used for.  Oh, and I don't * understand why there's a large chunk of CALL_DUMMY that never gets * executed (its function is superceeded by PUSH_DUMMY_FRAME; they * are designed to do the same thing). * *   PUSH_DUMMY_FRAME saves the registers above sp' and pushes the * register file stack down one. * *   call_function then writes CALL_DUMMY, pushes the args onto the * stack, and adjusts the stack pointer. * *   run_stack_dummy then starts execution (in the middle of * CALL_DUMMY, as directed by call_function). *//* Push an empty stack frame, to record the current PC, etc.  */#define PUSH_DUMMY_FRAME	sparc_push_dummy_frame ()#define POP_FRAME	sparc_pop_frame ()void sparc_push_dummy_frame PARAMS ((void)), sparc_pop_frame PARAMS ((void));#ifndef CALL_DUMMY/* This sequence of words is the instructions   0:   bc 10 00 01     mov  %g1, %fp   4:   9d e3 80 00     save  %sp, %g0, %sp   8:   bc 10 00 02     mov  %g2, %fp   c:   be 10 00 03     mov  %g3, %i7   10:   da 03 a0 58     ld  [ %sp + 0x58 ], %o5   14:   d8 03 a0 54     ld  [ %sp + 0x54 ], %o4   18:   d6 03 a0 50     ld  [ %sp + 0x50 ], %o3   1c:   d4 03 a0 4c     ld  [ %sp + 0x4c ], %o2   20:   d2 03 a0 48     ld  [ %sp + 0x48 ], %o1   24:   40 00 00 00     call  <fun>   28:   d0 03 a0 44     ld  [ %sp + 0x44 ], %o0   2c:   01 00 00 00     nop    30:   91 d0 20 01     ta  1   34:   01 00 00 00     nop   NOTES:   * the first four instructions are necessary only on the simulator.   * this is a multiple of 8 (not only 4) bytes.   * the `call' insn is a relative, not an absolute call.   * the `nop' at the end is needed to keep the trap from   clobbering things (if NPC pointed to garbage instead). */#define CALL_DUMMY { 0xbc100001, 0x9de38000, 0xbc100002, 0xbe100003,	\		     0xda03a058, 0xd803a054, 0xd603a050, 0xd403a04c,	\		     0xd203a048, 0x40000000, 0xd003a044, 0x01000000,	\		     0x91d02001, 0x01000000 }/* Size of the call dummy in bytes. */#define CALL_DUMMY_LENGTH 0x38/* Offset within call dummy of first instruction to execute. */#define CALL_DUMMY_START_OFFSET 0/* Offset within CALL_DUMMY of the 'call' instruction. */#define CALL_DUMMY_CALL_OFFSET (CALL_DUMMY_START_OFFSET + 0x24)/* Offset within CALL_DUMMY of the 'ta 1' instruction. */#define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + 0x30)#define CALL_DUMMY_STACK_ADJUST 68#endif/* Insert the specified number of args and function address   into a call sequence of the above form stored at DUMMYNAME.  */#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ sparc_fix_call_dummy (dummyname, pc, fun, type, gcc_p)void sparc_fix_call_dummy PARAMS ((char *dummy, CORE_ADDR pc, CORE_ADDR fun,				   struct type * value_type, int using_gcc));/* The Sparc returns long doubles on the stack.  */#define RETURN_VALUE_ON_STACK(TYPE) \  (TYPE_CODE(TYPE) == TYPE_CODE_FLT \   && TYPE_LENGTH(TYPE) > 8)/* Sparc has no reliable single step ptrace call */#define SOFTWARE_SINGLE_STEP_P 1extern void sparc_software_single_step PARAMS ((unsigned int, int));#define SOFTWARE_SINGLE_STEP(sig,bp_p) sparc_software_single_step (sig,bp_p)/* We need more arguments in a frame specification for the   "frame" or "info frame" command.  */#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));/* To print every pair of float registers as a double, we use this hook.   We also print the condition code registers in a readable format   (FIXME: can expand this to all control regs).  */#undef 	PRINT_REGISTER_HOOK#define	PRINT_REGISTER_HOOK(regno)	\  sparc_print_register_hook (regno)extern void sparc_print_register_hook PARAMS ((int regno));/* Optimization for storing registers to the inferior.  The hook   DO_DEFERRED_STORES   actually executes any deferred stores.  It is called any time   we are going to proceed the child, or read its registers.   The hook CLEAR_DEFERRED_STORES is called when we want to throw   away the inferior process, e.g. when it dies or we kill it.   FIXME, this does not handle remote debugging cleanly.  */extern int deferred_stores;#define	DO_DEFERRED_STORES	\  if (deferred_stores)		\    target_store_registers (-2);#define	CLEAR_DEFERRED_STORES	\  deferred_stores = 0;/* If the current gcc for for this target does not produce correct debugging   information for float parameters, both prototyped and unprototyped, then   define this macro.  This forces gdb to  always assume that floats are   passed as doubles and then converted in the callee. */#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)/* Select the sparc disassembler */#define TM_PRINT_INSN_MACH bfd_mach_sparc/* Arguments smaller than an int must promoted to ints when synthesizing   function calls.  */#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \  (sparc_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))extern CORE_ADDR  sparc_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -