venuswu
venuswu

Reputation: 107

What' wrong with INT %ebx?

I this assembly code:

INT %ebx

GCC is giving me an error when trying to assemble it:

INT ERROR:mismatch operand type for 'int'.

Does this imply that the operand of instruction INT must be a constant like INT $0X80?

Upvotes: 3

Views: 220

Answers (2)

Grizzly
Grizzly

Reputation: 20201

Your assumption is correct, the operand of INT must be a constant. According to the NASM x86 reference:

A.81 INT: Software Interrupt
INT imm8                      ; CD ib                [8086]

A.82 INT3, INT1, ICEBP, INT01: Breakpoints
INT1                          ; F1                   [P6] 
ICEBP                         ; F1                   [P6] 
INT01                         ; F1                   [P6]
INT3                          ; CC                   [8086]

A.83 INTO: Interrupt if Overflow
INTO                          ; CE                   [8086]

So INT takes an 8bit immediate value and non of the interrupt variants actually take an register.

Upvotes: 6

Carl Norum
Carl Norum

Reputation: 225052

Yes. If you take a look at the Intel Software Developers Manual, Volume 2A Instruction Set Reference, A-M, there are three variants for INT:

 Opcode   Instruction  Description
 CC       INT 3        Interrupt 3—trap to debugger.
 CD ib    INT imm8     Interrupt vector number specified by immediate byte.
 CE       INTO         Interrupt 4—if overflow flag is 1.

That's it - none that take register parameters.

Upvotes: 4

Related Questions