NO

Author Topic: few questions regarding 64bit assembly  (Read 3637 times)

ramguru

  • Guest
few questions regarding 64bit assembly
« on: July 16, 2009, 09:31:28 am »
Hello,
poasm has beautiful 64bit support for win programming & I really like it.
but here is a little problem  ;D
I want to save winproc parameters for later use.
Code: [Select]
WinProc PROC hWin:QWORD, uMsg:QWORD, wParam:QWORD, lParam:QWORD PARMAREA=4*QWORD   
    mov    hWin, rcx
...
; mov instruction will assemble to this :/
    mov    rcx, rcx
; of course it will do no good
From one point of view I understand why it happens (because no stack frame is created)
but from other .. referencing winproc parameters by their names I should reference stack instead. ([rsp+..])

A quick workaround would be:
Code: [Select]
WinProc PROC hWin:QWORD, uMsg:QWORD, wParam:QWORD, lParam:QWORD PARMAREA=4*QWORD
    LOCAL hWin_:QWORD
    mov    hWin_, rcx
But here I declare additional stack variable..instead of using reserved stack space for those parameters..

Also I want to ask if using "/LARGEADDRESSAWARE:NO" switch is a bad manner of programming 64bit apps,
will I be missing some essential 64bit features ?

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2084
    • http://www.smorgasbordet.com
Re: few questions regarding 64bit assembly
« Reply #1 on: July 31, 2009, 02:33:45 pm »
1. When *reading* the parameter, you most likely want the register it's located in (hWin will/should be be in RCX in this case). When *writing* to the parameter, you may want the "home" stack position reserved by the caller, but I'm not sure this is always the case. Always getting the register is more consistent, at least. Also, changing this now will be "surprising" for existing code...

2. You will limited the module to a smaller valid address range, but I'm not sure what else. I suspect Microsoft docs can tell you more...
/Pelle