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