From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Julien Grall <julien.grall@arm.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [Xen-devel] [PATCH 7/7] xen/arm: types: Specify the zero padding in the definition of PRIregister
Date: Fri, 26 Jul 2019 12:47:55 +0000 [thread overview]
Message-ID: <87imrphshw.fsf@epam.com> (raw)
In-Reply-To: <20190723213553.22300-8-julien.grall@arm.com>
Julien Grall writes:
> The definition of PRIregister varies between Arm32 and Arm64 (32-bit vs
> 64-bit). However, some of the users uses the wrong padding.
type: "users use"
> For more consistency, the padding is now moved into the PRIregister and
> varies depending on the architecture.
I'm not sure this is the right thing to do. There are lots of code
(especially in vgic) that does not use padding at all. Now it will print
padding, even if original author does not wanted to. And, honestly it is
hard to parse 15-16 zeroes in a row.
I am suggesting to add another macro like PRIregister_pad or something
like that.
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
> xen/arch/arm/traps.c | 10 +++++-----
> xen/include/asm-arm/types.h | 4 ++--
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index ef37ca6bde..f062ae6f6a 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -797,7 +797,7 @@ static void show_registers_32(const struct cpu_user_regs *regs,
>
> if ( guest_mode )
> {
> - printk("USR: SP: %08"PRIx32" LR: %08"PRIregister"\n",
> + printk("USR: SP: %08"PRIx32" LR: %"PRIregister"\n",
> regs->sp_usr, regs->lr);
> printk("SVC: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
> regs->sp_svc, regs->lr_svc, regs->spsr_svc);
> @@ -815,7 +815,7 @@ static void show_registers_32(const struct cpu_user_regs *regs,
> #ifndef CONFIG_ARM_64
> else
> {
> - printk("HYP: SP: %08"PRIx32" LR: %08"PRIregister"\n", regs->sp, regs->lr);
> + printk("HYP: SP: %08"PRIx32" LR: %"PRIregister"\n", regs->sp, regs->lr);
> }
> #endif
> printk("\n");
> @@ -823,7 +823,7 @@ static void show_registers_32(const struct cpu_user_regs *regs,
> if ( guest_mode )
> {
> printk(" SCTLR: %"PRIregister"\n", ctxt->sctlr_el1);
> - printk(" TCR: %08"PRIregister"\n", ctxt->tcr_el1);
> + printk(" TCR: %"PRIregister"\n", ctxt->tcr_el1);
> printk(" TTBR0: %016"PRIx64"\n", ctxt->ttbr0_el1);
> printk(" TTBR1: %016"PRIx64"\n", ctxt->ttbr1_el1);
> printk(" IFAR: %08"PRIx32", IFSR: %08"PRIx32"\n"
> @@ -895,7 +895,7 @@ static void show_registers_64(const struct cpu_user_regs *regs,
> printk(" FAR_EL1: %016"PRIx64"\n", ctxt->far);
> printk("\n");
> printk(" SCTLR_EL1: %"PRIregister"\n", ctxt->sctlr_el1);
> - printk(" TCR_EL1: %08"PRIregister"\n", ctxt->tcr_el1);
> + printk(" TCR_EL1: %"PRIregister"\n", ctxt->tcr_el1);
> printk(" TTBR0_EL1: %016"PRIx64"\n", ctxt->ttbr0_el1);
> printk(" TTBR1_EL1: %016"PRIx64"\n", ctxt->ttbr1_el1);
> printk("\n");
> @@ -934,7 +934,7 @@ static void _show_registers(const struct cpu_user_regs *regs,
> printk("\n");
>
> printk(" SCTLR_EL2: %08"PRIx32"\n", READ_SYSREG32(SCTLR_EL2));
> - printk(" HCR_EL2: %016"PRIregister"\n", READ_SYSREG(HCR_EL2));
> + printk(" HCR_EL2: %"PRIregister"\n", READ_SYSREG(HCR_EL2));
> printk(" TTBR0_EL2: %016"PRIx64"\n", READ_SYSREG64(TTBR0_EL2));
> printk("\n");
> printk(" ESR_EL2: %08"PRIx32"\n", regs->hsr);
> diff --git a/xen/include/asm-arm/types.h b/xen/include/asm-arm/types.h
> index 30f95078cb..89aae25ffe 100644
> --- a/xen/include/asm-arm/types.h
> +++ b/xen/include/asm-arm/types.h
> @@ -41,7 +41,7 @@ typedef u64 paddr_t;
> #define INVALID_PADDR (~0ULL)
> #define PRIpaddr "016llx"
> typedef u32 register_t;
> -#define PRIregister "x"
> +#define PRIregister "08x"
> #elif defined (CONFIG_ARM_64)
> typedef signed long s64;
> typedef unsigned long u64;
> @@ -51,7 +51,7 @@ typedef u64 paddr_t;
> #define INVALID_PADDR (~0UL)
> #define PRIpaddr "016lx"
> typedef u64 register_t;
> -#define PRIregister "lx"
> +#define PRIregister "016lx"
> #endif
>
> #if defined(__SIZE_TYPE__)
--
Volodymyr Babchuk at EPAM
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-07-26 12:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 21:35 [Xen-devel] [PATCH 0/7] xen/arm: Xen hardening for newer Armv8 Julien Grall
2019-07-23 21:35 ` [Xen-devel] [PATCH 1/7] xen/public: arch-arm: Restrict the visibility of struct vcpu_guest_core_regs Julien Grall
2019-07-26 12:14 ` Volodymyr Babchuk
2019-07-26 12:55 ` Julien Grall
2019-07-26 13:17 ` Volodymyr Babchuk
2019-07-29 21:14 ` Stefano Stabellini
2019-07-23 21:35 ` [Xen-devel] [PATCH 2/7] xen/arm: SCTLR_EL1 is a 64-bit register on Arm64 Julien Grall
2019-07-26 12:22 ` Volodymyr Babchuk
2019-07-29 21:33 ` Stefano Stabellini
2019-07-23 21:35 ` [Xen-devel] [PATCH 3/7] xen/arm: Rework psr_mode_is_32bit() Julien Grall
2019-07-26 12:31 ` Volodymyr Babchuk
2019-07-26 13:09 ` Julien Grall
2019-07-26 14:05 ` Volodymyr Babchuk
2019-07-29 21:52 ` Stefano Stabellini
2019-07-31 12:14 ` Julien Grall
2019-07-23 21:35 ` [Xen-devel] [PATCH 4/7] xen/arm: traps: Avoid using BUG_ON() in _show_registers() Julien Grall
2019-07-26 12:33 ` Volodymyr Babchuk
2019-07-29 21:55 ` Stefano Stabellini
2019-07-23 21:35 ` [Xen-devel] [PATCH 5/7] xen/arm: traps: Avoid BUG_ON() in do_trap_brk() Julien Grall
2019-07-26 12:38 ` Volodymyr Babchuk
2019-07-29 22:02 ` Stefano Stabellini
2019-07-30 8:59 ` Julien Grall
2019-07-30 17:00 ` Stefano Stabellini
2019-07-31 14:48 ` Andrew Cooper
2019-07-23 21:35 ` [Xen-devel] [PATCH 6/7] xen/arm: vsmc: The function identifier is always 32-bit Julien Grall
2019-07-26 12:39 ` Volodymyr Babchuk
2019-07-29 22:13 ` Stefano Stabellini
2019-07-23 21:35 ` [Xen-devel] [PATCH 7/7] xen/arm: types: Specify the zero padding in the definition of PRIregister Julien Grall
2019-07-26 12:47 ` Volodymyr Babchuk [this message]
2019-07-26 13:19 ` Julien Grall
2019-07-26 14:21 ` Volodymyr Babchuk
2019-07-26 14:35 ` Julien Grall
2019-07-26 14:42 ` Julien Grall
2019-07-26 17:05 ` Volodymyr Babchuk
2019-07-29 22:15 ` Stefano Stabellini
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=87imrphshw.fsf@epam.com \
--to=volodymyr_babchuk@epam.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.