aboutsummaryrefslogtreecommitdiff
path: root/gdb/frv-linux-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/frv-linux-tdep.c')
-rw-r--r--gdb/frv-linux-tdep.c166
1 files changed, 76 insertions, 90 deletions
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index c9cfb6f..0791153 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -36,7 +36,8 @@
/* Define the size (in bytes) of an FR-V instruction. */
static const int frv_instr_size = 4;
-enum {
+enum
+{
NORMAL_SIGTRAMP = 1,
RT_SIGTRAMP = 2
};
@@ -55,9 +56,9 @@ frv_linux_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc,
instr = extract_unsigned_integer (buf, sizeof buf, byte_order);
- if (instr == 0x8efc0077) /* setlos #__NR_sigreturn, gr7 */
+ if (instr == 0x8efc0077) /* setlos #__NR_sigreturn, gr7 */
retval = NORMAL_SIGTRAMP;
- else if (instr == 0x8efc00ad) /* setlos #__NR_rt_sigreturn, gr7 */
+ else if (instr == 0x8efc00ad) /* setlos #__NR_rt_sigreturn, gr7 */
retval = RT_SIGTRAMP;
else
return 0;
@@ -65,7 +66,7 @@ frv_linux_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc,
if (target_read_memory (pc + frv_instr_size, buf, sizeof buf) != 0)
return 0;
instr = extract_unsigned_integer (buf, sizeof buf, byte_order);
- if (instr != 0xc0700000) /* tira gr0, 0 */
+ if (instr != 0xc0700000) /* tira gr0, 0 */
return 0;
/* If we get this far, we'll return a non-zero value, either
@@ -208,14 +209,14 @@ frv_linux_sigcontext_reg_addr (frame_info_ptr this_frame, int regno,
padding) = 24.) */
if (target_read_memory (sp + 12, buf, sizeof buf) != 0)
{
- warning (_("Can't read realtime sigtramp frame."));
+ warning (_ ("Can't read realtime sigtramp frame."));
return 0;
}
sc_addr = extract_unsigned_integer (buf, sizeof buf, byte_order);
sc_addr += 24;
}
else
- internal_error (_("not a signal trampoline"));
+ internal_error (_ ("not a signal trampoline"));
if (sc_addr_cache_ptr)
*sc_addr_cache_ptr = sc_addr;
@@ -223,43 +224,42 @@ frv_linux_sigcontext_reg_addr (frame_info_ptr this_frame, int regno,
switch (regno)
{
- case psr_regnum :
+ case psr_regnum:
return sc_addr + 0;
/* sc_addr + 4 has "isr", the Integer Status Register. */
- case ccr_regnum :
+ case ccr_regnum:
return sc_addr + 8;
- case cccr_regnum :
+ case cccr_regnum:
return sc_addr + 12;
- case lr_regnum :
+ case lr_regnum:
return sc_addr + 16;
- case lcr_regnum :
+ case lcr_regnum:
return sc_addr + 20;
- case pc_regnum :
+ case pc_regnum:
return sc_addr + 24;
/* sc_addr + 28 is __status, the exception status.
sc_addr + 32 is syscallno, the syscall number or -1.
sc_addr + 36 is orig_gr8, the original syscall arg #1.
sc_addr + 40 is gner[0].
sc_addr + 44 is gner[1]. */
- case iacc0h_regnum :
+ case iacc0h_regnum:
return sc_addr + 48;
- case iacc0l_regnum :
+ case iacc0l_regnum:
return sc_addr + 52;
- default :
+ default:
if (first_gpr_regnum <= regno && regno <= last_gpr_regnum)
return sc_addr + 56 + 4 * (regno - first_gpr_regnum);
else if (first_fpr_regnum <= regno && regno <= last_fpr_regnum)
return sc_addr + 312 + 4 * (regno - first_fpr_regnum);
else
- return -1; /* not saved. */
+ return -1; /* not saved. */
}
}
/* Signal trampolines. */
static struct trad_frame_cache *
-frv_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+frv_linux_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -297,8 +297,7 @@ frv_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
}
static void
-frv_linux_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+frv_linux_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct trad_frame_cache *cache
@@ -318,8 +317,7 @@ frv_linux_sigtramp_frame_prev_register (frame_info_ptr this_frame,
static int
frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
@@ -332,24 +330,27 @@ frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind frv_linux_sigtramp_frame_unwind =
-{
- "frv linux sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- frv_linux_sigtramp_frame_this_id,
- frv_linux_sigtramp_frame_prev_register,
- NULL,
- frv_linux_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind frv_linux_sigtramp_frame_unwind
+ = { "frv linux sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ frv_linux_sigtramp_frame_this_id,
+ frv_linux_sigtramp_frame_prev_register,
+ NULL,
+ frv_linux_sigtramp_frame_sniffer };
+
/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include
the loadmap addresses in the register set. (See below for more info.) */
#define FRV_ELF_NGREG (46 + 2)
typedef unsigned char frv_elf_greg_t[4];
-typedef struct { frv_elf_greg_t reg[FRV_ELF_NGREG]; } frv_elf_gregset_t;
+
+typedef struct
+{
+ frv_elf_greg_t reg[FRV_ELF_NGREG];
+} frv_elf_gregset_t;
typedef unsigned char frv_elf_fpreg_t[4];
+
typedef struct
{
frv_elf_fpreg_t fr[64];
@@ -362,25 +363,24 @@ typedef struct
/* Register maps. */
-static const struct regcache_map_entry frv_linux_gregmap[] =
- {
- { 1, psr_regnum, 4 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* isr */
- { 1, ccr_regnum, 4 },
- { 1, cccr_regnum, 4 },
- { 1, lr_regnum, 4 },
- { 1, lcr_regnum, 4 },
- { 1, pc_regnum, 4 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* __status */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* syscallno */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* orig_gr8 */
- { 1, gner0_regnum, 4 },
- { 1, gner1_regnum, 4 },
- { 1, REGCACHE_MAP_SKIP, 8 }, /* iacc0 */
- { 1, tbr_regnum, 4 },
- { 31, first_gpr_regnum + 1, 4 }, /* gr1 ... gr31 */
-
- /* Technically, the loadmap addresses are not part of `pr_reg' as
+static const struct regcache_map_entry frv_linux_gregmap[]
+ = { { 1, psr_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* isr */
+ { 1, ccr_regnum, 4 },
+ { 1, cccr_regnum, 4 },
+ { 1, lr_regnum, 4 },
+ { 1, lcr_regnum, 4 },
+ { 1, pc_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* __status */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* syscallno */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* orig_gr8 */
+ { 1, gner0_regnum, 4 },
+ { 1, gner1_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* iacc0 */
+ { 1, tbr_regnum, 4 },
+ { 31, first_gpr_regnum + 1, 4 }, /* gr1 ... gr31 */
+
+ /* Technically, the loadmap addresses are not part of `pr_reg' as
found in the elf_prstatus struct. The fields which communicate
the loadmap address appear (by design) immediately after
`pr_reg' though, and the BFD function elf32_frv_grok_prstatus()
@@ -388,31 +388,24 @@ static const struct regcache_map_entry frv_linux_gregmap[] =
section that it extracts from the core file. So, for our
purposes, they may be viewed as registers. */
- { 1, fdpic_loadmap_exec_regnum, 4 },
- { 1, fdpic_loadmap_interp_regnum, 4 },
- { 0 }
- };
-
-static const struct regcache_map_entry frv_linux_fpregmap[] =
- {
- { 64, first_fpr_regnum, 4 }, /* fr0 ... fr63 */
- { 1, fner0_regnum, 4 },
- { 1, fner1_regnum, 4 },
- { 1, msr0_regnum, 4 },
- { 1, msr1_regnum, 4 },
- { 8, acc0_regnum, 4 }, /* acc0 ... acc7 */
- { 1, accg0123_regnum, 4 },
- { 1, accg4567_regnum, 4 },
- { 1, fsr0_regnum, 4 },
- { 0 }
- };
+ { 1, fdpic_loadmap_exec_regnum, 4 },
+ { 1, fdpic_loadmap_interp_regnum, 4 },
+ { 0 } };
+
+static const struct regcache_map_entry frv_linux_fpregmap[]
+ = { { 64, first_fpr_regnum, 4 }, /* fr0 ... fr63 */
+ { 1, fner0_regnum, 4 }, { 1, fner1_regnum, 4 },
+ { 1, msr0_regnum, 4 }, { 1, msr1_regnum, 4 },
+ { 8, acc0_regnum, 4 }, /* acc0 ... acc7 */
+ { 1, accg0123_regnum, 4 }, { 1, accg4567_regnum, 4 },
+ { 1, fsr0_regnum, 4 }, { 0 } };
/* Unpack an frv_elf_gregset_t into GDB's register cache. */
-static void
+static void
frv_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
int regi;
@@ -429,17 +422,11 @@ frv_linux_supply_gregset (const struct regset *regset,
/* FRV Linux kernel register sets. */
-static const struct regset frv_linux_gregset =
-{
- frv_linux_gregmap,
- frv_linux_supply_gregset, regcache_collect_regset
-};
+static const struct regset frv_linux_gregset
+ = { frv_linux_gregmap, frv_linux_supply_gregset, regcache_collect_regset };
-static const struct regset frv_linux_fpregset =
-{
- frv_linux_fpregmap,
- regcache_supply_regset, regcache_collect_regset
-};
+static const struct regset frv_linux_fpregset
+ = { frv_linux_fpregmap, regcache_supply_regset, regcache_collect_regset };
static void
frv_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -453,17 +440,16 @@ frv_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
&frv_linux_fpregset, NULL, cb_data);
}
-
static void
frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
linux_init_abi (info, gdbarch, 0);
/* Set the sigtramp frame sniffer. */
- frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
+ frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, frv_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, frv_linux_iterate_over_regset_sections);
}
static enum gdb_osabi
@@ -483,12 +469,12 @@ frv_linux_elf_osabi_sniffer (bfd *abfd)
}
void _initialize_frv_linux_tdep ();
+
void
_initialize_frv_linux_tdep ()
{
gdbarch_register_osabi (bfd_arch_frv, 0, GDB_OSABI_LINUX,
frv_linux_init_abi);
- gdbarch_register_osabi_sniffer (bfd_arch_frv,
- bfd_target_elf_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_frv, bfd_target_elf_flavour,
frv_linux_elf_osabi_sniffer);
}