Commit ec62bf2f authored by Siva Chandra Reddy's avatar Siva Chandra Reddy
Browse files

[libc] Move the implementation of mmap and munmap into a linux specific area.

This allows us to get rid of the PAGE_SIZE macro and use EXEC_PAGESIZE
from linux/param.h.

Few other points about this change:
1. The linux syscall functions have been moved into a linux specific area
instead of src/unistd/syscall.h. The Linux syscall function from unistd.h
is a public vararg function. What we have currently are linux speciif internal
overloaded C++ functions. So, moving them to a Linux only area is more
meaningful.
2. The implementations of mmap and munmap are now in a 'linux' directory
within src/sys/mman. The idea here is that platform specific
implementations will live in a platform specific subdirectories like these.
Infrastructure common to a platform will live in the platform's config
directory. For example, the linux syscall implementations live in
config/linux.

Reviewers: abrachet

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D73302
parent 96f3ea0d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
add_gen_header(
  linux_syscall_h
  DEF_FILE syscall.h.def
  GEN_HDR syscall.h
  PARAMS
    inline_syscalls=${LIBC_TARGET_MACHINE}/syscall.h.inc
  DATA_FILES
    ${LIBC_TARGET_MACHINE}/syscall.h.inc
)

add_subdirectory(x86_64)
+0 −6
Original line number Diff line number Diff line
@@ -11,9 +11,3 @@
#define ENTRYPOINT_SECTION_ATTRIBUTE(name) \
    __attribute__((section(".llvm.libc.entrypoint."#name)))
#define LLVM_LIBC_ENTRYPOINT(name) ENTRYPOINT_SECTION_ATTRIBUTE(name) name

// TODO: Get rid of the PAGE_SIZE macro. It is present only as an interim
// measure until we can move the implementations of mmap and munmap to under
// the config/linux directory. After that, the implementations can use
// EXEC_PAGESIZE until page size can be read from the aux vector. 
#define PAGE_SIZE 4096
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ add_gen_header(
  GEN_HDR sys/mman.h
  DEPENDS
    libc_posix_types_h
    llvm_libc_common_h
)

add_gen_header(
+0 −1
Original line number Diff line number Diff line
@@ -3,6 +3,5 @@ add_subdirectory(math)
add_subdirectory(string)
# TODO: Add this target conditional to the target OS.
add_subdirectory(sys)
add_subdirectory(unistd)

add_subdirectory(__support)
Loading