禁用硬件和放大器;软件中断 [英] Disable Hardware & Software Interrupts

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

问题描述

是否有可能与ASM禁止所有中断/ C / C ++程序,以获取有关处理器完全控制?

Is it possible to disable all interrupts with a ASM/C/C++ program to get full control about the processor?

如果是? - >如何

如果不? - >怎么办原子操作的系统调用的工作(例如进入一个关键部分)

If not -> how do "atomic" operation system calls work (for example entering a critical section)?

感谢您的帮助!

推荐答案

在x86汇编中的命令是

In x86 assembly the the commands are


  • STI 将中断使能位

  • CLI 清除中断使能位

  • sti set interrupt enable bit
  • cli clear interrupt enable bit

这些命令设置和清除 IF标志。当IF标志被设置时,CPU将处理硬件中断,并且当很明显,CPU将忽略硬件中断。它不影响非屏蔽的处理中断,虽然,也不会影响软件中断或异常。这些指令还没有在非特权模式下工作(一般都环比0更高,取决于 IOPL )虽然。

These commands set and clear the IF Flag. When the IF flag is set, the CPU will handle hardware interrupts, and when it is clear the CPU will ignore hardware interrupts. It does not affect the handling of non-maskable interrupts though, nor does it affect software interrupts or exceptions. These instructions also don't work in unprivileged mode (usually everything higher than ring 0, depending on IOPL) though.

这篇关于禁用硬件和放大器;软件中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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