From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucio De Re To: 9fans@cse.psu.edu Subject: Re: [9fans] Re: Kernel failure - i486 Message-ID: <20040122155451.C28365@cackle.proxima.alt.za> References: <20040122135242.B28365@cackle.proxima.alt.za> <56180b256fc8cc8d05e5b24091071cbf@terzarima.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <56180b256fc8cc8d05e5b24091071cbf@terzarima.net>; from Charles Forsyth on Thu, Jan 22, 2004 at 12:52:26PM +0000 Date: Thu, 22 Jan 2004 15:54:51 +0200 Topicbox-Message-UUID: bd7722b0-eacc-11e9-9e20-41e7f4b1d025 On Thu, Jan 22, 2004 at 12:52:26PM +0000, Charles Forsyth wrote: > > without the check. could make port code check m->havetsc and require > all Mach to include that too, but i wonder whether it wouldn't be simpler to have > void (*cycles)(uvlong*) in pc/fns.h and have x86 processors that don't support it set > cycles to point to a function zero the uvlong, and x86 processors that do support > Thank you, Charles, you're right on the button. This is the version that works for me, based on some changes jmk put into devarch.c to get the SiS 550 to work: diff -n /n/dump/2004/0122/sys/src/9/pc/fns.h /sys/src/9/pc/fns.h /n/dump/2004/0122/sys/src/9/pc/fns.h:16 c /sys/src/9/pc/fns.h:16,18 < void cycles(uvlong*); --- > void (*cycles)(uvlong*); > void tsccycles(uvlong*); > void nocycles(uvlong*); diff -n /n/dump/2004/0122/sys/src/9/pc/devarch.c /sys/src/9/pc/devarch.c /n/dump/2004/0122/sys/src/9/pc/devarch.c:59 a /sys/src/9/pc/devarch.c:60,64 > void > nocycles (uvlong *uvl) { > *uvl = 0; > } > /n/dump/2004/0122/sys/src/9/pc/devarch.c:663 c /sys/src/9/pc/devarch.c:668 < else if(strncmp(m->cpuidid, "SiS SiS SiS ", 12) == 0) --- > else if(strncmp(m->cpuidid, "SiS SiS SiS", 11) == 0) /n/dump/2004/0122/sys/src/9/pc/devarch.c:680 a /sys/src/9/pc/devarch.c:686 > cycles = nocycles; /n/dump/2004/0122/sys/src/9/pc/devarch.c:682 a /sys/src/9/pc/devarch.c:689 > cycles = tsccycles; diff -n /n/dump/2004/0122/sys/src/9/pc/l.s /sys/src/9/pc/l.s /n/dump/2004/0122/sys/src/9/pc/l.s:332 c /sys/src/9/pc/l.s:332 < TEXT cycles(SB), $0 /* time stamp counter; cycles since power up */ --- > TEXT tsccycles(SB), $0 /* time stamp counter; cycles since power up */ /n/dump/2004/0122/sys/src/9/pc/l.s:334 c /sys/src/9/pc/l.s:334 < MOVL vlong+0(FP), CX /* &vlong */ --- > MOVL vlong+0(FP), CX /* &vlong */ Unless jmk has already released these, here are what I use: cpu% diff /n/dump/2004/0122/sys/src/9/pc/devarch.c /n/dump/2004/0117/sys/src/9/pc/devarch.c 613,620d612 < /* < * SiS 55x < */ < static X86type x86sis[] = < { < {5, 0, 23, "SiS 55x",}, /* guesswork */ < { -1, -1, 23, "unknown", }, /* total default */ < }; 663,664d654 < else if(strncmp(m->cpuidid, "SiS SiS SiS ", 12) == 0) < tab = x86sis; 681,685c671,673 < if(m->cpuiddx & 0x10){ < m->havetsc = 1; < if(m->cpuiddx & 0x20) < wrmsr(0x10, 0); < } --- > m->havetsc = t->family >= 5; > if(m->havetsc) > wrmsr(0x10, 0); This is all perfectly unreadable, of course :-) It does look right, to the best of my recollection. ++L