Re: What is the purpose of %fs?
- From: John Reiser <jreiser@xxxxxxxxxxxx>
- Date: Thu, 22 Dec 2005 11:36:17 -0800
Josef Moellers wrote:
> While trying to analyse a problem with snmpd, I stumbled across
> instructions in the tls/libc that reference %fs. Where could I find
> information about the contents of that segment?
>
> I've single-stepped through a small printf("Hello, world")-program but
> have found no instruction which populates this segment, yet it seems to
> exist and contains data.
It provides an addressing space for thread-local storage ("TLS").
See __NR_set_thread_area, __NR_get_thread_area in /usr/include/asm/unistd.h
and the code for clone() in the glibc sources in
glibc-2.3.5/sysdeps/unix/sysv/linux/i386/clone.S .
Note that clone() takes 7 arguments as glibc routine,
but only 5 as a system call. One of the arguments is
the address to use for the base of %fs (or %gs, depending on machine.)
Note that glibc considers this to be none of your business.
--
.
- Follow-Ups:
- Re: What is the purpose of %fs?
- From: Josef Moellers
- Re: What is the purpose of %fs?
- References:
- What is the purpose of %fs?
- From: Josef Moellers
- What is the purpose of %fs?
- Prev by Date: Re: Wanted: serial driver (RS232) emulation on LAN
- Next by Date: Re: How come two process simulteneously getting spin lock...
- Previous by thread: What is the purpose of %fs?
- Next by thread: Re: What is the purpose of %fs?
- Index(es):
Relevant Pages
|