grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] RISC-V: Restore the typcast to 64bit type


From: Daniel Kiper
Subject: Re: [PATCH] RISC-V: Restore the typcast to 64bit type
Date: Tue, 30 Mar 2021 00:29:56 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, Mar 29, 2021 at 11:33:11AM -0700, Khem Raj wrote:
> On Mon, Mar 29, 2021 at 3:24 AM Andreas Schwab <schwab@suse.de> wrote:
> > On Mär 28 2021, Khem Raj wrote:
> > > this makes the type promotions clear and explicit
> > > It was already typecasted to long but was accidentally dropped in [1]
> >
> > Note that long is 32-bit on riscv32, so the title is misleading (there
> > was no cast to 64-bit type before).  The cast really was a no-op, as it
> > didn't change the resulting type.  The issue is that the types of
> > sym_addr, target_section_addr and offset are Elf_Addr (aka Elf32_Addr),
> > which is an unsigned type (image_target->vaddr_offset is signed, but not
> > wider than Elf32_Addr, so it doesn't change the overall type).  Thus
> > when the result of the expression is extended to grub_int64_t it is
> > always a positive value instead of the desired sign-extended one.
> >
>
> This is right I think, I initially typecasted it to long and then
> changed to using grub_int64_t
> and could have done better on commit message. Do you prefer a new revision 
> with
> better commit msg.

If long is 32-bit on riscv32 should not we cast to grub_int32_t then?

And then next question: Why off is defined as grub_int64_t?

Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]