-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Initial SuperH SH-1/SH-2 Processor Support #715
Conversation
Any plans to merge this soon? |
Yes, Sorry for the delay in review. Very much appreciate the contribution! The plan is to review for best practices and then accept after review. We're going to push to get this and others accepted. Do you have a sample binary that could be used for review? |
No worries on the delay. I have been using this site for homebrew Sega Saturn games to test: http://archives.dcemulation.org/vieille.merde.free.fr/vieille.merde.free.fr/index.html. In particular if you download one of the attachments labelled "binary executable", use SH-2 as the processor, and load to address 0x06004000 in Ghidra it should work. I can also look for some ELF SH-1/SH-2 Linux binaries. |
Don't know the state of it, guessing @VGKintsugi is familiar but you could buiding gcc from https://github.com/SaturnSDK/Saturn-SDK-GCC-SH2 |
Would be great to have a C-compiler for SH1/2 we can use the just pushed emulation test framework to test your processor module. |
Do you have notes on how to use the emulation test framework? I glanced at the REcon slides but I'm not sure how to launch it. In terms of compilers:
|
Thank you for the feedback. I will work on these changes and have something for next week. |
Sounds great. Overall, the design was really well-thought out. Great work! |
Can you take a look at this instruction:
The psuedocode is:
Specifically when PC is 2-byte aligned but not 4-byte aligned I think there might be some issue. I've tried matching it up with a Sega Saturn emulator and it appears my processor module might be reading two bytes ahead of where it should. It could be an issue with the video game emulator or a bug in my code. |
Shouldn't have to worry about the 2 or 4 byte align since you mask PC with fffffffc, right? It's always 4 byte aligned after that. I do question why you have a
Oh PC is at 2 instructions after the mov, nmd +4 makes sense |
@mumbel is correct about the byte-alignment issue.It shouldn't be an issue for branch delay slots since it's considered an illegal instruction in the branch delay. |
I admit I didn't read closely and misinterpreted the example. It made sense with |
I see what you mean now. You are very likely correct there. |
I have pushed most of the changes requested from the code review. I have not:
|
I was just about to comment when i saw an email come in. A quick guess at the
|
Thanks @mumbel, I fixed the whitespace. I still couldn't get the n==m to work. I also gave you merge access to my fork in case you want to push @loudinthecloud's SH2A PR. Also, do you know how to use the emulation test framework? I would like to try it. |
@GhidorahRex I have been reviewing some changes that @loudinthecloud has made to add 2A support, this is basically a few additional instructions and FPU support. @loudinthecloud 's PR is very clean in my POV and I'll will be working to merge that PR hopefully tomorrow night, so should show up here then. Hopefully this is not too burdensome, but seems ideal to get 2A in addition to 1 and 2. |
It's a single equals, not a double equals. I was able to get it to compile by using: |
@VGKintsugi @GhidorahRex I merged in the SH-2A (from @loudinthecloud ) and fixed these recent changes in I did not touch the n=m code though |
Thanks again @mumbel. I implemented the n=m checks in the last commit. |
@GhidorahRex still thinking if it can get away with fewer goto's, but hopefully more readable now |
It looks pretty good at this point. I'll submit it for internal review and if there are any additional suggested changes I'll add them here. |
I apparently swapped the bsrf and the jsr instructions during the code review. It's fixed now. |
@VGKintsugi, we noticed that you are submitting this under the MIT license, rather than following the guidance defined in our Contributors Guide:
Was it your desire to license this to all Ghidra users under MIT instead? We’re happy to include it under Apache 2.0, and it’s a lot easier for us to proceed in this way. This wouldn’t preclude you from licensing the files under MIT in other venues. If you insist on using the MIT license, we can accommodate it, but it complicates things. Just let us know so we can proceed with your contribution...thanks! |
I am OK with including the code under Apache 2.0 to keep things simple. What's the easiest way to do that? Commit a different License file with this PR? Or is this message itself sufficient? |
Hi @ryanmkurtz, we at Toka are also submitting our work in this pull request. I suggest to remove the license alltogether, and perhaps add a CREDITS file instead. Is that ok by you @VGKintsugi? |
@loudinthecloud that works for me. |
I pushed the license change and added a CREDITS file. Let me know if you there any concerns. |
@VGKintsugi, yes, your message itself is sufficient. We don't support a custom LICENSE file in the repo. We have an internal certification process that marks the license of each file, which then gets stored in the java file header or certification.manifest file for non-java/c files. When we do a build, the appropriate license file will get put into the module's directory. If you wish to declare copyright information, the only thing that will work right now is putting in your own comments in the appropriate source files. Currently, a custom CREDITS file will also get discarded by the build process. We'll have to have a discussion internally about that type of file. We have been giving credit so far just from the Git commit history. |
Hi, do you have any update regarding this pull request? We are not insisting on adding a CREDITS file, but it would be nice. |
@loudinthecloud Wouldn't it be enough to put your credits/names on the headers of each file you have contributed to? This wouldn't break/interfere with @ryanmkurtz building conventions/releng and you'll retain that authorship (as well as the commits themselves)? I'm just eager to get this shipped soon along with #37 :) |
We're fine with that too @brainstorm :) |
Sorry for the delay in responding. We just pushed this to master and it will be included in the 9.1 release! It's showing as closed instead of merged because we made a commit before incorporating your last commit that removed the LICENSE file. I guess that was enough for GitHub to not consider the branch associated with this pull request anymore. Please take a look and make sure everything looks right on your end with it. Thanks! |
Following up from issue 608, I am submitting a PR for my Sega Saturn (SuperH SH-1/SH-2) processor module.
I struggled with issues related to sign extensions, flags, conditionals, and branches. I also struggled writing SLEIGH code for some of the longer instructions such as addv, div1, mac.l, and mac.w. Thanks in advance.