[PATCH v5 00/14] tools/nolibc: add a new syscall helper

Zhangjin Wu falcon at tinylab.org
Wed Jun 28 06:07:16 PDT 2023


Willy, Thomas

This is the revision of our 'tools/nolibc: add a new syscall helper'
series [1].

It mainly applies the core part of suggestions from Thomas (Many thanks)
and cleans up the multiple whitespaces issues reported by
scripts/checkpatch.pl.

Changes from v4 --> v5:

* tools/nolibc: sys.h: add a syscall return helper
  tools/nolibc: unistd.h: apply __sysret() helper
  tools/nolibc: sys.h: apply __sysret() helper
  tools/nolibc: unistd.h: reorder the syscall macros
  tools/nolibc: __sysret: support syscalls who return a pointer
  selftests/nolibc: add EXPECT_PTREQ, EXPECT_PTRNE and EXPECT_PTRER
  selftests/nolibc: add sbrk_0 to test current brk getting

    The same to original v4 series, no code change.

* tools/nolibc: string.h: clean up multiple whitespaces with tab
  tools/nolibc: arch-*.h: clean up multiple whitespaces
  tools/nolibc: arch-loongarch.h: shrink with SYSCALL_CLOBBERLIST
  tools/nolibc: arch-mips.h: shrink with SYSCALL_CLOBBERLIST

    Clean up the multiple whitespaces issues reported by
    scripts/checkpatch.pl, prepare for the coming mips my_syscall6()

    This cleanup is also required by another new arch shrink patchset.

    In v4, we didn't touch multiple whitespaces, because the
    changes are huge, but it is really important to do this
    before being always 'complained' by scripts/checkpatch.pl in the
    future.

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

    Use tab instead of multiple whitespaces, let scripts/checkpatch.pl
    happy, also apply SYSCALL_CLOBBERLIST

* tools/nolibc: clean up mmap() support

    Include <linux/mman.h> and remove more macros from nolibc side.

    The return type of sys_mmap() is reserved as before, not changed
    currently.
  
* selftests/nolibc: add mmap and munmap test cases

    Applies some suggestions from Thomas,

    - Rebase length and offset on page_size and file_size

    - make sure the last offset argument is not always zero to test
      my_syscall6()

    - easier the for loop with NULL check

    - use /proc/1/exe and /proc/self/exe for run, run-user and libc-test

      but still reserve the old init files to align our another attempt
      to remove the unnecessary dependency on procfs (this is important
      to let developers happy to do all-architectures-test, the
      accumulated time cost and wait is really appreciable, it is really
      a pain for me to do repeated all-architectures-test for the new
      'minimal' kernel config patchset [2], a v2 is ready for it).

Best regards,
Zhangjin
---
[1]: https://lore.kernel.org/lkml/cover.1687187451.git.falcon@tinylab.org/
[2]: https://lore.kernel.org/lkml/cover.1687706332.git.falcon@tinylab.org/

Zhangjin Wu (14):
  tools/nolibc: sys.h: add a syscall return helper
  tools/nolibc: unistd.h: apply __sysret() helper
  tools/nolibc: sys.h: apply __sysret() helper
  tools/nolibc: unistd.h: reorder the syscall macros
  tools/nolibc: string.h: clean up multiple whitespaces with tab
  tools/nolibc: arch-*.h: clean up multiple whitespaces
  tools/nolibc: arch-loongarch.h: shrink with SYSCALL_CLOBBERLIST
  tools/nolibc: arch-mips.h: shrink with SYSCALL_CLOBBERLIST
  tools/nolibc: add missing my_syscall6() for mips
  tools/nolibc: __sysret: support syscalls who return a pointer
  tools/nolibc: clean up mmap() support
  selftests/nolibc: add EXPECT_PTREQ, EXPECT_PTRNE and EXPECT_PTRER
  selftests/nolibc: add sbrk_0 to test current brk getting
  selftests/nolibc: add mmap and munmap test cases

 tools/include/nolibc/arch-aarch64.h          | 210 +++++-----
 tools/include/nolibc/arch-arm.h              | 240 ++++++------
 tools/include/nolibc/arch-i386.h             | 226 +++++------
 tools/include/nolibc/arch-loongarch.h        | 219 +++++------
 tools/include/nolibc/arch-mips.h             | 241 ++++++------
 tools/include/nolibc/arch-riscv.h            | 208 +++++-----
 tools/include/nolibc/arch-s390.h             | 202 +++++-----
 tools/include/nolibc/arch-x86_64.h           | 222 +++++------
 tools/include/nolibc/nolibc.h                |   9 +-
 tools/include/nolibc/string.h                |   8 +-
 tools/include/nolibc/sys.h                   | 391 +++----------------
 tools/include/nolibc/types.h                 |   6 +
 tools/include/nolibc/unistd.h                |  13 +-
 tools/testing/selftests/nolibc/nolibc-test.c | 115 ++++++
 14 files changed, 1083 insertions(+), 1227 deletions(-)

-- 
2.25.1




More information about the linux-riscv mailing list