x86 Assembly上的保护模式键盘访问 [英] Protected Mode Keyboard Access on x86 Assembly

查看:211
本文介绍了x86 Assembly上的保护模式键盘访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我正在开发的非常基本的内核进行键盘输入,并且完全陷入了困境.我似乎在网上找不到任何可以向我显示我需要知道的信息的信息.

I'm working on keyboard input for a very basic kernel that I'm developing and I'm completely stuck. I can't seem to find any information online that can show me the information I need to know.

我的内核目前正在保护模式下运行,因此我无法避免进入实模式并返回实模式来使用键盘常规例程.我希望能够从保护模式访问键盘.有谁知道如何做到这一点?到目前为止,我发现的唯一一件事是涉及使用输入/输出端口直接与控制器对话,但除此之外,我感到很困惑.当然,这不是经常出现的事情.通常,Assembly教程假定您在下面运行操作系统.

My kernel is running in protected mode right now, so I can't use the real mode keyboard routines without jumping into real mode and back, which I'm trying to avoid. I want to be able to access my keyboard from protected mode. Does anyone know how to do this? The only thing I have found so far is that it involves talking to the controller directly using in/out ports, but beyond that I'm stumped. This is, of course, is not something that comes up very often. Normally, Assembly tutorials assume you're running an operating system underneath.

我对x86程序集非常陌生,因此我只是在寻找一些很好的资源来使用受保护模式下的标准硬件.我正在用NASM编译Assembly源代码,并将其链接到用DJGPP编译的C源代码.有什么建议吗?

I'm very new to the x86 assembly, so I'm just looking for some good resources for working with the standard hardware from protected mode. I'm compiling the Assembly source code with NASM and linking it to the C source code compiled with DJGPP. Any suggestions?

推荐答案

MIT操作系统类具有很多很好的参考.特别是,请查看 Adam Chapweske的资源关于键盘和鼠标编程.

The MIT operating systems class has lots of good references. In particular, check out Adam Chapweske's resources on keyboard and mouse programming.

简而言之,是的,您将使用原始输入/输出端口,这需要以内核模式运行,或者在EFLAGS寄存器中设置了I/O许可位(IOPL).有关I/O权限的详细信息,请参见此页面

In short, yes, you will be using the raw in/out ports, which requires either running in kernel mode, or having the I/O permission bits (IOPL) set in the EFLAGS register. See this page for more details on I/O permissions.

这篇关于x86 Assembly上的保护模式键盘访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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