I am on 64-bit Linux x86. I need to execute mmap syscall using the syscall function. mmap standby number: 9:
printf("mmap-1: %lli\n", syscall(9, 0, 10, 3, 2 | 32, -1, 0)); printf("mmap-2: %lli\n", mmap( 0, 10, 3, 2 | 32, -1, 0));
However, when I run it, the syscall function gives incorrect results.
mmap-1: 2236940288 mmap-2: 140503502090240 mmap-1: 3425849344 mmap-2: 140612065181696 mmap-1: 249544704 mmap-2: 139625341366272
mmap works just fine, but the "addresses" returned by syscall lead to a Segmentation fault . The values ββfrom syscall seem to be fine up to 32 bits or something else.
What am I doing wrong?
c system-calls mmap
Vad
source share