From: Christoph Hellwig <hch@lst.de>
To: Palmer Dabbelt <palmer@sifive.com>
Cc: Nick Kossifidis <mick@ics.forth.gr>,
Atish Patra <atish.patra@wdc.com>,
linux-riscv@lists.infradead.org
Subject: [PATCH 09/11] riscv: remove duplicate macros from ptrace.h
Date: Mon, 15 Apr 2019 11:14:40 +0200 [thread overview]
Message-ID: <20190415091442.19945-10-hch@lst.de> (raw)
In-Reply-To: <20190415091442.19945-1-hch@lst.de>
No need to have two names for the same thing.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/riscv/include/asm/ptrace.h | 21 ++++++---------------
arch/riscv/kernel/stacktrace.c | 10 +++++-----
arch/riscv/kernel/traps.c | 2 +-
3 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h
index d35ec2f41381..9c867a4bac83 100644
--- a/arch/riscv/include/asm/ptrace.h
+++ b/arch/riscv/include/asm/ptrace.h
@@ -70,47 +70,38 @@ struct pt_regs {
/* Helpers for working with the instruction pointer */
-#define GET_IP(regs) ((regs)->sepc)
-#define SET_IP(regs, val) (GET_IP(regs) = (val))
-
static inline unsigned long instruction_pointer(struct pt_regs *regs)
{
- return GET_IP(regs);
+ return regs->sepc;
}
static inline void instruction_pointer_set(struct pt_regs *regs,
unsigned long val)
{
- SET_IP(regs, val);
+ regs->sepc = val;
}
#define profile_pc(regs) instruction_pointer(regs)
/* Helpers for working with the user stack pointer */
-#define GET_USP(regs) ((regs)->sp)
-#define SET_USP(regs, val) (GET_USP(regs) = (val))
-
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
{
- return GET_USP(regs);
+ return regs->sp;
}
static inline void user_stack_pointer_set(struct pt_regs *regs,
unsigned long val)
{
- SET_USP(regs, val);
+ regs->sp = val;
}
/* Helpers for working with the frame pointer */
-#define GET_FP(regs) ((regs)->s0)
-#define SET_FP(regs, val) (GET_FP(regs) = (val))
-
static inline unsigned long frame_pointer(struct pt_regs *regs)
{
- return GET_FP(regs);
+ return regs->s0;
}
static inline void frame_pointer_set(struct pt_regs *regs,
unsigned long val)
{
- SET_FP(regs, val);
+ regs->s0 = val;
}
static inline unsigned long regs_return_value(struct pt_regs *regs)
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 855036c440c1..a4386a0c8f67 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct task_struct *task,
unsigned long fp, sp, pc;
if (regs) {
- fp = GET_FP(regs);
- sp = GET_USP(regs);
- pc = GET_IP(regs);
+ fp = frame_pointer(regs);
+ sp = user_stack_pointer(regs);
+ pc = instruction_pointer(regs);
} else if (task == NULL || task == current) {
const register unsigned long current_sp __asm__ ("sp");
fp = (unsigned long)__builtin_frame_address(0);
@@ -78,8 +78,8 @@ static void notrace walk_stackframe(struct task_struct *task,
unsigned long *ksp;
if (regs) {
- sp = GET_USP(regs);
- pc = GET_IP(regs);
+ sp = user_stack_pointer(regs);
+ pc = instruction_pointer(regs);
} else if (task == NULL || task == current) {
const register unsigned long current_sp __asm__ ("sp");
sp = current_sp;
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index 0d5dac0eaddb..d9b2fd39c8bb 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code,
&& printk_ratelimit()) {
pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT,
tsk->comm, task_pid_nr(tsk), signo, code, addr);
- print_vma_addr(KERN_CONT " in ", GET_IP(regs));
+ print_vma_addr(KERN_CONT " in ", instruction_pointer(regs));
pr_cont("\n");
show_regs(regs);
}
--
2.20.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2019-04-15 9:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 9:14 misc cleanups v3 Christoph Hellwig
2019-04-15 9:14 ` [PATCH 01/11] riscv: use asm-generic/extable.h Christoph Hellwig
2019-04-15 9:14 ` [PATCH 02/11] riscv: turn mm_segment_t into a struct Christoph Hellwig
2019-04-15 9:14 ` [PATCH 03/11] riscv: remove unreachable big endian code Christoph Hellwig
2019-04-15 9:14 ` [PATCH 04/11] riscv: remove CONFIG_RISCV_ISA_A Christoph Hellwig
2019-04-15 9:14 ` [PATCH 05/11] riscv: clear all pending interrupts when booting Christoph Hellwig
2019-04-15 9:14 ` [PATCH 06/11] riscv: simplify the stack pointer setup in head.S Christoph Hellwig
2019-04-15 9:14 ` [PATCH 07/11] riscv: cleanup the parse_dtb calling conventions Christoph Hellwig
2019-04-15 9:14 ` [PATCH 08/11] riscv: remove unreachable !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR code Christoph Hellwig
2019-04-15 9:14 ` Christoph Hellwig [this message]
2019-04-15 9:14 ` [PATCH 10/11] riscv: print the unexpected interrupt cause Christoph Hellwig
2019-04-15 9:14 ` [PATCH 11/11] riscv: call pm_power_off from machine_halt / machine_power_off Christoph Hellwig
2019-04-23 8:23 ` misc cleanups v3 Christoph Hellwig
2019-04-25 21:58 ` Palmer Dabbelt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190415091442.19945-10-hch@lst.de \
--to=hch@lst.de \
--cc=atish.patra@wdc.com \
--cc=linux-riscv@lists.infradead.org \
--cc=mick@ics.forth.gr \
--cc=palmer@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).