[OT] x86 assembler question

Matthew Dillon dillon at apollo.backplane.com
Sun Aug 28 21:53:03 PDT 2005


:
:Is there a trick to calling malloc from NASM code?  It links fine and steps
:into malloc() fine, but returns a NULL pointer.

    Nope, should work just fine.  The assembly should look something like
    this (assuming we are talking about a userland program here):

    pushl	$bytes_to_malloc
    call	malloc
    addl	$4,%esp
    [ returns pointer in %eax ]

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Kernel mailing list