Page 1 of 1

usage of FS and GS in long mode.

Posted: Sat Feb 17, 2007 4:02 pm
by os64dev
ok, i am working on a pure long mode (64-bit) operating system, bye bye legacy finally, and am wondering about the usage of the FS and GS registers. In longmode the other segment selectors DS, ES and SS have become quite useless.

this is my idea:
1) because of the SWAPGS instruction i can use the GS selector to switch between kernel and user information. In case of user mode GS points to a thread structure containing information the thread needs fast access to. when an interrupt/syscall i use the SWAPGS function to make GS point to a kernel specific structure.
2) for the FS i think about thread local storage.

anyone comments or suggestions?