Search code examples
assemblyreverse-engineering

Value of %rsi in assembly code


I am working through a modified version of binary bomb, but I am stuck on what the value of %rsi is. Does it have something to do with line 5 and moving value into rax?

Thanks

Dump of assembler code for function phase_2:

=> 0x00000000004011c7 <+0>: sub    $0x8,%rsp
0x00000000004011cb <+4>:    cmp    $0x3,%rdi  //contains 3 values
0x00000000004011cf <+8>:    je     0x4011df <phase_2+24>  //check values if equal to three
0x00000000004011d1 <+10>:   callq  0x401bd7 <bomb_explosion>
0x00000000004011d6 <+15>:   mov    $0xffffffffffffffff,%rax
0x00000000004011dd <+22>:   jmp    0x401214 <phase_2+77>
0x00000000004011df <+24>:   not    %rsi
...

Solution

  • RSI contains the second argument to the function. (The first argument is in RDI.)

    For x86-64 systems that conform to the System V ABI (Linux, OS X, most UNIX in general; Windows uses a different calling convention), the first six integer and pointer parameters to a function are in RDI, RSI, RDX, RCX, R8, and R9. Floating-point arguments are passed in XMM (SSE) registers.