MIPS功能逆向工程

发布于 2025-01-31 10:25:58 字数 1833 浏览 2 评论 0原文

目前正在从事一些MIPS组件进行逆向工程,我有点卡住了

004052c0 <subroutine_fnc>:
  4052c0:   27bdfff8    addiu   sp,sp,-8
  4052c4:   afbe0004    sw  s8,4(sp)
  4052c8:   03a0f025    move    s8,sp
  4052cc:   afc40008    sw  a0,8(s8)
  4052d0:   8fc20008    lw  v0,8(s8)
  4052d4:   00000000    nop
  4052d8:   2842005b    slti    v0,v0,91
  4052dc:   10400006    beqz    v0,4052f8 <subroutine_fnc+0x38>
  4052e0:   00000000    nop
  4052e4:   8fc20008    lw  v0,8(s8)
  4052e8:   00000000    nop
  4052ec:   28420041    slti    v0,v0,65
  4052f0:   10400004    beqz    v0,405304 <subroutine_fnc+0x44>
  4052f4:   00000000    nop
    else
  4052f8:   8fc20008    lw  v0,8(s8)
  4052fc:   1000000c    b   405330 <subroutine_fnc+0x70>
  405300:   00000000    nop
  405304:   3c020041    lui v0,0x41
  405308:   8c426190    lw  v0,24976(v0)
  40530c:   00000000    nop
  405310:   24430001    addiu   v1,v0,1
  405314:   3c020041    lui v0,0x41
  405318:   ac436190    sw  v1,24976(v0)
  40531c:   8fc20008    lw  v0,8(s8)
  405320:   00000000    nop
  405324:   24420020    addiu   v0,v0,32
  405328:   afc20008    sw  v0,8(s8)
  40532c:   8fc20008    lw  v0,8(s8)
  405330:   03c0e825    move    sp,s8
  405334:   8fbe0004    lw  s8,4(sp)
  405338:   27bd0008    addiu   sp,sp,8
  40533c:   03e00008    jr  ra
  405340:   00000000    nop

,我认为我已经能够拆卸大部分,但我真的被困在其他陈述的中间。我主要不太了解指令lw v0,24976(v0)lui v0,0x41太好了。任何帮助将不胜感激。

int subroutine_fnc(char a) {
    int b = (a<91) ? 1 : 0;
 
    if(b==0){
        return a;
    }else{
        b = (a<65) ? 1 : 0;
        if(b != 0){
            return a;
        }else{
            b = 0x41 << 16;
            //int v1 = b+1;
            // ???
            a+=32;
        }
    }
    return a;
}

currently working on reverse engineering some MIPS assembly and I am a bit stuck

004052c0 <subroutine_fnc>:
  4052c0:   27bdfff8    addiu   sp,sp,-8
  4052c4:   afbe0004    sw  s8,4(sp)
  4052c8:   03a0f025    move    s8,sp
  4052cc:   afc40008    sw  a0,8(s8)
  4052d0:   8fc20008    lw  v0,8(s8)
  4052d4:   00000000    nop
  4052d8:   2842005b    slti    v0,v0,91
  4052dc:   10400006    beqz    v0,4052f8 <subroutine_fnc+0x38>
  4052e0:   00000000    nop
  4052e4:   8fc20008    lw  v0,8(s8)
  4052e8:   00000000    nop
  4052ec:   28420041    slti    v0,v0,65
  4052f0:   10400004    beqz    v0,405304 <subroutine_fnc+0x44>
  4052f4:   00000000    nop
    else
  4052f8:   8fc20008    lw  v0,8(s8)
  4052fc:   1000000c    b   405330 <subroutine_fnc+0x70>
  405300:   00000000    nop
  405304:   3c020041    lui v0,0x41
  405308:   8c426190    lw  v0,24976(v0)
  40530c:   00000000    nop
  405310:   24430001    addiu   v1,v0,1
  405314:   3c020041    lui v0,0x41
  405318:   ac436190    sw  v1,24976(v0)
  40531c:   8fc20008    lw  v0,8(s8)
  405320:   00000000    nop
  405324:   24420020    addiu   v0,v0,32
  405328:   afc20008    sw  v0,8(s8)
  40532c:   8fc20008    lw  v0,8(s8)
  405330:   03c0e825    move    sp,s8
  405334:   8fbe0004    lw  s8,4(sp)
  405338:   27bd0008    addiu   sp,sp,8
  40533c:   03e00008    jr  ra
  405340:   00000000    nop

I think I have been able to disassemble most of it but I am really stuck on halfway through where the else statement. I mainly don't really understand the instructions lw v0,24976(v0) and lui v0,0x41 too well. Any help would be greately appreciated.

int subroutine_fnc(char a) {
    int b = (a<91) ? 1 : 0;
 
    if(b==0){
        return a;
    }else{
        b = (a<65) ? 1 : 0;
        if(b != 0){
            return a;
        }else{
            b = 0x41 << 16;
            //int v1 = b+1;
            // ???
            a+=32;
        }
    }
    return a;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文