title: Why syscall doesn't work?
body: <p>I'm on MAC OSX and I'm trying to call through assembly the execve syscall..
  His opcode is 59 .
  In linux I have to set opcode into eax, then parameters into the others registers, but here I have to put the opcode into eax and push parameters into the stack from right to left.</p>
  
  <p>So I need execve("/bin/sh",NULL,NULL), I found somewhere that with assembly null=0, so I put null into 2nd and 3rd parameters.</p>
  
  <pre><code>global start 
  section .text
  start:
      jmp string
  main: 
      ; 59 opcode
      ; int execve(char *fname, char **argp, char **envp);
      pop ebx             ;stringa
      push 0x0            ;3rd param
      push 0x0            ;2nd param
      push ebx            ;1st param
      add eax,0x3b        ;execve opcode
      int 0x80            ;interupt
      sub eax,0x3a        ; exit opcode
      int 0x80
  string:
      call main
      db '/bin/sh',0
  </code></pre>
  
  <p>When I try to execute it say:
  Bad system call: 12</p>