All of lore.kernel.org
 help / color / mirror / Atom feed
* RISC-V Floating Point Extension
@ 2024-04-29 14:02 Derek Christ
  2024-04-29 14:54 ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Derek Christ @ 2024-04-29 14:02 UTC (permalink / raw)
  To: qemu-riscv

Hello,

I'm currently trying to run a RISC-V bare-metal kernel on QEMU that uses the 
floating point extension F.
It seems like this extension, besides D, is enabled automatically in QEMU. 
In fact, the floating point registers can be examined successfully using 
GDB.
However, when the first floating point instruction is reached in the program 
execution (in this case flw), an illegal instruction trap is raised. The 
kernel itself is compiled using these flags: -march=rv32imaf -mabi=ilp32f
Is there something I am missing? Perhaps, the FPU needs to be enabled in 
some way?

Thanks for your help!

Best
Derek


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RISC-V Floating Point Extension
  2024-04-29 14:02 RISC-V Floating Point Extension Derek Christ
@ 2024-04-29 14:54 ` Palmer Dabbelt
  2024-04-30  7:01   ` Derek Christ
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2024-04-29 14:54 UTC (permalink / raw)
  To: dchrist; +Cc: qemu-riscv

On Mon, 29 Apr 2024 07:02:59 PDT (-0700), dchrist@rptu.de wrote:
> Hello,
>
> I'm currently trying to run a RISC-V bare-metal kernel on QEMU that uses the
> floating point extension F.
> It seems like this extension, besides D, is enabled automatically in QEMU.
> In fact, the floating point registers can be examined successfully using
> GDB.
> However, when the first floating point instruction is reached in the program
> execution (in this case flw), an illegal instruction trap is raised. The
> kernel itself is compiled using these flags: -march=rv32imaf -mabi=ilp32f
> Is there something I am missing? Perhaps, the FPU needs to be enabled in
> some way?

There's dynamic enable bits for floating point in the various status 
registers, see mstatus.FS in the priv spec for the details.

> Thanks for your help!
>
> Best
> Derek


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RISC-V Floating Point Extension
  2024-04-29 14:54 ` Palmer Dabbelt
@ 2024-04-30  7:01   ` Derek Christ
  0 siblings, 0 replies; 3+ messages in thread
From: Derek Christ @ 2024-04-30  7:01 UTC (permalink / raw)
  To: qemu-riscv

[-- Attachment #1: Type: text/plain, Size: 21 bytes --]

Thanks, that was it!

[-- Attachment #2: Type: text/html, Size: 213 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-30  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 14:02 RISC-V Floating Point Extension Derek Christ
2024-04-29 14:54 ` Palmer Dabbelt
2024-04-30  7:01   ` Derek Christ

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.