Re: Using %cr2 to reference "current"

David Howells
2001-11-07T15:32:38Z

Instead of using %cr2, how about giving each CPU it's own GDT (the GDT doesn't
need to contain many entries). Have one segment number point to a CPU specific
data area that contains things like the current task pointer for that CPU, the
CPU number, etc, etc. This same segment number will be used on all CPU's, but
will be multiplexed via the per-CPU GDTs instead.

Then you can load up a segment register with this segment on entry to the
kernel, and then make CPU data accesses relative to that.

David