linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux system call for allocation of memory
@ 2003-11-13  8:14 Lawrence
  2003-11-13 10:19 ` zad
  2003-11-13 20:34 ` Brian Raiter
  0 siblings, 2 replies; 6+ messages in thread
From: Lawrence @ 2003-11-13  8:14 UTC (permalink / raw)
  To: linux-assembly

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux system call for allocation of memory
  2003-11-13 10:19 ` zad
@ 2003-11-13  9:37   ` Lawrence
  2003-11-13 11:00     ` zad
  2003-11-13 13:38     ` peter w krause
  0 siblings, 2 replies; 6+ messages in thread
From: Lawrence @ 2003-11-13  9:37 UTC (permalink / raw)
  To: zad; +Cc: linux-assembly

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 ??:

>
>
> Lawrence wrote:
>
>> 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
>>
>> -
>> To unsubscribe from this list: send the line "unsubscribe 
>> linux-assembly" in
>> the body of a message to majordomo@vger.kernel.org
>> 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.
>
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux system call for allocation of memory
  2003-11-13  8:14 linux system call for allocation of memory Lawrence
@ 2003-11-13 10:19 ` zad
  2003-11-13  9:37   ` Lawrence
  2003-11-13 20:34 ` Brian Raiter
  1 sibling, 1 reply; 6+ messages in thread
From: zad @ 2003-11-13 10:19 UTC (permalink / raw)
  To: linux-assembly



Lawrence wrote:
> 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
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> 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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux system call for allocation of memory
  2003-11-13  9:37   ` Lawrence
@ 2003-11-13 11:00     ` zad
  2003-11-13 13:38     ` peter w krause
  1 sibling, 0 replies; 6+ messages in thread
From: zad @ 2003-11-13 11:00 UTC (permalink / raw)
  To: linux-assembly



Lawrence wrote:
> 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 ??:
> 

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux system call for allocation of memory
  2003-11-13  9:37   ` Lawrence
  2003-11-13 11:00     ` zad
@ 2003-11-13 13:38     ` peter w krause
  1 sibling, 0 replies; 6+ messages in thread
From: peter w krause @ 2003-11-13 13:38 UTC (permalink / raw)
  To: Lawrence, linux-assembly

Lawrence am Thursday 13 November 2003 09:37:
> 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

> Does this imply one must write linux asm program in flat model?

yes.


regards,
		hp
-- 
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml
  >> hp -at- lxhp -dot- in-berlin -dot- de <<


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux system call for allocation of memory
  2003-11-13  8:14 linux system call for allocation of memory Lawrence
  2003-11-13 10:19 ` zad
@ 2003-11-13 20:34 ` Brian Raiter
  1 sibling, 0 replies; 6+ messages in thread
From: Brian Raiter @ 2003-11-13 20:34 UTC (permalink / raw)
  To: linux-assembly

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-11-13 20:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-13  8:14 linux system call for allocation of memory Lawrence
2003-11-13 10:19 ` zad
2003-11-13  9:37   ` Lawrence
2003-11-13 11:00     ` zad
2003-11-13 13:38     ` peter w krause
2003-11-13 20:34 ` Brian Raiter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).