Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a value to null in Assembly

Tags:

null

x86

assembly

I'm trying to set a value in a register to null to later on test if some other value is null. I've looked around the internet to check what the representation of null is in IA32, however could not find anything properly.

Can anybody help?

like image 942
spurra Avatar asked Dec 15 '22 03:12

spurra


1 Answers

On IA-32, the general registers are simply bits that are mostly interpreted as integer values. They do not have additional states such as “null” in the sense of “not currently holding a value”. (Some architectures do have such additional states, and the floating-point registers in IA-32 can have such a state.)

If you want to set an IA-32 general register to a “no value” state, there is no way to do this.

If you want to set a register to a “null pointer” state, the same as the C NULL macro, then this is represented as zero in most C implementations.

like image 108
Eric Postpischil Avatar answered Feb 10 '23 12:02

Eric Postpischil