Date: Tue, 23 May 2017 19:25:07 +0530 From: karnajit wangkhem <karnajitw@gmail.com> To: freebsd-hackers@freebsd.org Subject: Seventh argument seen in mmap on i386 Message-ID: <CAB6rxaStKLXKFrQ2Lqa4gLDNM9CJeMXxDur6uTQC=_TGwZ_K_g@mail.gmail.com>
index | next in thread | raw e-mail
Hi All,
I am trying to understand this scenario where a seventh argument is seen in
case of freebsd.x-i386. As per the mmap man page, the libc function
prototype takes in 6 arguments.
Ktrace shows the following
// Freebsd-11.0 – i386 box
44416 a.out CALL
mmap(0,0x1000,0x7<PROT_READ|PROT_WRITE|PROT_EXEC>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0,0)
44416 a.out RET mmap 671535104/0x2806d000
// Freebsd-11.0 – amd64 box
366 a.out CALL
mmap(0,0x1000,0x7<PROT_READ|PROT_WRITE|PROT_EXEC>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
366 a.out RET mmap 34366287872/0x80063f000
Also, the disassemble code show that an extra argument was pushed in i386
case
<SNIP>
-> 0x80485e6 <+38>: movl %esp, %ebx
0x80485e8 <+40>: movl $0x0, 0x18(%ebx)
0x80485ef <+47>: movl $0x0, 0x14(%ebx)
0x80485f6 <+54>: movl $0xffffffff, 0x10(%ebx) ; imm = 0xFFFFFFFF
0x80485fd <+61>: movl $0x1002, 0xc(%ebx) ; imm = 0x1002
0x8048604 <+68>: movl $0x7, 0x8(%ebx)
0x804860b <+75>: movl $0x1000, 0x4(%ebx) ; imm = 0x1000
0x8048612 <+82>: movl $0x0, (%ebx)
<SNIP>
Please help me understand why this extra argument is seen in case of i386.
Regards,
Karan
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB6rxaStKLXKFrQ2Lqa4gLDNM9CJeMXxDur6uTQC=_TGwZ_K_g>
