What is the "FS"/"GS" register intended for?
what is the m
what is the p
the definition of love
what is the definition of definition
what is the purpose of the word the
what is the in grammar
what is the meaning of in
So I know what the following registers and their uses are supposed to be:
CS = Code Segment (used for IP)
DS = Data Segment (used for MOV)
ES = Destination Segment (used for MOVS, etc.)
SS = Stack Segment (used for SP)
But what are the following registers intended to be used for?
FS = "File Segment"?
GS = ???
Note: I'm not asking about any particular operating system -- I'm asking about what they were intended to be used for by the CPU, if anything.
There is what they were intended for, and what they are used for by Windows and Linux.
The original intention behind the segment registers was to allow a program to access many different (large) segments of memory that were intended to be independent and part of a persistent virtual store. The idea was taken from the 1966 Multics operating system, that treated files as simply addressable memory segments. No BS "Open file, write record, close file", just "Store this value into that virtual data segment" with dirty page flushing.
Our current 2010 operating systems are a giant step backwards, which is why they are called "Eunuchs". You can only address your process space's single segment, giving a so-called "flat (IMHO dull) address space". The segment registers on the x86-32 machine can still be used for real segment registers, but nobody has bothered (Andy Grove, former Intel president, had a rather famous public fit last century when he figured out after all those Intel engineers spent energy and his money to implement this feature, that nobody was going to use it. Go, Andy!)
AMD in going to 64 bits decided they didn't care if they eliminated Multics as a choice (that's the charitable interpretation; the uncharitable one is they were clueless about Multics) and so disabled the general capability of segment registers in 64 bit mode. There was still a need for threads to access thread local store, and each thread needed a a pointer ... somewhere in the immediately accessible thread state (e.g, in the registers) ... to thread local store. Since Windows and Linux both used FSand GS (thanks Nick for the clarification) for this purpose in the 32 bit version, AMD decided to let the 64 bit segment registers (GS and FS) be used essentially only for this purpose (I think you can make them point anywhere in your process space; dunno if the application code can load them or not). Intel in their panic to not lose market share to AMD on 64 bits, and Andy being retired, decided to just copy AMD's scheme.
It would have been architecturally prettier IMHO to make each thread's memory map have an absolute virtual address (e.g, 0-FFF say) that was its thread local storage (no [segment] register pointer needed!); I did this in an 8 bit OS back in the 1970s and it was extremely handy, like having another big stack of registers to work in.
So, the segment registers are now kind of like your appendix. They serve a vestigial purpose. To our collective loss.
Those that don't know history aren't doomed to repeat it; they're doomed to doing something dumber.
The, of the —used to indicate a person or thing that has already been mentioned or seen or is clearly understood from the situation. —used to refer to things or people that are common in daily life. —used to refer to things that occur in nature. definite article. What Is the What is the epic novel based on the life of Valentino Achak Deng who, along with thousands of other children —the so-called Lost Boys—was forced to leave his village in Sudan at the age of seven and trek hundreds of miles by foot, pursued by militias, government bombers, and wild animals, crossing the deserts of three countries to find freedom. When he finally is resettled in the United States, he finds a life full of promise, but also heartache and myriad new challenges.
GS are segment registers. They have no processor-defined purpose, but instead are given purpose by the OS's running them. In Windows 64-bit the
GS register is used to point to operating system defined structures.
GS are commonly used by OS kernels to access thread-specific memory. In windows, the
GS register is used to manage thread-specific memory. The linux kernel uses
GS to access cpu-specific memory.
Using Articles—A, An, The, in front of singular or plural nouns and adjectives to refer to something with which both the speaker/writer and listener/reader are familiar. “It depends on what the meaning of the word ‘is’ is. If the—if he—if ‘is’ means is and never has been, that is not—that is one thing. If it means there is none, that was a
FS is used to point to the thread information block (TIB) on windows processes .
one typical example is (SEH) which store a pointer to a callback function in
GS is commonly used as a pointer to a thread local storage (TLS) . and one example that you might have seen before is the stack canary protection (stackguard) , in gcc you might see something like this :
mov eax,gs:0x14 mov DWORD PTR [ebp-0xc],eax
Coincide, There are two main ways to pronounce this little word, based largely on what word follows it. If the is followed by a word which begins with a consonant sound ( What Is the What is an eye-opening and heartbreaking book, the story of a Lost Boy escaping war-torn Sudan and who finds his way in the US.
According to the Intel Manual, in 64-bit mode these registers are intended to be used as additional base registers in some linear address calculations. I pulled this from section 220.127.116.11 (pg. 86 in the 4 volume set). Usually when the CPU is in this mode, linear address is the same as effective address, because segmentation is often not used in this mode.
So in this flat address space, FS & GS play role in addressing not just local data but certain operating system data structures(pg 2793, section 3.2.4) thus these registers were intended to be used by the operating system, however those particular designers determine.
There is some interesting trickery when using overrides in both 32 & 64-bit modes but this involves privileged software.
From the perspective of "original intentions," that's tough to say other than they are just extra registers. When the CPU is in real address mode, this is like the processor is running as a high speed 8086 and these registers have to be explicitly accessed by a program. For the sake of true 8086 emulation you'd run the CPU in virtual-8086 mode and these registers would not be used.
The, Pronouns are words that can replace nouns, like the way "it" replaces "elephant" in "I Duration: 2:00 Posted: Apr 14, 2016 The World Wide Web (WWW) is a network of online content that is formatted in HTML and accessed via HTTP. The term refers to all the interlinked HTML pages that can be accessed over the Internet. The World Wide Web was originally designed in 1991 by Tim Berners-Lee while he was a contractor at CERN.
What is a pronoun? (video), A noun is a word that describes a person, place, thing, or idea. Examples of nouns What is Duration: 4:28 Posted: Jan 27, 2016 The space station is also a science lab. Many countries worked together to build it. They also work together to use it. The space station is made of many pieces. The pieces were put together in space by astronauts. The space station's orbit is approximately 250 miles above Earth.
Introduction to nouns (video), It is derived from gendered articles in Old English which combined in Middle English and now has a single form used with pronouns of either genders. The word Question: "What is the gospel?". Answer: The word gospel literally means “good news” and occurs 93 times in the Bible, exclusively in the New Testament. In Greek, it is the word euaggelion, from which we get our English words evangelist, evangel, and evangelical.
The, Welch had traveled to Washington because of a conspiracy theory known, now famously, as Pizzagate, which claimed that Hillary Clinton was WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.
- As far as I know, the F and G in these two do not stand for anything. It's just that there was room on the CPU (and in the instruction set) for six user-specifiable segment registers, and someone noticed that besides the "S"tack segment, the letters "C" and "D" (code and data) were in sequence, so "E" was the "extra" segment, and then "F" and "G" just sort of followed.
- Could have been, it's always hard to know what was going on in someone else's head unless you were there at the time (and I was on the other coast, nowhere near Intel's design team).
- Just think of how much fun we could have had with BS register :-}
- I always used GS as the "Graphics Segment". :-)
- How about "G"eneral "S"egment?
- @supercat: A simpler, more brilliant scheme that would have let them address 65536 times as much storage, would been to have treated the segment registers as full upper 16 bit extension of the lower 16 bits, which is in essence what the 286, 386 and Multics did.
- @IraBaxter: The problem with that approach is that 80286-style segments have a sufficiently high overhead than one ends up having to store many objects in each segment, and thus store both segment and offset on every pointer. By contrast, if one is willing to round memory allocations up to multiples of 16 bytes, 8086-style segmentation allows one to use the segment alone as a means of identifying an object. Rounding allocations up to 16 bytes might have been slightly irksome in 1980, but would represent a win today if it reduced the size of each object reference from 8 bytes to four.
- Those registers are used in modern operating systems. They're mostly dedicated to point to information about task control blocks, at least in the two major OSes now available for x86 chips. And, since they are no longer "general purpose" even for their original intent, you can't use them for much. Better to pretend on x86-64 systems that they simply don't exist until you need the information they let you access in the thread control blocks.
- The appendix analogy is really bad based on outdated science; it's related to the immune system, so definitely not "vestigial". It detracts from the actual post. Other than that, it's a good response.
- Thanks for the amusing, no-holds-barred treatment of segmented vs flat memory :) Having also written code on 6809 (with and without paged memory), 6502, z80, 68k and 80?86, my perspective is that segmented memory is a horror show and I'm glad it was consigned to the dustbin of history. The use of FS and GS for efficient access of thread_local data is a happy unintended consequence of an historical error.
- Were they intended to be used for OS-defined purposes, or to facilitate code which needs to do something like
*dest++ = lookup[*src++];which would otherwise be rather awkward if dest, lookup, and src were at three unrelated locations.
- On Windows FS is indeed for thread specific storage. See documented map of the block pointed by FS here en.wikipedia.org/wiki/Win32_Thread_Information_Block
- It's not just on Windows. GS is also used for the TLS on OS X. GS is also used by 64bit kernels to keep track of system structures during context switches. The OS will use SWAPGS to that effect.
- This doesn't actually answer the question. The question states Note: I'm not asking about any particular operating system -- I'm asking about what they were intended to be used for by the CPU, if anything.
- @MichaelPetch ya i know i just want to add this as good info for those who read this q/s in SO