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

ps2link crashes with EE exception after starting up #21

Closed
cosmito opened this issue Mar 21, 2021 · 15 comments
Closed

ps2link crashes with EE exception after starting up #21

cosmito opened this issue Mar 21, 2021 · 15 comments
Labels

Comments

@cosmito
Copy link
Member

cosmito commented Mar 21, 2021

I recently built the latest from master of the toolchain, ps2eth and ps2link and found out that an EE exception happens during or after initialization of ps2link.

Exception details: TLB load/inst fetch exception, cause 10008008 BadAddr 3A0D2BE8, status 70030C13, EPC 88188.

Under the guidance of https://github.com/fjtrujy I tried to troubleshoot it and to find out the breaking change but not successful.

We found that the ps2link built as artifact of CI 17 (https://github.com/ps2dev/ps2link/actions/runs/477067363) still works but the one from CI 18 (https://github.com/fjtrujy/ps2link/actions/runs/653975338) crashes.

I reverted locally the change that was done in between (ps2dev/ps2sdk#164) but that didn't made any difference. Also, I tried to revert locally the upgrade newlib to 4.1.0 (https://github.com/ps2dev/ps2toolchain-ee/blob/main/scripts/003-newlib.sh#L7) but 4.0.0 gave the same exception again (I tried all the possibilities of combining the two changes).

ps2link CI 18

ps2link CI 18crash

@cosmito cosmito added the bug label Mar 21, 2021
@AKuHAK
Copy link
Contributor

AKuHAK commented Mar 21, 2021

Please provide more details when this exception happen. Does it happened just when loading ps2link.elf, or it is happen when you try to load some program from ps2client? Also try to move ps2link to memory card.

@cosmito
Copy link
Member Author

cosmito commented Mar 21, 2021

It happens during initialization of ps2link.elf, so before any loading of an .elf with ps2client.

@AKuHAK
Copy link
Contributor

AKuHAK commented Mar 21, 2021

looks like you have some cached config enabled, maybe t tries to load some irx files, which are mentioned in *.txt config file. Please create a directory on a memory card and copy there only ps2link

@cosmito
Copy link
Member Author

cosmito commented Mar 21, 2021

I did that now, created a folder in my memory card and copied over ps2link.elf only. After executing from there, I get the same result regarding the exception (during initialization it gets the default IP since I left out the extra.cnf, IPCONFIG.DAT, system.cnf).

I also tried to copy everything and I get the exception too.

@cosmito
Copy link
Member Author

cosmito commented Mar 21, 2021

looks like you have some cached config enabled, maybe t tries to load some irx files, which are mentioned in *.txt config file. Please create a directory on a memory card and copy there only ps2link

Please note that ps2link.elf from CI 17 works perfectly with all the same config files.

@rickgaiser
Copy link
Member

In the Makefile you can enable an extra debugging option. I've reproduced the issue, it crashes after this line:
IMG_20210409_204212

Somehow the issue is only present with the compressed version of the elf (bin/PS2LINK.ELF). The uncompressed elf (ee/ps2link.elf) seems to work fine.

The loading of this elf has many steps, perhaps there's an overlapping memory section somewhere causing corruption? Or perhaps it's a bug in ps2-packer? Adding -a 64 to ps2-packer also seems to fix the issue. Could this be an alignment issue in ps2-packer? Can we somehow check?

Also note that I've used an old "high loading" version of ps2link to test loading the new ps2link. The high and low loading versions of ps2link produce different results, suggesting a section overlap is the issue?

I hope this helps in finding the real issue(s).

@fjtrujy
Copy link
Member

fjtrujy commented May 10, 2021

Hello,
After the PR that I have just generated #22 , the CI is generating again functional ps2link.elf.
Not sure if it is related but we're now saving about 64KB, maybe the crash was related to the limited space that we have to ubicate ps2link.

ps2link loaded at 0x00083FF8-0x000D1E7C

Thanks!

@rickgaiser rickgaiser linked a pull request May 11, 2021 that will close this issue
@rickgaiser
Copy link
Member

One thing I notice in Rules.make (after looking at #22) is that we use EE_LIBS += -lc -lkernel-nopatch but we don't set -nodefaultlibs or -nostdlib anywhere. So probably both libkernel (a default library) and libkernel-nopatch are linked?

@fjtrujy
Copy link
Member

fjtrujy commented May 11, 2021

I noticed yesterday the same, I think that we can reduce the size even more

@rickgaiser rickgaiser removed a link to a pull request May 25, 2021
@fjtrujy
Copy link
Member

fjtrujy commented Jun 27, 2021

@cosmito @AKuHAK and @rickgaiser, hello to all,
We have done some changes in the ps2toolchain and now IOP uses newer GCC/Binutils versions.
Not sure if this will solve the current crash we were suffering in this thread, but please let's take a look ( I don't have currently a PS2 so I can't test myself)

Thanks

@fjtrujy
Copy link
Member

fjtrujy commented Jun 27, 2021

I have done another improvement into ps2link, solving all the warnings and making the binary even smaller.

There is an interesting warning:
fjtrujy@b3dd75a

I resolved reading this thread
https://stackoverflow.com/questions/16879434/why-do-these-c-struct-definitions-give-warnings-and-errors

I think these warnings started to appear when we upgraded the toolchain, the important thing here is that the ps2eth compilation (which is needed by ps2link) is still full of these warnings.
Maybe this was one of the reasons why ps2link was crashing.

Thanks

@fjtrujy
Copy link
Member

fjtrujy commented Jun 28, 2021

The #26 has been merged, and @AKuHAK confirmed that ps2link is now NOT crashing.

Anyway, I will keep this issue opened till @cosmito, double-checks it.

https://github.com/ps2dev/ps2link/releases/tag/v1.7.0

Thanks

@cosmito
Copy link
Member Author

cosmito commented Jun 29, 2021

Hi @fjtrujy, I am kind of very busy these days... But I can find some minutes over the next days to upload a compiled .ELF and try.
Should I try from this one? https://github.com/ps2dev/ps2link/releases/tag/v1.7.0

@fjtrujy
Copy link
Member

fjtrujy commented Jun 29, 2021

Hi @fjtrujy, I am kind of very busy these days... But I can find some minutes over the next days to upload a compiled .ELF and try.

Should I try from this one? https://github.com/ps2dev/ps2link/releases/tag/v1.7.0

Yes it should work fine

@cosmito
Copy link
Member Author

cosmito commented Jul 18, 2021

The bug was fixed. Tested with https://github.com/ps2dev/ps2link/releases/tag/v1.7.0.

@cosmito cosmito closed this as completed Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants