Advertisement
MichaelPetch

Aligned stack variables MASM 64-bit

Jan 3rd, 2023 (edited)
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. .code
  2. main PROC
  3. main_locs STRUC QWORD ; 8 byte (QWORD) alignment
  4. beginStack DQ ?
  5. myLocalA DQ ?
  6. myLocalB DQ ?
  7. myArrayA BYTE 10 DUP (?)
  8. myArrayB BYTE 10 DUP (?)
  9. endStack DQ ?
  10. main_locs ENDS
  11. LOCAL stack_vars: main_locs
  12.  
  13. lea rcx, stack_vars
  14. mov [rcx][main_locs.beginStack], 0ffffffffdeadbeefh
  15. mov [rcx][main_locs.myLocalA], 0ffffffffffffffffh
  16. mov [rcx][main_locs.myLocalB], 00000000000000000h
  17. ;Fill myArrayA with 10 As
  18. mov rax, "AAAAAAAA"
  19. mov QWORD PTR[rcx][main_locs.myArrayA], rax
  20. mov WORD PTR[rcx][main_locs.myArrayA+8], ax
  21. ;Fill myArrayB with 10 Bs
  22. mov rax, "BBBBBBBB"
  23. mov QWORD PTR[rcx][main_locs.myArrayB], rax
  24. mov WORD PTR[rcx][main_locs.myArrayB+8], ax
  25. mov [rcx][main_locs.endStack], 0ffffffffbaadf00dh
  26. ret
  27. main ENDP
  28.  
  29. end
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement