Ok, maybe this isn't the right place for asking questions about Linux Assembly. But this is the only place I know where I can find help to problems. Maybe there are a few people here who have experience with Linux ASM.

I'm trying to allocate a piece of memory in Linux. But I don't know which syscall I have to use. I've already checked some documents on http://linuxassembly.org but I haven't found anything useful. Does anyone have a solution to this.

Thanks...
Posted on 2003-07-18 05:35:45 by Compuholic
right, this question is really terribly out of topic... :grin:


take a look to this thred i've found Googling

memory allocation


Bye
B7
Posted on 2003-07-18 07:39:33 by Bit7
Hey, I've found this Post, too.

The Problem is: If you look into the Syscall-List the only thing which sounds familiar with the syscall mentioned in the Post is:

brk void *end_data_segment 45
change data section size, top of .bss
arg eax 45
ebx (virtual) address of new .bss top in range of data-space bottom
and, below any linked library or 16K below .ss bottom, rsp, within
the limits of the owner process' data size - re getrlimit.
ebx := 0 can be used to finding the currently valid top address of .bbs.
return eax currently, after call valid top address
errors eax nomem
source mm/mmap.c

As you can see, this is not similar to malloc()
Thanks
Posted on 2003-07-18 10:35:48 by Compuholic
Take a look at the malloc code in the HLA Standard Library.
There are two standard ways to do *gross* memory allocation in Linux: via SBRK and via memory-mapped files. You have to allocate a large chunk of memory and then do your small malloc by carving pieces of out the big chunk you created with SBRK or MMAP.
Cheers,
Randy Hyde
P.S., you can find the HLA Standard Library source code on the HLA download page at http://webster.cs.ucr.edu.

Also, visit www.linuxassembly.org for Linux assembly support.
Posted on 2003-07-18 17:21:20 by rhyde