]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/jdb/ia32/jdb_kern_info-ia32-ux.cpp
94d34460f72777e2e127c5282fa8edcce96c01c4
[l4.git] / kernel / fiasco / src / jdb / ia32 / jdb_kern_info-ia32-ux.cpp
1 IMPLEMENTATION[ia32,ux,amd64]:
2
3 #include <cstdio>
4 #include <cstring>
5 #include "simpleio.h"
6 #include "jdb_screen.h"
7
8 PUBLIC
9 void
10 Jdb_kern_info_cpu::show_f_bits (unsigned features, const char *const *table,
11                                 unsigned first_pos, unsigned &last_pos,
12                                 unsigned &colon)
13 {
14   unsigned i, count;
15
16   for (i=count=0; *table != (char *) -1; i++, table++)
17     if ((features & (1 << i)) && *table)
18       {
19         int slen = strlen(*table);
20         if (last_pos+colon+slen > 78)
21           {
22             colon = 0;
23             last_pos = first_pos;
24             printf("\n%*s", first_pos, "");
25           }
26         printf ("%s%s", colon ? ", " : "", *table);
27         last_pos += slen + colon;
28         colon = 2;
29       }
30 }
31
32 PUBLIC
33 void
34 Jdb_kern_info_cpu::show_features()
35 {
36   static const char *const simple[] = 
37   {
38     "fpu (fpu on chip)",
39     "vme (virtual-8086 mode enhancements)",
40     "de (I/O breakpoints)",
41     "pse (4MB pages)",
42     "tsc (rdtsc instruction)",
43     "msr (rdmsr/rdwsr instructions)",
44     "pae (physical address extension)",
45     "mce (machine check exception #18)",
46     "cx8 (cmpxchg8 instruction)",
47     "apic (on-chip APIC)",
48     NULL,
49     "sep (sysenter/sysexit instructions)",
50     "mtrr (memory type range registers)",
51     "pge (global TLBs)",
52     "mca (machine check architecture)",
53     "cmov (conditional move instructions)",
54     "pat (page attribute table)",
55     "pse36 (32-bit page size extension)",
56     "psn (processor serial number)",
57     "clfsh (flush cache line instruction)",
58     NULL,
59     "ds (debug store to memory)",
60     "acpi (thermal monitor and soft controlled clock)",
61     "mmx (MMX technology)",
62     "fxsr (fxsave/fxrstor instructions)",
63     "sse (SSE extensions)",
64     "sse2 (SSE2 extensions)",
65     "ss (self snoop of own cache structures)",
66     "htt (hyper-threading technology)",
67     "tm (thermal monitor)",
68     NULL,
69     "pbe (pending break enable)",
70     (char *)(-1)
71   };
72   static const char *const extended[] =
73   {
74     "pni (prescott new instructions)",
75     NULL, NULL,
76     "monitor (monitor/mwait instructions)",
77     "dscpl (CPL qualified debug store)",
78     "vmx (virtual machine technology)",
79     NULL,
80     "est (enhanced speedstep technology)",
81     "tm2 (thermal monitor 2)",
82     NULL,
83     "cid (L1 context id)",
84     NULL, NULL,
85     "cmpxchg16b",
86     "xtpr (send task priority messages)",
87     (char *)(-1)
88   };
89   static const char *const ext_81_ecx[] =
90   {
91     NULL, NULL, "svm (secure virtual machine)", NULL, NULL,
92     "abm (adv bit manipulation)", "SSE4A", NULL,
93     NULL, "OSVW (OS visible workaround)", NULL, NULL,
94     "SKINIT", "WDT (watchdog timer support)",
95     (char *)(-1)
96   };
97   static const char *const ext_81_edx[] =
98   {
99     NULL, NULL, NULL, NULL,
100     NULL, NULL, NULL, NULL,
101     NULL, NULL, NULL,
102     "syscall (syscall/sysret instructions)",
103     NULL, NULL, NULL, NULL,
104     NULL, NULL, NULL,
105     "mp (MP capable)",
106     "nx (no-execute page protection)",
107     NULL,
108     "mmxext (AMD extensions to MMX)",
109     NULL, NULL,
110     "fxsr_opt (FXSR optimizations)",
111     "Page1GB",
112     "RDTSCP",
113     NULL, // reserved
114     "lm (Long mode)",
115     "3dnowext (AMD 3DNow! extenstion)",
116     "3dnow (3DNow! instructions)",
117     (char *)(-1)
118   };
119
120   unsigned position = 5, colon = 0;
121   putstr("CPU features:\n     ");
122   show_f_bits (Cpu::boot_cpu()->features(), simple, 5, position, colon);
123   show_f_bits (Cpu::boot_cpu()->ext_features(), extended, 5, position, colon);
124   show_f_bits (Cpu::boot_cpu()->ext_8000_0001_ecx(), ext_81_ecx, 5, position, colon);
125   show_f_bits (Cpu::boot_cpu()->ext_8000_0001_edx(), ext_81_edx, 5, position, colon);
126 }
127
128 PRIVATE inline NEEDS["jdb_screen.h"]
129 void
130 Jdb_kern_info_misc::show_pdir()
131 {
132   Mem_space *s = current_mem_space();
133   // printf ("%s"L4_PTR_FMT" (taskno=%x, chief=%x)\n",
134   //      Jdb_screen::Root_page_table,
135   //      (Address) s->dir(),
136   //      unsigned (s->id()),
137   //      unsigned (s->chief()));
138   printf ("%s"L4_PTR_FMT"\n",
139           Jdb_screen::Root_page_table,
140           (Address) s->dir());
141 }