Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mips eabi64 support #270

Merged
merged 24 commits into from
Feb 17, 2025
Merged

mips eabi64 support #270

merged 24 commits into from
Feb 17, 2025

Conversation

ethteck
Copy link
Contributor

@ethteck ethteck commented Mar 21, 2024

Very much a WIP, but this PR brings us from

void func_001099D8(void) {
    sceGsSetDefLoadImage(&D_002B8700, 0xE00, 8, 1);
    FlushCache(0);
    sceGsSyncPath(0, 0);
    sceGsExecLoadImage(&D_002B8700, &func_F20000);
    sceGsSetDefLoadImage(&D_002B8760, 0x1400, 8, 1);
    FlushCache(0);
    sceGsSyncPath(0, 0);
    sceGsExecLoadImage(&D_002B8760, &func_F20000 + 0x48000);
}

to the more accurate

void func_001099D8(s64 arg0, s64 arg2, s64 arg4) {
    sceGsSetDefLoadImage(&D_002B8700, 0xE00, 8, 1, 0, 0, 0x200, 0xC0);
    FlushCache(0);
    sceGsSyncPath(0, 0);
    sceGsExecLoadImage(&D_002B8700, &func_F20000);
    sceGsSetDefLoadImage(&D_002B8760, 0x1400, 8, 1, 0, 0, 0x200, 0xC0);
    FlushCache(0);
    sceGsSyncPath(0, 0);
    sceGsExecLoadImage(&D_002B8760, &func_F20000 + 0x48000);
}

That being said, the signature of this function is broken now, and some actual code changes will probably be needed here

@ethteck ethteck changed the title mipsee arch (n32 abi) support mipsee arch (eabi64) support Mar 21, 2024
@ethteck ethteck changed the title mipsee arch (eabi64) support mips eabi64 support Mar 24, 2024
@ethteck ethteck marked this pull request as ready for review April 3, 2024 17:14
Copy link
Collaborator

@simonlindholm simonlindholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for extreme slowness in getting to this.

m2c/arch_mips.py Outdated
"r0": Register("zero"),
}

o32abi_float_regs = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not really o32 abi, is it? is there a reference for this list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the convention that you set the assembler to assemble using n32 register names when targeting eabi? Or is this maybe not something that you specify at all, and all the register name mappings are unique and as is able to just take the union of them? The gist seems to suggest though that $12 is $t0 rather than $t4 for n32, which doesn't quite match that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just pass the following flags to as for Kingdom Hearts: -no-pad-sections -EL -march=5900 -mabi=eabi. I am not totally sure how to answer your question unfortunately..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a vague question, I was basically just hoping to get some more information about how these aliases work. I gather from experimenting with the flags you mention that as doesn't actually accept these register names as inputs, nor does objdump output them (-Mreg-names=eabi is not a thing). And the same seems to be true for integer registers.

So then, I take it all the names are just made up by us? And we made a decision to stay backwards compatible with o32 names, given the choice of naming $12 $t4 instead of $t0? Are eabi projects using some common prelude.inc that define these names for use with as, or is everyone sticking to numbered registers? Or are there projects assembling code using o32 register names? If so, should we support that, and make $t0 an alias for $a4?

Using the n32 naming of fp regs seems like a poor choice: it names $f21 $ft8 despite it being a saved register. I guess we have a few choices here:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I'm fine with option 1.. does it mean just getting rid of this dict?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, should be. Do you have any thoughts on the questions about integer registers?

@simonlindholm
Copy link
Collaborator

I'll merge this and then push some follow-ups on top.

@simonlindholm simonlindholm merged commit eb7fff4 into matt-kempster:master Feb 17, 2025
1 check passed
@simonlindholm
Copy link
Collaborator

5bd7558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants