设备驱动程序和中断服务例程
一个非常基本的问题。我了解到设备驱动程序和中断服务例程只是一些程序或代码。每当需要时,他们都会被要求执行。 执行意味着CPU正在执行其指令集ISA之外的一些指令。那么这是否意味着设备驱动程序和 ISR 也是生成所需结果的机器指令呢?
设备驱动程序和中断例程等程序到底由什么组成?这样的程序也有数据段、代码段和堆栈段吗?
我正在学习 x86 汇编语言和 C 。
A very basic question. I have learnt that device drivers and interrupt service routines are some program or codes only. whenever required they are made to execute.
Execution means CPU is executing some instructions out of its instruction set ISA. So does it mean that device drivers and ISRs are also machine instructions to generate the required result?
what exactly such programs likes device driver and interrupt routines made up of? do such programs also have a data segment, code segment and stack segment?
I am learning x86 assembly language and C .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个准确的评估。一个足够复杂的设备驱动程序有数据段、代码段和堆栈段。
That is an accurate assessment. A complex enough device driver has a data segment, code segment and a stack segment.
考虑如何从设备获取数据。有两种方法:
根据您的操作系统(或无操作系统,只是裸机),设备驱动程序可以是一个程序,也可以是操作系统内核的一个组成部分,...
典型的设备驱动程序将执行几件事:识别设备、初始化设备、处理来自设备的中断、处理写入/读取/配置设备的请求……
当然,现代 CPU 倾向于提供保护功能,并且不允许任意进程访问设备。因此,设备驱动程序要么以高权限级别运行,通常作为操作系统内核的一部分,要么在用户空间设备驱动程序的情况下,它将使用内核提供的一些定义良好的接口。
Consider how to get data from a device. There are two ways:
Depending on your OS (or no-OS, just bare metal) a device driver can be a program, or it can be an integral part of your OS kernel, ...
A typical device driver will do several things: identifying devices, initializing devices, handling interrupts from the device, handling requests to write/read/configure the device, ...
Of course, modern CPUs tend to provide protection features, and don't allow arbitrary processes access to devices. So the device driver will either run at a high privilege level, normally as a part of the OS kernel, or in the case if userspace device-drivers it will use some well-defined interfaces provided by the kernel.