The previous article explained how to add the x64 assembly when writing x64 applications, and here is how to add x64 assembly when writing x64 drivers.
I. Writing function functions separately in ASM files
For example, to implement a 64-bit addition function, the prototype is as follows:
ULONG64 Myadd (ULONG64 u1,ulong64 U2);
Then the source directory (typically the directory where the sources file is located) creates a new folder named AMD64.
Then create a new file and write the following:
. Codemyadd PROC add rcx,rdx mov rax,rcx ret Myadd Endpend
Save it as myadd.asm and store it in the AMD64 folder you just created.
and add the following declaration in the source file that references it:
Extern_c ULONG64 Myadd (ULONG64 u1,ulong64 U2);
Ii. Modification of sources file
Add a row to the sources file:
Amd64_sources = Amd64\asm.asm
After the original sources do not add this file, and then you can! It's simple enough to pass the test!
This newly added item only works when compiling the x64 driver and is automatically ignored when compiling the x86 driver, so that you do not need to modify any settings even if you switch the compilation environment.
Reference:
http://bbs.pediy.com/showthread.php?p=1185534
DDK method of adding x64 assembly when writing 64-bit drivers