syscall.Syscall6 on 386 Linux

553 views
Skip to first unread message

Evan Shaw

unread,
Apr 1, 2011, 8:27:09 PM4/1/11
to golang-nuts
I've been debugging a problem with some of my code that boiled down to
the fact that syscall.Syscall6 only passes 5 arguments on 386 Linux.
There's a comment in the code that notes this, so it's intentional.
From what I can tell, the 6th argument should be passed in the ebp
register. Why is the function written this way?

- Evan

Russ Cox

unread,
Apr 1, 2011, 8:33:16 PM4/1/11
to Evan Shaw, golang-nuts

The fact that Linux/386 supports 6-argument system calls is news to me.
Feel free to send a CL.

Russ

Ian Lance Taylor

unread,
Apr 1, 2011, 8:38:46 PM4/1/11
to Evan Shaw, golang-nuts
Evan Shaw <chick...@gmail.com> writes:

It seems like a bug to me.

That said, what syscall are you trying to call? The only ones I see
that can take 6 parameters are mmap2 (aka map_pgoff) and move_pages,
neither of which are in the current syscall package. I can't think of
any reason for Go code to call mmap2. And move_pages is an awfully
obscure syscall.

Ian

Evan Shaw

unread,
Apr 1, 2011, 8:42:23 PM4/1/11
to Ian Lance Taylor, golang-nuts
On Sat, Apr 2, 2011 at 1:38 PM, Ian Lance Taylor <ia...@google.com> wrote:
> That said, what syscall are you trying to call?  The only ones I see
> that can take 6 parameters are mmap2 (aka map_pgoff) and move_pages,
> neither of which are in the current syscall package.  I can't think of
> any reason for Go code to call mmap2.  And move_pages is an awfully
> obscure syscall.

I'm calling mmap2 because I want to map a file into memory.

Interestingly, runtime.mmap knows how to pass the 6th argument. CL forthcoming.

- Evan

Reply all
Reply to author
Forward
0 new messages