Skip to content

tools/nolibc: add a new syscall helper

Zhangjin Wu linux-kselftest linux-riscv lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest15 patches 7 repliesIn review
  2. v514 patches 21 repliesSuperseded
  3. v410 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v33 patches2 repliesSuperseded

Changes in v6 from the cover letter

* tools/nolibc: arch-*.h: fix up code indent errors toolc/nolibc: arch-*.h: clean up whitespaces after __asm__

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15tools/nolibc: arch-*.h: fix up code indent errorstools/include/nolibc/arch-aarch64.h tools/include/nolibc/arch-arm.h tools/include/nolibc/arch-i386.h +2 more+39 -391 reply
2/15toolc/nolibc: arch-*.h: clean up whitespaces after __asm__tools/include/nolibc/arch-aarch64.h tools/include/nolibc/arch-arm.h tools/include/nolibc/arch-i386.h +5 more+54 -540 replies
3/15tools/nolibc: arch-loongarch.h: shrink with _NOLIBC_SYSCALL_CLOBBERLISTtools/include/nolibc/arch-loongarch.h+9 -140 replies
4/15tools/nolibc: arch-mips.h: shrink with _NOLIBC_SYSCALL_CLOBBERLISTtools/include/nolibc/arch-mips.h+10 -120 replies
5/15tools/nolibc: add missing my_syscall6() for mipstools/include/nolibc/arch-mips.h tools/include/nolibc/nolibc.h+30 -60 replies
6/15tools/nolibc: __sysret: support syscalls who return a pointertools/include/nolibc/sys.h+12 -53 replies
7/15tools/nolibc: clean up mmap() routinetools/include/nolibc/sys.h tools/include/nolibc/types.h+12 -230 replies
8/15tools/nolibc: clean up sbrk() routinetools/include/nolibc/sys.h+4 -50 replies
9/15selftests/nolibc: export argv0 for some teststools/testing/selftests/nolibc/nolibc-test.c+4 -00 replies
10/15selftests/nolibc: prepare: create /dev/zerotools/testing/selftests/nolibc/nolibc-test.c+3 -10 replies
11/15selftests/nolibc: add EXPECT_PTREQ, EXPECT_PTRNE and EXPECT_PTRERtools/testing/selftests/nolibc/nolibc-test.c+58 -00 replies
12/15selftests/nolibc: add sbrk_0 to test current brk gettingtools/testing/selftests/nolibc/nolibc-test.c+1 -00 replies
13/15selftests/nolibc: add mmap_bad test casetools/testing/selftests/nolibc/nolibc-test.c+1 -03 replies
14/15selftests/nolibc: add munmap_bad test casetools/testing/selftests/nolibc/nolibc-test.c+1 -00 replies
15/15selftests/nolibc: add mmap_munmap_good test casetools/testing/selftests/nolibc/nolibc-test.c+60 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 00/15] tools/nolibc: add a new syscall helper

Hi, Willy

Here is the v6 of the __sysret series [1], applies your suggestions. additionally, the sbrk() also uses the __sysret helper.

These patches are tested (together with the coming v4 selftests/nolibc patches) for all of the supported architectures:

           arch/board | result
          ------------|------------
      arm/vexpress-a9 | 142 test(s) passed, 1 skipped, 0 failed.
             arm/virt | 142 test(s) passed, 1 skipped, 0 failed.
         aarch64/virt | 142 test(s) passed, 1 skipped, 0 failed.
          ppc/g3beige | not supported
          ppc/ppce500 | not supported
              i386/pc | 142 test(s) passed, 1 skipped, 0 failed.
            x86_64/pc | 142 test(s) passed, 1 skipped, 0 failed.
         mipsel/malta | 142 test(s) passed, 1 skipped, 0 failed.
     loongarch64/virt | 142 test(s) passed, 1 skipped, 0 failed.
         riscv64/virt | 142 test(s) passed, 1 skipped, 0 failed.
         riscv32/virt | 0 test(s) passed, 0 skipped, 0 failed.
