GSoC 2019: POSIX Compliance - FENV Environment probably not working properly in RISCV

Vaibhav Gupta vaibhavgupta40 at gmail.com
Wed Aug 14 12:36:17 UTC 2019


So I cloned the 'sis' repository and build it locally:
$  git clone git://git.rtems.org/sis.git
.
.
On one terminal I was running sis:
$ ~/development/sis/sis -riscv nouartrx -gdb
.
.
.
.
On another terminal I did:
$ riscv-rtems5-gdb psxfenv01.exe

Reading symbols from psxfenv01.exe...done.
(gdb) target extended-remote localhost:1234
Remote debugging using localhost:1234
0x00000000 in ?? ()
(gdb) load
Loading section .start, size 0x3c lma 0x80000000
Loading section .text, size 0xd8c4 lma 0x8000003c
Loading section .rodata, size 0x11e29 lma 0x8000d900
Loading section .sdata2, size 0x20 lma 0x8001f72c
Loading section .eh_frame, size 0x68 lma 0x8001f74c
Loading section .init_array, size 0x4 lma 0x8001f7b4
Loading section .fini_array, size 0x4 lma 0x8001f7b8
Loading section .rtemsroset, size 0x34 lma 0x8001f7bc
Loading section .data, size 0x488 lma 0x8001f7f0
Loading section .htif, size 0x1000 lma 0x8001fc80
Loading section .sdata, size 0x3c lma 0x80021000
Start address 0x80000000, load size 134321
Transfer rate: 2474 KB/sec, 236 bytes/write.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program:
/home/varodek/development/rtems/kernel/rv32imac/riscv-rtems5/c/rv32imac/testsuites/psxtests/psxfenv01.exe

.
.
The screen just hangs here.

Vaibhav Gupta

On Wed, Aug 14, 2019 at 12:48 PM Jiri Gaisler <jiri at gaisler.se> wrote:

