9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Lucio De Re <lucio@proxima.alt.za>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Re: Kernel failure - i486
Date: Thu, 22 Jan 2004 15:54:51 +0200	[thread overview]
Message-ID: <20040122155451.C28365@cackle.proxima.alt.za> (raw)
In-Reply-To: <56180b256fc8cc8d05e5b24091071cbf@terzarima.net>; from Charles Forsyth on Thu, Jan 22, 2004 at 12:52:26PM +0000

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


      parent reply	other threads:[~2004-01-22 13:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-22 11:47 [9fans] " Lucio De Re
2004-01-22 11:52 ` [9fans] " Lucio De Re
2004-01-22 12:52   ` Charles Forsyth
2004-01-22 12:56     ` Charles Forsyth
2004-01-22 13:54     ` Lucio De Re [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040122155451.C28365@cackle.proxima.alt.za \
    --to=lucio@proxima.alt.za \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).