This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] further mips archification


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.

> 
> 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): 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.
> 
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.108
> diff -p -r1.108 mips-tdep.c
> *** mips-tdep.c 19 Aug 2002 23:22:17 -0000      1.108
> --- mips-tdep.c 20 Aug 2002 03:33:35 -0000
> *************** pc_is_mips16 (bfd_vma memaddr)
> *** 717,722 ****
> --- 717,754 ----
>       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 (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.  */
> +
> + int
> + 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,
> *** 1646,1652 ****
>   }
> 
> 
> ! CORE_ADDR
>   mips_frame_saved_pc (struct frame_info *frame)
>   {
>     CORE_ADDR saved_pc;
> --- 1678,1684 ----
>   }
> 
> 
> ! static CORE_ADDR
>   mips_frame_saved_pc (struct frame_info *frame)
>   {
>     CORE_ADDR saved_pc;
> *************** get_frame_pointer (struct frame_info *fr
> *** 2358,2364 ****
> 
>   mips_extra_func_info_t cached_proc_desc;
> 
> ! CORE_ADDR
>   mips_frame_chain (struct frame_info *frame)
>   {
>     mips_extra_func_info_t proc_desc;
> --- 2390,2396 ----
> 
>   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_type_needs_double_align (struct typ
> *** 2536,2542 ****
>   #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,
> --- 2568,2574 ----
>   #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,
> *** 2789,2795 ****
> 
>   /* N32/N64 version of push_arguments.  */
> 
> ! CORE_ADDR
>   mips_n32n64_push_arguments (int nargs,
>                             struct value **args,
>                             CORE_ADDR sp,
> --- 2821,2827 ----
> 
>   /* 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,
> *** 3611,3617 ****
>     return sp;
>   }
> 
> ! CORE_ADDR
>   mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
>   {
>     /* Set the return address register to point to the entry
> --- 3643,3649 ----
>     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
> *** 3646,3652 ****
>   /* 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;
> --- 3678,3684 ----
>   /* 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)
> *** 3725,3731 ****
>     PROC_PC_REG (proc_desc) = RA_REGNUM;
>   }
> 
> ! void
>   mips_pop_frame (void)
>   {
>     register int regnum;
> --- 3757,3763 ----
>     PROC_PC_REG (proc_desc) = RA_REGNUM;
>   }
> 
> ! static void
>   mips_pop_frame (void)
>   {
>     register int regnum;
> *************** mips_pop_frame (void)
> *** 3783,3788 ****
> --- 3815,3827 ----
>       }
>   }
> 
> + 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
> *************** mips_gdbarch_init (struct gdbarch_info i
> *** 5570,5575 ****
> --- 5609,5617 ----
>     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
> *** 5793,5802 ****
> --- 5835,5848 ----
>     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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]