This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Additional registers used by NTPL on x64 Linux


Hi,

On 5/25/07, Wei Shen <cquark@gmail.com> wrote:
I know that %gs is used by NTPL to locate thread local data on x86. So, how about the situation on x86-64?

I find some one said that:
"%fs points to the TLS area. If the value fits in 32 bits, it does the same as with %gs in 32bit mode . If the value does not fit in 32 bits, the full FS_BASE MSR is written, and %fs is set to 0"

I get it. The code I read is from the Linux 2.4.20 kernel, in wich FS_BASE MSR is always used.

However, I still have some questions:

(1) When FS_BASE_MSR is used, will %fs and %gs still be changed by
Glibc? If so, when the changing occurs, at thread intitiation, program
startup, new execution, or possibly every system call?

I use glibc-2.3.2-95 and kernel 2.4.21.

(2) Since FS_BASE_MSR is got/set via sys_arch_prctl, can I modify the
the system call and find another location to save its value (without
affecting the NTPL)?

(3) What is value range of %gs of a 32-bit and a 64-bit thread
respectively? Can it be set to 451 (0x1c3)?

Thanks,

Wei Shen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]