1 |
106 |
markom |
/* Parameters for execution on a Motorola MCore.
|
2 |
|
|
Copyright (C) 1995 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is part of GDB.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
19 |
|
|
Boston, MA 02111-1307, USA. */
|
20 |
|
|
|
21 |
|
|
/* The mcore is little endian (by default) */
|
22 |
|
|
#define TARGET_BYTE_ORDER_DEFAULT LITTLE_ENDIAN
|
23 |
|
|
|
24 |
|
|
/* All registers are 32 bits */
|
25 |
|
|
#define REGISTER_SIZE 4
|
26 |
|
|
#define MAX_REGISTER_RAW_SIZE 4
|
27 |
|
|
|
28 |
|
|
#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
|
29 |
|
|
|
30 |
|
|
#define REGISTER_BYTE(REG) ((REG) * REGISTER_SIZE)
|
31 |
|
|
#define REGISTER_VIRTUAL_SIZE(REG) 4
|
32 |
|
|
#define REGISTER_RAW_SIZE(REG) 4
|
33 |
|
|
|
34 |
|
|
#define MAX_REGISTER_VIRTUAL_SIZE 4
|
35 |
|
|
|
36 |
|
|
#define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
|
37 |
|
|
|
38 |
|
|
extern char *mcore_register_names[];
|
39 |
|
|
#define REGISTER_NAME(I) mcore_register_names[I]
|
40 |
|
|
|
41 |
|
|
/* Registers. The Motorola MCore contains:
|
42 |
|
|
|
43 |
|
|
16 32-bit general purpose registers (r0-r15)
|
44 |
|
|
16 32-bit alternate file registers (ar0-ar15)
|
45 |
|
|
32 32-bit control registers (cr0-cr31)
|
46 |
|
|
+ 1 pc
|
47 |
|
|
------
|
48 |
|
|
65 registers */
|
49 |
|
|
#define NUM_REGS 65
|
50 |
|
|
#define PC_REGNUM 64
|
51 |
|
|
#define SP_REGNUM 0
|
52 |
|
|
#define FP_REGNUM (SP_REGNUM)
|
53 |
|
|
#define PR_REGNUM 15
|
54 |
|
|
#define FIRST_ARGREG 2
|
55 |
|
|
#define LAST_ARGREG 7
|
56 |
|
|
#define RETVAL_REGNUM 2
|
57 |
|
|
|
58 |
|
|
/* Offset from address of function to start of its code.
|
59 |
|
|
Zero on most machines. */
|
60 |
|
|
#define FUNCTION_START_OFFSET 0
|
61 |
|
|
|
62 |
|
|
#define DECR_PC_AFTER_BREAK 0
|
63 |
|
|
|
64 |
|
|
/* BREAKPOINT_FROM_PC uses the program counter value to determine
|
65 |
|
|
the breakpoint that should be used. */
|
66 |
|
|
extern breakpoint_from_pc_fn mcore_breakpoint_from_pc;
|
67 |
|
|
#define BREAKPOINT_FROM_PC(PCPTR, LENPTR) mcore_breakpoint_from_pc (PCPTR, LENPTR)
|
68 |
|
|
|
69 |
|
|
#define INNER_THAN(LHS,RHS) ((LHS) < (RHS))
|
70 |
|
|
|
71 |
|
|
#define SAVED_PC_AFTER_CALL(FRAME) read_register (PR_REGNUM)
|
72 |
|
|
|
73 |
|
|
struct frame_info;
|
74 |
|
|
struct type;
|
75 |
|
|
struct value;
|
76 |
|
|
|
77 |
|
|
extern void mcore_init_extra_frame_info (struct frame_info *fi);
|
78 |
|
|
#define INIT_EXTRA_FRAME_INFO(FROMLEAF, FI) mcore_init_extra_frame_info ((FI))
|
79 |
|
|
#define INIT_FRAME_PC /* Not necessary */
|
80 |
|
|
#define FRAME_INIT_SAVED_REGS(FI) /* handled by init_extra_frame_info */
|
81 |
|
|
|
82 |
|
|
extern CORE_ADDR mcore_frame_chain (struct frame_info *fi);
|
83 |
|
|
#define FRAME_CHAIN(FI) mcore_frame_chain ((FI))
|
84 |
|
|
#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid ((FP), (FI))
|
85 |
|
|
|
86 |
|
|
extern CORE_ADDR mcore_frame_saved_pc (struct frame_info *);
|
87 |
|
|
#define FRAME_SAVED_PC(FI) (mcore_frame_saved_pc ((FI)))
|
88 |
|
|
|
89 |
|
|
/* Extracting/storing return values. */
|
90 |
|
|
extern void mcore_store_return_value (struct type *type, char *valbuf);
|
91 |
|
|
#define STORE_RETURN_VALUE(TYPE, VALBUF) mcore_store_return_value ((TYPE), (VALBUF))
|
92 |
|
|
|
93 |
|
|
extern void mcore_extract_return_value (struct type *type, char *regbut, char *valbuf);
|
94 |
|
|
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
|
95 |
|
|
mcore_extract_return_value ((TYPE), (REGBUF), (VALBUF));
|
96 |
|
|
|
97 |
|
|
#define STORE_STRUCT_RETURN(ADDR, SP) /* handled by mcore_push_arguments */
|
98 |
|
|
|
99 |
|
|
extern CORE_ADDR mcore_extract_struct_value_address (char *regbuf);
|
100 |
|
|
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
|
101 |
|
|
mcore_extract_struct_value_address (REGBUF)
|
102 |
|
|
|
103 |
|
|
extern CORE_ADDR mcore_skip_prologue (CORE_ADDR pc);
|
104 |
|
|
#define SKIP_PROLOGUE(PC) (PC) = mcore_skip_prologue ((PC))
|
105 |
|
|
|
106 |
|
|
#define FRAME_ARGS_SKIP 0
|
107 |
|
|
extern CORE_ADDR mcore_frame_args_address (struct frame_info *fi);
|
108 |
|
|
#define FRAME_ARGS_ADDRESS(FI) mcore_frame_args_address ((FI))
|
109 |
|
|
extern CORE_ADDR mcore_frame_locals_address (struct frame_info *fi);
|
110 |
|
|
#define FRAME_LOCALS_ADDRESS(FI) mcore_frame_locals_address ((FI))
|
111 |
|
|
#define FRAME_NUM_ARGS(FI) (-1)
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
extern void mcore_pop_frame (struct frame_info *fi);
|
115 |
|
|
#define POP_FRAME mcore_pop_frame (get_current_frame ())
|
116 |
|
|
|
117 |
|
|
#define USE_GENERIC_DUMMY_FRAMES 1
|
118 |
|
|
#define CALL_DUMMY {0}
|
119 |
|
|
#define CALL_DUMMY_START_OFFSET (0)
|
120 |
|
|
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
|
121 |
|
|
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
|
122 |
|
|
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
|
123 |
|
|
#define CALL_DUMMY_ADDRESS() entry_point_address ()
|
124 |
|
|
#define SIZEOF_CALL_DUMMY_WORDS 0
|
125 |
|
|
#define SAVE_DUMMY_FRAME_TOS(SP) generic_save_dummy_frame_tos (SP)
|
126 |
|
|
|
127 |
|
|
extern CORE_ADDR mcore_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
|
128 |
|
|
#define PUSH_RETURN_ADDRESS(PC, SP) mcore_push_return_address (PC, SP)
|
129 |
|
|
|
130 |
|
|
#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
|
131 |
|
|
|
132 |
|
|
extern CORE_ADDR mcore_push_arguments PARAMS ((int, struct value **, CORE_ADDR,
|
133 |
|
|
unsigned char, CORE_ADDR));
|
134 |
|
|
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
|
135 |
|
|
(SP) = mcore_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
|
136 |
|
|
|
137 |
|
|
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
|
138 |
|
|
|
139 |
|
|
/* MCore will never pass a sturcture by reference. It will always be split
|
140 |
|
|
between registers and stack. */
|
141 |
|
|
#define REG_STRUCT_HAS_ADDR(GCC_P, TYPE) 0
|
142 |
|
|
|
143 |
|
|
extern use_struct_convention_fn mcore_use_struct_convention;
|
144 |
|
|
#define USE_STRUCT_CONVENTION(GCC_P, TYPE) mcore_use_struct_convention (GCC_P, TYPE)
|
145 |
|
|
|
146 |
|
|
/* override the default get_saved_register function with
|
147 |
|
|
one that takes account of generic CALL_DUMMY frames */
|
148 |
|
|
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
|
149 |
|
|
generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
|
150 |
|
|
|
151 |
|
|
/* Cons up virtual frame pointer for trace */
|
152 |
|
|
extern void mcore_virtual_frame_pointer PARAMS ((CORE_ADDR, long *, long *));
|
153 |
|
|
#define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \
|
154 |
|
|
mcore_virtual_frame_pointer ((PC), (REGP), (OFFP))
|
155 |
|
|
|
156 |
|
|
/* MCore can be bi-endian. */
|
157 |
|
|
#define TARGET_BYTE_ORDER_SELECTABLE_P 1
|
158 |
|
|
|
159 |
|
|
/* For PE, gcc will tell us what th real type of
|
160 |
|
|
arguments are when it promotes arguments. */
|
161 |
|
|
#define BELIEVE_PCC_PROMOTION 1
|