Re: Using %cr2 to reference "current"

Dave Jones
2001-11-06T19:16:48Z

On Tue, 6 Nov 2001, Benjamin LaHaise wrote:

> Here are some numbers:
> Which come from insmod of the below two modules. I didn't test writing to
> the stack register, but I expect it's similarly expensive as it affects the
> call return stack and other behind the scenes dependancies. Suffice it to
> say that reading %cr2 is essentially free on my box (athlon mp). Maybe
> we should use it as a pointer into a per-cpu area to avoid writing it?

If this is done, it should perhaps be done on only on certain x86s,
as some show the results go the other way. For example, the Cyrix III..

read stk best: 42 av: 42.60
read cr2 best: 61 av: 61.28

regards,

Dave.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs