Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

In MASM can you do this PUSH 0xFFFF0820CADBA78D

I’m building a KMDF device driver (64 bit) project with assembly code which is located in a separate .ASM file. I’m using the MASM (ml64.exe) compiler integrated within Visual Studio 2019 Community to build the .ASM into an object file and linked to the 64 bit project. I’m trying the following code which does a PUSH of an imm64 value onto the stack. I’m getting the error below. How can I accomplish this ?

PUSH FFFF0820CADBA78D // 

The above instruction gives me the following error

Error   A2006   undefined symbol : FFFF0820CADBA78Dh

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Recall that numbers must begin with a digit in MASM syntax (refer to the MASM manual for details) and must be suffixed with a h, indicating a hexadecimal number. So the correct syntax would be

PUSH 0FFFF0820CADBA78Dh

Then please notice that no PUSH imm64 instruction exists on amd64. Only 32 bit constants sign extended to 64 bit can be pushed. So this will not assemble. Instead, first load the constant into a register and then push that.

MOV RAX, 0FFFF0820CADBA78Dh
PUSH RAX
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading