x86 系统结构 2 x86 工作模式

本系列博客用来记录自己对x86体系结构的学习总结,同时方便大家查阅,节省大家学习的时间。

模式操作

long mode

下面又有两种

  1. 64-bit
  2. compatibility mode 虽然有兼容模式,但是还是不支持legacy real mode和virtual 8086(太老了?) 兼容模式只是代表可以运行?不代表和后面的模式完全一样?

64-Bit Mode

  1. 操作数一般是32bits
  2. 这个猛,需要回头看看,支持相对于RIP的data addressing. legacy mode 不支持,只有类似branch的指令支持.

compatibility mode

  1. 核心就一句话,这个模式可以让64-bits OS 运行legacy应用,但是不用recompilation
  2. 只可以访问virtual addr的低4GB
  3. 从软件角度来看,compatibility mode是和legacy x86 protected-mode environment一样,从OS角度,addr translation/interrupt/excpetion handling/system data structrue是和64-bits long mode一致

legacy mode

不仅软件可以跑16/32,更可以跑32bits OS

  1. protected mode.

    up to 4GB memory space

  2. virtual-8086 mode

    在protected模式下跑16-bits的 real-mode的意思. uses a simple form of memory segmentation, optional paging, and limited protection-checking. Programs running in virtual-8086 mode can access up to 1MB of memory space.

  3. real mode

    using simple register-based memory segmentation. It does not support paging or protection-checking. up to 1MB of memory space.

回头需要弄明白几个模式之间如何切换,就算你实现的是AMD64,你也需要在real mode去boot up. 因为这document是描述amd 64的,所以你需要搞明白对于一个cpu x86 64来说,哪些是你需要实现的. Processors that implement the AMD64 architecture boot in legacy real mode, just like processors that implement the legacy x86 architecture.



Written on September 13, 2017