Coder Social home page Coder Social logo

ghidra-segasaturn-processor's People

Contributors

vgkintsugi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghidra-segasaturn-processor's Issues

SH-2A Support + FPU + Fixes

Hi @VGKintsugi

Nice work with the repo, we use it at Toka.

We would like to contribute the following enhancements: we've added a new variant: SH-2A, as well as FPU support and various fixes that I see you addressed some of them already. We get a clean decompile in Ghidra.

A little suggestion, since SH-2A is not SegaSaturn, what about renaming the project to ghidra-processor-superh or something similar?

Let me know what are your thought and I will initiate a new pull request for this issue.

Thanks,
Guy

Add Patterns

The patterns in the patternconstants.xml are used to enhance and speed up detection of various things, one of which is the function start.
Crude ones I've been using are

<patternlist>
  <pattern>
     <data>0x2F86</data> <!-- mov.l   r8, @-r15 -->
     <codeboundary/>
     <possiblefuncstart/>
  </pattern>
  <pattern>
     <data>0x2FE6</data> <!-- mov.l   r14, @-r15 -->
     <codeboundary/>
     <possiblefuncstart/>
  </pattern>
</patternlist>

but i have near no knowledge of SuperH so i dunno what else could be added.

Args that are in the stack are incorrect or missing

In the Saturn sdk \SAMPLE\S_9_1\SCL_FUNC.C the function Map2VRAM has the args ( Uint16 *Map_Data , Uint32 Map_Adr , Uint16 suuj , Uint16 suui , Uint16 palnum ,Uint32 mapoff) but Ghidra decompiles it with the first 4 args and rest go missing, instead the code has weird unaff_r# in_r# which are usually accompanied by a + 0xXX offset in some functions.


void Map2VRAM(ushort *puParm1,short *psParm2,uint uParm3,ushort uParm4)
{
    ushort uVar1;
    int in_r1;
    uint uVar2;
    uint uVar3;
    ushort uVar4;
    int in_r9;
    undefined4 uVar5;
    bool bVar6;
    
    uParm3 &= 0xffff;
    uVar2 = *(uint *)(in_r1 + 0xc);
    uVar4 = 0;
    uVar5 = *(undefined4 *)(in_r9 + 0x10);
    if (uParm4 == 0) {
        bVar6 = true;
    }
    else {
        bVar6 = false;
    }
    if (!bVar6) {
        do {
            uVar3 = 0;
            if (uParm3 == 0) {
                bVar6 = true;
            }
            else {
                bVar6 = false;
            }
            while (!bVar6) {
                uVar1 = *puParm1;
                if (true) {
                    puParm1 = (ushort *)((int)puParm1 + 1);
                }
                *psParm2 = (uVar1 | (ushort)((uVar2 & 0xf) << 0xc)) + (short)uVar5;
                uVar3 = uVar3 + 1 & 0xffff;
                if (uVar3 < uParm3) {
                    bVar6 = false;
                }
                else {
                    bVar6 = true;
                }
                psParm2 = psParm2 + 1;
            }
            uVar4 += 1;
            if (uVar4 < uParm4) {
                bVar6 = false;
            }
            else {
                bVar6 = true;
            }
            psParm2 = psParm2 + (0x40 - uParm3);
        } while (!bVar6);
    }
    return;
}

I was looking at C&C for the Saturn where there are a lot of class functions that have a lot of args but to hopefully simplify debugging this i tried to find functions that will have similar issues in the SDK(as it is unknown if anything is different compared to the info i have on the C&C PC counterpart so its probably not the best thing to examine in this case).

SCL_InitRotateTable
SCL_SetDisplayMode
SCL_SetAutoColChg
ex_keyword2
BPL_GetStmInfo
GFCD_GetLenData
GFS_GetFileSize
PCM_GetWriteBuf
Map2VRAM
gxSetMaterial
SND_CtrlDirMidi
GFS_GetFileSize
STM_GetInfo
FNT_Print256
BPL_GetStmInfo
MTH_Curve2
MPG_GetReport
MPG_SpGetTimeCode
SPR_3AllCoordTransClipPers
MPSYS_DoPlay
MPG_MvGetTimeCode
PCM_MeGetRingWrite
pcm_GetPcmWrite

should be ones that would have arg issues like these.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.