Thread: Re: [GD-General] calling functions generically
Brought to you by:
vexxed72
From: Brett B. <res...@ga...> - 2004-02-15 03:02:25
|
Thanks Ignacio and Ivan-Assen for the links, both were helpful. I now = have my Windows version working. I'm now trying to get the PS2 and = GameCube up and running. I got the Application Binary Interface specs = for both machines and implemented the PS2 version, but CodeWarrior = generates different code than me in certain circumstances that I can't = quite work out. Just curious, does anybody know if the PS2 has some variance to the = normal MIPS ABI? Or CodeWarrior? I couldn't find anything in the PS2 doc = or on ps2-pro so I'm not sure sure what to doexcept keep compiling test = cases and looking for patterns. If anybody has any tips for this, please = let me know. I don't think posting violates the Sony NDA because the doc = is publicly available and the PS2 Linux kit includes all the doc too. Cheers, Brett ----- Original Message -----=20 From: "Ivan-Assen Ivanov" <as...@ha...> To: <gam...@li...> Sent: Sunday, February 15, 2004 3:49 AM Subject: RE: [GD-General] calling functions generically > > Sometimes the complier does a "pop ecx" on return and=20 > > sometimes "mov dword ptr [ebp-0x8],eax" or a variant of that.=20 > > Can someone help me to understand how to robustly handle=20 > > this? I have done lots of assembly programming on other=20 > > platforms, but this is my first look at Intel and the 16/32=20 > > bit stuff combined with different modes is really confusing for me. >=20 > You might want to check out the roundup of calling conventions > Raymond Chen recently did on his blog: >=20 > http://blogs.msdn.com/oldnewthing >=20 > (dig a bit into the archives, they probably disappeared from > the front page) >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D557 |
From: Stefan B. <ste...@di...> - 2004-02-15 10:49:19
Attachments:
Stefan Boberg.vcf
|
> Thanks Ignacio and Ivan-Assen for the links, both were helpful. I now have > my Windows version working. I'm now trying to get the PS2 and GameCube up > and running. I got the Application Binary Interface specs for both > machines and implemented the PS2 version, but CodeWarrior generates > different code than me in certain circumstances that I can't quite work > out. I implemented something like this a few years ago for a data-driven Lua script integration. There are several different MIPS ABI's and I can't recall precisely which one the PS2 uses. I wrote the code for my previous company so I don't have access to the code in order to check either unfortunately. I based my code on an existing library -- libffi. It contains implementations for PowerPC (worked fine on GameCube), Intel and MIPS (including the MIPS ABI variation which the PS2 uses). I based my code on the 2.0 release which I think I got from the pnet code tree. > Just curious, does anybody know if the PS2 has some variance to the normal > MIPS ABI? I don't know about CodeWarrior, but I have a vague memory that the PS2 GCC compiler seemed to have a slight variation when passing structures by value. Other than that, it was just one of the standard MIPS ABI's supported by libffi. /Stefan Stefan Boberg Chief Technical Officer Digital Illusions CE AB |
From: Brett B. <res...@ga...> - 2004-02-15 11:15:44
|
Wow! This is exactly what I needed, thanks! I owe you a beer :) ----- Original Message -----=20 From: "Stefan Boberg" <ste...@di...> To: <gam...@li...> Sent: Sunday, February 15, 2004 6:46 PM Subject: RE: [GD-General] calling functions generically > > Thanks Ignacio and Ivan-Assen for the links, both were helpful. I = now have > > my Windows version working. I'm now trying to get the PS2 and = GameCube up > > and running. I got the Application Binary Interface specs for both > > machines and implemented the PS2 version, but CodeWarrior generates > > different code than me in certain circumstances that I can't quite = work > > out. >=20 > I implemented something like this a few years ago for a data-driven = Lua > script integration. There are several different MIPS ABI's and I can't > recall precisely which one the PS2 uses. I wrote the code for my = previous > company so I don't have access to the code in order to check either > unfortunately. >=20 > I based my code on an existing library -- libffi. It contains > implementations for PowerPC (worked fine on GameCube), Intel and MIPS > (including the MIPS ABI variation which the PS2 uses). I based my code = on > the 2.0 release which I think I got from the pnet code tree. >=20 > > Just curious, does anybody know if the PS2 has some variance to the = normal > > MIPS ABI? >=20 > I don't know about CodeWarrior, but I have a vague memory that the = PS2 > GCC compiler seemed to have a slight variation when passing structures = by > value. Other than that, it was just one of the standard MIPS ABI's = supported > by libffi. >=20 > /Stefan >=20 > Stefan Boberg > Chief Technical Officer > Digital Illusions CE AB >=20 >=20 > |
From: Pierre T. <pie...@no...> - 2004-02-18 23:30:31
|
Hi guys, I'm happy to announce the release of our new physics SDK. You can grab it here: http://www.novodex.com/downloads/NovodeX_SDK_Personal_2.02.exe ...the demos are worth watching... :) - Pierre PS: I think this is not off-topic for GD-General, is it ? |
From: Alen L. <ale...@cr...> - 2004-02-15 08:58:47
|
For a really robust and portable solution, perhaps you should use stubs? Just use a simple parser to preprocess a header file with function headers you want to call at runtime, and generate stub functions that take your argument lists and call the real ones. If you can afford that preprocess step (during compilation), you should have no problems handling any kind of calling conventions on any system, because the compiler actually does is all for you. A (very sketchy) description of this can be found in Game Programming Gems 3, I believe. We've been using such a system for some time now and it is very reliable. Just my 0.02$, Alen > > Sometimes the complier does a "pop ecx" on return and > > sometimes "mov dword ptr [ebp-0x8],eax" or a variant of that. > > Can someone help me to understand how to robustly handle > > this? |