什么是" FS" /" GS"寄存器供? [英] What is the "FS"/"GS" register intended for?

查看:218
本文介绍了什么是" FS" /" GS"寄存器供?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我知道下面的寄存器和它们的用途应该是什么是:

So I know what the following registers and their uses are supposed to be:


  • CS = code段(用于IP)

  • CS = Code Segment (used for IP)

DS =数据段(用于MOV)

DS = Data Segment (used for MOV)

ES =目标段(用于MOVS,等等。)

ES = Destination Segment (used for MOVS, etc.)

SS =堆栈段(用于SP)

SS = Stack Segment (used for SP)

但什么是用于拟以下寄存器?

But what are the following registers intended to be used for?


  • FS =文件段?

  • FS = "File Segment"?

GS = ???

请注意:我的不可以问任何特定的操作系统 - 我问他们打算什么由CPU用于,如果有的话

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.

推荐答案

有就是他们的目的为了什么,以及它们是由Windows和Linux的用途。

There is what they were intended for, and what they are used for by Windows and Linux.

段寄存器背后的初衷是为了允许程序访问的是意在独立和持久虚拟存储的一部分内存许多不同的(大)段。这个想法是从 1966年的Multics操作系统,即处理文件,只需寻址内存段拍摄。废话少说打开文件时,写入记录,关闭文件,只是存储这个值到该虚拟数据段脏页刷新。

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.

我们的当前2010操作系统是一个巨大的倒退,这就是为什么他们被称为太监。你可以只处理的的进程空间中的单段,给人一种所谓的平(恕我直言沉闷)地址空间。在X86-32机器上的段寄存器仍然可以用于实时段寄存器,但没有人一直困扰着(安迪·格鲁夫,英特尔前president,有一个颇有名气的公共适合上个世纪的时候,他所有的英特尔工程师后想通了消耗的能量和他的金钱来实现此功能,那没有人会使用它。走吧,安迪!)

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在将64位的决定,他们并不在乎,如果他们淘汰了Multics作为一种选择(这是慈善间pretation;在无情的是,他们对Multics的无能)等禁用段的一般能力登记在64位模式。目前仍然是一个需要线程访问线程本地存储,每个线程需要一个指针......在可立即访问线程状态(例如,在寄存器)...某处线程本地存储。由于Windows和Linux都使用FS为此在32位版本,AMD决定让64位段寄存器(GS和FS)只用于此目的(我认为基本上被用于你可以让他们在你的进程空间指向任何;不知道如果应用程序code可以加载与否)。英特尔在他们的恐慌不会失去市场份额AMD在64位,安迪被退休了,决定只复制AMD的方案。

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 FS 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.

这本来是建筑prettier恕我直言,以使每个线程的内存映射具有绝对的虚拟地址(例如,0-FFF说),那就是它的线程本地存储(无[片段]寄存器指针需要!);我这样做是在一个8位操作系统早在上世纪70年代,它是非常方便,就像寄存器的另一大叠的工作。

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.

这篇关于什么是" FS" /" GS"寄存器供?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