10aa7ea4eSTue Ly //===---------------------- Darwin syscalls ---------------------*- C++ -*-===// 20aa7ea4eSTue Ly // 30aa7ea4eSTue Ly // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40aa7ea4eSTue Ly // See https://llvm.org/LICENSE.txt for license information. 50aa7ea4eSTue Ly // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60aa7ea4eSTue Ly // 70aa7ea4eSTue Ly //===----------------------------------------------------------------------===// 80aa7ea4eSTue Ly 9270547f3SGuillaume Chatelet #ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_SYSCALL_H 10270547f3SGuillaume Chatelet #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_SYSCALL_H 110aa7ea4eSTue Ly 12f0a3954eSMichael Jones #include "src/__support/CPP/bit.h" 130aa7ea4eSTue Ly #include "src/__support/common.h" 14*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 150aa7ea4eSTue Ly #include "src/__support/macros/properties/architectures.h" 160aa7ea4eSTue Ly 170aa7ea4eSTue Ly #ifdef LIBC_TARGET_ARCH_IS_ANY_ARM 180aa7ea4eSTue Ly #include "arm/syscall.h" 190aa7ea4eSTue Ly #else 200aa7ea4eSTue Ly #error "Unsupported architecture" 210aa7ea4eSTue Ly #endif 220aa7ea4eSTue Ly 23*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 240aa7ea4eSTue Ly 25f0a3954eSMichael Jones template <typename R, typename... Ts> 26f0a3954eSMichael Jones LIBC_INLINE R syscall_impl(long __number, Ts... ts) { 270aa7ea4eSTue Ly static_assert(sizeof...(Ts) <= 6, "Too many arguments for syscall"); 28f0a3954eSMichael Jones return cpp::bit_or_static_cast<R>(syscall_impl(__number, (long)ts...)); 290aa7ea4eSTue Ly } 300aa7ea4eSTue Ly 31*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 320aa7ea4eSTue Ly 33270547f3SGuillaume Chatelet #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_SYSCALL_H 34