3 ms·
"It's a convention." Does Minix use that convention? How about BSD?
by gwu78 12y ago
"It's a convention."
Does Minix use that convention? How about BSD?
- icebraining 12y ago"The calling convention of the System V AMD64 ABI is followed on Solaris, Linux, FreeBSD, Mac OS X, and other UNIX-like or POSIX-compliant operating systems." http://en.wikipedia.org/wiki/X86_calling_conventions#System_V_AMD64_ABI http://en.wikipedia.org/wiki/X86_calling_conventions#System_...
- gwu78 12y agoint80h.org Anyway, the original question was _why_ does Linux use registers to pass arguments. Arguments can be passed on the stack, but Linux chose to use registers. Why this choice over the other option? Do you know the answer? Just curious.
- icebraining 12y agoIt's because in theory, it's faster to copy the values to registers than to have to push them all to the stack and then have the callee pop them. At least that was the thought behind Microsoft's __fastcall, which was their original version of a calling convention using registers, though in that case it seems the benchmarks aren't conclusively in support of the theory.