aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorAustin Clements <amdragon@MIT.EDU>2011-08-14 23:22:28 -0400
committerBlue Swirl <blauwirbel@gmail.com>2011-08-21 16:42:39 +0000
commitc76c8416be5631dfdbd13799d3c67ad670637155 (patch)
tree8c9c338869a492e9916588a387696121ae2256da /monitor.c
parent8a94b8ca530a983dacc78bd165fa2afb95205cb0 (diff)
monitor: Show combined protection bits in "info mem"
Previously, "info mem" considered and displayed only the last-level protection bits for a memory range, which doesn't accurrately represent the protection of that range. Now it shows the combined protection. Signed-off-by: Austin Clements <amdragon@mit.edu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/monitor.c b/monitor.c
index d1f03e4a98..0e101f5418 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2248,7 +2248,8 @@ static void mem_info_32(Monitor *mon, CPUState *env)
pte = le32_to_cpu(pte);
end = (l1 << 22) + (l2 << 12);
if (pte & PG_PRESENT_MASK) {
- prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);
+ prot = pte & pde &
+ (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);
} else {
prot = 0;
}
@@ -2297,8 +2298,8 @@ static void mem_info_pae32(Monitor *mon, CPUState *env)
pte = le64_to_cpu(pte);
end = (l1 << 30) + (l2 << 21) + (l3 << 12);
if (pte & PG_PRESENT_MASK) {
- prot = pte & (PG_USER_MASK | PG_RW_MASK |
- PG_PRESENT_MASK);
+ prot = pte & pde & (PG_USER_MASK | PG_RW_MASK |
+ PG_PRESENT_MASK);
} else {
prot = 0;
}
@@ -2345,6 +2346,7 @@ static void mem_info_64(Monitor *mon, CPUState *env)
if (pdpe & PG_PSE_MASK) {
prot = pdpe & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
+ prot &= pml4e;
mem_print(mon, &start, &last_prot, end, prot);
} else {
pd_addr = pdpe & 0x3fffffffff000ULL;
@@ -2356,6 +2358,7 @@ static void mem_info_64(Monitor *mon, CPUState *env)
if (pde & PG_PSE_MASK) {
prot = pde & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
+ prot &= pml4e & pdpe;
mem_print(mon, &start, &last_prot, end, prot);
} else {
pt_addr = pde & 0x3fffffffff000ULL;
@@ -2369,6 +2372,7 @@ static void mem_info_64(Monitor *mon, CPUState *env)
if (pte & PG_PRESENT_MASK) {
prot = pte & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
+ prot &= pml4e & pdpe & pde;
} else {
prot = 0;
}