Gary is right, only volatile registers (EAX, ECX, RDX, R8, R9, R10 and R11)
can be freely used by a called function without preserving their values.
Other registers (e.g. EBX, RSI, …) are non-volatile registers and must be
saved and restored by functions that use them.
Please read something about x64 assembler (e.g. x64 prolog/epilog,
convention calls, etc) - it’s quite different from x86 assembler.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@excite.com
Sent: Wednesday, March 09, 2011 8:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Linking 64-bit amd64 asm code
In general, how do I link 64-bit amd64 asm code into a winddk driver? My .c
code
resides one level above the /amd64 folder and calls a .asm file in the
/amd64 folder.
The .asm file at this point is only:
.code
capabilities PROC
xor rax, rax
xor rbx, rbx
mov rax, rbx
RET
capabilities ENDP
END
When I run this, I crash, and the crashdump begins with:
module: nt
exception code NTStatus 0xc0000005 The instruction referenced memory at
0x%081x. The
memory could not be %s
Googling this error makes me think that the program references memory that
it can’t.
But I don’t know how exactly the transition works.
Background notes:
capabilities is expected to return an integer–I think that is understood to
be in
rax
I am running this with build /amd64 -cw in WinDDK 7600.16385.1 in the x64
Checked
Build Environment.
Thank you for any help that you can give!
eva
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer