2 #include "../port/lib.h"
8 #include "../port/error.h"
10 typedef struct IOMap IOMap;
25 IOMap maps[32]; /* some initial free maps */
27 QLock ql; /* lock for reading map */
47 enum { /* cpuid standard function codes */
48 Highstdfunc = 0, /* also returns vendor string */
54 typedef long Rdwrfn(Chan*, void*, long, vlong);
56 static Rdwrfn *readfn[Qmax];
57 static Rdwrfn *writefn[Qmax];
59 static Dirtab archdir[Qmax] = {
60 ".", { Qdir, 0, QTDIR }, 0, 0555,
61 "ioalloc", { Qioalloc, 0 }, 0, 0444,
62 "iob", { Qiob, 0 }, 0, 0660,
63 "iow", { Qiow, 0 }, 0, 0660,
64 "iol", { Qiol, 0 }, 0, 0660,
65 "msr", { Qmsr, 0 }, 0, 0660,
67 Lock archwlock; /* the lock is only for changing archdir */
69 int (*_pcmspecial)(char*, ISAConf*);
70 void (*_pcmspecialclose)(int);
72 static int doi8253set = 1;
75 * Add a file to the #P listing. Once added, you can't delete it.
76 * You can't add a file with the same name as one already there,
77 * and you get a pointer to the Dirtab entry so you can do things
78 * like change the Qid version. Changing the Qid path is disallowed.
81 addarchfile(char *name, int perm, Rdwrfn *rdfn, Rdwrfn *wrfn)
87 memset(&d, 0, sizeof d);
94 print("addarchfile: out of entries for %s\n", name);
98 for(i=0; i<narchdir; i++)
99 if(strcmp(archdir[i].name, name) == 0){
104 d.qid.path = narchdir;
105 archdir[narchdir] = d;
106 readfn[narchdir] = rdfn;
107 writefn[narchdir] = wrfn;
108 dp = &archdir[narchdir++];
120 for(i = 0; i < nelem(iomap.maps)-1; i++)
121 iomap.maps[i].next = &iomap.maps[i+1];
122 iomap.maps[i].next = nil;
123 iomap.free = iomap.maps;
126 * This is necessary to make the IBM X20 boot.
127 * Have not tracked down the reason.
128 * i82557 is at 0x1000, the dummy entry is needed for swappable devs.
130 ioalloc(0x0fff, 1, 0, "dummy");
132 if ((excluded = getconf("ioexclude")) != nil) {
136 while (s && *s != '\0' && *s != '\n') {
140 io_s = (int)strtol(s, &ends, 0);
141 if (ends == nil || ends == s || *ends != '-') {
142 print("ioinit: cannot parse option string\n");
147 io_e = (int)strtol(s, &ends, 0);
148 if (ends && *ends == ',')
152 ioalloc(io_s, io_e - io_s + 1, 0, "pre-allocated");
159 * Reserve a range to be ioalloced later.
160 * This is in particular useful for exchangable cards, such
161 * as pcmcia and cardbus cards.
164 ioreserve(int, int size, int align, char *tag)
170 /* find a free port above 0x400 and below 0x1000 */
172 for(l = &iomap.m; *l; l = &(*l)->next){
174 if (m->start < 0x400) continue;
179 port = ((port+align-1)/align)*align;
189 print("ioalloc: out of maps");
193 iomap.free = m->next;
196 m->end = port + size;
198 strncpy(m->tag, tag, sizeof(m->tag)-1);
199 m->tag[sizeof(m->tag)-1] = 0;
202 archdir[0].qid.vers++;
209 * alloc some io port space and remember who it was
210 * alloced to. if port < 0, find a free region.
213 ioalloc(int port, int size, int align, char *tag)
220 /* find a free port above 0x400 and below 0x1000 */
222 for(l = &iomap.m; (m = *l) != nil; l = &m->next){
223 if (m->start < 0x400) continue;
228 port = ((port+align-1)/align)*align;
237 /* Only 64KB I/O space on the x86. */
238 if((port+size) > 0x10000){
242 /* see if the space clashes with previously allocated ports */
243 for(l = &iomap.m; (m = *l) != nil; l = &m->next){
246 if(m->reserved && m->start == port && m->end >= port + size) {
251 if(m->start >= port+size)
259 print("ioalloc: out of maps");
263 iomap.free = m->next;
266 m->end = port + size;
267 strncpy(m->tag, tag, sizeof(m->tag)-1);
268 m->tag[sizeof(m->tag)-1] = 0;
271 archdir[0].qid.vers++;
283 for(l = &iomap.m; (m = *l) != nil; l = &m->next){
284 if(m->start == port){
286 m->next = iomap.free;
293 archdir[0].qid.vers++;
298 iounused(int start, int end)
302 for(m = iomap.m; m != nil; m = m->next){
303 if(start >= m->start && start < m->end
304 || start <= m->start && end > m->start)
311 checkport(int start, int end)
313 /* standard vga regs are OK */
314 if(start >= 0x2b0 && end <= 0x2df+1)
316 if(start >= 0x3c0 && end <= 0x3da+1)
319 if(iounused(start, end))
325 archattach(char* spec)
327 return devattach('P', spec);
331 archwalk(Chan* c, Chan *nc, char** name, int nname)
333 return devwalk(c, nc, name, nname, archdir, narchdir, devgen);
337 archstat(Chan* c, uchar* dp, int n)
339 return devstat(c, dp, n, archdir, narchdir, devgen);
343 archopen(Chan* c, int omode)
345 return devopen(c, omode, archdir, narchdir, devgen);
359 archread(Chan *c, void *a, long n, vlong offset)
369 switch((ulong)c->qid.path){
371 return devdirread(c, a, n, archdir, narchdir, devgen);
375 checkport(offset, offset+n);
376 for(p = a; port < offset+n; port++)
383 checkport(offset, offset+n);
385 for(port = offset; port < offset+n; port += 2)
392 checkport(offset, offset+n);
394 for(port = offset; port < offset+n; port += 4)
402 for(port = offset; port < offset+n; port += 8)
403 if(rdmsr(port, vp++) < 0)
411 if(c->qid.path < narchdir && (fn = readfn[c->qid.path]))
412 return fn(c, a, n, offset);
417 if((buf = malloc(n)) == nil)
421 offset = offset/Linelen;
424 for(m = iomap.m; n > 0 && m != nil; m = m->next){
427 sprint(p, "%8lux %8lux %-12.12s\n", m->start, m->end-1, m->tag);
441 archwrite(Chan *c, void *a, long n, vlong offset)
450 switch((ulong)c->qid.path){
453 checkport(offset, offset+n);
454 for(port = offset; port < offset+n; port++)
461 checkport(offset, offset+n);
463 for(port = offset; port < offset+n; port += 2)
470 checkport(offset, offset+n);
472 for(port = offset; port < offset+n; port += 4)
480 for(port = offset; port < offset+n; port += 8)
481 if(wrmsr(port, *vp++) < 0)
486 if(c->qid.path < narchdir && (fn = writefn[c->qid.path]) != nil)
487 return fn(c, a, n, offset);
516 * the following is a generic version of the
517 * architecture specific stuff
537 * Often the BIOS hangs during restart if a conventional 8042
538 * warm-boot sequence is tried. The following is Intel specific and
539 * seems to perform a cold-boot, but at least it comes back.
540 * And sometimes there is no keyboard...
542 * The reset register (0xcf9) is usually in one of the bridge
543 * chips. The actual location and sequence could be extracted from
544 * ACPI but why bother, this is the end of the line anyway.
546 print("Takes a licking and keeps on ticking...\n");
547 *(ushort*)KADDR(0x472) = 0x1234; /* BIOS warm-boot flag */
551 print("can't reset\n");
557 * 386 has no compare-and-swap instruction.
558 * Run it with interrupts turned off instead.
561 cmpswap386(long *addr, long old, long new)
566 if(r = (*addr == old))
573 * On a uniprocessor, you'd think that coherence could be nop,
574 * but it can't. We still need a barrier when using coherence() in
577 * On VMware, it's safe (and a huge win) to set this to nop.
578 * Aux/vmware does this via the #P/archctl file.
580 void (*coherence)(void) = nop;
582 int (*cmpswap)(long*, long, long) = cmpswap386;
585 extern PCArch* knownarch[];
587 PCArch archgeneric = {
591 .serialpower= unimplemented,
592 .modempower= unimplemented,
594 .intrinit= i8259init,
595 .intrenable= i8259enable,
596 .intrvecno= i8259vecno,
597 .intrdisable= i8259disable,
601 .clockenable= i8253enable,
602 .fastclock= i8253read,
603 .timerset= i8253timerset,
606 typedef struct X86type X86type;
614 static X86type x86intel[] =
616 { 4, 0, 22, "486DX", }, /* known chips */
617 { 4, 1, 22, "486DX50", },
618 { 4, 2, 22, "486SX", },
619 { 4, 3, 22, "486DX2", },
620 { 4, 4, 22, "486SL", },
621 { 4, 5, 22, "486SX2", },
622 { 4, 7, 22, "DX2WB", }, /* P24D */
623 { 4, 8, 22, "DX4", }, /* P24C */
624 { 4, 9, 22, "DX4WB", }, /* P24CT */
627 { 5, 2, 23, "P54C", },
628 { 5, 3, 23, "P24T", },
629 { 5, 4, 23, "P55C MMX", },
630 { 5, 7, 23, "P54C VRT", },
631 { 6, 1, 16, "PentiumPro", },/* trial and error */
632 { 6, 3, 16, "PentiumII", },
633 { 6, 5, 16, "PentiumII/Xeon", },
634 { 6, 6, 16, "Celeron", },
635 { 6, 7, 16, "PentiumIII/Xeon", },
636 { 6, 8, 16, "PentiumIII/Xeon", },
637 { 6, 0xB, 16, "PentiumIII/Xeon", },
638 { 6, 0xF, 16, "Xeon5000-series", },
639 { 6, 0x16, 16, "Celeron", },
640 { 6, 0x17, 16, "Core 2/Xeon", },
641 { 6, 0x1A, 16, "Core i7/Xeon", },
642 { 6, 0x1C, 16, "Atom", },
643 { 6, 0x1D, 16, "Xeon MP", },
644 { 0xF, 1, 16, "P4", }, /* P4 */
645 { 0xF, 2, 16, "PentiumIV/Xeon", },
646 { 0xF, 6, 16, "PentiumIV/Xeon", },
648 { 3, -1, 32, "386", }, /* family defaults */
649 { 4, -1, 22, "486", },
650 { 5, -1, 23, "P5", },
651 { 6, -1, 16, "P6", },
652 { 0xF, -1, 16, "P4", }, /* P4 */
654 { -1, -1, 16, "unknown", }, /* total default */
658 * The AMD processors all implement the CPUID instruction.
659 * The later ones also return the processor name via functions
660 * 0x80000002, 0x80000003 and 0x80000004 in registers AX, BX, CX
662 * K5 "AMD-K5(tm) Processor"
663 * K6 "AMD-K6tm w/ multimedia extensions"
664 * K6 3D "AMD-K6(tm) 3D processor"
667 static X86type x86amd[] =
669 { 5, 0, 23, "AMD-K5", }, /* guesswork */
670 { 5, 1, 23, "AMD-K5", }, /* guesswork */
671 { 5, 2, 23, "AMD-K5", }, /* guesswork */
672 { 5, 3, 23, "AMD-K5", }, /* guesswork */
673 { 5, 4, 23, "AMD Geode GX1", }, /* guesswork */
674 { 5, 5, 23, "AMD Geode GX2", }, /* guesswork */
675 { 5, 6, 11, "AMD-K6", }, /* trial and error */
676 { 5, 7, 11, "AMD-K6", }, /* trial and error */
677 { 5, 8, 11, "AMD-K6-2", }, /* trial and error */
678 { 5, 9, 11, "AMD-K6-III", },/* trial and error */
679 { 5, 0xa, 23, "AMD Geode LX", }, /* guesswork */
681 { 6, 1, 11, "AMD-Athlon", },/* trial and error */
682 { 6, 2, 11, "AMD-Athlon", },/* trial and error */
684 { 0x1F, 9, 11, "AMD-K10 Opteron G34", },/* guesswork */
686 { 4, -1, 22, "Am486", }, /* guesswork */
687 { 5, -1, 23, "AMD-K5/K6", }, /* guesswork */
688 { 6, -1, 11, "AMD-Athlon", },/* guesswork */
689 { 0xF, -1, 11, "AMD-K8", }, /* guesswork */
690 { 0x1F, -1, 11, "AMD-K10", }, /* guesswork */
692 { -1, -1, 11, "unknown", }, /* total default */
698 static X86type x86winchip[] =
700 {5, 4, 23, "Winchip",}, /* guesswork */
701 {6, 7, 23, "Via C3 Samuel 2 or Ezra",},
702 {6, 8, 23, "Via C3 Ezra-T",},
703 {6, 9, 23, "Via C3 Eden-N",},
704 { -1, -1, 23, "unknown", }, /* total default */
710 static X86type x86sis[] =
712 {5, 0, 23, "SiS 55x",}, /* guesswork */
713 { -1, -1, 23, "unknown", }, /* total default */
716 static X86type *cputype;
718 static void simplecycles(uvlong*);
719 void (*cycles)(uvlong*) = simplecycles;
720 void _cycles(uvlong*); /* in l.s */
723 simplecycles(uvlong*x)
731 print("cpu%d: %dMHz %s %s (AX %8.8uX CX %8.8uX DX %8.8uX)\n",
732 m->machno, m->cpumhz, m->cpuidid, m->cpuidtype,
733 m->cpuidax, m->cpuidcx, m->cpuiddx);
739 * - whether or not we have a TSC (cycle counter)
740 * - whether or not it supports page size extensions
742 * - whether or not it supports machine check exceptions
744 * - whether or not it supports the page global flag
751 int family, model, nomce;
757 cpuid(Highstdfunc, regs);
758 memmove(m->cpuidid, ®s[1], BY2WD); /* bx */
759 memmove(m->cpuidid+4, ®s[3], BY2WD); /* dx */
760 memmove(m->cpuidid+8, ®s[2], BY2WD); /* cx */
761 m->cpuidid[12] = '\0';
763 cpuid(Procsig, regs);
764 m->cpuidax = regs[0];
765 m->cpuidcx = regs[2];
766 m->cpuiddx = regs[3];
768 if(strncmp(m->cpuidid, "AuthenticAMD", 12) == 0 ||
769 strncmp(m->cpuidid, "Geode by NSC", 12) == 0)
771 else if(strncmp(m->cpuidid, "CentaurHauls", 12) == 0)
773 else if(strncmp(m->cpuidid, "SiS SiS SiS ", 12) == 0)
778 family = X86FAMILY(m->cpuidax);
779 model = X86MODEL(m->cpuidax);
780 for(t=tab; t->name; t++)
781 if((t->family == family && t->model == model)
782 || (t->family == family && t->model == -1)
783 || (t->family == -1))
786 m->cpuidtype = t->name;
789 * if there is one, set tsc to a known value
791 if(m->cpuiddx & Tsc){
794 if(m->cpuiddx & Cpumsr)
800 * use i8253 to guess our cpu speed
802 guesscpuhz(t->aalcycles);
805 * If machine check exception, page size extensions or page global bit
806 * are supported enable them in CR4 and clear any other set extensions.
807 * If machine check was enabled clear out any lingering status.
809 if(m->cpuiddx & (Pge|Mce|Pse)){
812 cr4 |= 0x10; /* page size extensions */
813 if(p = getconf("*nomce"))
814 nomce = strtoul(p, 0, 0);
817 if((m->cpuiddx & Mce) != 0 && !nomce){
818 if((m->cpuiddx & Mca) != 0){
826 wrmsr(0x17B, ~0ULL); /* enable all mca features */
832 /* init MCi .. MC1 (except MC0) */
834 wrmsr(0x400 + bank*4, ~0ULL);
835 wrmsr(0x401 + bank*4, 0);
838 if(family != 6 || model >= 0x1A)
843 else if(family == 5){
847 cr4 |= 0x40; /* machine check enable */
851 * Detect whether the chip supports the global bit
852 * in page directory and page table entries. When set
853 * in a particular entry, it means ``don't bother removing
854 * this from the TLB when CR3 changes.''
856 * We flag all kernel pages with this bit. Doing so lessens the
857 * overhead of switching processes on bare hardware,
858 * even more so on VMware. See mmu.c:/^memglobal.
860 * For future reference, should we ever need to do a
861 * full TLB flush, it can be accomplished by clearing
862 * the PGE bit in CR4, writing to CR3, and then
863 * restoring the PGE bit.
865 if(m->cpuiddx & Pge){
866 cr4 |= 0x80; /* page global enable bit */
872 if((m->cpuiddx & (Mca|Mce)) == Mce)
876 if(m->cpuiddx & Mtrr)
879 if(m->cpuiddx & Fxsr){ /* have sse fp? */
881 fprestore = fpsserestore;
882 putcr4(getcr4() | CR4Osfxsr|CR4Oxmmex);
885 fprestore = fpx87restore;
893 cputyperead(Chan*, void *a, long n, vlong offset)
898 mhz = (m->cpuhz+999999)/1000000;
900 snprint(str, sizeof(str), "%s %lud\n", cputype->name, mhz);
901 return readstr(offset, a, n, str);
905 archctlread(Chan*, void *a, long nn, vlong offset)
910 p = buf = smalloc(READSTR);
912 p = seprint(p, ep, "cpu %s %lud%s\n",
913 cputype->name, (ulong)(m->cpuhz+999999)/1000000,
914 m->havepge ? " pge" : "");
915 p = seprint(p, ep, "pge %s\n", getcr4()&0x80 ? "on" : "off");
916 p = seprint(p, ep, "coherence ");
917 if(coherence == mb386)
918 p = seprint(p, ep, "mb386\n");
919 else if(coherence == mb586)
920 p = seprint(p, ep, "mb586\n");
921 else if(coherence == mfence)
922 p = seprint(p, ep, "mfence\n");
923 else if(coherence == nop)
924 p = seprint(p, ep, "nop\n");
926 p = seprint(p, ep, "0x%p\n", coherence);
927 p = seprint(p, ep, "cmpswap ");
928 if(cmpswap == cmpswap386)
929 p = seprint(p, ep, "cmpswap386\n");
930 else if(cmpswap == cmpswap486)
931 p = seprint(p, ep, "cmpswap486\n");
933 p = seprint(p, ep, "0x%p\n", cmpswap);
934 p = seprint(p, ep, "i8253set %s\n", doi8253set ? "on" : "off");
936 n += mtrrprint(p, ep - p);
939 n = readstr(offset, a, nn, buf);
952 static Cmdtab archctlmsg[] =
955 CMcoherence, "coherence", 2,
956 CMi8253set, "i8253set", 2,
961 archctlwrite(Chan*, void *a, long n, vlong)
973 ct = lookupcmd(cb, archctlmsg, nelem(archctlmsg));
977 error("processor does not support pge");
978 if(strcmp(cb->f[1], "on") == 0)
979 putcr4(getcr4() | 0x80);
980 else if(strcmp(cb->f[1], "off") == 0)
981 putcr4(getcr4() & ~0x80);
983 cmderror(cb, "invalid pge ctl");
986 if(strcmp(cb->f[1], "mb386") == 0)
988 else if(strcmp(cb->f[1], "mb586") == 0){
989 if(X86FAMILY(m->cpuidax) < 5)
990 error("invalid coherence ctl on this cpu family");
992 }else if(strcmp(cb->f[1], "mfence") == 0){
993 if((m->cpuiddx & Sse2) == 0)
994 error("invalid coherence ctl on this cpu family");
996 }else if(strcmp(cb->f[1], "nop") == 0){
997 /* only safe on vmware */
999 error("cannot disable coherence on a multiprocessor");
1002 cmderror(cb, "invalid coherence ctl");
1005 if(strcmp(cb->f[1], "on") == 0)
1007 else if(strcmp(cb->f[1], "off") == 0){
1009 (*arch->timerset)(0);
1011 cmderror(cb, "invalid i2853set ctl");
1014 base = strtoull(cb->f[1], &ep, 0);
1016 error("cache: parse error: base not a number?");
1017 size = strtoull(cb->f[2], &ep, 0);
1019 error("cache: parse error: size not a number?");
1020 ep = mtrr(base, size, cb->f[3]);
1031 rmemrw(int isr, void *a, long n, vlong off)
1035 if(off < 0 || n < 0)
1036 error("bad offset/count");
1042 memmove(a, KADDR(addr), n);
1044 /* allow vga framebuf's write access */
1045 if(addr >= MB || addr+n > MB ||
1046 (addr < 0xA0000 || addr+n > 0xB0000+0x10000))
1047 error("bad offset/count in write");
1048 memmove(KADDR(addr), a, n);
1054 rmemread(Chan*, void *a, long n, vlong off)
1056 return rmemrw(1, a, n, off);
1060 rmemwrite(Chan*, void *a, long n, vlong off)
1062 return rmemrw(0, a, n, off);
1070 arch = &archgeneric;
1071 for(p = knownarch; *p != nil; p++){
1072 if((*p)->ident != nil && (*p)->ident() == 0){
1077 if(arch != &archgeneric){
1079 arch->id = archgeneric.id;
1080 if(arch->reset == nil)
1081 arch->reset = archgeneric.reset;
1082 if(arch->serialpower == nil)
1083 arch->serialpower = archgeneric.serialpower;
1084 if(arch->modempower == nil)
1085 arch->modempower = archgeneric.modempower;
1086 if(arch->intrinit == nil)
1087 arch->intrinit = archgeneric.intrinit;
1088 if(arch->intrenable == nil)
1089 arch->intrenable = archgeneric.intrenable;
1093 * Decide whether to use copy-on-reference (386 and mp).
1094 * We get another chance to set it in mpinit() for a
1097 if(X86FAMILY(m->cpuidax) == 3)
1100 if(X86FAMILY(m->cpuidax) >= 4)
1101 cmpswap = cmpswap486;
1103 if(X86FAMILY(m->cpuidax) >= 5)
1106 if(m->cpuiddx & Sse2)
1109 addarchfile("cputype", 0444, cputyperead, nil);
1110 addarchfile("archctl", 0664, archctlread, archctlwrite);
1111 addarchfile("realmodemem", 0660, rmemread, rmemwrite);
1115 * call either the pcmcia or pccard device setup
1118 pcmspecial(char *idstr, ISAConf *isa)
1120 return (_pcmspecial != nil)? _pcmspecial(idstr, isa): -1;
1124 * call either the pcmcia or pccard device teardown
1127 pcmspecialclose(int a)
1129 if (_pcmspecialclose != nil)
1130 _pcmspecialclose(a);
1134 * return value and speed of timer set in arch->clockenable
1137 fastticks(uvlong *hz)
1139 return (*arch->fastclock)(hz);
1145 return fastticks2us((*arch->fastclock)(nil));
1149 * set next timer interrupt
1155 (*arch->timerset)(x);
1159 * put the processor in the halt state if we've no processes to run.
1160 * an interrupt will get us going again.
1162 * halting in an smp system can result in a startup latency for
1163 * processes that become ready.
1164 * if idle_spin is zero, we care more about saving energy
1165 * than reducing this latency.
1167 * the performance loss with idle_spin == 0 seems to be slight
1168 * and it reduces lock contention (thus system time and real time)
1169 * on many-core systems with large values of NPROC.
1174 extern int nrdy, idle_spin;
1178 else if(m->cpuidcx & Monitor)
1180 else if(idle_spin == 0)
1185 isaconfig(char *class, int ctlrno, ISAConf *isa)
1190 snprint(cc, sizeof cc, "%s%d", class, ctlrno);
1196 isa->nopt = tokenize(p, isa->opt, NISAOPT);
1197 for(i = 0; i < isa->nopt; i++){
1199 if(cistrncmp(p, "type=", 5) == 0)
1201 else if(cistrncmp(p, "port=", 5) == 0)
1202 isa->port = strtoul(p+5, &p, 0);
1203 else if(cistrncmp(p, "irq=", 4) == 0)
1204 isa->irq = strtoul(p+4, &p, 0);
1205 else if(cistrncmp(p, "dma=", 4) == 0)
1206 isa->dma = strtoul(p+4, &p, 0);
1207 else if(cistrncmp(p, "mem=", 4) == 0)
1208 isa->mem = strtoul(p+4, &p, 0);
1209 else if(cistrncmp(p, "size=", 5) == 0)
1210 isa->size = strtoul(p+5, &p, 0);
1211 else if(cistrncmp(p, "freq=", 5) == 0)
1212 isa->freq = strtoul(p+5, &p, 0);
1223 if((m->cpuiddx & (Mce|Cpumsr)) != (Mce|Cpumsr))
1225 if((m->cpuiddx & Mca) == 0){
1228 iprint("MCA %8.8llux MCT %8.8llux\n", v, w);
1233 iprint("MCG CAP %.16llux STATUS %.16llux\n", v, w);
1239 rdmsr(0x401 + bank*4, &v);
1240 if((v & (1ull << 63)) == 0)
1242 iprint("MC%d STATUS %.16llux", bank, v);
1243 if(v & (1ull << 58)){
1244 rdmsr(0x402 + bank*4, &w);
1245 iprint(" ADDR %.16llux", w);
1247 if(v & (1ull << 59)){
1248 rdmsr(0x403 + bank*4, &w);
1249 iprint(" MISC %.16llux", w);