Page 1 of 1
					
				ABI Question
				Posted: Sun Feb 27, 2005 1:20 pm
				by J.F.
				I was looking at something and ran into a question - what ABI does the EE gcc use? Be specific as there are a dozen MIPS ABIs floating around. I don't think I've seen this mentioned anywhere in the examples and what-not.
Thanks.
			 
			
					
				
				Posted: Sun Feb 27, 2005 4:04 pm
				by mrbrown
				Cygnus' EABI.
			 
			
					
				
				Posted: Mon Feb 28, 2005 4:00 am
				by J.F.
				That was helpful... a little googoling turned up this:
http://sources.redhat.com/ml/binutils/2 ... 00436.html
Could someone please look this over and see if there are any differences to the EE abi the toolchain builds?
 
			
					
				
				Posted: Mon Feb 28, 2005 6:40 am
				by mrbrown
				The EABI used in GCC for the EE uses 64-bit longs, and 32-bit pointers.  Stack alignment is 16 bytes, not 8.  IIRC, structs with 8 or fewer bytes are passed as values as opposed to 4 given in the spec.  Perhaps pixel knows more about that, 'cause I also seem to remember that value being 16 at some point.  It would make sense if it's 16 bytes because that's the most data a EE register can hold.
Everything else looks OK.
			 
			
					
				
				Posted: Mon Feb 28, 2005 12:00 pm
				by J.F.
				That's the kind of info some programmers need. We should probably make a doc for PS2Dev that details the EABI the toolchain gcc uses. We could start with something like the message I linked to above, then make the appropriate changes where needed.
			 
			
					
				
				Posted: Mon Feb 28, 2005 2:14 pm
				by mrbrown
				Thanks for volunteering!
			 
			
					
				
				Posted: Mon Feb 28, 2005 7:35 pm
				by pixel
				mrbrown wrote:The EABI used in GCC for the EE uses 64-bit longs, and 32-bit pointers.  Stack alignment is 16 bytes, not 8.  IIRC, structs with 8 or fewer bytes are passed as values as opposed to 4 given in the spec.  Perhaps pixel knows more about that, 'cause I also seem to remember that value being 16 at some point.  It would make sense if it's 16 bytes because that's the most data a EE register can hold.
Everything else looks OK.
Never looked at how ee-gcc handles structs-passed-as-arguments. But it would sound strange since even though 16-bytes is the biggest thing EE can handle in its registers, gcc doesn't know about how to do anything with that apart of load and store. Trying...
-----
With a 16-bytes structure passed on first argument of a function, a0 contains a pointer to the structure.
With a 8-bytes structure passed on first argument of a function, the structure is contained straight inside the stack.
With a 4-bytes structure passed on first argument of a function, the structure is inside a0.
 
			
					
				
				Posted: Mon Feb 28, 2005 10:24 pm
				by mrbrown
				Ah - interesting that it would put it on the stack, but I guess according to the EABI it's a parameter.
It would be cool if 16 bytes were supported, and MMI instructions were used by the compiler to "depack" the register :).
			 
			
					
				
				Posted: Mon Feb 28, 2005 10:36 pm
				by pixel
				mrbrown wrote:It would be cool if 16 bytes were supported, and MMI instructions were used by the compiler to "depack" the register :).
Thanks for volunteering ^_^
 
			
					
				
				Posted: Tue Mar 01, 2005 10:55 am
				by J.F.
				I'd be glad to put together the ABI spec file. Just keep the comments on various things coming and I'll make the changes in the base spec file. I might also post a question or two when I spot something that needs clarification.
:)