The MASM Forum

General => The Campus => Topic started by: Lonewolff on April 16, 2018, 07:00:09 PM

Title: Registers
Post by: Lonewolff on April 16, 2018, 07:00:09 PM
Hi Guys,

Which registers do not need to be preserved?

Thanks in advance  :biggrin:
Title: Re: Registers
Post by: jj2007 on April 16, 2018, 07:50:26 PM
Eax, ecx, edx
Title: Re: Registers
Post by: Lonewolff on April 16, 2018, 07:55:41 PM
Cool! Thanks for that.

Why is it that the other registers require preservation? What happens with them to make them different?
Title: Re: Registers
Post by: jj2007 on April 16, 2018, 08:51:56 PM
The Windows APIs rely on their values, that's all. Take the WndProc, for example: It gets called a Million times by Windows itself, and Windows uses esi edi ebx ebp for various purposes. So the message is "use them if you like, but on return I want my pointers to xyz exactly as they were on entry!".
Title: Re: Registers
Post by: Lonewolff on April 16, 2018, 08:57:45 PM
Awesome explanation  :t
Title: Re: Registers
Post by: hutch-- on April 16, 2018, 09:47:24 PM
If you look in the help file "asmintro.chm" you will find a section in the file called "Register Preservation Convention" which explains in detail how the Intel Application Binary Interface works.