TRAP,软件中断和硬件中断之间的区别? [英] Difference between TRAP , software interrupts and hardware interrupts?

查看:176
本文介绍了TRAP,软件中断和硬件中断之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道它们之间的基本区别.

I just wanted to know the basic difference among them.

我在某些地方发现TRAP本质上也被称为软件中断或类似异常的东西.

I found at some places that TRAP is essentially also called as a software interrupt,or something like an exception.

此外,软件中断和异常之间的基本区别是什么.

Also what is the basic difference between a software interrupt and an exception.

可以通过INT指令生成软件中断,但是只能在某些情况下(例如被零除)生成TRAP?是吗?

Software interrupt can be generated by the INT instruction,but TRAP can only be generated by certain scenarios like divide by zero? Is that right?

请对此查询给出适当的答案,其中涵盖了s/w中断陷阱和异常.

推荐答案

该术语确实有点模糊,可能取决于CPU供应商.

The terminology is indeed a bit blurry and may depend on the CPU vendor.

很明显,硬件中断是由硬件信号触发的,并使CPU输入预定义的ISR.这些是由(通常是外部)硬件触发的异常.

What is clear is that a hardware interrupt is triggered by a hardware signal and makes the CPU enter a predefined ISR. These are exceptions triggered by (typically external) hardware.

陷阱的表示法在CPU供应商之间略有不同.非Intel CPU (例如68000或PowerPC CPU)上的陷阱可以是软件中断.这些CPU具有TRAP指令.在x86上,该指令在Power PC TRAP #xx上的ARM CPU SWI/SVC上为INT xxx.这将是由用户程序故意触发的异常(通常用于进入操作系统)

The notation of a trap varies a bit between CPU vendors. Traps on non-Intel CPUs can (e.g. on a 68000 or PowerPC CPU) be software interrupts. Those CPUs have a TRAP instruction. On an x86, this instruction would be INT xxx, on an ARM CPU SWI/SVC, on a PowerPC TRAP #xx. This would be an exception deliberately triggered by a user program (typically used to enter the operating system)

Intel世界中的陷阱是例外条件,例如被零除或其他错误,例如无效的内存访问(但也可能由设置的单步标记触发).其他CPU供应商只是将其称为 exception .这些都是异常情况,通常是由错误程序触发的,或者是在正常程序流期间CPU无法处理的条件.

Traps in the Intel world are exceptional conditions, like division by zero or other errors like invalid memory access (but might also be triggered by a set single step flag). Other CPU vendors simply call that an exception. Those are exceptions typically triggered by erroneous programs or conditions the CPU is not able to handle during normal program flow.

所有这些通常都称为异常.

这篇关于TRAP,软件中断和硬件中断之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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