linux system call for allocation of memory
Hi Linux asm gurus,
I would like to know if the linux kernel has the syscall for memory manipulation(allocation, release and resize) that synonymous with DOS 48H of INT 21. I've read some documents saying that these are implemented in C library.
I know that I can use the flat memory model, but I would like to take the allocaion/release approach, for easy porting my current DOS program to Linux.
Thanks
Lawrence
Thanks for your reply zad.
I just browsed the list of linux system call again, and didn't find any related to either memory allocation or release. Does this imply one must write linux asm program in flat model?
Thanks
Lawrence
zad ??:
Quoted 38 lines
Quoted 12 lines · Lawrence
Hi Linux asm gurus,
I would like to know if the linux kernel has the syscall for memory
manipulation(allocation, release and resize)that synonymous with DOS 48H of INT 21. I've read some documents saying that these are implemented in C library.I know that I can use the flat memory model, but I would like to take the allocaion/release approach, for easy porting my current DOS program to Linux.
Quoted 8 lines
Thanks
Lawrence-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSo :
1) If u want call a linux'system call u need to use the interrupt0x80with the follown convenctions:(quoted diff) +0
-2-eax contains the syscall number -ebx ecx edx esi edi the first argument ,second ,and third and so onetill the six
-the return value of a syscall is stored in eax reg.
2) a complete list of sys call is in the file /linux/include/asm/unistd.h where linux is the base tree of the kernel source.-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 12 lines · Lawrence
Hi Linux asm gurus,
I would like to know if the linux kernel has the syscall for memory
manipulation(allocation, release and resize)that synonymous with DOS 48H of INT 21. I've read some documents saying that these are implemented in C library.I know that I can use the flat memory model, but I would like to take the allocaion/release approach, for easy porting my current DOS program to Linux.
Quoted 8 lines
Thanks
Lawrence-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
So :
1) If u want call a linux'system call u need to use the interrupt 0x80 with the follown convenctions:
-eax contains the syscall number
-ebx ecx edx esi edi the first argument ,second ,and third and so
one till the six
-the return value of a syscall is stored in eax reg.
2) a complete list of sys call is in the file /linux/include/asm/unistd.h where linux is the base tree of the kernel source.
Quoted 9 lines · Lawrence
Thanks for your reply zad.
I just browsed the list of linux system call again, and didn't find any related to either memory allocation or release. Does this imply one must write linux asm program in flat model?
Thanks
Lawrencezad ??:
Have u take a look at brk syscall ? (for informations man brk ) if thi is not for your case take a look here:
http://www.tldp.org/HOWTO/Assembly-HOWTO/faq.html#AEN1005
Lawrence am Thursday 13 November 2003 09:37:
Quoted 4 lines
Thanks for your reply zad.
I just browsed the list of linux system call again, and didn't find any related to either memory allocation or release.
syscalls: mmap, munmap, mremap
"F4" might serve as an example implementation w. a very simple automatic de-/allocation scheme.
http://www.lxhp.in-berlin.de/lhpf4.html (de, introduction + source)
http://www.lxhp.in-berlin.de/e-lhpf4.html (en, as above, short text)
other, more sophisticated memory management routines can be found in the 'asmutils':
http://linuxassembly.org
Quoted 1 line
Does this imply one must write linux asm program in flat model?
yes.
regards,
hp
Signature · 1 line
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml
Quoted 1 line
Quoted 1 line
hp -at- lxhp -dot- in-berlin -dot- de <<
Quoted 4 lines
I would like to know if the linux kernel has the syscall for memory
manipulation(allocation, release and resize)that synonymous with DOS 48H of INT 21. I've read some documents saying that these are implemented in C library.
The brk system call can be used to enlarge your process's heap. You can then manage your heap by writing your own set of malloc-realloc-free functions. Alternately, you can use the mmap system call to allocate arbitrary pages of memory directly.
b