title: Syscall or sysenter on 32 bits Linux?
body: <p>Since MS‑DOS, I know system invocation using interrupts. In old papers, I saw reference to <code>int 80h</code> to invoke system functions on Linux. Since a rather long time now, I know <code>int 80h</code> is deprecated in favour of the <code>syscall</code> instruction. But I can't get it working on my 32 bits machine.</p>
  
  <h1>The question</h1>
  
  <p>Is the <code>syscall</code> instruction to be used on 64 bits platform only? Doesn't 32 bits Linux makes use of <code>syscall</code>?</p>
  
  <h1>A sample test</h1>
  
  <p>On my 32 bits Linux (Ubuntu Precise), this program terminates with a core dump:</p>
  
  <pre><code>global _start
  
  _start:
          mov     eax, 4                ; 4 is write
          mov     ebx, 1                ; 1 is stdout
          mov     ecx, message          ; address of string
          mov     edx, length           ; number of bytes
          syscall
  
          mov     eax, 1                ; 1 is exit
          xor     ebx, ebx              ; return code 0
          syscall
  
  message:
          db  10,"Hello, World",10,10
  length  equ $ - message
  </code></pre>
  
  <p>I've tried with <code>sysenter</code> instead of <code>syscall</code>, but it crashes the same way.</p>