[Xen-devel,01/22] xen/arm: traps: Constify show_registers parameters

Message ID 20181018132109.31192-2-julien.grall@arm.com
State New
Headers show
Series
  • xen/arm: Bunch of clean-ups
Related show

Commit Message

Julien Grall Oct. 18, 2018, 1:20 p.m.
show_registers helpers are not meant to modify any parameters.
So constify them.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/traps.c            | 14 +++++++-------
 xen/include/asm-arm/processor.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Andrii Anisov Oct. 24, 2018, 2:03 p.m. | #1
Hello Julien,


On 18.10.18 16:20, Julien Grall wrote:
> show_registers helpers are not meant to modify any parameters.

> So constify them.

>

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

> ---

>   xen/arch/arm/traps.c            | 14 +++++++-------

>   xen/include/asm-arm/processor.h |  2 +-

>   2 files changed, 8 insertions(+), 8 deletions(-)

The file xen/arch/arm/traps.c has a bunch of show functions except for 
registers. For stack, trace, etc. So maybe constify their parameters 
right away?

-- 

*Andrii Anisov*
Julien Grall Oct. 24, 2018, 2:12 p.m. | #2
On 10/24/18 3:03 PM, Andrii Anisov wrote:
> Hello Julien,

Hi,

> 
> 
> On 18.10.18 16:20, Julien Grall wrote:
>> show_registers helpers are not meant to modify any parameters.
>> So constify them.
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> ---
>>    xen/arch/arm/traps.c            | 14 +++++++-------
>>    xen/include/asm-arm/processor.h |  2 +-
>>    2 files changed, 8 insertions(+), 8 deletions(-)
> The file xen/arch/arm/traps.c has a bunch of show functions except for
> registers. For stack, trace, etc. So maybe constify their parameters
> right away?

Good idea. I will update the series.

Cheers,

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 51d2e42c77..9eec51ea90 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);
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 8016cf306f..efa33b4665 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -794,7 +794,7 @@  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_registers(const struct cpu_user_regs *regs);
 //#define dump_execution_state() run_in_exception_handler(show_execution_state)
 #define dump_execution_state() WARN()