Skip to contentSkip to conversation

hvf: Fix value of MMU_PAGE_NX and add MMU_PAGE_RS

PATCH In review Jessica Clarke 3 participants 3 messages Nov 16, 2020 – Nov 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvf: Fix value of MMU_PAGE_NX and add MMU_PAGE_RS

These are meant to correspond to the error code reported for #PF, so fix the definition for Instruction Fetch faults and add one for Reserved Bit faults (checking for that is currently a TODO in x86_mmu.c).

---
 target/i386/hvf/x86_mmu.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/i386/hvf/x86_mmu.h +2 -1
index cd6e137e79..710adb82b5 100644
@@ -34,7 +34,8 @@
 #define MMU_PAGE_PT             (1 << 0)
 #define MMU_PAGE_WT             (1 << 1)
 #define MMU_PAGE_US             (1 << 2)
-#define MMU_PAGE_NX             (1 << 3)
+#define MMU_PAGE_RS             (1 << 3)
+#define MMU_PAGE_NX             (1 << 4)
 
 bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa);
 
Signature · 1 line
2.28.0
#1 lore raw
Quoted 14 lines · Jessica Clarke

These are meant to correspond to the error code reported for #PF, so fix the definition for Instruction Fetch faults and add one for Reserved Bit faults (checking for that is currently a TODO in x86_mmu.c).

---
  target/i386/hvf/x86_mmu.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
target/i386/hvf/x86_mmu.h +0 -0
index cd6e137e79..710adb82b5 100644

target/i386/hvf/x86_mmu.h line 40

Quoted 8 lines
target/i386/hvf/x86_mmu.h +2 -1
@@ -34,7 +34,8 @@
  #define MMU_PAGE_PT             (1 << 0)
  #define MMU_PAGE_WT             (1 << 1)
  #define MMU_PAGE_US             (1 << 2)
-#define MMU_PAGE_NX             (1 << 3)
+#define MMU_PAGE_RS             (1 << 3)
+#define MMU_PAGE_NX             (1 << 4)
 
  bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa);

Since you are at it, can you instead replace these flags with PG_ERROR_{P,W,U,RSVD,I_D}_MASK from cpu.h?

Thanks,

Paolo

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jessica Clarke
Quoted 26 lines · Jessica Clarke

These are meant to correspond to the error code reported for #PF, so fix the definition for Instruction Fetch faults and add one for Reserved Bit faults (checking for that is currently a TODO in x86_mmu.c).

---
 target/i386/hvf/x86_mmu.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/i386/hvf/x86_mmu.h +2 -1
index cd6e137e79..710adb82b5 100644
@@ -34,7 +34,8 @@
 #define MMU_PAGE_PT             (1 << 0)
 #define MMU_PAGE_WT             (1 << 1)
 #define MMU_PAGE_US             (1 << 2)
-#define MMU_PAGE_NX             (1 << 3)
+#define MMU_PAGE_RS             (1 << 3)
+#define MMU_PAGE_NX             (1 << 4)
 
 bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa);
 
Signature · 1 line
2.28.0

But I agree with Paolo that eliminating HVF-only definition duplicates would be helpful.

Thanks,
Roman