1

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

2
2

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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