Clarification on mstatus.fs/xs

180 views
Skip to first unread message

dharan G

unread,
Dec 8, 2021, 5:38:55 AM12/8/21
to RISC-V ISA Dev
Hi all,
In the table 3.4: FS and XS state transitions in page 26 of RISC-V Privileged spec v1.10, it is mentioned that there is a way to use instructions to disable (FP) extension unit and to unconfigure (FP) extension unit. Could someone explain about the difference in these instructions and its effects on (FP) extension unit. 

Thanks in Advance,
G.Dharani Shankar.
fs_xs_query.PNG

Greg Favor

unread,
Dec 8, 2021, 12:12:09 PM12/8/21
to dharan G, RISC-V ISA Dev
On Wed, Dec 8, 2021 at 2:38 AM dharan G <dhara...@gmail.com> wrote:
Hi all,
In the table 3.4: FS and XS state transitions in page 26 of RISC-V Privileged spec v1.10, it is mentioned that there is a way to use instructions to disable (FP) extension unit and to unconfigure (FP) extension unit. Could someone explain about the difference in these instructions and its effects on (FP) extension unit. 

The table header says "Note that the standard floating-point and vector extensions do not support user-mode unconfigure or disable/enable instructions."

Also, a key word is the "user-mode" qualification.  For FP extensions machine-mode can use misa F, D, and Q bits (if they are implemented as writeable) to disable the associated extensions.  But in any case there is no concept of "configure/unconfigure" for the FP extensions. 

Greg


 

Allen Baum

unread,
Dec 8, 2021, 12:17:45 PM12/8/21
to dharan G, RISC-V ISA Dev
I will take a not-so-wild, but NOT authoritative guess.
Disabled is when the configuration is set such that any attempt to execute an FP op will trap with an illegal op exception.
There could be two reasons for that: misa.F is sero, or mstatus.FS=00. 
      (Since I know I will be corrected on this,  let me state that, yes, I know if misa.F=0, 
      there is no guarantee that an attempt to execute an op with an FP encoding will trap
      even if the FP unit is present and misa.F is a read/write bit)

Unconfigured is simply an indication to the OS that the register state doesn't need to be saved, but may need to be restored or initialized.

Section 3.1.6.6 should be read closely, but it does explain this.

On Wed, Dec 8, 2021 at 2:38 AM dharan G <dhara...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/efacfcc4-5c62-4a46-82c5-d6e37fd3ed31n%40groups.riscv.org.

dharan G

unread,
Dec 14, 2021, 6:37:16 AM12/14/21
to RISC-V ISA Dev, RISC-V ISA Dev

Thank you for replying.

In page 25 of RISC-V Privileged spec v1.10, it is mentioned that,

1)"If the status is Initial, the context must be set to an initial constant value on context restore to avoid a security hole, but this can be done without accessing memory. For example, the floating-point registers can all be initialized to the immediate value 0."

2)"Changing the setting of FS has no effect on the contents of the floating-point register state. In particular, setting FS=Off does not destroy the state, nor does setting FS=Initial clear the contents."

From the above lines, does it imply that when MSTATUS.FS is set to Initial state(01), the implementation will not initialize the FP state, rather privileged code has to initialize them?

Thanks in advance,
Dharani Shankar   


Allen Baum

unread,
Dec 14, 2021, 10:52:26 AM12/14/21
to dharan G, RISC-V ISA Dev
That is certainly my interpretation.

--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.

Andrew Waterman

unread,
Dec 14, 2021, 9:09:21 PM12/14/21
to Allen Baum, dharan G, RISC-V ISA Dev
Yeah, that's indeed what we meant by "nor does setting FS=Initial clear the contents".

Reply all
Reply to author
Forward
0 new messages