OpenBSD manual page server

Manual Page Search Parameters

I386_GET_FSBASE(2) System Calls Manual (i386) I386_GET_FSBASE(2)

i386_get_fsbase, i386_set_fsbasemanage i386 per-thread %fs base address

#include <sys/types.h>
#include <machine/sysarch.h>

int
i386_get_fsbase(void **base);

int
i386_set_fsbase(void *base);

() copies the current base address of the segment that, by default, is referenced by the %fs selector into the memory referenced by base.

() sets the base address of the segment that, by default, is referenced by %fs to the address base.

The segment base address is local to each thread. The initial thread of a new process inherits its segment base address from the parent thread. __tfork(3) sets the initial segment base address for threads that it creates.

Code using the () and i386_set_fsbase() functions must be compiled using -li386.

Upon successful completion, i386_get_fsbase() and i386_set_fsbase() return 0. Otherwise, a value of -1 is returned and the global variable errno is set to indicate the error.

i386_get_fsbase() will fail if:

[]
base points outside the process's allocated address space.

fork(2), __tfork(3)

Intel, i386 Microprocessor Programmer's Reference Manual.

March 30, 2016 OpenBSD-current