Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157583890
D56924.id177546.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56924.id177546.diff
View Options
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -112,6 +112,7 @@
* and to when physical maps must be made correct.
*/
+#include "opt_ddb.h"
#include "opt_pmap.h"
#include <sys/param.h>
@@ -136,6 +137,10 @@
#include <sys/sched.h>
#include <sys/sysctl.h>
#include <sys/smp.h>
+#ifdef DDB
+#include <sys/kdb.h>
+#include <ddb/ddb.h>
+#endif
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -5596,3 +5601,59 @@
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_SKIP,
NULL, 0, sysctl_kmaps, "A",
"Dump kernel address layout");
+
+#ifdef DDB
+DB_SHOW_COMMAND(pte, pmap_print_pte)
+{
+ pd_entry_t *l0, l0e, *l1, l1e;
+ pt_entry_t *l2, l2e, *l3, l3e;
+ vm_offset_t va;
+ pmap_t pmap;
+
+ if (!have_addr) {
+ db_printf("show pte addr\n");
+ return;
+ }
+
+ va = (vm_offset_t)addr;
+ if (!VIRT_IS_VALID(va)) {
+ db_printf("malformed virtual address %#lx\n", va);
+ return;
+ }
+
+ if (kdb_thread != NULL)
+ pmap = vmspace_pmap(kdb_thread->td_proc->p_vmspace);
+ else
+ pmap = PCPU_GET(curpmap);
+
+ db_printf("VA 0x%016lx", va);
+ if (pmap_mode == PMAP_MODE_SV48) {
+ l0 = pmap_l0(pmap, va);
+ l0e = pmap_load(l0);
+ db_printf(" l0e@0x%016lx 0x%016lx", (uint64_t)l0, l0e);
+ }
+ l1 = pmap_l1(pmap, va);
+ if (l1 == NULL) {
+ db_printf("\n");
+ return;
+ }
+ l1e = pmap_load(l1);
+ db_printf(" l1e@0x%016lx 0x%016lx", (uint64_t)l1, l1e);
+
+ l2 = pmap_l2(pmap, va);
+ if (l2 == NULL) {
+ db_printf("\n");
+ return;
+ }
+ l2e = pmap_load(l2);
+ db_printf(" l2e@0x%016lx 0x%016lx", (uint64_t)l2, l2e);
+
+ l3 = pmap_l3(pmap, va);
+ if (l3 == NULL) {
+ db_printf("\n");
+ return;
+ }
+ l3e = pmap_load(l3);
+ db_printf(" l3e@0x%016lx 0x%016lx\n", (uint64_t)l3, l3e);
+}
+#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 24, 2:21 AM (8 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32947762
Default Alt Text
D56924.id177546.diff (1 KB)
Attached To
Mode
D56924: riscv/pmap.c: Add a ddb command for inspecting PTE hierachy
Attached
Detach File
Event Timeline
Log In to Comment