Re: Question about AMD64 ABI
- Reply: Daniel Cervus : "Re: Question about AMD64 ABI"
- In reply to: Daniel Cervus : "Re: Question about AMD64 ABI"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 13 Nov 2022 15:42:41 UTC
On Sun, Nov 13, 2022 at 7:41 AM Daniel Cervus <DanieltheDeer@outlook.com> wrote: > Sorry if I didn’t make myself clear. in other words, I mean if a > function prototype requires a parameter less than 64 bits (such as int, > short...), since the ABI requires it to be passed by a 64-bit register, > will the function completely ignore the unused bits? Can I safely leave the > garbage in upper bits? Or I have to expand everything to 64 bits? > >> 64 bits (such as int, short...), since the ABI requires it to be passed by a 64-bit register, will the function completely ignore the unused bits? Can I safely leave the garbage in upper bits? Or I have to expand everything to 64 bits? This depends on the function and who wrote it. 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. 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. Thanks, Paul -- __________________ :(){ :|:& };: