8324280: RISC-V: Incorrect implementation in VM_Version::parse_satp_mode
Reviewed-by: rehn, fyang
This commit is contained in:
parent
3d32c460eb
commit
e7fdac9d5c
@ -169,13 +169,13 @@ void VM_Version::os_aux_features() {
|
||||
}
|
||||
|
||||
VM_Version::VM_MODE VM_Version::parse_satp_mode(const char* vm_mode) {
|
||||
if (!strcmp(vm_mode, "sv39")) {
|
||||
if (!strncmp(vm_mode, "sv39", sizeof "sv39" - 1)) {
|
||||
return VM_SV39;
|
||||
} else if (!strcmp(vm_mode, "sv48")) {
|
||||
} else if (!strncmp(vm_mode, "sv48", sizeof "sv48" - 1)) {
|
||||
return VM_SV48;
|
||||
} else if (!strcmp(vm_mode, "sv57")) {
|
||||
} else if (!strncmp(vm_mode, "sv57", sizeof "sv57" - 1)) {
|
||||
return VM_SV57;
|
||||
} else if (!strcmp(vm_mode, "sv64")) {
|
||||
} else if (!strncmp(vm_mode, "sv64", sizeof "sv64" - 1)) {
|
||||
return VM_SV64;
|
||||
} else {
|
||||
return VM_MBARE;
|
||||
@ -197,7 +197,7 @@ char* VM_Version::os_uarch_additional_features() {
|
||||
if ((p = strchr(buf, ':')) != nullptr) {
|
||||
if (mode == VM_NOTSET) {
|
||||
if (strncmp(buf, "mmu", sizeof "mmu" - 1) == 0) {
|
||||
mode = VM_Version::parse_satp_mode(p);
|
||||
mode = VM_Version::parse_satp_mode(p + 2);
|
||||
}
|
||||
}
|
||||
if (ret == nullptr) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user