Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@cs.Helsinki.FI>
Subject: Re: {rd,wr}unique palcode insns
Date: Wed, 11 Sep 1996 07:50:58 +0300 (EET DST)	[thread overview]
Message-ID: <b45ab8725b9a11fa7162796fe7605c6d.axp-list@archive.invalid> (raw)
In-Reply-To: <199609102252.RAA12047@atheist.tamu.edu>

On Tue, 10 Sep 1996, Richard Henderson wrote:
> 
> Does anyone know what the rdunique/wrunique unprivileged PALcode
> traps are for?  Do they, as they appear, allow one value to be stored
> per-thread?

Yep, they store/load a value in the process control block, so each thread 
gets a unique 64-bit value associated with it. You can use it either as 
just a silly thread ID, or you could use it as a pointer to a thread info 
block.

>	     How are they used in DEC Unix?  What kind of performance
> hit do I take trapping to PALcode?

Small test-program: 15ns for a rdunique call on my ev5/333. Not too bad: 
that's just 5 clock cycles (but that's assuming everything hits in the cache:
"rdunique" does a memory access, so it can be a lot more expensive, but
that's "normal" expenses). 

> I ask because I was thinking of changing the LinuxThreads code to use
> this for its thread id, rather than doing some screwy stack pointer
> lookup nonsense as is necessary for other platforms.

You should be able to do better with the stack pointer (you should be able to
do it with just a shift+mask if you set up the stacks cleverly), but it looks
like the entry to pal-code isn't very expensive, so the simplicity of this
approach might pay off. 

		Linus

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

       reply	other threads:[~1996-09-11  4:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199609102252.RAA12047@atheist.tamu.edu>
1996-09-11  4:50 ` Linus Torvalds [this message]
1996-09-10 23:18 {rd,wr}unique palcode insns David Mosberger
  -- strict thread matches above, loose matches on Subject: below --
1996-09-10 22:52 Richard Henderson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox