DragonFly BSD
DragonFly kernel List (threaded) for 2005-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [OT] x86 assembler question


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 28 Aug 2005 21:45:26 -0700 (PDT)

:
: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@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]