Hi,
I tried to use mmap to allocate dynamic memory on a 64 bit linux system.
mmap has 6 parameters:
void *mmap(void *addr, size_t length, int prot,
int flags, int fd, off_t pgoffset);
According to the AMD64 ABI the 4th parameter is passed in rcx. mmap always failed and I finally figured out using strace that the 4th parameter is not get from rcx but from r10. All the other parameters were passed as described in the amd64 ABI (1th rdi, 2nd rsi ...).
Using the r10 as the 4th parameter solved the earlier problems and mmap worked as expected.
Do you know if this is a bug in the linux syscall (and e.g. kept for binary compatibility) or I missed something and this is the right behaviour of mmap?
Thanks,
Csaba