]> code.delx.au - refind/blob - refind/apple.h
17ed15506f0f7057af8406a90e3d7440af4f7ad1
[refind] / refind / apple.h
1 /*
2 * refind/apple.h
3 *
4 * Copyright (c) 2015 Roderick W. Smith
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef __APPLE_H_
22 #define __APPLE_H_
23
24 // The constants related to Apple's System Integrity Protection (SIP)....
25 #define CSR_GUID { 0x7c436110, 0xab2a, 0x4bbb, { 0xa8, 0x80, 0xfe, 0x41, 0x99, 0x5c, 0x9f, 0x82 } };
26 // These codes are returned in the first byte of the csr-active-config variable
27 #define CSR_ALLOW_UNTRUSTED_KEXTS 0x01
28 #define CSR_ALLOW_UNRESTRICTED_FS 0x02
29 #define CSR_ALLOW_TASK_FOR_PID 0x04
30 #define CSR_ALLOW_KERNEL_DEBUGGER 0x08
31 #define CSR_ALLOW_APPLE_INTERNAL 0x10
32 #define CSR_ALLOW_UNRESTRICTED_DTRACE 0x20
33 #define CSR_ALLOW_UNRESTRICTED_NVRAM 0x40
34 #define CSR_END_OF_LIST 0xFFFFFFFF
35 // Some summaries....
36 #define SIP_ENABLED CSR_ALLOW_APPLE_INTERNAL
37 #define SIP_DISABLED (CSR_ALLOW_UNRESTRICTED_NVRAM | \
38 CSR_ALLOW_UNRESTRICTED_DTRACE | \
39 CSR_ALLOW_APPLE_INTERNAL | \
40 CSR_ALLOW_TASK_FOR_PID | \
41 CSR_ALLOW_UNRESTRICTED_FS | \
42 CSR_ALLOW_UNTRUSTED_KEXTS)
43 #define CSR_MAX_LEGAL_VALUE (CSR_ALLOW_UNTRUSTED_KEXTS | \
44 CSR_ALLOW_UNRESTRICTED_FS | \
45 CSR_ALLOW_TASK_FOR_PID | \
46 CSR_ALLOW_KERNEL_DEBUGGER | \
47 CSR_ALLOW_APPLE_INTERNAL | \
48 CSR_ALLOW_UNRESTRICTED_DTRACE | \
49 CSR_ALLOW_UNRESTRICTED_NVRAM)
50
51 extern CHAR16 *gCsrStatus;
52
53 EFI_STATUS GetCsrStatus(UINT32 *CsrValue);
54 VOID RecordgCsrStatus(UINT32 CsrStatus, BOOLEAN DisplayMessage);
55 VOID RotateCsrValue(VOID);
56 EFI_STATUS SetAppleOSInfo();
57
58 #endif