Advertising (This ad goes away for registered users. You can Login or Register)

Binary Loader's bug

This is the development forum of the half-byte loader project. For general Half Byte Loader questions, visit the Half Byte Loader forum.
Forum rules
This forum is for HBL Development discussions ONLY. For User support or HBL general discussions, go to viewforum.php?f=3 . Messages that are not development related will be deleted.
coyotebean
Guru
Posts: 96
Joined: Mon Sep 27, 2010 3:22 pm

Re: Binary Loader's bug

Post by coyotebean » Sat Nov 20, 2010 11:56 pm

The thing is ABI & EABI defines that only s registers are preserved. Any software (compilers) compliance to the standard will ignore the value of other registers returned in a function.
Advertising
GBASP x1, GBM x2, NDSL x2, PSP 100X x3, PSP 200X x6, PSP 300X x5, PSP Go x4, Wii x1

User avatar
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Binary Loader's bug

Post by m0skit0 » Sun Nov 21, 2010 12:03 am

You already said that before. We're talking about two different levels. You're talking about ABI and I'm talking about C prototypes. Yes, aX can be modified, but if a C prototype declares them by value, the C compiler (because it's a C compiler, it should enforce C protocols, on top of ABI ones) should make sure they're not modified. If the arguments were passed by reference, they can be modified. That's why the ABI leaves aX as modifiable by callee: it's defined on a higher level (like C).
Advertising
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"

wololo
Site Admin
Posts: 3619
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Binary Loader's bug

Post by wololo » Sun Nov 21, 2010 12:58 am

I don't really understand why you think a compiled C program should stick to the ABI rules, as long as gcc knows it's equivalent, I think you can trust it.
Or am I missing a bigger problem here?

Edit: It could be that parameters such as -O allow your C compiler to not follow some rules that would hurt performance.
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!

User avatar
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Binary Loader's bug

Post by m0skit0 » Sun Nov 21, 2010 10:54 am

Wololo wrote:I don't really understand why you think a compiled C program should stick to the ABI rules
In fact, the C compiler also MUST preserve the ABI rules, but also the C rules. They're layers. First is the ABI set of rules, then the C set of rules, and so on. I hope this clears what I mean.
Wololo wrote:Edit: It could be that parameters such as -O allow your C compiler to not follow some rules that would hurt performance.
I don't think you can skip ABI & C rules by using compiler parameters. AFAIK GCC optimization flags only adapt your code to be optimized based on the ABI and C rules.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"

Post Reply

Return to “Half Byte Loader Development”