Re: [PATCH v5 09/14] tools/nolibc: add missing my_syscall6() for mips

From: Zhangjin Wu
Date: Mon Jul 03 2023 - 06:14:14 EST


Hi, Willy

> Hi Zhangjin,
>
> On Wed, Jun 28, 2023 at 09:37:29PM +0800, Zhangjin Wu wrote:
> > It is able to pass the 6th argument like the 5th argument via the stack
> > for mips, let's add a new my_syscall6() now, see [1] for details:
> >
> > The mips/o32 system call convention passes arguments 5 through 8 on
> > the user stack.
> >
> > Both mmap() and pselect6() require my_syscall6().
>
> Very interesting, I didn't manage to make it work previously. Did you
> test it to confirm that it works ? I guess so but since you didn't
> mention, I preferred to ask.
>

Yes, I'm curious too ;-)

we did add the mmap test cases and run it for mips, as Thomas
suggested, we pass a none-zero pa_offset to mmap() to make sure the 6th
argument is used.

I just re-tested it for mips and printed something like this:

44 mmap_bad = <0xffffffff> EINVAL [OK]
45 munmap_bad = -1 EINVAL [OK]
46 mmap_munmap_good
pa_offset: 8192
length: 1
file_size: 12287
= 0 [OK]
47 open_tty = 3 [OK]
48 open_blah = -1 ENOENT [OK]

And I also checked the mips support of musl, it evan provide a
__syscall7, so, it should be ok ;-)

The only difference is, musl provide a different clobber list for
'__mips_isa_rev >= 6', I didn't look into the details yet:
https://elixir.bootlin.com/musl/latest/source/arch/mips/syscall_arch.h

Best regards,
Zhangjin

> Thanks!
> Willy