* [Qemu-devel] [PATCH] monitor: Show combined protection bits in "info mem"
@ 2011-08-15 3:22 Austin Clements
2011-08-21 18:27 ` Blue Swirl
0 siblings, 1 reply; 2+ messages in thread
From: Austin Clements @ 2011-08-15 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Austin Clements, Markus Armbruster, Luiz Capitulino
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>
---
monitor.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/monitor.c b/monitor.c
index f8ba0ef..cd4e749 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2246,7 +2246,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;
}
@@ -2295,8 +2296,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;
}
@@ -2343,6 +2344,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;
@@ -2354,6 +2356,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;
@@ -2367,6 +2370,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;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] monitor: Show combined protection bits in "info mem"
2011-08-15 3:22 [Qemu-devel] [PATCH] monitor: Show combined protection bits in "info mem" Austin Clements
@ 2011-08-21 18:27 ` Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2011-08-21 18:27 UTC (permalink / raw)
To: Austin Clements; +Cc: Luiz Capitulino, qemu-devel, Markus Armbruster
Thanks, applied.
On Mon, Aug 15, 2011 at 3:22 AM, Austin Clements <amdragon@mit.edu> wrote:
> 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>
> ---
> monitor.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index f8ba0ef..cd4e749 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2246,7 +2246,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;
> }
> @@ -2295,8 +2296,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;
> }
> @@ -2343,6 +2344,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;
> @@ -2354,6 +2356,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;
> @@ -2367,6 +2370,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;
> }
> --
> 1.7.5.4
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-21 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-15 3:22 [Qemu-devel] [PATCH] monitor: Show combined protection bits in "info mem" Austin Clements
2011-08-21 18:27 ` Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).