← Back to context

Comment by jart

12 days ago

I think that's accurate. Example code:

    static privileged int GetPid(void) {
      int res;
    #ifdef __x86_64__
      asm volatile("syscall"
                   : "=a"(res)
                   : "0"(__NR_linux_getpid)
                   : "rcx", "r11", "memory");
    #elif defined(__aarch64__)
      register long res_x0 asm("x0");
      asm volatile("mov\tx8,%1\n\t"
                   "svc\t0"
                   : "=r"(res_x0)
                   : "i"(__NR_linux_getpid)
                   : "x8", "memory");
      res = res_x0;
    #endif
      return res;
    }

You should be fine.