tools/nolibc/sys: Implement `mmap()` and `munmap()`
authorAmmar Faizi <ammarfaizi2@gnuweeb.org>
Tue, 29 Mar 2022 10:17:33 +0000 (17:17 +0700)
committerPaul E. McKenney <paulmck@kernel.org>
Thu, 21 Apr 2022 00:05:46 +0000 (17:05 -0700)
commit544fa1a2d3e61c954ab531f2c790bc79c1745606
tree9d671e46bf8b28b32a61cc96d61a8d9b2c4ea330
parentf4738ff74c74241c2458269bb6afb64000ec1001
tools/nolibc/sys: Implement `mmap()` and `munmap()`

Implement mmap() and munmap(). Currently, they are only available for
architecures that have my_syscall6 macro. For architectures that don't
have, this function will return -1 with errno set to ENOSYS (Function
not implemented).

This has been tested on x86 and i386.

Notes for i386:
 1) The common mmap() syscall implementation uses __NR_mmap2 instead
    of __NR_mmap.

 2) The offset must be shifted-right by 12-bit.

Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/sys.h