如果前32个中断是为异常保留的,那么计时器中断如何为0x08? [英] How can the timer interrupt be 0x08 if the first 32 interrupts are reserved for exceptions?

查看:62
本文介绍了如果前32个中断是为异常保留的,那么计时器中断如何为0x08?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Intel i386开发一个嵌入式程序,并且试图弄清楚如何使用硬件计时器.我已经在此处(和其他地方)中看到计时器中断为0x08,但是此页面(以及其他各种来源)说,前32个中断是为异常保留的,而中断0x08专门用于双重错误..哪个是对的?我该如何使用程序集或非常低级的C而没有操作系统调用来设置计时器中断处理程序?

I am developing an embedded program for an intel i386, and I am trying to figure out how to use the hardware timer. I have read here (and other places) that the timer interrupt is 0x08, but this page (And various other sources) say that the first 32 interrupts are reserved for exceptions, and interrupt 0x08 specifically is for double fault. Which is true? How can I setup a timer interrupt handler, using either assembly or very low-level C with no operating system calls?

我正在开发一个简单的操作系统,以了解操作系统的开发,因此我无法访问Linux或系统调用之类的东西(除非我自己实现该系统调用.但是创建一个完全兼容POSIX的操作系统远非如此)超出了该项目的范围,因此,我宁愿坚持使用简单的解决方案(如果有些偏僻的话).

I am developing a simple operating system to learn about operating system development, so I don't have access to anything like Linux or system calls (unless I implement the system calls myself. But creating a fully POSIX-compliant OS is far outside the scope of this project, so I would rather stick to simple, if slightly hacky, solutions).

如果有问题,我可以在QEMU上运行它,而不是实际的物理i386.

If it matters, I am running this on QEMU, not an actual physical i386.

推荐答案

大多数人都认为这(使用INT8的计时器)是原始IBM PC体系结构中的设计缺陷.为了(部分地)保护这一罪行,最初的8088确实没有使用此向量-但是从一开始它就被Intel标记为保留".

Most people assume this (Timer using INT8) a design flaw in the original IBM PC architecture. To (partially) protect the guilty, the original 8088 really didn't use this vector - It was, however, marked as "reserved" by Intel from the very beginning.

在发明保护模式之前,并没有真正发生冲突(CPU< 80286没有使用此双重故障).在当今的大多数PC中,8259 PIC仍然存在,尽管它不是作为单独的芯片,而是隐藏在PC芯片集中的某个位置.值得庆幸的是,用于定时器中断的INT08并非刻在硬件中,而是由PC BIOS初始化为PIC.因此,受保护模式的OS可以轻松地将PIC中断重新映射到其他更方便的位置,以避免冲突.据我所知,只有DOS和其他早期操作系统会在INT8上承担计时器中断.

Before protected mode was invented, that conflict didn't really occur (CPUs < 80286 didn't use this double fault). In most of today's PCs, the 8259 PIC is still there, albeit not as separate chip, but hidden somewhere in the PCs chip set. Thankfully, INT08 for the timer interrupt is not carved in hardware, but rather initialized into the PIC by the PC BIOS. So protected mode OSs can easily re-map the PIC interrupts to other, more convenient places in order to avoid the conflict. To my knowledge, only DOS and other early operating systems assume the timer interrupt on INT8.

这篇关于如果前32个中断是为异常保留的,那么计时器中断如何为0x08?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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