在16位实模式和32位保护模式之间切换 [英] Switch to and from 16-bit Real Mode and 32-bit Protected Mode

查看:254
本文介绍了在16位实模式和32位保护模式之间切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣编写自己的带有图形支持的微内核.但是,据我所知,没有中断0x10就无法更改图形模式,而这需要实模式.在应用程序运行时如何在实模式和保护模式之间切换?我在 osdev.org 上看到了一篇文章,但是由于我不熟悉汇编程序,所以无法解决来实现这一点.

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.

技术细节:

  • Ubuntu 16.04.4 LTS
  • GCC 7.3.0交叉编译器(i686-elf)
  • NASM 2.11.08汇编程序,但是内联GAS样式的语法很好

推荐答案

您引用的页面上有一个部分,说明了将CPU从保护模式转换回实模式所需执行的操作.甚至还有一个汇编代码段.

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.

要从实模式转到保护模式,请使用中给出的英特尔建议.英特尔SDM 卷3A,第9章.第9.10.2节给出了一个汇编代码示例,该汇编代码旨在将CPU转移到保护模式.

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.

也就是说,您实际上并不一定要在实模式下使用INT 10h. 查看有关您问题的评论.

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

这篇关于在16位实模式和32位保护模式之间切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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