Re: [PATCH v2] csky: fix csky_cmpxchg_fixup not working

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

 



On Wed, Oct 16, 2024 at 5:56 PM Yang Li <yang.li85200@xxxxxxxxx> wrote:
>
> In the csky_cmpxchg_fixup function, it is incorrect to use the global
>  variable csky_cmpxchg_stw to determine the address where the exception
>  occurred.The global variable csky_cmpxchg_stw stores the opcode at the
>  time of the exception, while &csky_cmpxchg_stw shows the address where
>  the exception occurred.
>
> Signed-off-by: Yang Li <yang.li85200@xxxxxxxxx>
> ---
> V1 -> V2:Eliminate compilation warnings
>
>  arch/csky/mm/fault.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c
> index a885518ce1dd..5226bc08c336 100644
> --- a/arch/csky/mm/fault.c
> +++ b/arch/csky/mm/fault.c
> @@ -45,8 +45,8 @@ static inline void csky_cmpxchg_fixup(struct pt_regs *regs)
>         if (trap_no(regs) != VEC_TLBMODIFIED)
>                 return;
>
> -       if (instruction_pointer(regs) == csky_cmpxchg_stw)
> -               instruction_pointer_set(regs, csky_cmpxchg_ldw);
> +       if (instruction_pointer(regs) == (unsigned long)&csky_cmpxchg_stw)
> +               instruction_pointer_set(regs, (unsigned long)&csky_cmpxchg_ldw);
csky_cmpxchg_ldw(stw) is a label symbol, not a variable.

arch/csky/kernel/atomic.S:
GLOBAL(csky_cmpxchg_ldw)
GLOBAL(csky_cmpxchg_stw)

Your modification does not affect the ASM output.

(gdb) p main
$1 = {void (void)} 0x5fa <main>
(gdb) p &main
$2 = (void (*)(void)) 0x5fa <main>

>         return;
>  }
>  #endif
> --
> 2.34.1
>


-- 
Best Regards
 Guo Ren





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux