Hello.
I am porting my program which is initially written in assembly for
Linux/Intel to Solaris

I use my own routines to allocate/free memory, using the possibility
of anonymously mmap in Linux.

For that I declare mmap_ structure
.section .data
.comm mmap_, 24

Fill it with necessary parameters
.section .text
movl $0, mmap_
#movl $65535, mmap_+4  # length of requested memory
movl $3, mmap_+8      # read, write, PROT_WRITE | PROT_READ, 0x02,
0x01
movl $34, mmap_+12  # map anonymously (0x20), map_private (0x2)
movl $-1, mmap_+16   # fd, -1 for portability
movl $0, mmap_+20    # offset is ignored

And when it is necessary to request memory I do

.section .text
movl $SIZEOFREQUESTEDMEMORY, mmap_+4
movl $90, %eax        # mmap sys call
leal mmap_, %ebx
int $0x80

And since that pointer to the new memory is in %eax
movl %eax, pointer

To free memory, I do simply

movl $91, %eax # number of syscall
movl pointer, %ebx
movl $SIZEOFREQUESTEDMEMORY, %ecx
int $0x80

This is free()

And now I'd like to do the same in OpenSolaris
I know, that I must push parameters to the stack, instead of writing
in registers.
But I do not exactly know where to search for syscall numbers and description, 
and do I need to do an extra pushl $0 as in FreeBSD for example.

If anyone can provide an example of calling mmap/munmap kernel call in assembly 
that would be nice.
I also want to do a 64bit port of my appliation, and again, in Linux everything 
clear, and if someone mention how to do it in 64bit as well it would be perfect.

It is not a student assignment, I have been graduated more than 15 years ago.

Thank you

P. S. Any link to Solaris assembly programming documentation would be very 
useful.
--
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to