Print this page
9723 provide support for VMM's GDT handling
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/i86pc/modules/unix/unix.c
          +++ new/usr/src/cmd/mdb/i86pc/modules/unix/unix.c
↓ open down ↓ 896 lines elided ↑ open up ↑
 897  897                  mdb_printf("%s\n", name);
 898  898          }
 899  899  
 900  900          mdb_free(fset, sz);
 901  901          return (DCMD_OK);
 902  902  }
 903  903  
 904  904  #ifdef _KMDB
 905  905  /* ARGSUSED */
 906  906  static int
 907      -crregs_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
      907 +sysregs_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
 908  908  {
 909  909          ulong_t cr0, cr2, cr3, cr4;
      910 +        desctbr_t gdtr;
      911 +
 910  912          static const mdb_bitmask_t cr0_flag_bits[] = {
 911  913                  { "PE",         CR0_PE,         CR0_PE },
 912  914                  { "MP",         CR0_MP,         CR0_MP },
 913  915                  { "EM",         CR0_EM,         CR0_EM },
 914  916                  { "TS",         CR0_TS,         CR0_TS },
 915  917                  { "ET",         CR0_ET,         CR0_ET },
 916  918                  { "NE",         CR0_NE,         CR0_NE },
 917  919                  { "WP",         CR0_WP,         CR0_WP },
 918  920                  { "AM",         CR0_AM,         CR0_AM },
 919  921                  { "NW",         CR0_NW,         CR0_NW },
↓ open down ↓ 26 lines elided ↑ open up ↑
 946  948                  { "OSXSAVE",    CR4_OSXSAVE,    CR4_OSXSAVE },
 947  949                  { "SMEP",       CR4_SMEP,       CR4_SMEP },
 948  950                  { "SMAP",       CR4_SMAP,       CR4_SMAP },
 949  951                  { NULL,         0,              0 }
 950  952          };
 951  953  
 952  954          cr0 = kmdb_unix_getcr0();
 953  955          cr2 = kmdb_unix_getcr2();
 954  956          cr3 = kmdb_unix_getcr3();
 955  957          cr4 = kmdb_unix_getcr4();
      958 +
      959 +        kmdb_unix_getgdtr(&gdtr);
      960 +
 956  961          mdb_printf("%%cr0 = 0x%lx <%b>\n", cr0, cr0, cr0_flag_bits);
 957  962          mdb_printf("%%cr2 = 0x%lx <%a>\n", cr2, cr2);
 958  963  
 959  964          if ((cr4 & CR4_PCIDE)) {
 960  965                  mdb_printf("%%cr3 = 0x%lx <pfn:0x%lx pcid:%lu>\n", cr3,
 961  966                      cr3 >> MMU_PAGESHIFT, cr3 & MMU_PAGEOFFSET);
 962  967          } else {
 963  968                  mdb_printf("%%cr3 = 0x%lx <pfn:0x%lx flags:%b>\n", cr3,
 964  969                      cr3 >> MMU_PAGESHIFT, cr3, cr3_flag_bits);
 965  970          }
 966  971  
 967  972          mdb_printf("%%cr4 = 0x%lx <%b>\n", cr4, cr4, cr4_flag_bits);
 968  973  
      974 +        mdb_printf("%%gdtr.base = 0x%lx, %%gdtr.limit = 0x%hx\n",
      975 +            gdtr.dtr_base, gdtr.dtr_limit);
      976 +
 969  977          return (DCMD_OK);
 970  978  }
 971  979  #endif
 972  980  
 973  981  static const mdb_dcmd_t dcmds[] = {
 974  982          { "gate_desc", ":", "dump a gate descriptor", gate_desc },
 975  983          { "idt", ":[-v]", "dump an IDT", idt },
 976  984          { "ttrace", "[-x] [-t kthread]", "dump trap trace buffers", ttrace },
 977  985          { "vatopfn", ":[-a as]", "translate address to physical page",
 978  986              va2pfn_dcmd },
↓ open down ↓ 11 lines elided ↑ open up ↑
 990  998          { "pfntomfn", ":", "convert physical page to hypervisor machine page",
 991  999              pfntomfn_dcmd },
 992 1000          { "mfntopfn", ":", "convert hypervisor machine page to physical page",
 993 1001              mfntopfn_dcmd },
 994 1002          { "memseg_list", ":", "show memseg list", memseg_list },
 995 1003          { "scalehrtime", ":",
 996 1004              "scale an unscaled high-res time", scalehrtime_cmd },
 997 1005          { "x86_featureset", NULL, "dump the x86_featureset vector",
 998 1006                  x86_featureset_cmd },
 999 1007  #ifdef _KMDB
1000      -        { "crregs", NULL, "dump control registers", crregs_dcmd },
     1008 +        { "sysregs", NULL, "dump system registers", sysregs_dcmd },
1001 1009  #endif
1002 1010          { NULL }
1003 1011  };
1004 1012  
1005 1013  static const mdb_walker_t walkers[] = {
1006 1014          { "ttrace", "walks trap trace buffers in reverse chronological order",
1007 1015                  ttrace_walk_init, ttrace_walk_step, ttrace_walk_fini },
1008 1016          { "mutex_owner", "walks the owner of a mutex",
1009 1017                  mutex_owner_init, mutex_owner_step },
1010 1018          { "memseg", "walk the memseg structures",
↓ open down ↓ 17 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX