svn commit: r254032 - stable/9/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Wed Aug 7 07:24:21 UTC 2013


Author: kib
Date: Wed Aug  7 07:24:20 2013
New Revision: 254032
URL: http://svnweb.freebsd.org/changeset/base/254032

Log:
  MFC r253352:
  MFi386: add ddb "show sysregs" command.

Modified:
  stable/9/sys/amd64/amd64/machdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/machdep.c	Wed Aug  7 07:22:56 2013	(r254031)
+++ stable/9/sys/amd64/amd64/machdep.c	Wed Aug  7 07:24:20 2013	(r254032)
@@ -1198,6 +1198,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


More information about the svn-src-all mailing list