I want to create an array that will contains for example 4 values Here's my code:
mov $32,%rsi # 4 x 8bytes
mov $9,%rax
mov $0,%rdi
mov $0x3,%rdx
mov $0x01,%r10
mov $0,%r9
syscall
Now I am having a new adress of alocated 32 bytes in rax?
When I am trying to put something into it , for example:
mov $0,%r14
mov $3,%rdx
mov %rdx,(%rax,%r14,8)
It gives me SIGSEGV error
raxafter the syscall? Is itMAP_FAILED(0xFFFFFFFFFFFFFFFF)? Also, for a system call the system call # goes inraxand the arguments go in order into the registersrdi rsi rdx r10 r8 r9. Forvoid *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);this means addr->rdi, length->rsi, prot->rdx, flags->r10, fd->r8 and offset->r9. Why are you not setting r8?mov $-1,%r8and set r10 to 3 (map_anonymous) now I have received rax0xffffffffffffffff(map_failed)MAP_PRIVATEflag and OR into itMAP_ANONYMOUS. The rule is that exactly one of eitherMAP_PRIVATEorMAP_SHARED, but not both, must be specified, and in addition zero or more other flags, includingMAP_ANONYMOUS.mov $1,%r10asMAP_PRIVATE, the rax after syscal is now0xffffffffffffffed, but still when I want to do an operation on thismov %rdx,(%rax,%r14,8)it gives me SIGSEGV errorMAP_PRIVATEis 0x1 andMAP_ANONYMOUSis 0x3, after OR operation on 01 and 11 I got 11 which is the same as 0x3. I've tried putting 1,2,3,4,5,6,7 number in r10 always ending with SIGSEGV error.