提交 c76c8416 编写于 作者: A Austin Clements 提交者: Blue Swirl

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: NAustin Clements <amdragon@mit.edu>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 8a94b8ca
...@@ -2248,7 +2248,8 @@ static void mem_info_32(Monitor *mon, CPUState *env) ...@@ -2248,7 +2248,8 @@ static void mem_info_32(Monitor *mon, CPUState *env)
pte = le32_to_cpu(pte); pte = le32_to_cpu(pte);
end = (l1 << 22) + (l2 << 12); end = (l1 << 22) + (l2 << 12);
if (pte & PG_PRESENT_MASK) { 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 { } else {
prot = 0; prot = 0;
} }
...@@ -2297,7 +2298,7 @@ static void mem_info_pae32(Monitor *mon, CPUState *env) ...@@ -2297,7 +2298,7 @@ static void mem_info_pae32(Monitor *mon, CPUState *env)
pte = le64_to_cpu(pte); pte = le64_to_cpu(pte);
end = (l1 << 30) + (l2 << 21) + (l3 << 12); end = (l1 << 30) + (l2 << 21) + (l3 << 12);
if (pte & PG_PRESENT_MASK) { if (pte & PG_PRESENT_MASK) {
prot = pte & (PG_USER_MASK | PG_RW_MASK | prot = pte & pde & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK); PG_PRESENT_MASK);
} else { } else {
prot = 0; prot = 0;
...@@ -2345,6 +2346,7 @@ static void mem_info_64(Monitor *mon, CPUState *env) ...@@ -2345,6 +2346,7 @@ static void mem_info_64(Monitor *mon, CPUState *env)
if (pdpe & PG_PSE_MASK) { if (pdpe & PG_PSE_MASK) {
prot = pdpe & (PG_USER_MASK | PG_RW_MASK | prot = pdpe & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK); PG_PRESENT_MASK);
prot &= pml4e;
mem_print(mon, &start, &last_prot, end, prot); mem_print(mon, &start, &last_prot, end, prot);
} else { } else {
pd_addr = pdpe & 0x3fffffffff000ULL; pd_addr = pdpe & 0x3fffffffff000ULL;
...@@ -2356,6 +2358,7 @@ static void mem_info_64(Monitor *mon, CPUState *env) ...@@ -2356,6 +2358,7 @@ static void mem_info_64(Monitor *mon, CPUState *env)
if (pde & PG_PSE_MASK) { if (pde & PG_PSE_MASK) {
prot = pde & (PG_USER_MASK | PG_RW_MASK | prot = pde & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK); PG_PRESENT_MASK);
prot &= pml4e & pdpe;
mem_print(mon, &start, &last_prot, end, prot); mem_print(mon, &start, &last_prot, end, prot);
} else { } else {
pt_addr = pde & 0x3fffffffff000ULL; pt_addr = pde & 0x3fffffffff000ULL;
...@@ -2369,6 +2372,7 @@ static void mem_info_64(Monitor *mon, CPUState *env) ...@@ -2369,6 +2372,7 @@ static void mem_info_64(Monitor *mon, CPUState *env)
if (pte & PG_PRESENT_MASK) { if (pte & PG_PRESENT_MASK) {
prot = pte & (PG_USER_MASK | PG_RW_MASK | prot = pte & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK); PG_PRESENT_MASK);
prot &= pml4e & pdpe & pde;
} else { } else {
prot = 0; prot = 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册