Skip to content

[Bug Report]There is an error in the implementation of mepc[0]. #149

@youzi27

Description

@youzi27

Description

Nutshell does not check whether mepc[0] is zero.
Described in the privileged specification 3.1.14:

The low bit of mepc (mepc[0]) is always zero.

Environment

Implementation: Nutshell
Test case: See attachment

Expected Behavior

When attempting to write a value to mepc, it is required that mepc[0] must be 0.

Observed Behavior

In Spike: when writing to mepc, the last bit is forcibly set to 0.
In Nutshell: It is not forcibly set to 0. This violates the specification.

Potential Impact

Not sure.

Result log display:

The assembly code context for 'mret' is as follows(Note:for more details, please refer to the attachment):

-                   la x14, 0 #To check
-                   addi x14,x14,1 #To check
-                   csrw 0x341, x14

mepc different at pc = 0x00800001a8, spike = 0x0000000000000000, Nutshell= 0x0000000000000001

I am looking forward to your insights and resolution on this matter. If I have any inaccuracies, please point them out. If you also consider this to be an issue, please let me know.

testcase.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions