]>
Commit | Line | Data |
---|---|---|
98760eab AC |
1 | /* Definitions to make GDB target for an ARM |
2 | Copyright 1986, 1987, 1989, 1991, 1993, 1997, 1998 Free Software Foundation, Inc. | |
ade40d31 RP |
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 | |
98760eab | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
ade40d31 | 19 | |
98760eab AC |
20 | #ifdef __STDC__ /* Forward decls for prototypes */ |
21 | struct type; | |
22 | struct value; | |
23 | #endif | |
24 | ||
25 | #define TARGET_BYTE_ORDER_SELECTABLE | |
ade40d31 RP |
26 | |
27 | /* IEEE format floating point */ | |
28 | ||
29 | #define IEEE_FLOAT | |
30 | ||
98760eab AC |
31 | /* FIXME: may need a floatformat_ieee_double_bigbyte_littleword format for |
32 | BIG_ENDIAN use. -fnf */ | |
33 | ||
34 | #define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \ | |
35 | ? &floatformat_ieee_double_big \ | |
36 | : &floatformat_ieee_double_littlebyte_bigword) | |
37 | ||
38 | /* When reading symbols, we need to zap the low bit of the address, which | |
39 | may be set to 1 for Thumb functions. */ | |
40 | ||
41 | #define SMASH_TEXT_ADDRESS(addr) ((addr) &= ~0x1) | |
42 | ||
43 | /* Remove useless bits from addresses in a running program. */ | |
ade40d31 | 44 | |
98760eab AC |
45 | CORE_ADDR arm_addr_bits_remove PARAMS ((CORE_ADDR)); |
46 | ||
47 | #define ADDR_BITS_REMOVE(val) (arm_addr_bits_remove (val)) | |
ade40d31 RP |
48 | |
49 | /* Offset from address of function to start of its code. | |
50 | Zero on most machines. */ | |
51 | ||
52 | #define FUNCTION_START_OFFSET 0 | |
53 | ||
54 | /* Advance PC across any function entry prologue instructions | |
55 | to reach some "real" code. */ | |
56 | ||
98760eab AC |
57 | extern CORE_ADDR arm_skip_prologue PARAMS ((CORE_ADDR pc)); |
58 | ||
59 | #define SKIP_PROLOGUE(pc) { pc = arm_skip_prologue (pc); } | |
ade40d31 RP |
60 | |
61 | /* Immediately after a function call, return the saved pc. | |
62 | Can't always go through the frames for this because on some machines | |
63 | the new frame is not set up until the new function executes | |
64 | some instructions. */ | |
65 | ||
98760eab AC |
66 | #define SAVED_PC_AFTER_CALL(frame) arm_saved_pc_after_call (frame) |
67 | struct frame_info; | |
68 | extern CORE_ADDR arm_saved_pc_after_call PARAMS ((struct frame_info *)); | |
ade40d31 RP |
69 | |
70 | /* I don't know the real values for these. */ | |
71 | #define TARGET_UPAGES UPAGES | |
72 | #define TARGET_NBPG NBPG | |
73 | ||
74 | /* Address of end of stack space. */ | |
75 | ||
76 | #define STACK_END_ADDR (0x01000000 - (TARGET_UPAGES * TARGET_NBPG)) | |
77 | ||
78 | /* Stack grows downward. */ | |
79 | ||
3a0c96a9 | 80 | #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) |
ade40d31 | 81 | |
98760eab AC |
82 | /* !!!! if we're using RDP, then we're inserting breakpoints and storing |
83 | their handles instread of what was in memory. It is nice that | |
84 | this is the same size as a handle - otherwise remote-rdp will | |
85 | have to change. */ | |
86 | ||
98760eab AC |
87 | /* BREAKPOINT_FROM_PC uses the program counter value to determine whether a |
88 | 16- or 32-bit breakpoint should be used. It returns a pointer | |
89 | to a string of bytes that encode a breakpoint instruction, stores | |
90 | the length of the string to *lenptr, and adjusts the pc (if necessary) to | |
91 | point to the actual memory location where the breakpoint should be | |
92 | inserted. */ | |
93 | ||
679ce731 | 94 | extern breakpoint_from_pc_fn arm_breakpoint_from_pc; |
98760eab | 95 | #define BREAKPOINT_FROM_PC(pcptr, lenptr) arm_breakpoint_from_pc (pcptr, lenptr) |
ade40d31 RP |
96 | |
97 | /* Amount PC must be decremented by after a breakpoint. | |
98 | This is often the number of bytes in BREAKPOINT | |
99 | but not always. */ | |
100 | ||
101 | #define DECR_PC_AFTER_BREAK 0 | |
102 | ||
ade40d31 RP |
103 | /* code to execute to print interesting information about the |
104 | * floating point processor (if any) | |
105 | * No need to define if there is nothing to do. | |
106 | */ | |
107 | #define FLOAT_INFO { arm_float_info (); } | |
108 | ||
98760eab AC |
109 | /* Say how long (ordinary) registers are. This is a piece of bogosity |
110 | used in push_word and a few other places; REGISTER_RAW_SIZE is the | |
111 | real way to know how big a register is. */ | |
ade40d31 | 112 | |
98760eab | 113 | #define REGISTER_SIZE 4 |
ade40d31 RP |
114 | |
115 | /* Number of machine registers */ | |
116 | ||
117 | /* Note: I make a fake copy of the pc in register 25 (calling it ps) so | |
118 | that I can clear the status bits from pc (register 15) */ | |
119 | ||
120 | #define NUM_REGS 26 | |
121 | ||
122 | /* Initializer for an array of names of registers. | |
123 | There should be NUM_REGS strings in this initializer. */ | |
124 | ||
98760eab AC |
125 | #define ORIGINAL_REGISTER_NAMES \ |
126 | { "a1", "a2", "a3", "a4", /* 0 1 2 3 */ \ | |
127 | "v1", "v2", "v3", "v4", /* 4 5 6 7 */ \ | |
128 | "v5", "v6", "sl", "fp", /* 8 9 10 11 */ \ | |
129 | "ip", "sp", "lr", "pc", /* 12 13 14 15 */ \ | |
130 | "f0", "f1", "f2", "f3", /* 16 17 18 19 */ \ | |
131 | "f4", "f5", "f6", "f7", /* 20 21 22 23 */ \ | |
132 | "fps","ps" } /* 24 25 */ | |
133 | ||
134 | /* These names are the ones which gcc emits, and | |
135 | I find them less confusing. Toggle between them | |
136 | using the `othernames' command. */ | |
137 | ||
138 | #define ADDITIONAL_REGISTER_NAMES \ | |
139 | { "r0", "r1", "r2", "r3", /* 0 1 2 3 */ \ | |
140 | "r4", "r5", "r6", "r7", /* 4 5 6 7 */ \ | |
141 | "r8", "r9", "sl", "fp", /* 8 9 10 11 */ \ | |
142 | "ip", "sp", "lr", "pc", /* 12 13 14 15 */ \ | |
143 | "f0", "f1", "f2", "f3", /* 16 17 18 19 */ \ | |
144 | "f4", "f5", "f6", "f7", /* 20 21 22 23 */ \ | |
145 | "fps","ps" } /* 24 25 */ | |
146 | ||
147 | #define REGISTER_NAMES ADDITIONAL_REGISTER_NAMES | |
148 | #ifndef REGISTER_NAMES | |
149 | #define REGISTER_NAMES ORIGINAL_REGISTER_NAMES | |
150 | #endif | |
ade40d31 RP |
151 | |
152 | /* Register numbers of various important registers. | |
153 | Note that some of these values are "real" register numbers, | |
154 | and correspond to the general registers of the machine, | |
155 | and some are "phony" register numbers which are too large | |
156 | to be actual register numbers as far as the user is concerned | |
157 | but do serve to get the desired values when passed to read_register. */ | |
158 | ||
98760eab AC |
159 | #define A1_REGNUM 0 /* first integer-like argument */ |
160 | #define A4_REGNUM 3 /* last integer-like argument */ | |
ade40d31 RP |
161 | #define AP_REGNUM 11 |
162 | #define FP_REGNUM 11 /* Contains address of executing stack frame */ | |
163 | #define SP_REGNUM 13 /* Contains address of top of stack */ | |
164 | #define LR_REGNUM 14 /* address to return to from a function call */ | |
165 | #define PC_REGNUM 15 /* Contains program counter */ | |
166 | #define F0_REGNUM 16 /* first floating point register */ | |
98760eab AC |
167 | #define F3_REGNUM 19 /* last floating point argument register */ |
168 | #define F7_REGNUM 23 /* last floating point register */ | |
ade40d31 RP |
169 | #define FPS_REGNUM 24 /* floating point status register */ |
170 | #define PS_REGNUM 25 /* Contains processor status */ | |
171 | ||
98760eab AC |
172 | #define THUMB_FP_REGNUM 7 /* R7 is frame register on Thumb */ |
173 | ||
174 | #define ARM_NUM_ARG_REGS 4 | |
175 | #define ARM_LAST_ARG_REGNUM A4_REGNUM | |
176 | #define ARM_NUM_FP_ARG_REGS 4 | |
177 | #define ARM_LAST_FP_ARG_REGNUM F3_REGNUM | |
178 | ||
179 | /* Instruction condition field values. */ | |
180 | #define INST_EQ 0x0 | |
181 | #define INST_NE 0x1 | |
182 | #define INST_CS 0x2 | |
183 | #define INST_CC 0x3 | |
184 | #define INST_MI 0x4 | |
185 | #define INST_PL 0x5 | |
186 | #define INST_VS 0x6 | |
187 | #define INST_VC 0x7 | |
188 | #define INST_HI 0x8 | |
189 | #define INST_LS 0x9 | |
190 | #define INST_GE 0xa | |
191 | #define INST_LT 0xb | |
192 | #define INST_GT 0xc | |
193 | #define INST_LE 0xd | |
194 | #define INST_AL 0xe | |
195 | #define INST_NV 0xf | |
196 | ||
197 | #define FLAG_N 0x80000000 | |
198 | #define FLAG_Z 0x40000000 | |
199 | #define FLAG_C 0x20000000 | |
200 | #define FLAG_V 0x10000000 | |
201 | ||
202 | ||
ade40d31 RP |
203 | |
204 | /* Total amount of space needed to store our copies of the machine's | |
205 | register state, the array `registers'. */ | |
206 | #define REGISTER_BYTES (16*4 + 12*8 + 4 + 4) | |
207 | ||
208 | /* Index within `registers' of the first byte of the space for | |
209 | register N. */ | |
210 | ||
211 | #define REGISTER_BYTE(N) (((N) < F0_REGNUM) ? (N)*4 : \ | |
212 | (((N) < PS_REGNUM) ? 16*4 + ((N) - 16)*12 : \ | |
213 | 16*4 + 8*12 + ((N) - FPS_REGNUM) * 4)) | |
214 | ||
215 | /* Number of bytes of storage in the actual machine representation | |
216 | for register N. On the vax, all regs are 4 bytes. */ | |
217 | ||
218 | #define REGISTER_RAW_SIZE(N) (((N) < F0_REGNUM || (N) >= FPS_REGNUM) ? 4 : 12) | |
219 | ||
220 | /* Number of bytes of storage in the program's representation | |
221 | for register N. On the vax, all regs are 4 bytes. */ | |
222 | ||
223 | #define REGISTER_VIRTUAL_SIZE(N) (((N) < F0_REGNUM || (N) >= FPS_REGNUM) ? 4 : 8) | |
224 | ||
225 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
226 | ||
98760eab | 227 | #define MAX_REGISTER_RAW_SIZE 12 |
ade40d31 RP |
228 | |
229 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ | |
230 | ||
231 | #define MAX_REGISTER_VIRTUAL_SIZE 8 | |
232 | ||
233 | /* Nonzero if register N requires conversion | |
234 | from raw format to virtual format. */ | |
ade40d31 RP |
235 | #define REGISTER_CONVERTIBLE(N) ((unsigned)(N) - F0_REGNUM < 8) |
236 | ||
98760eab AC |
237 | /* Convert data from raw format for register REGNUM in buffer FROM |
238 | to virtual format with type TYPE in buffer TO. */ | |
ade40d31 | 239 | |
98760eab AC |
240 | #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ |
241 | { \ | |
242 | double val; \ | |
243 | convert_from_extended ((FROM), & val); \ | |
244 | store_floating ((TO), TYPE_LENGTH (TYPE), val); \ | |
245 | } | |
ade40d31 | 246 | |
98760eab AC |
247 | /* Convert data from virtual format with type TYPE in buffer FROM |
248 | to raw format for register REGNUM in buffer TO. */ | |
ade40d31 | 249 | |
98760eab AC |
250 | #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ |
251 | { \ | |
252 | double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \ | |
253 | convert_to_extended (&val, (TO)); \ | |
254 | } | |
ade40d31 RP |
255 | /* Return the GDB type object for the "standard" data type |
256 | of data in register N. */ | |
257 | ||
258 | #define REGISTER_VIRTUAL_TYPE(N) \ | |
259 | (((unsigned)(N) - F0_REGNUM) < 8 ? builtin_type_double : builtin_type_int) | |
260 | \f | |
261 | /* The system C compiler uses a similar structure return convention to gcc */ | |
98760eab AC |
262 | extern use_struct_convention_fn arm_use_struct_convention; |
263 | #define USE_STRUCT_CONVENTION(gcc_p, type) arm_use_struct_convention (gcc_p, type) | |
ade40d31 RP |
264 | |
265 | /* Store the address of the place in which to copy the structure the | |
266 | subroutine will return. This is called from call_function. */ | |
267 | ||
268 | #define STORE_STRUCT_RETURN(ADDR, SP) \ | |
269 | { write_register (0, (ADDR)); } | |
270 | ||
271 | /* Extract from an array REGBUF containing the (raw) register state | |
272 | a function return value of type TYPE, and copy that, in virtual format, | |
273 | into VALBUF. */ | |
274 | ||
275 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
276 | if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ | |
98760eab | 277 | convert_from_extended (REGBUF + REGISTER_BYTE (F0_REGNUM), VALBUF); \ |
ade40d31 RP |
278 | else \ |
279 | memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE)) | |
280 | ||
281 | /* Write into appropriate registers a function return value | |
282 | of type TYPE, given in virtual format. */ | |
283 | ||
284 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
285 | if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) { \ | |
286 | char _buf[MAX_REGISTER_RAW_SIZE]; \ | |
98760eab | 287 | convert_to_extended (VALBUF, _buf); \ |
ade40d31 RP |
288 | write_register_bytes (REGISTER_BYTE (F0_REGNUM), _buf, MAX_REGISTER_RAW_SIZE); \ |
289 | } else \ | |
290 | write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) | |
291 | ||
292 | /* Extract from an array REGBUF containing the (raw) register state | |
293 | the address in which a function should return its structure value, | |
294 | as a CORE_ADDR (or an expression that can be used as one). */ | |
295 | ||
296 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) | |
297 | ||
298 | /* Specify that for the native compiler variables for a particular | |
299 | lexical context are listed after the beginning LBRAC instead of | |
300 | before in the executables list of symbols. */ | |
301 | #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p)) | |
302 | ||
303 | \f | |
98760eab AC |
304 | /* Define other aspects of the stack frame. |
305 | We keep the offsets of all saved registers, 'cause we need 'em a lot! | |
306 | We also keep the current size of the stack frame, and the offset of | |
307 | the frame pointer from the stack pointer (for frameless functions, and | |
308 | when we're still in the prologue of a function with a frame) */ | |
309 | ||
310 | #define EXTRA_FRAME_INFO \ | |
311 | struct frame_saved_regs fsr; \ | |
312 | int framesize; \ | |
313 | int frameoffset; \ | |
314 | int framereg; | |
315 | ||
316 | extern void arm_init_extra_frame_info PARAMS ((struct frame_info *fi)); | |
317 | #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) arm_init_extra_frame_info (fi) | |
318 | ||
319 | /* Return the frame address. On ARM, it is R11; on Thumb it is R7. */ | |
320 | CORE_ADDR arm_target_read_fp PARAMS ((void)); | |
321 | #define TARGET_READ_FP() arm_target_read_fp () | |
322 | ||
ade40d31 RP |
323 | /* Describe the pointer in each stack frame to the previous stack frame |
324 | (its caller). */ | |
325 | ||
326 | /* FRAME_CHAIN takes a frame's nominal address | |
327 | and produces the frame's chain-pointer. | |
328 | ||
329 | However, if FRAME_CHAIN_VALID returns zero, | |
330 | it means the given frame is the outermost one and has no caller. */ | |
331 | ||
98760eab AC |
332 | #define FRAME_CHAIN(thisframe) (CORE_ADDR) arm_frame_chain (thisframe) |
333 | extern CORE_ADDR arm_frame_chain PARAMS ((struct frame_info *)); | |
ade40d31 | 334 | |
98760eab | 335 | #define LOWEST_PC 0x20 /* the first 0x20 bytes are the trap vectors. */ |
ade40d31 RP |
336 | |
337 | #define FRAME_CHAIN_VALID(chain, thisframe) \ | |
98760eab | 338 | (chain != 0 && (FRAME_SAVED_PC (thisframe) >= LOWEST_PC)) |
ade40d31 RP |
339 | |
340 | /* Define other aspects of the stack frame. */ | |
341 | ||
342 | /* A macro that tells us whether the function invocation represented | |
343 | by FI does not have a frame on the stack associated with it. If it | |
344 | does not, FRAMELESS is set to 1, else 0. */ | |
345 | #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ | |
346 | { \ | |
347 | CORE_ADDR func_start, after_prologue; \ | |
348 | func_start = (get_pc_function_start ((FI)->pc) + \ | |
349 | FUNCTION_START_OFFSET); \ | |
350 | after_prologue = func_start; \ | |
351 | SKIP_PROLOGUE (after_prologue); \ | |
352 | (FRAMELESS) = (after_prologue == func_start); \ | |
353 | } | |
354 | ||
355 | /* Saved Pc. */ | |
356 | ||
98760eab AC |
357 | #define FRAME_SAVED_PC(FRAME) arm_frame_saved_pc (FRAME) |
358 | extern CORE_ADDR arm_frame_saved_pc PARAMS ((struct frame_info *)); | |
ade40d31 RP |
359 | |
360 | #define FRAME_ARGS_ADDRESS(fi) (fi->frame) | |
361 | ||
362 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) | |
363 | ||
364 | /* Return number of args passed to a frame. | |
365 | Can return -1, meaning no way to tell. */ | |
366 | ||
367 | #define FRAME_NUM_ARGS(numargs, fi) (numargs = -1) | |
368 | ||
369 | /* Return number of bytes at start of arglist that are not really args. */ | |
370 | ||
371 | #define FRAME_ARGS_SKIP 0 | |
372 | ||
373 | /* Put here the code to store, into a struct frame_saved_regs, | |
374 | the addresses of the saved registers of frame described by FRAME_INFO. | |
375 | This includes special registers such as pc and fp saved in special | |
376 | ways in the stack frame. sp is even more special: | |
377 | the address we return for it IS the sp for the next frame. */ | |
378 | ||
98760eab AC |
379 | struct frame_saved_regs; |
380 | struct frame_info; | |
381 | void frame_find_saved_regs PARAMS((struct frame_info *fi, | |
382 | struct frame_saved_regs *fsr)); | |
383 | ||
ade40d31 | 384 | #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ |
98760eab AC |
385 | arm_frame_find_saved_regs (frame_info, &(frame_saved_regs)); |
386 | ||
ade40d31 RP |
387 | \f |
388 | /* Things needed for making the inferior call functions. */ | |
389 | ||
98760eab AC |
390 | #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ |
391 | sp = arm_push_arguments ((nargs), (args), (sp), (struct_return), (struct_addr)) | |
392 | extern CORE_ADDR | |
393 | arm_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR)); | |
394 | ||
ade40d31 RP |
395 | /* Push an empty stack frame, to record the current PC, etc. */ |
396 | ||
98760eab AC |
397 | void arm_push_dummy_frame PARAMS ((void)); |
398 | ||
399 | #define PUSH_DUMMY_FRAME arm_push_dummy_frame () | |
ade40d31 RP |
400 | |
401 | /* Discard from the stack the innermost frame, restoring all registers. */ | |
402 | ||
98760eab AC |
403 | void arm_pop_frame PARAMS ((void)); |
404 | ||
405 | #define POP_FRAME arm_pop_frame () | |
ade40d31 RP |
406 | |
407 | /* This sequence of words is the instructions | |
408 | ||
98760eab AC |
409 | mov lr,pc |
410 | mov pc,r4 | |
ade40d31 RP |
411 | swi bkpt_swi |
412 | ||
98760eab | 413 | Note this is 12 bytes. */ |
ade40d31 | 414 | |
98760eab | 415 | #define CALL_DUMMY {0xe1a0e00f, 0xe1a0f004, 0xef180000} |
ade40d31 RP |
416 | |
417 | #define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */ | |
418 | ||
98760eab AC |
419 | #define CALL_DUMMY_BREAKPOINT_OFFSET arm_call_dummy_breakpoint_offset() |
420 | extern int arm_call_dummy_breakpoint_offset PARAMS ((void)); | |
421 | ||
ade40d31 RP |
422 | /* Insert the specified number of args and function address |
423 | into a call sequence of the above form stored at DUMMYNAME. */ | |
424 | ||
425 | #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ | |
98760eab AC |
426 | arm_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p) |
427 | ||
428 | void arm_fix_call_dummy PARAMS ((char *dummy, CORE_ADDR pc, CORE_ADDR fun, | |
429 | int nargs, struct value **args, | |
430 | struct type *type, int gcc_p)); | |
431 | ||
432 | CORE_ADDR arm_get_next_pc PARAMS ((CORE_ADDR)); | |
433 | ||
434 | /* Functions for dealing with Thumb call thunks. */ | |
435 | #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) arm_in_call_stub (pc, name) | |
436 | #define SKIP_TRAMPOLINE_CODE(pc) arm_skip_stub (pc) | |
437 | extern int arm_in_call_stub PARAMS ((CORE_ADDR pc, char *name)); | |
438 | extern CORE_ADDR arm_skip_stub PARAMS ((CORE_ADDR pc)); | |
439 | ||
440 | /* Function to determine whether MEMADDR is in a Thumb function. */ | |
441 | extern int arm_pc_is_thumb PARAMS ((bfd_vma memaddr)); | |
442 | ||
443 | /* Function to determine whether MEMADDR is in a call dummy called from | |
444 | a Thumb function. */ | |
445 | extern int arm_pc_is_thumb_dummy PARAMS ((bfd_vma memaddr)); | |
446 | ||
447 | /* Macros for setting and testing a bit in a minimal symbol that | |
448 | marks it as Thumb function. The MSB of the minimal symbol's | |
449 | "info" field is used for this purpose. This field is already | |
450 | being used to store the symbol size, so the assumption is | |
451 | that the symbol size cannot exceed 2^31. | |
452 | ||
453 | COFF_MAKE_MSYMBOL_SPECIAL | |
454 | ELF_MAKE_MSYMBOL_SPECIAL tests whether the COFF or ELF symbol corresponds | |
455 | to a thumb function, and sets a "special" bit in a | |
456 | minimal symbol to indicate that it does | |
457 | MSYMBOL_SET_SPECIAL actually sets the "special" bit | |
458 | MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol | |
459 | MSYMBOL_SIZE returns the size of the minimal symbol, i.e. | |
460 | the "info" field with the "special" bit masked out | |
461 | */ | |
462 | ||
463 | extern int coff_sym_is_thumb(int val); | |
464 | #define MSYMBOL_SET_SPECIAL(msym) \ | |
465 | MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) | 0x80000000) | |
466 | #define MSYMBOL_IS_SPECIAL(msym) \ | |
467 | (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0) | |
468 | #define MSYMBOL_SIZE(msym) \ | |
469 | ((long) MSYMBOL_INFO (msym) & 0x7fffffff) | |
470 | ||
471 | /* Thumb symbol are of type STT_LOPROC, (synonymous with STT_ARM_TFUNC) */ | |
472 | #define ELF_MAKE_MSYMBOL_SPECIAL(sym,msym) \ | |
473 | { if(ELF_ST_TYPE(((elf_symbol_type *)(sym))->internal_elf_sym.st_info) == STT_LOPROC) \ | |
474 | MSYMBOL_SET_SPECIAL(msym); } | |
475 | ||
476 | #define COFF_MAKE_MSYMBOL_SPECIAL(val,msym) \ | |
477 | { if(coff_sym_is_thumb(val)) MSYMBOL_SET_SPECIAL(msym); } |