]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/jdb/ia32/jdb_kern_info-ia32-ux.cpp
update
[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     NULL, NULL, NULL, NULL,
88     "sse41", "sse42",
89     NULL, NULL,
90     "popcnt", NULL,
91     "aes", "xsave", "osxsave",
92     "avx", "f16c",
93     (char *)(-1)
94   };
95   static const char *const ext_81_ecx[] =
96   {
97     NULL, NULL, "svm (secure virtual machine)", NULL, NULL,
98     "abm (adv bit manipulation)", "SSE4A", NULL,
99     NULL, "OSVW (OS visible workaround)", NULL, NULL,
100     "SKINIT", "WDT (watchdog timer support)", NULL,
101     "lwp", "fmaa", NULL, NULL, "nodeid", NULL, "tbm", "topext",
102     (char *)(-1)
103   };
104   static const char *const ext_81_edx[] =
105   {
106     NULL, NULL, NULL, NULL,
107     NULL, NULL, NULL, NULL,
108     NULL, NULL, NULL,
109     "syscall (syscall/sysret instructions)",
110     NULL, NULL, NULL, NULL,
111     NULL, NULL, NULL,
112     "mp (MP capable)",
113     "nx (no-execute page protection)",
114     NULL,
115     "mmxext (AMD extensions to MMX)",
116     NULL, NULL,
117     "fxsr_opt (FXSR optimizations)",
118     "Page1GB",
119     "RDTSCP",
120     NULL, // reserved
121     "lm (Long mode)",
122     "3dnowext (AMD 3DNow! extenstion)",
123     "3dnow (3DNow! instructions)",
124     (char *)(-1)
125   };
126
127   unsigned position = 5, colon = 0;
128   putstr("CPU features:\n     ");
129   show_f_bits (Cpu::boot_cpu()->features(), simple, 5, position, colon);
130   show_f_bits (Cpu::boot_cpu()->ext_features(), extended, 5, position, colon);
131   show_f_bits (Cpu::boot_cpu()->ext_8000_0001_ecx(), ext_81_ecx, 5, position, colon);
132   show_f_bits (Cpu::boot_cpu()->ext_8000_0001_edx(), ext_81_edx, 5, position, colon);
133 }
134
135 PRIVATE inline NEEDS["jdb_screen.h"]
136 void
137 Jdb_kern_info_misc::show_pdir()
138 {
139   Mem_space *s = current_mem_space();
140   printf("%s" L4_PTR_FMT "\n",
141          Jdb_screen::Root_page_table, (Address)s->dir());
142 }