title: What is the exact behaviour of INT instruction?
body: <p>Such as <strong>x86</strong> instructions :<code>push</code> can be <strong>precisely</strong> described by:</p>
  
  <pre><code>push:
  sub esp, data_size
  mov [esp], data
  </code></pre>
  
  <p>And <code>call</code> can be described by:</p>
  
  <pre><code>call:
  push (eip+2)
  jmp addr
  </code></pre>
  
  <p><strong>By knowing these, we would be totally clear about how these instructions affect stack, registers and flags</strong> and I think it is crucial.</p>
  
  <p>However, after going through "Intel® 64 and IA-32 Architectures Software Developer’s Manual". and "i386 programmers' manual" I found nothing about the exact behaviour of INT instruction.</p>
  
  <p>Now, I want to modify the stack after INT call, to make my program return to another place.</p>
  
  <p><strong>So, what exactly INT did after it was called?</strong></p>
  
  <p>(by programmer or hardware. I heard they act differently)</p>
  
  <p>Thanks in advance!!</p>
  
  <blockquote>
    <p>ps: </p>
    
    <p>As far as I know, INT pushes eip, 4 general registers, eflags and
    some weird things in some order. </p>
    
    <p>I observed that it consumed 6 bytes on stack when called by me,</p>
    
    <p>and it consumed 18 bytes when triggered by hardware.(like clock)</p>
    
    <p>supplement: my code </p>
    
    <ol>
    <li><p>hook ivt 0x1ch(System Timer Tick) to my function [foo]</p></li>
    <li><p>sti</p></li>
    <li><p>jmp $</p></li>
    <li><p>foo: print 'A'</p></li>
    </ol>
    
    <p>I check the stack at <code>jmp $</code> and just before entering <code>foo</code> </p>
  </blockquote>