Skip to content

Commit d2dd368

Browse files
Weiwei Liguoren83
Weiwei Li
authored andcommitted
target/riscv: Enable Sv32 for xlen=64
Before this patch, the sv32 only works with xlen=32. The new proposal of 64sv32 in the RVI community would permit xlen=64 sv32 to support s64ilp32 Linux. The difference is that sv32 allows zext(MSB) and sext(MSB) concurrently, but sv39,48.57 only allows sext(MSB). Signed-off-by: Weiwei Li <[email protected]> Reviewed-by: Guo Ren <[email protected]>
1 parent 88fcee7 commit d2dd368

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

target/riscv/cpu_helper.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,12 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
872872
}
873873
masked_msbs = (addr >> (va_bits - 1)) & mask;
874874

875-
if (masked_msbs != 0 && masked_msbs != mask) {
876-
return TRANSLATE_FAIL;
875+
if (vm == VM_1_10_SV32) {
876+
if (masked_msbs != 0 && masked_msbs != mask && masked_msbs != 1)
877+
return TRANSLATE_FAIL;
878+
} else {
879+
if (masked_msbs != 0 && masked_msbs != mask)
880+
return TRANSLATE_FAIL;
877881
}
878882

879883
int ptshift = (levels - 1) * ptidxbits;

target/riscv/csr.c

+1
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,7 @@ static const char valid_vm_1_10_32[16] = {
11301130

11311131
static const char valid_vm_1_10_64[16] = {
11321132
[VM_1_10_MBARE] = 1,
1133+
[VM_1_10_SV32] = 1,
11331134
[VM_1_10_SV39] = 1,
11341135
[VM_1_10_SV48] = 1,
11351136
[VM_1_10_SV57] = 1

0 commit comments

Comments
 (0)