Is it possible to load x86 linear address with LEA-like instruction?

Viewed 65

Background: I am using x86's GS register to store the base linear address of (more precisely, the segment selector to) the per-CPU data area (much like the trick used in Linux). There is a need to load the pointers (linear addresses) of the per-CPU variables inside this area. However, the instruction LEA cannot deal with the GS, since, by definition, an "effective address" is just the "offset" part of the segmented linear address. I have noticed that Linux stores the base address of the per-CPU data area as a per-CPU variable to get around this problem, but this approach requires a load to get the pointer.

My question: Is there a way to use one instruction without loading from the memory to get the linear address (just like what LEA does for the effective address)? As far as I know, the base linear address of the segment is cached in the "hidden part" of the segment register, so I believe technically this is possible, but I find no answer anywhere.

0 Answers
Related