How to disable interrupts for one instruction?

Is there any other way to disable interrupts for only one command than using the CLI command?

+3
source share
2 answers

Yes, loading SS using MOV will prevent external interrupts for the next command. This is what the reference instruction set says:

Loading the SS register into the MOV instruction disables all interrupts until the next instruction is executed. This operation allows loading the stack pointer into the ESP register using the following command (MOV ESP, stack pointer value) before the interrupt takes place.

+5
source

This piece of code does the trick:

 pushf pop ax and ax, FDFFh push ax popf ;This disables interrupts, You didn't use "CLI" ; Here IF is clear sti 
+1
source

Source: https://habr.com/ru/post/1241238/


All Articles