Re: Question about AMD64 ABI

From: Daniel Cervus <DanieltheDeer_at_outlook.com>
Date: Mon, 14 Nov 2022 02:24:51 UTC
> What I mean specifically is, if you're a fledgling asm programmer and you wrote a function with the intention of addressing a 32-bit register, but instead you address it as a 64-bit register, then that's a problem because whatever results you get are erroneous.

I see, I will definitely avoid that in my code.


> If instead you're leaning on a compiler to build the function body, then the compiler will undoubtedly do the right thing.
> 
> The above is a long winded way for me to say:  For most purposes and in my experience has always been that it's safe to ignore higher bits of passed 32-bit registers.

Yes, most of the time I have to rely on functions written by others. I get it. And what if the function requires a 16-bit or an 8-bit parameter? (I know it’s rare) Can I safely ignore the upper bits, simply 'mov di' or 'mov dil'?

Thanks,
Daniel