[Xen-devel,v2,01/21] xen/arm: traps: Constify show_*, do_unexpected_trap and do_bug_frame parameters

Message ID 20181031181313.8028-2-julien.grall@arm.com
State Accepted
Commit 6ac3518ecc2040a19ad59cadeb1dad3ce9c47027
Headers show
Series
  • xen/arm: Bunch of clean-ups
Related show

Commit Message

Julien Grall Oct. 31, 2018, 6:12 p.m.
Those helpers are not meant to modify most of the parameters. So constify them.

Signed-off-by: Julien Grall <julien.grall@arm.com>

---

    Changes in v2:
        - Constify more parameters.
---
 xen/arch/arm/traps.c            | 26 +++++++++++++-------------
 xen/include/asm-arm/bug.h       |  2 +-
 xen/include/asm-arm/processor.h |  7 ++++---
 3 files changed, 18 insertions(+), 17 deletions(-)

Comments

Andrii Anisov Nov. 9, 2018, 1:40 p.m. | #1
Hello Julien,

Reviewed-by: Andrii Anisov <andrii_anisov@epam.com>

ps. please reach me by my gmail andrii.anisov@gmail.com further, rather than epam's email.
Our infra enabled 2-factor auth, and I didn't manage to make thunderbird functional any more. And outlook's web interface is nearly unusable.
  
 
ANDRII ANISOV

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 51d2e42c77..e8fa760607 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -787,8 +787,8 @@  static const char *mode_string(uint32_t cpsr)
     return mode_strings[mode] ? : "Unknown";
 }
 
-static void show_registers_32(struct cpu_user_regs *regs,
-                              struct reg_ctxt *ctxt,
+static void show_registers_32(const struct cpu_user_regs *regs,
+                              const struct reg_ctxt *ctxt,
                               int guest_mode,
                               const struct vcpu *v)
 {
@@ -864,8 +864,8 @@  static void show_registers_32(struct cpu_user_regs *regs,
 }
 
 #ifdef CONFIG_ARM_64
-static void show_registers_64(struct cpu_user_regs *regs,
-                              struct reg_ctxt *ctxt,
+static void show_registers_64(const struct cpu_user_regs *regs,
+                              const struct reg_ctxt *ctxt,
                               int guest_mode,
                               const struct vcpu *v)
 {
@@ -925,8 +925,8 @@  static void show_registers_64(struct cpu_user_regs *regs,
 }
 #endif
 
-static void _show_registers(struct cpu_user_regs *regs,
-                            struct reg_ctxt *ctxt,
+static void _show_registers(const struct cpu_user_regs *regs,
+                            const struct reg_ctxt *ctxt,
                             int guest_mode,
                             const struct vcpu *v)
 {
@@ -981,7 +981,7 @@  static void _show_registers(struct cpu_user_regs *regs,
     printk("\n");
 }
 
-void show_registers(struct cpu_user_regs *regs)
+void show_registers(const struct cpu_user_regs *regs)
 {
     struct reg_ctxt ctxt;
     ctxt.sctlr_el1 = READ_SYSREG(SCTLR_EL1);
@@ -1027,7 +1027,7 @@  void vcpu_show_registers(const struct vcpu *v)
     _show_registers(&v->arch.cpu_info->guest_cpu_user_regs, &ctxt, 1, v);
 }
 
-static void show_guest_stack(struct vcpu *v, struct cpu_user_regs *regs)
+static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
 {
     int i;
     vaddr_t sp;
@@ -1161,7 +1161,7 @@  static void show_guest_stack(struct vcpu *v, struct cpu_user_regs *regs)
  */
 #define STACK_FRAME_BASE(fp)       ((register_t*)(fp))
 #endif
-static void show_trace(struct cpu_user_regs *regs)
+static void show_trace(const struct cpu_user_regs *regs)
 {
     register_t *frame, next, addr, low, high;
 
@@ -1196,7 +1196,7 @@  static void show_trace(struct cpu_user_regs *regs)
     printk("\n");
 }
 
-void show_stack(struct cpu_user_regs *regs)
+void show_stack(const struct cpu_user_regs *regs)
 {
     register_t *stack = STACK_BEFORE_EXCEPTION(regs), addr;
     int i;
@@ -1223,7 +1223,7 @@  void show_stack(struct cpu_user_regs *regs)
     show_trace(regs);
 }
 
-void show_execution_state(struct cpu_user_regs *regs)
+void show_execution_state(const struct cpu_user_regs *regs)
 {
     show_registers(regs);
     show_stack(regs);
@@ -1249,14 +1249,14 @@  void vcpu_show_execution_state(struct vcpu *v)
     vcpu_unpause(v);
 }
 
-void do_unexpected_trap(const char *msg, struct cpu_user_regs *regs)
+void do_unexpected_trap(const char *msg, const struct cpu_user_regs *regs)
 {
     printk("CPU%d: Unexpected Trap: %s\n", smp_processor_id(), msg);
     show_execution_state(regs);
     panic("CPU%d: Unexpected Trap: %s\n", smp_processor_id(), msg);
 }
 
-int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc)
+int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc)
 {
     const struct bug_frame *bug = NULL;
     const char *prefix = "", *filename, *predicate;
diff --git a/xen/include/asm-arm/bug.h b/xen/include/asm-arm/bug.h
index 4704e2d858..90a59c972b 100644
--- a/xen/include/asm-arm/bug.h
+++ b/xen/include/asm-arm/bug.h
@@ -77,7 +77,7 @@  extern const struct bug_frame __start_bug_frames[],
                               __stop_bug_frames_1[],
                               __stop_bug_frames_2[];
 
-int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc);
+int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc);
 
 #endif /* __ARM_BUG_H__ */
 /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 8016cf306f..fcdc0f6375 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -793,8 +793,8 @@  void init_traps(void);
 
 void panic_PAR(uint64_t par);
 
-void show_execution_state(struct cpu_user_regs *regs);
-void show_registers(struct cpu_user_regs *regs);
+void show_execution_state(const struct cpu_user_regs *regs);
+void show_registers(const struct cpu_user_regs *regs);
 //#define dump_execution_state() run_in_exception_handler(show_execution_state)
 #define dump_execution_state() WARN()
 
@@ -804,7 +804,8 @@  void show_registers(struct cpu_user_regs *regs);
 #define cpu_to_core(_cpu)   (0)
 #define cpu_to_socket(_cpu) (0)
 
-void noreturn do_unexpected_trap(const char *msg, struct cpu_user_regs *regs);
+void noreturn do_unexpected_trap(const char *msg,
+                                 const struct cpu_user_regs *regs);
 
 struct vcpu;
 void vcpu_regs_hyp_to_user(const struct vcpu *vcpu,