Why does this load instruction come after a jump?

丶灬走出姿态 提交于 2019-12-11 15:34:58

问题


Let me preface this by saying that I'm new to MIPS.

I'm trying to reverse some sample code that I compiled for PSX using Psy-Q. I compiled a small "hello world" program that happens to contain the following function call in C

int main() {
    FntLoad(960, 256) // load the font from the BIOS into the framebuffer
}

I suppose it doesn't matter too much what the function call is, but it is that line above with those two arguments.

My disassembly looks like the following for that function call in hexadecimal:

C0 03 04 24 E7 45 00 0C 00 01 05 24

In my disassembler, it looks like the following 3 instructions:

TEXT:800103E4                     li      $a0, 0x3C0
TEXT:800103E8                     jal     FntLoad
TEXT:800103EC                     li      $a1, 0x100

Out of the examples that I've seen so far, all function arguments are loaded before the jal line, but in my disassembly the load immediate happens after the jump.

Is this correct or is something weird going on here? If my understand of how jal is incorrect, would someone mind explaining how the last argument is passed?

来源:https://stackoverflow.com/questions/53715539/why-does-this-load-instruction-come-after-a-jump

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!