title: linux assembly: how to call syscall?
body: <p>I want to call a syscall in assembly. The problem is I can't <code>mov ecx,rsp</code>. <code>rsp</code> is 64-bit register, <code>ecx</code> is a 32-bit register. I want to pass the buffer addr as a parameter of this syscall. What can I do? Thanks.</p>
  
  <pre><code>section .data 
  s0: db "Largest basic function number supported:%s\n",0
  s0len: equ $-s0
  
  section .text 
  global main
  extern write
  main: 
  sub rsp, 16
  xor eax, eax
  cpuid
  
  mov [rsp], ebx
  mov [rsp+4], edx
  mov [rsp+8], ecx 
  mov [rsp+12], word 0x0
  
  mov eax, 4
  mov ebx, 1
  mov ecx, rsp
  mov edx, 4 
  int 80h
  
  mov eax, 4
  mov ebx, 1
  mov ecx, s0
  mov edx, s0len 
  int 80h
  
  mov eax, 1
  int 80h
  </code></pre>