diff options
author | kib <kib@FreeBSD.org> | 2013-07-15 06:30:57 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-07-15 06:30:57 +0000 |
commit | c833aa741fe7347d0990dfb8080bdf319eb3cce5 (patch) | |
tree | 1c093a583b43feede66e443e10e13c51875ebec3 | |
parent | 6f8e41d6cbe4a6159abeaba412a9adbc4bd819ee (diff) | |
download | FreeBSD-src-c833aa741fe7347d0990dfb8080bdf319eb3cce5.zip FreeBSD-src-c833aa741fe7347d0990dfb8080bdf319eb3cce5.tar.gz |
MFi386: add ddb "show sysregs" command.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
-rw-r--r-- | sys/amd64/amd64/machdep.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index a1c61eb..7a39ef8 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1228,6 +1228,36 @@ DB_SHOW_COMMAND(idt, db_show_idt) ip++; } } + +/* Show privileged registers. */ +DB_SHOW_COMMAND(sysregs, db_show_sysregs) +{ + struct { + uint16_t limit; + uint64_t base; + } __packed idtr, gdtr; + uint16_t ldt, tr; + + __asm __volatile("sidt %0" : "=m" (idtr)); + db_printf("idtr\t0x%016lx/%04x\n", + (u_long)idtr.base, (u_int)idtr.limit); + __asm __volatile("sgdt %0" : "=m" (gdtr)); + db_printf("gdtr\t0x%016lx/%04x\n", + (u_long)gdtr.base, (u_int)gdtr.limit); + __asm __volatile("sldt %0" : "=r" (ldt)); + db_printf("ldtr\t0x%04x\n", ldt); + __asm __volatile("str %0" : "=r" (tr)); + db_printf("tr\t0x%04x\n", tr); + db_printf("cr0\t0x%016lx\n", rcr0()); + db_printf("cr2\t0x%016lx\n", rcr2()); + db_printf("cr3\t0x%016lx\n", rcr3()); + db_printf("cr4\t0x%016lx\n", rcr4()); + db_printf("EFER\t%016lx\n", rdmsr(MSR_EFER)); + db_printf("FEATURES_CTL\t%016lx\n", rdmsr(MSR_IA32_FEATURE_CONTROL)); + db_printf("DEBUG_CTL\t%016lx\n", rdmsr(MSR_DEBUGCTLMSR)); + db_printf("PAT\t%016lx\n", rdmsr(MSR_PAT)); + db_printf("GSBASE\t%016lx\n", rdmsr(MSR_GSBASE)); +} #endif void |