I'm reading source code in package syscall
now, and met some problems:
Since I'm totally a noob of syscall
and assembly
, so don't hesitate to share anything you know about it :)
First about func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
: what does its parameter trap, a1, a2, a3
& return value r1 r2
means? I've searched documents and site but seems lack of description about this.
Second, since I'm using darwin/amd64
I searched source code and find it here:
http://golang.org/src/pkg/syscall/asm_darwin_amd64.s?h=RawSyscall
Seems it's written by assemble(which I can't understand), can you explain what happened in line 61-80, and what's the meaning of ok1:
part under line 76?
I also found some code in http://golang.org/src/pkg/syscall/zsyscall_darwin_amd64.go , what does zsyscall
mean in its filename?
What's the difference between syscall
& rawsyscall
?
How and when to use them if I want to write my own syscall function(Yes, os package gave many choices but there are still some situation it doesn't cover)?
So many noob questions, thanks for your patience to read and answer :)