usage of FS and GS in long mode.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

usage of FS and GS in long mode.

Post 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?
Author of COBOS
Post Reply