Author: kib Date: Mon Jul 15 06:30:57 2013 New Revision: 253352 URL: http://svnweb.freebsd.org/changeset/base/253352
Log: MFi386: add ddb "show sysregs" command. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Mon Jul 15 06:16:57 2013 (r253351) +++ head/sys/amd64/amd64/machdep.c Mon Jul 15 06:30:57 2013 (r253352) @@ -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 _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"