Max Yankov
Max Yankov

Reputation: 13307

What's the purpose of `sidt idtr` instruction?

I encountered this instruction here. I think that I understand this incorrectly, because my understanding leads to believe that this instruction does absolutely nothing. Can you please point me to my mistake in understanding it?

sidt is supposed to "store the contents of the global descriptor table register (GDTR) or the interrupt descriptor table register (IDTR) in the destination operand". But since the destination operand is idtr itself, it essentially means "store contents of idtr in idtr", so it would never actually do anything. Or am I wrong?

Upvotes: 1

Views: 2073

Answers (1)

Jester
Jester

Reputation: 58792

The idtr there is not the idtr register, it's a variable in memory. You can not specify the idtr register as operand, it's implicit. So that instruction is reading the idtr register and placing it in a variable named idtr.

Upvotes: 2

Related Questions