From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: X-Archive-Original-Message-ID: <199609101807.UAA01026@ceres.tat.physik.uni-tuebingen.de> Date: Wed, 11 Sep 1996 07:50:58 +0300 (EET DST) From: Linus Torvalds Subject: Re: {rd,wr}unique palcode insns 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