Switch to and from 16-bit Real Mode and 32-bit Protected Mode

那年仲夏 提交于 2019-12-13 17:51:45

问题


I'm interested in writing my own microkernel with graphics support. However, as far as I know there is no way to change the graphics mode without interrupt 0x10, which requires Real Mode. How can I switch between Real and Protected Mode during the application's runtime? I have seen an article on osdev.org, but since I am new to assembly I cannot work out how to implement this.

Technical details:

  • Ubuntu 16.04.4 LTS
  • GCC 7.3.0 cross-compiler (i686-elf)
  • NASM 2.11.08 assembler, but inline GAS-style syntax is fine

回答1:


The very page you reference has a section that describes what needs to be done to transfer CPU from protected back to real mode. It even has an assembler snippet for that.

To get from real mode to protected mode, use Intel's recommendations given in the Intel SDM volume 3A, chapter 9. Section 9.10.2 given an example of assembly code that is meant to transfer CPU to protected mode.

That said, you are in fact not bound to use INT 10h in real mode. See comments for your question.



来源:https://stackoverflow.com/questions/49016194/switch-to-and-from-16-bit-real-mode-and-32-bit-protected-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!