What does GCC do with FS and GS?
And is there no way at all of accessing data off another segment in C in pmode?
Segmentation
probably depends on which version, but as i understand, GCC avoids using FS and GS, as some OSs use them for accessing process structures (and one of the fast syscalls (dont remember which one) requires it for something)pacman wrote:What does GCC do with FS and GS?
there isnt supposed to be... the compiler is supposed to hide all implementation specific details (such as how the CPU handles memory) C itself doesnt even dictate how large pointers are (on some systems for example, a pointer could be 18bits or 84 bits or any other number and any properly conforming c code would compiler without issue)And is there no way at all of accessing data off another segment in C in pmode?
on x86/RMode, a pointer is 16:16 or 32bits
on x86/PMode, a pointer is 16:32 or 48 bits, however, because of the way the x86 platform handles segmentation, the segment selector isnt normally used (its implied -- you cant even choose to specify it within most instruction encodes), therefore, using it greatly complicates (and bloats) the generated code, and compiler, therefore, since most PMode OSs provide the application with a flat space, most compilers simply ignores segmentation, and assumes DS==SS==ES
this isnt always the case: most RMode C compilers do use segmentation, but in PMode 'segmentation' use is optional, and none of the 'mature' OSes actually use it, so the compiler 'cheats' and ignores it (if it didnt, it would also likely require rewriting parts of the compiler, and certainly parts of the optimizer between OSes)