1. 程式人生 > >寫一個作業系統:第十天

寫一個作業系統:第十天

計劃

今天終於寫到了核心,可以使用c語言了。
打算複習一下前面的內容,加深理解。

筆記

  • overlay
  • 虛擬記憶體(Virtual Memory)
    虛擬記憶體的基本思想是程式、資料、堆疊的總的大小可以超過物理儲存器的大小。
  • Accessing more than 64k requires the use of segment register that are difficult to work with.
    這類似在彙編課上學過的段超越
  • 真實模式下預設的CPU運算元長度是16位。
  • GDT是基於硬體的記憶體保護
  • 真實模式下可以使用bios中斷,保護模式下不可以。
  • Programmers often think that since Real Mode defaults to 16 bits, that the 32 bit registers are not accessible. This is not true.
    All of the 32-bit registers (EAX, …) are still usable, by simply adding the “Operand Size Override Prefix” (0x66) to the beginning of any instruction. Your assembler is likely to do this for you, if you simply try to use a 32-bit register.
  • If you set DS (or any segment register) to a value of 0xFFFF, it points to an address that is 16 bytes below 1 MB. If you then use that segment register as a base, with an offset of 0x10 to 0xFFFF, you can access physical memory addresses from 0x100000 to 0x10FFEF. This (almost 64 kB) area above 1 MB is called the “High Memory Area” in Real Mode. Note that you have to have the A20 address line activated for this to work.
  • The physical address space is the direct memory address used to access a real location in RAM.
  • A virtual address can be mapped to any physical address.

參考連結

問題

  • 地址對齊的概念一直不理解
  • 什麼是opcode?
  • PIC(Position Independent Code)