From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <732b1707b783c57f27b9c26d5e9c0900@felloff.net> References: <732b1707b783c57f27b9c26d5e9c0900@felloff.net> Date: Tue, 2 Feb 2016 00:34:41 +0100 Message-ID: From: Giacomo Tesio To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a1148d7ca3afc35052abdd404 Subject: Re: [9fans] FP register usage in Plan9 assembler Topicbox-Message-UUID: 8101d516-ead9-11e9-9d60-3106f5b1d025 --001a1148d7ca3afc35052abdd404 Content-Type: text/plain; charset=UTF-8 Thanks for the explainations! I did read in the Pike's paper about the syntax name+offset(FP), but I did understood that name had to be a symbol already defined, and I was looking for it in the c code. Sorry for the noise! This led me to another question, however: I've read before that the plan9 compilers use the stack for va_list, but here the assembler is using it also for explicit parameters, right? Is it correct to say that this means that the Plan9 compiler suite *never* follows the sysV calling convention documented at section 3.2.3 of AMD64 ABI http://www.x86-64.org/documentation/abi.pdf and always pushes parameters to the stack? Giacomo 2016-02-01 23:48 GMT+01:00 : > FP is a translated to a varying offset to SP depending on where in the > program > you are. arguments on the stack are padded to 8 bytes on amd64, the first > argument > is not passed on the stack on function entry, but passed in BP register > (RARG is an > alias for that), however the slot on the stack for first arg is still > reserved > so we have a save place to splill it. so 0(FP) is first function argument > on the > stack, 8(FP) second argument 16(FP) third ect... > > -- > cinap > > --001a1148d7ca3afc35052abdd404 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks for the explainations!

I did= read in the Pike's paper about the syntax name+offset(FP), but I did u= nderstood that name had to be a symbol already defined, and I was looking f= or it in the c code. Sorry for the noise!

This led me to another que= stion, however: I've read before that the plan9 compilers use the stack= for va_list, but here the assembler is using it also for explicit paramete= rs, right?

Is it correct to say that this means that the Plan9 compi= ler suite *never* follows the sysV calling convention documented at section= 3.2.3 of AMD64 ABI http://www.x86-64.org/documentation/abi.pdf and always pushes paramete= rs to the stack?


Giacomo


=

2016-02-01 = 23:48 GMT+01:00 <cinap_lenrek@felloff.net>:
FP is a translated to a varying offset to SP depe= nding on where in the program
you are. arguments on the stack are padded to 8 bytes on amd64, the first a= rgument
is not passed on the stack on function entry, but passed in BP register (RA= RG is an
alias for that), however the slot on the stack for first arg is still reser= ved
so we have a save place to splill it. so 0(FP) is first function argument o= n the
stack, 8(FP) second argument 16(FP) third ect...

--
cinap


--001a1148d7ca3afc35052abdd404--