Skip to contentSkip to conversation

i386/monitor: Fix page table walking issue for LA57 enabled guest

PATCH New Yuan Yao 1 participant 1 message Jun 27, 2022

lore
Share & tools
lore

Yuan Yao

author
#0 lore raw

PATCH v2 1/1 i386/monitor: Fix page table walking issue for LA57 enabled guest

Inverse the condition checking to PG_PRESENT_MASK when walk LA57 guest's pdpe/pde for "info mem" command.

The current condition checking:
if (PG_PRESENT_MASK is set)
Skip low level page table.
else
Try to walk low level page table.

This is wrong because PG_PRESENT_MASK is set means the pdpe/pde is present so we should continue walking the low level page table it points to. This issue leads to no mapping information is collected for LA57 guest when run the command.

v2:
1. Fix Typo (Zhang Chen <[email protected]> and Markus Armbruster <[email protected]>).
2. Rewrite commit message (Markus Armbruster <[email protected]>).
3. Add Fixes tag (Markus Armbruster <[email protected]>).

Fixes 6c7c3c21f9 ("x86: implement la57 paging mode")
---
 target/i386/monitor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/monitor.c +2 -2
index 8e4b4d600c..3339550bbe 100644
@@ -489,7 +489,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
                 cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8);
                 pdpe = le64_to_cpu(pdpe);
                 end = (l0 << 48) + (l1 << 39) + (l2 << 30);
-                if (pdpe & PG_PRESENT_MASK) {
+                if (!(pdpe & PG_PRESENT_MASK)) {
                     prot = 0;
                     mem_print(mon, env, &start, &last_prot, end, prot);
                     continue;
@@ -508,7 +508,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)
                     cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8);
                     pde = le64_to_cpu(pde);
                     end = (l0 << 48) + (l1 << 39) + (l2 << 30) + (l3 << 21);
-                    if (pde & PG_PRESENT_MASK) {
+                    if (!(pde & PG_PRESENT_MASK)) {
                         prot = 0;
                         mem_print(mon, env, &start, &last_prot, end, prot);
                         continue;
Signature · 1 line
2.27.0