Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 2 Dec 2019 17:46:16 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Cc: alankao@...estech.com
Subject: Re: [PATCH] riscv64: fenv.S: Fix fesetenv(FE_DFL_ENV) failure

* Ruinland ChuanTzu Tsai <ruinland@...estech.com> [2019-12-02 19:06:52 +0800]:
> Hi all, 
> during testing libc-test on RV64,
> I happended to encounter a segfault on math/fenv.exe .
> 
> When FE_DFL_ENV is passed to fesetenv(),
> the very first instruction : lw t1, 0(a0) 
> will fail since a0 is -1 .
> 
> Here's quick hack - -
> 
> git diff -- src/fenv/riscv64/fenv.S
> diff --git a/src/fenv/riscv64/fenv.S b/src/fenv/riscv64/fenv.S
> index 97f74dd6..06215954 100644
> --- a/src/fenv/riscv64/fenv.S
> +++ b/src/fenv/riscv64/fenv.S
> @@ -45,8 +45,12 @@ fegetenv:
>  .global fesetenv
>  .type fesetenv, %function
>  fesetenv:
> +        li t2, -1
> +        li t1, 0
> +        beq a0, t2, setfpcsr
>          lw t1, 0(a0)
> -        fscsr t0, t1
> +setfpcsr:
> +        fscsr t1
>          li a0, 0
>          ret
> 
> And the test case will pass.

thanks, this looks good

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.