X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/143464d58d2bd6378e74eec636961ceb0d32fb91..fe8ab488e9161c46dd9885d58fc52996dc0249ff:/bsd/sys/csr.h diff --git a/bsd/sys/csr.h b/bsd/sys/csr.h new file mode 100644 index 000000000..f418eef68 --- /dev/null +++ b/bsd/sys/csr.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +#ifndef _SYS_CSR_H_ +#define _SYS_CSR_H_ + +#include +#include +#include + +#ifdef __APPLE_API_PRIVATE + +typedef uint32_t csr_config_t; +typedef uint32_t csr_op_t; + +/* Rootless configuration flags */ +#define CSR_ALLOW_UNTRUSTED_KEXTS (1 << 0) +#define CSR_ALLOW_UNRESTRICTED_FS (1 << 1) +#define CSR_ALLOW_TASK_FOR_PID (1 << 2) +#define CSR_ALLOW_KERNEL_DEBUGGER (1 << 3) +#define CSR_ALLOW_APPLE_INTERNAL (1 << 4) +#define CSR_ALLOW_DESTRUCTIVE_DTRACE (1 << 5) /* name deprecated */ +#define CSR_ALLOW_UNRESTRICTED_DTRACE (1 << 5) +#define CSR_ALLOW_UNRESTRICTED_NVRAM (1 << 6) + +#define CSR_VALID_FLAGS (CSR_ALLOW_UNTRUSTED_KEXTS | \ + CSR_ALLOW_UNRESTRICTED_FS | \ + CSR_ALLOW_TASK_FOR_PID | \ + CSR_ALLOW_KERNEL_DEBUGGER | \ + CSR_ALLOW_APPLE_INTERNAL | \ + CSR_ALLOW_UNRESTRICTED_DTRACE | \ + CSR_ALLOW_UNRESTRICTED_NVRAM) + +#ifdef PRIVATE +/* Private system call interface between Libsyscall and xnu */ + +/* Syscall flavors */ +#define CSR_OP_CHECK 0 +#define CSR_OP_GET_ACTIVE_CONFIG 1 +#define CSR_OP_GET_PENDING_CONFIG 2 + +#endif /* PRIVATE */ + +__BEGIN_DECLS + +#ifdef XNU_KERNEL_PRIVATE +void csr_init(void); +#endif + +#if KERNEL_PRIVATE +void csr_set_allow_all(int value); +#endif + +/* Syscalls */ +int csr_check(csr_config_t mask); +int csr_get_active_config(csr_config_t *config); +int csr_get_pending_config(csr_config_t *config); + +__END_DECLS + +#endif /* __APPLE_API_PRIVATE */ + +#endif /* _SYS_CSR_H_ */