Mail Archives: djgpp/1996/08/07/08:47:12
reynders AT cc DOT Helsinki DOT FI (Joonas W N Reynders) wrote:
> What type is the pointer malloc returns? Is it a selector:offset
>pair, just a 32bit offset or what? The reason I need to know this is
>that I've got a few routines made with MASM which copy information from
>a mallocated buffer to SVGA buffer.
Wow. That'll need total rewriting for DJGPP :-)
All DJGPP pointers are 32-bit offsets into The Segment.
DS, SS, ES, and CS all point to The Segment, or aliases thereof.
Thus we can ignore segments alltogether, and just use [xyz] in
assembler... or in AT&T syntax, just xyz.
None of that LES xxx,xxx stuff.
EG:
C:
int *ptr = malloc(sizeof (int));
ASSEMBLER:
movl ptr,%eax // places the address of what is pointer to into eax
movl $ptr,%eax // places the address of the pointer into eac
and with an address in eax:
movl (%eax),%ebx // loads ebx with the int eax points to
I don't remember if
movl (ptr),%ebx
will work directly (probably will, try it and see)
> Joonas
ABW
--
I have become... Comfortably numb...
Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.hardcafe.co.uk/Alaric/">http://www.hardcafe.co.uk/Alaric/</A>
- Raw text -