This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] further mips archification
- From: Michael Snyder <msnyder at redhat dot com>
- To: Michael Snyder <msnyder at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com, cagney at redhat dot com
- Date: Tue, 20 Aug 2002 14:45:17 -0700
- Subject: Re: [PATCH] further mips archification
- Organization: Red Hat, Inc.
- References: <200208200321.g7K3LuC23169@reddwarf.sfbay.redhat.com>
Michael Snyder wrote:
>
> I'll check these in when the others get approved, or when I can
> make sure that these are independent of the others.
Committed, in the modified form shown below:
2002-08-19 Michael Snyder <msnyder@redhat.com>
* config/mips/tm-mips.h (ELF_MAKE_MSYMBOL_SPECIAL): Delete.
(MSYMBOL_IS_SPECIAL, MSYMBOL_SIZE): Change into functions.
(FIX_CALL_DUMMY, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
POP_FRAME, INIT_EXTRA_FRAME_INFO): Delete.
(CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_ADDRESS): Delete.
* mips-tdep.c (mips_elf_make_msymbol_special, mips_msymbol_size,
mips_msymbol_is_special, mips_fix_call_dummy): New functions.
(mips_gdbarch_init): Set elf_make_msymbol_special, pop_frame,
push_dummy_frame, fix_call_dummy, init_extra_frame_info,
push_return_address.
(mips_register_raw_size, mips_eabi_use_struct_convention,
mips_n32n64_use_struct_convention, mips_o32_use_struct_convention,
mips_o32_reg_struct_has_addr, mips_frame_saved_pc, mips_frame_chain,
mips_init_extra_frame_info, mips_eabi_push_arguments,
mips_n32n64_push_arguments, mips_push_return_address,
mips_push_dummy_frame, mips_pop_frame, mips_skip_prologue,
mips_breakpoint_from_pc, mips_call_dummy_address): Make static.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.112
diff -p -r1.112 mips-tdep.c
*** mips-tdep.c 20 Aug 2002 19:41:59 -0000 1.112
--- mips-tdep.c 20 Aug 2002 21:27:26 -0000
*************** mips_print_extra_frame_info (struct fram
*** 476,482 ****
static int mips64_transfers_32bit_regs_p = 0;
! int
mips_register_raw_size (int reg_nr)
{
if (mips64_transfers_32bit_regs_p)
--- 476,482 ----
static int mips64_transfers_32bit_regs_p = 0;
! static int
mips_register_raw_size (int reg_nr)
{
if (mips64_transfers_32bit_regs_p)
*************** show_mask_address (char *cmd, int from_t
*** 653,671 ****
/* Should call_function allocate stack space for a struct return? */
! int
mips_eabi_use_struct_convention (int gcc_p, struct type *type)
{
return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
}
! int
mips_n32n64_use_struct_convention (int gcc_p, struct type *type)
{
return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
}
! int
mips_o32_use_struct_convention (int gcc_p, struct type *type)
{
return 1; /* Structures are returned by ref in extra arg0. */
--- 653,671 ----
/* Should call_function allocate stack space for a struct return? */
! static int
mips_eabi_use_struct_convention (int gcc_p, struct type *type)
{
return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
}
! static int
mips_n32n64_use_struct_convention (int gcc_p, struct type *type)
{
return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
}
! static int
mips_o32_use_struct_convention (int gcc_p, struct type *type)
{
return 1; /* Structures are returned by ref in extra arg0. */
*************** mips_n32n64_reg_struct_has_addr (int gcc
*** 693,699 ****
return 0; /* Assumption: N32/N64 never passes struct by ref. */
}
! int
mips_o32_reg_struct_has_addr (int gcc_p, struct type *type)
{
return 0; /* Assumption: O32/O64 never passes struct by ref. */
--- 693,699 ----
return 0; /* Assumption: N32/N64 never passes struct by ref. */
}
! static int
mips_o32_reg_struct_has_addr (int gcc_p, struct type *type)
{
return 0; /* Assumption: O32/O64 never passes struct by ref. */
*************** pc_is_mips16 (bfd_vma memaddr)
*** 720,725 ****
--- 720,757 ----
return 0;
}
+ /* ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special",
+ i.e. refers to a 16-bit function, and sets a "special" bit in a
+ minimal symbol to mark it as a 16-bit function. */
+
+ static void
+ mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
+ {
+ if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_MIPS16)
+ {
+ MSYMBOL_INFO (msym) = (char *)
+ (((long) MSYMBOL_INFO (msym)) | 0x80000000);
+ SYMBOL_VALUE_ADDRESS (msym) |= 1;
+ }
+ }
+
+ /* MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol. */
+
+ int
+ mips_msymbol_is_special (struct minimal_symbol *msym)
+ {
+ return (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0);
+ }
+
+ /* MSYMBOL_SIZE returns the size of the minimal symbol, i.e. the
+ "info" field with the "special" bit masked out. */
+
+ long
+ mips_msymbol_size (struct minimal_symbol *msym)
+ {
+ return ((long) MSYMBOL_INFO (msym) & 0x7fffffff);
+ }
+
/* MIPS believes that the PC has a sign extended value. Perhaphs the
all registers should be sign extended for simplicity? */
*************** mips_init_frame_pc_first (int fromleaf,
*** 1649,1655 ****
}
! CORE_ADDR
mips_frame_saved_pc (struct frame_info *frame)
{
CORE_ADDR saved_pc;
--- 1681,1687 ----
}
! static CORE_ADDR
mips_frame_saved_pc (struct frame_info *frame)
{
CORE_ADDR saved_pc;
*************** get_frame_pointer (struct frame_info *fr
*** 2361,2367 ****
mips_extra_func_info_t cached_proc_desc;
! CORE_ADDR
mips_frame_chain (struct frame_info *frame)
{
mips_extra_func_info_t proc_desc;
--- 2393,2399 ----
mips_extra_func_info_t cached_proc_desc;
! static CORE_ADDR
mips_frame_chain (struct frame_info *frame)
{
mips_extra_func_info_t proc_desc;
*************** mips_frame_chain (struct frame_info *fra
*** 2392,2404 ****
and have frame size zero. */
&& !frame->signal_handler_caller
/* Check if this is a call dummy frame. */
! && frame->pc != mips_call_dummy_address ())
return 0;
else
return get_frame_pointer (frame, proc_desc);
}
! void
mips_init_extra_frame_info (int fromleaf, struct frame_info *fci)
{
int regnum;
--- 2424,2436 ----
and have frame size zero. */
&& !frame->signal_handler_caller
/* Check if this is a call dummy frame. */
! && frame->pc != CALL_DUMMY_ADDRESS ())
return 0;
else
return get_frame_pointer (frame, proc_desc);
}
! static void
mips_init_extra_frame_info (int fromleaf, struct frame_info *fci)
{
int regnum;
*************** mips_type_needs_double_align (struct typ
*** 2539,2545 ****
#define ROUND_DOWN(n,a) ((n) & ~((a)-1))
#define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1))
! CORE_ADDR
mips_eabi_push_arguments (int nargs,
struct value **args,
CORE_ADDR sp,
--- 2571,2577 ----
#define ROUND_DOWN(n,a) ((n) & ~((a)-1))
#define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1))
! static CORE_ADDR
mips_eabi_push_arguments (int nargs,
struct value **args,
CORE_ADDR sp,
*************** mips_eabi_push_arguments (int nargs,
*** 2792,2798 ****
/* N32/N64 version of push_arguments. */
! CORE_ADDR
mips_n32n64_push_arguments (int nargs,
struct value **args,
CORE_ADDR sp,
--- 2824,2830 ----
/* N32/N64 version of push_arguments. */
! static CORE_ADDR
mips_n32n64_push_arguments (int nargs,
struct value **args,
CORE_ADDR sp,
*************** mips_o64_push_arguments (int nargs,
*** 3614,3620 ****
return sp;
}
! CORE_ADDR
mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
{
/* Set the return address register to point to the entry
--- 3646,3652 ----
return sp;
}
! static CORE_ADDR
mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
{
/* Set the return address register to point to the entry
*************** mips_push_register (CORE_ADDR * sp, int
*** 3649,3655 ****
/* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<(MIPS_NUMREGS-1). */
#define MASK(i,j) (((1 << ((j)+1))-1) ^ ((1 << (i))-1))
! void
mips_push_dummy_frame (void)
{
int ireg;
--- 3681,3687 ----
/* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<(MIPS_NUMREGS-1). */
#define MASK(i,j) (((1 << ((j)+1))-1) ^ ((1 << (i))-1))
! static void
mips_push_dummy_frame (void)
{
int ireg;
*************** mips_push_dummy_frame (void)
*** 3728,3734 ****
PROC_PC_REG (proc_desc) = RA_REGNUM;
}
! void
mips_pop_frame (void)
{
register int regnum;
--- 3760,3766 ----
PROC_PC_REG (proc_desc) = RA_REGNUM;
}
! static void
mips_pop_frame (void)
{
register int regnum;
*************** mips_pop_frame (void)
*** 3786,3791 ****
--- 3818,3830 ----
}
}
+ static void
+ mips_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+ struct value **args, struct type *type, int gcc_p)
+ {
+ write_register(T9_REGNUM, fun);
+ }
+
/* Floating point register management.
Background: MIPS1 & 2 fp registers are 32 bits wide. To support
*************** mips16_skip_prologue (CORE_ADDR pc)
*** 4381,4387 ****
We must skip more in the case where part of the prologue is in the
delay slot of a non-prologue instruction). */
! CORE_ADDR
mips_skip_prologue (CORE_ADDR pc)
{
/* See if we can determine the end of the prologue via the symbol table.
--- 4420,4426 ----
We must skip more in the case where part of the prologue is in the
delay slot of a non-prologue instruction). */
! static CORE_ADDR
mips_skip_prologue (CORE_ADDR pc)
{
/* See if we can determine the end of the prologue via the symbol table.
*************** gdb_print_insn_mips (bfd_vma memaddr, di
*** 5097,5103 ****
(if necessary) to point to the actual memory location where the
breakpoint should be inserted. */
! const unsigned char *
mips_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
{
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
--- 5136,5142 ----
(if necessary) to point to the actual memory location where the
breakpoint should be inserted. */
! static const unsigned char *
mips_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
{
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
*************** mips_ignore_helper (CORE_ADDR pc)
*** 5340,5346 ****
point (e.g. programs in ROM) should define a symbol __CALL_DUMMY_ADDRESS
whose address is the location where the breakpoint should be placed. */
! CORE_ADDR
mips_call_dummy_address (void)
{
struct minimal_symbol *sym;
--- 5379,5385 ----
point (e.g. programs in ROM) should define a symbol __CALL_DUMMY_ADDRESS
whose address is the location where the breakpoint should be placed. */
! static CORE_ADDR
mips_call_dummy_address (void)
{
struct minimal_symbol *sym;
*************** mips_gdbarch_init (struct gdbarch_info i
*** 5674,5679 ****
--- 5713,5721 ----
tdep->found_abi = found_abi;
tdep->mips_abi = mips_abi;
+ set_gdbarch_elf_make_msymbol_special (gdbarch,
+ mips_elf_make_msymbol_special);
+
switch (mips_abi)
{
case MIPS_ABI_O32:
*************** mips_gdbarch_init (struct gdbarch_info i
*** 5897,5906 ****
--- 5939,5952 ----
set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address);
+ set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
+ set_gdbarch_push_dummy_frame (gdbarch, mips_push_dummy_frame);
+ set_gdbarch_pop_frame (gdbarch, mips_pop_frame);
set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
set_gdbarch_call_dummy_length (gdbarch, 0);
+ set_gdbarch_fix_call_dummy (gdbarch, mips_fix_call_dummy);
set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.38
diff -p -r1.38 tm-mips.h
*** config/mips/tm-mips.h 20 Aug 2002 19:41:59 -0000 1.38
--- config/mips/tm-mips.h 20 Aug 2002 21:27:26 -0000
*************** extern void mips_register_convert_from_t
*** 171,209 ****
mips_register_convert_from_type ((n), (type), (buffer))
- /* Things needed for making the inferior call functions. */
-
- /* Stack must be aligned on 32-bit boundaries when synthesizing
- function calls. We don't need STACK_ALIGN, PUSH_ARGUMENTS will
- handle it. */
-
- extern CORE_ADDR mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp);
- #define PUSH_RETURN_ADDRESS(PC, SP) (mips_push_return_address ((PC), (SP)))
-
- /* Push an empty stack frame, to record the current PC, etc. */
-
- #define PUSH_DUMMY_FRAME mips_push_dummy_frame()
- extern void mips_push_dummy_frame (void);
-
- /* Discard from the stack the innermost frame, restoring all registers. */
-
- #define POP_FRAME mips_pop_frame()
- extern void mips_pop_frame (void);
-
- #define CALL_DUMMY_START_OFFSET (0)
-
- #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
-
- /* When calling functions on Irix 5 (or any MIPS SVR4 ABI compliant
- platform), $t9 ($25) (Dest_Reg) contains the address of the callee
- (used for PIC). It doesn't hurt to do this on other systems; $t9
- will be ignored. */
- #define FIX_CALL_DUMMY(dummyname, start_sp, fun, nargs, args, rettype, gcc_p) \
- write_register(T9_REGNUM, fun)
-
- #define CALL_DUMMY_ADDRESS() (mips_call_dummy_address ())
- extern CORE_ADDR mips_call_dummy_address (void);
-
/* Special symbol found in blocks associated with routines. We can hang
mips_extra_func_info_t's off of this. */
--- 171,176 ----
*************** typedef struct mips_extra_func_info
*** 223,232 ****
}
*mips_extra_func_info_t;
- extern void mips_init_extra_frame_info (int fromleaf, struct frame_info *);
- #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \
- mips_init_extra_frame_info(fromleaf, fci)
-
extern void mips_print_extra_frame_info (struct frame_info *frame);
#define PRINT_EXTRA_FRAME_INFO(fi) \
mips_print_extra_frame_info (fi)
--- 190,195 ----
*************** typedef unsigned long t_inst; /* Integer
*** 302,319 ****
the "info" field with the "special" bit masked out
*/
- #define ELF_MAKE_MSYMBOL_SPECIAL(sym,msym) \
- { \
- if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_MIPS16) { \
- MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) | 0x80000000); \
- SYMBOL_VALUE_ADDRESS (msym) |= 1; \
- } \
- }
-
#define MSYMBOL_IS_SPECIAL(msym) \
! (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
#define MSYMBOL_SIZE(msym) \
! ((long) MSYMBOL_INFO (msym) & 0x7fffffff)
/* Command to set the processor type. */
--- 265,277 ----
the "info" field with the "special" bit masked out
*/
#define MSYMBOL_IS_SPECIAL(msym) \
! mips_msymbol_is_special (msym)
#define MSYMBOL_SIZE(msym) \
! mips_msymbol_size (msym)
! struct minimal_symbol;
! extern int mips_msymbol_is_special (struct minimal_symbol *msym);
! extern long mips_msymbol_size (struct minimal_symbol *msym);
/* Command to set the processor type. */