riscv-software-src / riscv-pk

RISC-V Proxy Kernel
Other
579 stars 306 forks source link

Ping instruction traps FP instruction on rv64imac hardware using BBL. #233

Open venkatakrishs opened 3 years ago

venkatakrishs commented 3 years ago

I have compiled busybox using "--march=rv64imac" for linux 5.5.0-rc1. This kernel is used to build the boot loader (BBL) for the RISCV processor. Linux does boot on this system all the way to the point where when I ping I get a trap as follows :

$ ping 192.168.1.1 [58282.121093] ping[111]: unhandled signal 4 code 0x1 at 0x00000000000125d0 in ping[10000+c000] [58282.489410] CPU: 0 PID: 111 Comm: ping Not tainted 5.5.0-rc1-00002-g1606ca44fcdd-dirty #1 [58282.790893] epc: 00000000000125d0 ra : 00000000000125b8 sp : 0000003ffff63c00 [58283.047760] gp : 000000000001ddd8 tp : 0000003fc07b7720 t0 : 0000003fc09d0160 [58283.308319] t1 : 0000003fc08375e0 t2 : 000000000001cfc0 s0 : 0000003ffff63f57 [58283.568023] s1 : 0000000000000002 a0 : 0000003ffff63f5b a1 : 8080808080808080 [58283.827667] a2 : d1cdc6ceff989196 a3 : 0000000000000000 a4 : 0000000000000036 [58284.086669] a5 : 000000000001d000 a6 : fefefefefefefeff a7 : 0000000000000093 [58284.347778] s2 : 0000003ffff63da8 s3 : 0000000000000002 s4 : 0000000000000000 [58284.606750] s5 : 0000000000000008 s6 : 0000003fdd0e8830 s7 : 0000000000000002 [58284.868194] s8 : 0000000000000014 s9 : 0000003fdd0e8830 s10: 00000000000c5e18 [58285.128204] s11: 00000000000ec7c5 t3 : 000000000007e5e0 t4 : 0000000000000002 [58285.388122] t5 : 0000000000000002 t6 : 0000000000003d38 [58285.562133] status: 0000000200000020 badaddr: 000000005e87b787 cause: 0000000000000002 Illegal instruction

also from the dump I have used the value 5e87b787 to search the opcode and found it as the following in the dump.

805286d4: 5e87b787 fld fa5,1512(a5) # 8056ecb8 <_payload_start+0x36ecb8>

The riscv gnu toolchain was made with disable-float flag and rv64imac as march to avoid any floating point in cross compilation for the bbl.

I am not able to find what may be causing this issue.

Thanks in advance.