Re: Using %cr2 to reference "current"

Robert Love
2001-11-06T08:01:46Z

On Tue, 2001-11-06 at 02:18, H. Peter Anvin wrote:
> 2.4.13-ac8 uses %cr2 rather than (%esp & 0xfffe0000) to get "current".
> I've been trying to figure out the point of this... <snip>

I too am confused. More so, the difference between hard_get_current and
get_current is confusing. I further question things because I suspect
there is a problem: hard_get_current is commented as "for within NMI,
do_page_fault, cpu_init" but all these functions call other functions
that may very well use get_current. How is this going to work?

Further, the preemptible kernel patch oopses with this patch (IOW, don't
use 2.4.13-ac8 + preempt-kernel, unless you remove all these bits like I
did :>). I think it may be because of:

Manfred Spraul wrote:
> error_code:
> [...]
> - GET_CURRENT(%ebx)
> call *%edi
> addl $8,%esp
> + GET_CURRENT(%ebx)
> The pointer to current was loaded into %ebx before the call to the error
> handler, now that only happens after the call. As far as I can see the
> load before the call is not required.

this change but I am unsure. Would Manfred or someone knowledgeable in
this mind letting me pick their brain?

Robert Love