📄 tm-arm.h
字号:
/* Largest value REGISTER_RAW_SIZE can have. */#define MAX_REGISTER_RAW_SIZE FP_REGISTER_RAW_SIZE/* Largest value REGISTER_VIRTUAL_SIZE can have. */#define MAX_REGISTER_VIRTUAL_SIZE FP_REGISTER_VIRTUAL_SIZE/* Nonzero if register N requires conversion from raw format to virtual format. */extern int arm_register_convertible (unsigned int);#define REGISTER_CONVERTIBLE(REGNUM) (arm_register_convertible (REGNUM))/* Convert data from raw format for register REGNUM in buffer FROM to virtual format with type TYPE in buffer TO. */extern void arm_register_convert_to_virtual (unsigned int regnum, struct type *type, void *from, void *to);#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ arm_register_convert_to_virtual (REGNUM, TYPE, FROM, TO)/* Convert data from virtual format with type TYPE in buffer FROM to raw format for register REGNUM in buffer TO. */extern void arm_register_convert_to_raw (unsigned int regnum, struct type *type, void *from, void *to);#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ arm_register_convert_to_raw (REGNUM, TYPE, FROM, TO)/* Return the GDB type object for the "standard" data type of data in register N. */#define REGISTER_VIRTUAL_TYPE(N) \ (((unsigned)(N) - F0_REGNUM) < NUM_FREGS \ ? builtin_type_double : builtin_type_int)/* The system C compiler uses a similar structure return convention to gcc */extern use_struct_convention_fn arm_use_struct_convention;#define USE_STRUCT_CONVENTION(gcc_p, type) \ arm_use_struct_convention (gcc_p, type)/* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. */#define STORE_STRUCT_RETURN(ADDR, SP) \ write_register (A1_REGNUM, (ADDR))/* 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. */extern void arm_extract_return_value (struct type *, char[], char *);#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ arm_extract_return_value ((TYPE), (REGBUF), (VALBUF))/* Write into appropriate registers a function return value of type TYPE, given in virtual format. */extern void convert_to_extended (void *dbl, void *ptr);#define STORE_RETURN_VALUE(TYPE,VALBUF) \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) { \ char _buf[MAX_REGISTER_RAW_SIZE]; \ convert_to_extended (VALBUF, _buf); \ write_register_bytes (REGISTER_BYTE (F0_REGNUM), _buf, MAX_REGISTER_RAW_SIZE); \ } else \ write_register_bytes (0, VALBUF, 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 ((PTR)(REGBUF), REGISTER_RAW_SIZE(0)))/* Specify that for the native compiler variables for a particular lexical context are listed after the beginning LBRAC instead of before in the executables list of symbols. */#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p))/* Define other aspects of the stack frame. 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 the frame pointer from the stack pointer (for frameless functions, and when we're still in the prologue of a function with a frame) */#define EXTRA_FRAME_INFO \ struct frame_saved_regs fsr; \ int framesize; \ int frameoffset; \ int framereg;extern void arm_init_extra_frame_info (int fromleaf, struct frame_info * fi);#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ arm_init_extra_frame_info ((fromleaf), (fi))/* Return the frame address. On ARM, it is R11; on Thumb it is R7. */CORE_ADDR arm_target_read_fp (void);#define TARGET_READ_FP() arm_target_read_fp ()/* Describe the pointer in each stack frame to the previous stack frame (its caller). *//* FRAME_CHAIN takes a frame's nominal address and produces the frame's chain-pointer. However, if FRAME_CHAIN_VALID returns zero, it means the given frame is the outermost one and has no caller. */#define FRAME_CHAIN(thisframe) arm_frame_chain (thisframe)extern CORE_ADDR arm_frame_chain (struct frame_info *);extern int arm_frame_chain_valid (CORE_ADDR, struct frame_info *);#define FRAME_CHAIN_VALID(chain, thisframe) \ arm_frame_chain_valid (chain, thisframe)/* 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. Sometimes we have functions that do a little setup (like saving the vN registers with the stmdb instruction, but DO NOT set up a frame. The symbol table will report this as a prologue. However, it is important not to try to parse these partial frames as frames, or we will get really confused. So I will demand 3 instructions between the start & end of the prologue before I call it a real prologue, i.e. at least mov ip, sp, stmdb sp!, {} sub sp, ip, #4. */extern int arm_frameless_function_invocation (struct frame_info *fi);#define FRAMELESS_FUNCTION_INVOCATION(FI) \(arm_frameless_function_invocation (FI)) /* Saved Pc. */#define FRAME_SAVED_PC(FRAME) arm_frame_saved_pc (FRAME)extern CORE_ADDR arm_frame_saved_pc (struct frame_info *);#define FRAME_ARGS_ADDRESS(fi) (fi->frame)#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)/* Return number of args passed to a frame. Can return -1, meaning no way to tell. */#define FRAME_NUM_ARGS(fi) (-1)/* Return number of bytes at start of arglist that are not really args. */#define FRAME_ARGS_SKIP 0/* 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. */struct frame_saved_regs;struct frame_info;void arm_frame_find_saved_regs (struct frame_info * fi, struct frame_saved_regs * fsr);#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ arm_frame_find_saved_regs (frame_info, &(frame_saved_regs));/* Things needed for making the inferior call functions. */#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ sp = arm_push_arguments ((nargs), (args), (sp), (struct_return), (struct_addr))extern CORE_ADDR arm_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR);/* Push an empty stack frame, to record the current PC, etc. */void arm_push_dummy_frame (void);#define PUSH_DUMMY_FRAME arm_push_dummy_frame ()/* Discard from the stack the innermost frame, restoring all registers. */void arm_pop_frame (void);#define POP_FRAME arm_pop_frame ()/* This sequence of words is the instructions mov lr,pc mov pc,r4 illegal Note this is 12 bytes. */#define CALL_DUMMY {0xe1a0e00f, 0xe1a0f004, 0xe7ffdefe}#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */#define CALL_DUMMY_BREAKPOINT_OFFSET arm_call_dummy_breakpoint_offset()extern int arm_call_dummy_breakpoint_offset (void);/* 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) \ arm_fix_call_dummy ((dummyname), (pc), (fun), (nargs), (args), (type), (gcc_p))void arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value ** args, struct type * type, int gcc_p);CORE_ADDR arm_get_next_pc (CORE_ADDR pc);/* Macros for setting and testing a bit in a minimal symbol that marks it as Thumb function. The MSB of the minimal symbol's "info" field is used for this purpose. This field is already being used to store the symbol size, so the assumption is that the symbol size cannot exceed 2^31. COFF_MAKE_MSYMBOL_SPECIAL ELF_MAKE_MSYMBOL_SPECIAL These macros test whether the COFF or ELF symbol corresponds to a thumb function, and set a "special" bit in a minimal symbol to indicate that it does. MSYMBOL_SET_SPECIAL Actually sets the "special" bit. MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. MSYMBOL_SIZE Returns the size of the minimal symbol, i.e. the "info" field with the "special" bit masked out */extern int coff_sym_is_thumb (int val);#define MSYMBOL_SET_SPECIAL(msym) \ MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) | 0x80000000)#define MSYMBOL_IS_SPECIAL(msym) \ (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)#define MSYMBOL_SIZE(msym) \ ((long) MSYMBOL_INFO (msym) & 0x7fffffff)/* Thumb symbols are of type STT_LOPROC, (synonymous with STT_ARM_TFUNC) */#define ELF_MAKE_MSYMBOL_SPECIAL(sym,msym) \ { if(ELF_ST_TYPE(((elf_symbol_type *)(sym))->internal_elf_sym.st_info) == STT_LOPROC) \ MSYMBOL_SET_SPECIAL(msym); }#define COFF_MAKE_MSYMBOL_SPECIAL(val,msym) \ { if(coff_sym_is_thumb(val)) MSYMBOL_SET_SPECIAL(msym); }/* The first 0x20 bytes are the trap vectors. */#define LOWEST_PC 0x20#endif /* TM_ARM_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -