"Check that rsp mod 16 = 8 in long mode." What does this mean and how to do it?
1 answer
I suspect that you are asked to check if the stack is aligned on the 16 byte boundary. Perhaps it is necessary for someone for the purpose of the efficiency of some processor instructions. The top of the stack is in rsp , so it must be a multiple of 16. You can check, for example, like this (I write from the head, did not compile):
mov rax, rsp and rax, 15 jz .aligned ; Перейти куда-то, если остаток от деления на 16 равен 0. Accordingly, to test at 8, you can write
mov rax, rsp and rax, 15 cmp rax, 8 je .aligned ; Перейти куда-то, если остаток от деления на 16 равен 8. - oneHmm, but in question
=8, not=0. - VladD - Yes, thanks for the amendment. I have written the answer, I forgot the question :) - Zealint
- Thank you. exactly what is needed. if you can, tell me how to align it, i.e. make a multiple of 8 in this case. - thez
- Well, you should push as many bytes into the stack as there are not enough for the multiplicity. - Zealint
- ok, thanks, with your help figured out. - thez
|