I am learning about windows x64 calling convention, where the first four arguments are passed to registers and left arguments are passed through the stack. To see it, I checked the assembly of the test file that I made. I understood the passing of first four arguments through the register, the left arguments were passed through the stack but I didn't understood the assembly of the instruction. It looked like this:

mov DWORD PTR 40[rsp], 6
mov DWORD PTR 32[rsp], 5

I don't know what does 40[rsp] means, maybe rsp+40 . If anyone knows, please explain to me

  • What assembler are you using?
    – Igor Skochinsky
    Commented Mar 25, 2021 at 8:33
  • 1
    gcc with tag -S
    – Mr. rc
    Commented Mar 26, 2021 at 3:28

1 Answer 1


Yes, mov DWORD PTR 40[rsp], 6 is the same as mov DWORD PTR [rsp + 40], 6. The first syntax makes a lot more sense in cases where the constant is the base address of an array, and the register contains a byte offset into that array. That's the use case the syntax was designed for.

  • Thanks, now i understood!
    – Mr. rc
    Commented Mar 28, 2021 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.