Add implementations of POSIX mmap and munmap functions.
authorSiva Chandra Reddy <sivachandra@google.com>
Thu, 5 Dec 2019 07:17:14 +0000 (23:17 -0800)
committerSiva Chandra Reddy <sivachandra@google.com>
Mon, 23 Dec 2019 22:04:02 +0000 (14:04 -0800)
commite5a743c4f6e3639ba3bee778c894a996ef96391a
tree3e0d71a35f51bef145cb95f010707a6d2a4ac58e
parent187f66bcac668dd2ea25244ed7d7711551275f9d
Add implementations of POSIX mmap and munmap functions.

Summary:
A set of of linux x86_64 internal syscall helpers have also been added.

This change does not try to be perfect with respect to OS and machine
abstractions. A TODO note has been added at places where such abstractions
would help and make the arrangement scalable and cleaner. Addressing the
TODOs and building such abstractions is not in the scope of this change.
It is hoped that follow up changes cleaning up the problem areas and
addressing the TODOs will better illustrate the need for the changes.

This change also does not try to imitate mmap and munmap implementations
of other libcs. The idea here is to put in the bare minimum required to
obtain a working mmap and munmap, and then add the rest of the
functionality on an as needed basis.

Reviewers: abrachet, phosek, stanshebs, theraven

Subscribers: mgorny, MaskRay, jfb, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D71634
31 files changed:
libc/CMakeLists.txt
libc/cmake/modules/LLVMLibCRules.cmake
libc/config/CMakeLists.txt [new file with mode: 0644]
libc/config/linux/CMakeLists.txt [new file with mode: 0644]
libc/config/linux/api.td
libc/config/linux/platfrom_defs.h.inc [moved from libc/src/__support/linux/entrypoint_macro.h.inc with 54% similarity]
libc/config/linux/syscall_numbers.h.inc [new file with mode: 0644]
libc/config/linux/x86_64/CMakeLists.txt [new file with mode: 0644]
libc/config/linux/x86_64/syscall.h.inc [new file with mode: 0644]
libc/config/linux/x86_64/syscall_test.cpp [new file with mode: 0644]
libc/include/CMakeLists.txt
libc/include/__posix-types.h [new file with mode: 0644]
libc/include/sys/mman.h.def [new file with mode: 0644]
libc/include/sys/syscall.h.def [new file with mode: 0644]
libc/lib/CMakeLists.txt
libc/spec/linux.td
libc/spec/posix.td
libc/spec/spec.td
libc/spec/stdc.td
libc/src/CMakeLists.txt
libc/src/__support/CMakeLists.txt
libc/src/__support/common.h.def
libc/src/sys/CMakeLists.txt [new file with mode: 0644]
libc/src/sys/mman/CMakeLists.txt [new file with mode: 0644]
libc/src/sys/mman/mmap.cpp [new file with mode: 0644]
libc/src/sys/mman/mmap.h [new file with mode: 0644]
libc/src/sys/mman/mmap_test.cpp [new file with mode: 0644]
libc/src/sys/mman/munmap.cpp [new file with mode: 0644]
libc/src/sys/mman/munmap.h [new file with mode: 0644]
libc/src/unistd/CMakeLists.txt [new file with mode: 0644]
libc/src/unistd/syscall.h.def [new file with mode: 0644]