s390x/s390-ccw-virtio | 142 test(s) passed, 1 skipped, 0 failed.

Changes from v5 --> v6:

* tools/nolibc: arch-*.h: fix up code indent errors toolc/nolibc: arch-*.h: clean up whitespaces after __asm__

Fix up the code indent errors and whitespaces between __asm__ and volatile.

The post-whitespaces are reserved as before.

* tools/nolibc: arch-loongarch.h: shrink with _NOLIBC_SYSCALL_CLOBBERLIST tools/nolibc: arch-mips.h: shrink with _NOLIBC_SYSCALL_CLOBBERLIST

Add _NOLIBC_ prefix for SYSCALL_CLOBBERLIST.

* tools/nolibc: add missing my_syscall6() for mips

Use post-whitespaces instead of post-tab.

The above 4 patches are preparation for this one.

* tools/nolibc: __sysret: support syscalls who return a pointer

Add comments about the new errno range [-MAX_ERRNOR, -1], add ref to the musl and glibc.

* tools/nolibc: clean up mmap() routine

Comment the MAP_FAILED return info.

* tools/nolibc: clean up sbrk() routine

New patch, applies __sysret() helper too and also fixes up an error reported by scripts/checkpatch.pl.

* selftests/nolibc: export argv0 for some tests
selftests/nolibc: prepare: create /dev/zero

Prepare /dev/zero and argv0 for mmap test cases.

* selftests/nolibc: add EXPECT_PTREQ, EXPECT_PTRNE and EXPECT_PTRER selftests/nolibc: add sbrk_0 to test current brk getting

No change.

* selftests/nolibc: add mmap_bad test case selftests/nolibc: add munmap_bad test case selftests/nolibc: add mmap_munmap_good test case

Split the first two out to standalone patches.

Add /dev/zero and argv0 to the file list and assigns a file_size manually for /dev/zero.

Best regards,
Zhangjin
---
[1]: https://lore.kernel.org/lkml/[email protected]/

Zhangjin Wu (15):
tools/nolibc: arch-*.h: fix up code indent errors toolc/nolibc: arch-*.h: clean up whitespaces after __asm__ tools/nolibc: arch-loongarch.h: shrink with _NOLIBC_SYSCALL_CLOBBERLIST tools/nolibc: arch-mips.h: shrink with _NOLIBC_SYSCALL_CLOBBERLIST tools/nolibc: add missing my_syscall6() for mips tools/nolibc: __sysret: support syscalls who return a pointer tools/nolibc: clean up mmap() routine
tools/nolibc: clean up sbrk() routine
selftests/nolibc: export argv0 for some tests selftests/nolibc: prepare: create /dev/zero selftests/nolibc: add EXPECT_PTREQ, EXPECT_PTRNE and EXPECT_PTRER selftests/nolibc: add sbrk_0 to test current brk getting selftests/nolibc: add mmap_bad test case
selftests/nolibc: add munmap_bad test case selftests/nolibc: add mmap_munmap_good test case

 tools/include/nolibc/arch-aarch64.h          |  28 ++--
 tools/include/nolibc/arch-arm.h              |  28 ++--
 tools/include/nolibc/arch-i386.h             |  24 ++--
 tools/include/nolibc/arch-loongarch.h        |  37 +++---
 tools/include/nolibc/arch-mips.h             |  73 +++++++----
 tools/include/nolibc/arch-riscv.h            |  14 +-
 tools/include/nolibc/arch-s390.h             |  14 +-
 tools/include/nolibc/arch-x86_64.h           |  28 ++--
 tools/include/nolibc/nolibc.h                |   9 +-
 tools/include/nolibc/sys.h                   |  55 ++++----
 tools/include/nolibc/types.h                 |   6 +
 tools/testing/selftests/nolibc/nolibc-test.c | 129 ++++++++++++++++++-
 12 files changed, 292 insertions(+), 153 deletions(-)

--
2.25.1