> I have attached the sis manual. Page 17:
>
> "SIS can be connected to gdb through a network socket using the gdb remote interface.
> Either start SIS with -gdb, or issue the ’gdb’ command inside SIS, and connect gdb with
> ’target extended-remote localhost:1234’. The port can be changed using the -port option."
>
> You still need all other options, so to start on a windows host do:
>
> $ riscv-rtems-sis -riscv -nouartrx -gdb
>
> To start gdb, do:
>
> $ riscv-rtems-gdb app.exe
>
> (gdb) target extended-remote localhost:1234
>
> (gdb) load
>
> (gdb) run
>
> To re-run the application, issue a new load command first.
>
> Regards, Jiri.
>
> On 8/14/19 12:37 AM, Vaibhav Gupta wrote:
>
>
>
> On Wed, Aug 14, 2019 at 4:04 AM Joel Sherrill <joel at rtems.org> wrote:
>
>>
>>
>> On Tue, Aug 13, 2019 at 5:09 PM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
>> wrote:
>>
>>>
>>>
>>> On Mon, Aug 12, 2019 at 11:50 PM Joel Sherrill <joel at rtems.org> wrote:
>>>
>>>> Can you post or email me privately the full patch? I can try to see
>>>> what I spot.
>>>>
>>> I have sent you the patch.
>>>
>>>>
>>>> Can you check with objdump or gdb that the methods which don't appear
>>>> to work
>>>> are actually the RISC-V implementation? Look at the disassembly and see
>>>> if it
>>>> looks like you expect.
>>>>
>>> I am exploring for this.
>>>
>>
>> Since I don't know how to attach gdb to the new sis for griscv, I emailed
>> Jiri privately.
>> Your program works as expected on Linux. Perhaps Jiri has some advice for
>> my
>> debugging setup ignorance and fenv on RISC-V.
>>
> Okay, I will wait. Till then I can work with porting for other
> architecture. :)
>
>>
>> Do you happen to have fenv support for another architecture queued up? It
>> would be
>> interesting to see if it works on other targets.
>>
> Yup, they were in my to do list. Till testsuite method is solved, I will
> work on them now.
>
> - Vaibhav Gupta
>
>>
>> --joel
>>
>>
>>>
>>> - Vaibhav Gupta
>>>
>>>>
>>>> Does this require a patch to newlib as well?
>>>>
>>>> --joel
>>>>
>>>> On Sun, Aug 11, 2019 at 10:49 AM Vaibhav Gupta <
>>>> vaibhavgupta40 at gmail.com> wrote:
>>>>
>>>>> Configure command I used to build BSP:
>>>>> ==============================================
>>>>> $ /home/varodek/development/rtems/kernel/rtems/configure
>>>>> --prefix=/home/varodek/development/rtems/5 --enable-maintainer-mode
>>>>> --target=riscv-rtems5 --enable-rtemsbsp=rv32imac --enable-tests
>>>>> --enable-posix --disable-networking --enable-cxx RISCV_ENABLE_HTIF_SUPPORT=1
>>>>> ==============================================
>>>>> .
>>>>> .
>>>>> .
>>>>> .
>>>>> Qemu command I used to run test:
>>>>> ==============================================
>>>>> $ qemu-system-riscv32 -no-reboot -nographic -machine virt -m 256M
>>>>> -kernel psxfenv01.exe
>>>>> ==============================================
>>>>> .
>>>>> .
>>>>> .
>>>>> .
>>>>> Makefile.am
>>>>> ==============================================
>>>>> + if TEST_psxfenv01
>>>>> + psx_tests += psxfenv01
>>>>> + psxfenv01_SOURCES = psxfenv01/init.c
>>>>> + psxfenv01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxfenv01) \
>>>>> +       $(support_includes)
>>>>> + psxfenv01_LDADD = -lm $(LDADD)
>>>>> + endif
>>>>> +
>>>>> ==============================================
>>>>>
>>>>> On Sun, Aug 11, 2019 at 8:36 PM Vaibhav Gupta <
>>>>> vaibhavgupta40 at gmail.com> wrote:
>>>>>
>>>>>> My code of testsuite:
>>>>>> ===============================================
>>>>>>   /* Test 'FE_DIVBYZERO' */
>>>>>>   puts( "\nDivide by zero and confirm fetestexcept()." );
>>>>>>   a = 0.0;
>>>>>>   b = 1.0;
>>>>>>   c = b/a;
>>>>>>   printf("\n%d",FE_DIVBYZERO);
>>>>>>   fegetexceptflag(&excepts,FE_ALL_EXCEPT);
>>>>>>   printf("\n%d",excepts);
>>>>>>   r = feraiseexcept(FE_DIVBYZERO);
>>>>>>   printf("\n%d\n",r);
>>>>>>   rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );
>>>>>> ==============================================
>>>>>> OUTPUT
>>>>>> ==============================================
>>>>>> Divide by zero and confirm fetestexcept().
>>>>>>
>>>>>> 8
>>>>>> 0
>>>>>> 1
>>>>>> /home/varodek/development/rtems/kernel/rtems/c/src/../../testsuites/psxtests/psxfenv01/init.c:
>>>>>> 84 fetestexcept( FE_DIVBYZERO )
>>>>>> ==============================================
>>>>>> EXPECTED OUTPUT
>>>>>> ==============================================
>>>>>> Divide by zero and confirm fetestexcept().
>>>>>>
>>>>>> 8
>>>>>> 8
>>>>>> 0
>>>>>> ==============================================
>>>>>> - fetestexcept( FE_DIVBYZERO ), should return a non-zero value as
>>>>>> division-by-zero was performed.
>>>>>> .
>>>>>> - feraiseexcept(FE_DIVBYZERO); is also not working. It should return
>>>>>> zero when successful
>>>>>> .
>>>>>> ==============================================
>>>>>>
>>>>>> Thank You
>>>>>> Vaibhav Gupta
>>>>>>
>>>>>> _______________________________________________
>>>>> devel mailing list
>>>>> devel at rtems.org
>>>>> http://lists.rtems.org/mailman/listinfo/devel
>>>>
>>>>
> _______________________________________________
> devel mailing listdevel at rtems.orghttp://lists.rtems.org/mailman/listinfo/devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190814/a7f537f0/attachment-0001.html>


More information about the devel mailing list