Why does this
not work: ?
mov var, 7FFFFFFFFFFFFFFDh
Quoteerror A2084:constant value too large
But this
does work: ???
mov rax, 7FFFFFFFFFFFFFFDh
mov var, rax
In both cases 'var' is a qword variable. Using ml64 to assemble.
:rolleyes: :tongue: :undecided: :smiley:
Pretty sure that mov mem,imm is restricted to a 32-bit value only.
Quote from: sinsi on October 20, 2024, 03:02:58 PMPretty sure that mov mem,imm is restricted to a 32-bit value only.
Really? Even for qwords in 64 bit code?? That's rather odd. :sad:
It seems I ought to do some more research. ... ... grumble, grumble.
Okay, thanks.
According to the Intel docs, the only mov is
MOV r64,imm64, there's no equivalent
MOV r/m64,imm64 :sad:
Quote from: sinsi on October 20, 2024, 03:02:58 PMrestricted to a 32-bit value only
Of course I meant "restricted to a
maximum 32-bit value only" :biggrin:
Yes, I was just now finding this out... and the reasons why. :smiley:
Makes me want to stick to 32 bit. :tongue:
Quote from: zedd151 on October 20, 2024, 03:29:35 PMYes, I was just now finding this out... and the reasons why. :smiley:
Makes me want to stick to 32 bit. :tongue:
One little thing like that? You wuss :badgrin:
:biggrin:
What good are 64 bit variables if I cannot use them to their full potential? :biggrin:
Anyway I have converted "dwtoa" from the masm32 library to "qwtoa" for use in 64 bit code. I was testing that function when I came across this issue.
So far "qwtoa" is working as expected, it converts signed qword values to ascii decimal string. Will post it when my testing is finished.
Quote from: sinsi on October 20, 2024, 03:02:58 PMPretty sure that mov mem,imm is restricted to a 32-bit value only.
Is that an Intel restriction or an assembler one?
According to Felix Cloutier (https://www.felixcloutier.com/x86/mov), the largest valid
MOV of an immediate value to memory uses a 32-bit value (which can be sign-extended to 64 bits).
It's a limitation of the ISA. (Intel/AMD)
We are actually running an x86 in 64 bit mode, if I correctly understood what I have read just a little while ago.
x86_64 (https://en.m.wikipedia.org/wiki/X86-64) This is not where I read about it, but explains some of the details.
Quote from: NoCforMe on October 20, 2024, 04:06:50 PMQuote from: sinsi on October 20, 2024, 03:02:58 PMPretty sure that mov mem,imm is restricted to a 32-bit value only.
Is that an Intel restriction or an assembler one?
It's a limitation of the CPU, there's no encoding for it.
Quote from: zedd151 on October 20, 2024, 04:13:28 PMWe are actually running an x86 in 64 bit mode
32-bit code runs in compatibility mode under long mode if that makes sense :biggrin:
Now I am totally confused. There seems to be a lot of conflicting information around, or maybe I simply don't understand it. :smiley:
Write 64 bit version of m2m macro as solution ?
It short for memory2memory
Nah: just do
MOV [register], [64-bit value]
MOV [memory], [register]
The only good thing about this, is that Microsoft is off the hook for this oddity. :biggrin:
64 bit CPU (but only sometimes). :badgrin:
Quote from: zedd151 on October 20, 2024, 05:22:14 PMNow I am totally confused. There seems to be a lot of conflicting information around, or maybe I simply don't understand it. :smiley:
Didn't you already got the Intel 64 and IA-32 Architectures Software Developers Manual? Check MOV's manual page. Theres all possible ways to use MOV instruction, for both 32bit and 64bit use.
@C3, nope. Reading that stuff makes my eyes bleed. :tongue:
I prefer explanations in plain language, from others with experience with such things. :biggrin:
Quote from: zedd151 on October 21, 2024, 03:19:55 AM@C3, nope. Reading that stuff makes my eyes bleed. :tongue:
I prefer explanations in plain language, from others with experience with such things. :biggrin:
Well, I do not know Intel copyright policy of that manual, so I'm not doing a screenshot of one page.
Thats okay, I have already googled for the reason and explanation. :smiley:
.. in addition to the info already posted here.
Quote from: sinsi on October 20, 2024, 03:02:58 PMPretty sure that mov mem,imm is restricted to a 32-bit value only.
Quote from: zedd151 on October 21, 2024, 03:23:47 AMThats okay, I have already googled for the reason and explanation. :smiley:
But another reason you to have the manual is.. that there is how instructions are build using machine language. So you can read and write the binary code/machine language. And I already know that you can do that too. But there is how the work is done by CPU Manufacturer.
Quote from: zedd151 on October 21, 2024, 03:19:55 AM@C3, nope. Reading that stuff makes my eyes bleed. :tongue:
I prefer explanations in plain language, from others with experience with such things. :biggrin:
Check out this page (https://www.felixcloutier.com/x86/mov); it shows all the possible permuations of
MOV.
Look at the end for all the variations that allow immediate values to be moved: notice that there are 4 sizes,
imm8,
imm16,
imm32 and
imm64. The only place that an immediate 64-bit value is allowed is when the destination is a register, not memory. (Keep in mind that
r/mXX means "register
or memory".)
It's not rocket science.