From patchwork Wed Oct 31 18:12:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 149865 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp7128280ljp; Wed, 31 Oct 2018 11:17:07 -0700 (PDT) X-Google-Smtp-Source: AJdET5eyDZvvK/sO8wY+FQMhtdJOfsK9qXfAoR1QOI+RVvv91jca4CKODdZXuPY2ohqiquA9B5yg X-Received: by 2002:a25:cfcc:: with SMTP id f195-v6mr4371461ybg.20.1541009827264; Wed, 31 Oct 2018 11:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541009827; cv=none; d=google.com; s=arc-20160816; b=Q2StiSPPQqmqFl+PpxCjKFUU+8fmslOnz5RihKHHfpb4U4EBp3K3Y4Z6M/z9mK4bDg UWNUBki7dmy8A+IhRHJEn+LF7bH5k/9XyvSHr6/NEk7dhvhGmnKn27/9grpZpKcdxoPP hH15Wu9Y+4IaVDW5HS/0Tgp+aFcXK6e6OVCkOA47gZqUG9D0aQYej8WcTT1TUp7/QADV VilxGLuXN1AL48isbvDYpJOxTKcv2eMyJ2zaMpOaiO9Ho7SbN8H7vfpbwLUxwD4yEeKI Ia7TuU76khQpFO6aWQBcYequX+TjZ93Q3ChPtd6x6z0HNmbROyctMQ7JxD7dN+RcwEA7 7JCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=SJcumdK+MJPHUxUn+NawH8CTPaHFqCcp8rBSB5S7Y3U=; b=ESkLLpxX0zRhkD/vuHzbGnEypMQ7pa43jnE5cIiBTAiU5YT9r9s4ncqiRfrCywdzqp PMl/jlZqGa2obCYH+vwZre0YFXlzpdqjpfHm30tz0MLdMw1aAIPRLMD1SpCzu8GFgzWg taB922CQApVuNWi5GKAj6e+xLgI/CZBIWxZw0vXwomw07zApNgbKxUDB1GwFE+cjPQ2A YZ0KzDtilH9VxwRZYaDnBp/2s6NPS24EtPLcxHy7GPrTxYq20VukBD5QYnv/M4Gf3yGa w24OI28YdQzsFsH5slILMDJVNKHAq/ZIR7MrV/q9gui0w/gZ7ONH4wmggJJYQ9XNx58G CwBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id b8-v6si11880154ybj.220.2018.10.31.11.17.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Oct 2018 11:17:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gHuzd-0004N3-19; Wed, 31 Oct 2018 18:13:25 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gHuzb-0004Mk-GR for xen-devel@lists.xen.org; Wed, 31 Oct 2018 18:13:23 +0000 X-Inumbo-ID: a650aeaa-dd38-11e8-b27b-12d6303a7972 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id a650aeaa-dd38-11e8-b27b-12d6303a7972; Wed, 31 Oct 2018 18:13:21 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 099771596; Wed, 31 Oct 2018 11:13:21 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E3F53F6A8; Wed, 31 Oct 2018 11:13:19 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 31 Oct 2018 18:12:53 +0000 Message-Id: <20181031181313.8028-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181031181313.8028-1-julien.grall@arm.com> References: <20181031181313.8028-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v2 01/21] xen/arm: traps: Constify show_*, do_unexpected_trap and do_bug_frame parameters X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , sstabellini@kernel.org, andrii_anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Those helpers are not meant to modify most of the parameters. So constify them. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- 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(-) 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,