X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fnios2-linux-tdep.c;h=f48cd9a1bad3517d4258f8eb85a871396c0e1c0b;hb=036003a671233c43e35b3004f91e4cbd61255cf3;hp=005c82a4b377a5f7e9b8076ee8a9e3302235b0d4;hpb=e2882c85786571175a0b0bfc3bcd2f14620b1ea3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c index 005c82a4b3..f48cd9a1ba 100644 --- a/gdb/nios2-linux-tdep.c +++ b/gdb/nios2-linux-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for GNU/Linux on Nios II. - Copyright (C) 2012-2018 Free Software Foundation, Inc. + Copyright (C) 2012-2019 Free Software Foundation, Inc. Contributed by Mentor Graphics, Inc. This file is part of GDB. @@ -29,6 +29,7 @@ #include "linux-tdep.h" #include "glibc-tdep.h" #include "nios2-tdep.h" +#include "gdbarch.h" /* Core file and register set support. */ @@ -67,10 +68,9 @@ nios2_supply_gregset (const struct regset *regset, if (regnum == -1 || regnum == regno) { if (reg_offsets[regno] != -1) - regcache_raw_supply (regcache, regno, - gregs + 4 * reg_offsets[regno]); + regcache->raw_supply (regno, gregs + 4 * reg_offsets[regno]); else - regcache_raw_supply (regcache, regno, zero_buf); + regcache->raw_supply (regno, zero_buf); } } @@ -88,8 +88,7 @@ nios2_collect_gregset (const struct regset *regset, if (regnum == -1 || regnum == regno) { if (reg_offsets[regno] != -1) - regcache_raw_collect (regcache, regno, - gregs + 4 * reg_offsets[regno]); + regcache->raw_collect (regno, gregs + 4 * reg_offsets[regno]); } } @@ -108,7 +107,8 @@ nios2_iterate_over_regset_sections (struct gdbarch *gdbarch, void *cb_data, const struct regcache *regcache) { - cb (".reg", NIOS2_GREGS_SIZE, &nios2_core_regset, NULL, cb_data); + cb (".reg", NIOS2_GREGS_SIZE, NIOS2_GREGS_SIZE, &nios2_core_regset, NULL, + cb_data); } /* Initialize a trad-frame cache corresponding to the tramp-frame. @@ -164,8 +164,8 @@ static struct tramp_frame nios2_r1_linux_rt_sigreturn_tramp_frame = SIGTRAMP_FRAME, 4, { - { MATCH_R1_MOVI | SET_IW_I_B (2) | SET_IW_I_IMM16 (139), -1 }, - { MATCH_R1_TRAP | SET_IW_R_IMM5 (0), -1}, + { MATCH_R1_MOVI | SET_IW_I_B (2) | SET_IW_I_IMM16 (139), ULONGEST_MAX }, + { MATCH_R1_TRAP | SET_IW_R_IMM5 (0), ULONGEST_MAX}, { TRAMP_SENTINEL_INSN } }, nios2_linux_rt_sigreturn_init @@ -176,8 +176,8 @@ static struct tramp_frame nios2_r2_linux_rt_sigreturn_tramp_frame = SIGTRAMP_FRAME, 4, { - { MATCH_R2_MOVI | SET_IW_F2I16_B (2) | SET_IW_F2I16_IMM16 (139), -1 }, - { MATCH_R2_TRAP | SET_IW_X2L5_IMM5 (0), -1}, + { MATCH_R2_MOVI | SET_IW_F2I16_B (2) | SET_IW_F2I16_IMM16 (139), ULONGEST_MAX }, + { MATCH_R2_TRAP | SET_IW_X2L5_IMM5 (0), ULONGEST_MAX}, { TRAMP_SENTINEL_INSN } }, nios2_linux_rt_sigreturn_init @@ -201,6 +201,17 @@ nios2_linux_syscall_next_pc (struct frame_info *frame, return pc + op->size; } +/* Return true if PC is a kernel helper, a function mapped by the kernel + into user space on an unwritable page. Currently the only such function + is __kuser_cmpxchg at 0x1004. See arch/nios2/kernel/entry.S in the Linux + kernel sources and sysdeps/unix/sysv/linux/nios2/atomic-machine.h in + GLIBC. */ +static bool +nios2_linux_is_kernel_helper (CORE_ADDR pc) +{ + return pc == 0x1004; +} + /* Hook function for gdbarch_register_osabi. */ static void @@ -231,6 +242,7 @@ nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) &nios2_r1_linux_rt_sigreturn_tramp_frame); tdep->syscall_next_pc = nios2_linux_syscall_next_pc; + tdep->is_kernel_helper = nios2_linux_is_kernel_helper; /* Index of target address word in glibc jmp_buf. */ tdep->jb_pc = 10;