[U-Boot] [PATCH 11/30] riscv: fix use of incorrectly sized variables

Rick Chen rickchen36 at gmail.com
Tue Oct 23 05:52:23 UTC 2018


> > -static void _exit_trap(int code, uint epc, struct pt_regs *regs)
> > +static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs)
> >  {
> >         static const char * const exception_code[] = {
> >                 "Instruction address misaligned",
> > @@ -70,6 +70,6 @@ static void _exit_trap(int code, uint epc, struct pt_regs
> *regs)
> >                 "Load address misaligned"
> >         };
> >
> > -       printf("exception code: %d , %s , epc %08x , ra %08lx\n",
> > +       printf("exception code: %ld , %s , epc %016lx , ra %016lx\n",
>
> We should not print 16 digits on a RV32 system.

Hi Lukas

Maybe you can try as below :

printf("exception code: %ld , %s , epc %p , ra %p\n",
      code, exception_code[code], (void *)epc, (void *)regs->ra);

Rick

>
> >                 code, exception_code[code], epc, regs->ra);
> >  }
> > --
>
> Others look good to me.
>
> Regards,
> Bin


More information about the U-Boot mailing list