ABI Question

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

ABI Question

Post 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.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Cygnus' EABI.
"He was warned..."
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post 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?
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post 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.
"He was warned..."
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post 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.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Thanks for volunteering!
"He was warned..."
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post 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.
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post 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 :).
"He was warned..."
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post 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 ^_^
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post 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.
:)
Post Reply