Seventh argument seen in mmap on i386
Konstantin Belousov
kostikbel at gmail.com
Tue May 23 14:06:11 UTC 2017
On Tue, May 23, 2017 at 07:25:07PM +0530, karnajit wangkhem wrote:
> 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.
off_t is 64bit. It is not seventh arg, it is offset which takes two words.
More information about the freebsd-hackers
mailing list