Skip to content

Commit abd3830

Browse files
author
Darwin
committed
1 parent ef20ac2 commit abd3830

File tree

3,034 files changed

+563139
-432826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,034 files changed

+563139
-432826
lines changed

.clang-format

Lines changed: 0 additions & 122 deletions
This file was deleted.

.gitignore

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ compile_commands.json
2525
# /libkern/kmod/libkmod.xcodeproj/
2626
/libkern/kmod/libkmod.xcodeproj/xcuserdata
2727

28+
# /libkdd/kdd.xcodeproj/
29+
/libkdd/kdd.xcodeproj/xcuserdata
30+
2831
# /libsyscall/Libsyscall.xcodeproj/
2932
/libsyscall/Libsyscall.xcodeproj/xcuserdata
3033
/libsyscall/Libsyscall.xcodeproj/project.xcworkspace
@@ -44,16 +47,25 @@ compile_commands.json
4447
# /tools/tests/testkext/testkext.xcodeproj/
4548
/tools/tests/testkext/testkext.xcodeproj/xcuserdata
4649

50+
#/tools/tests/unit_tests/cpu_monitor_tests_11646922_src/CatchRN/CatchRN.xcodeproj/
51+
/tools/tests/unit_tests/cpu_monitor_tests_11646922_src/CatchRN/CatchRN.xcodeproj/xcuserdata
52+
4753
# /tools/tests/unit_tests/cpu_monitor_tests_11646922_src/cpu_hog/cpu_hog.xcodeproj/
4854
/tools/tests/unit_tests/cpu_monitor_tests_11646922_src/cpu_hog/cpu_hog.xcodeproj/xcuserdata
4955

56+
# /tools/tests/unit_tests/mach_test_15789220_src/mach_test.xcodeproj/
57+
/tools/tests/unit_tests/mach_test_15789220_src/mach_test.xcodeproj/xcuserdata
58+
5059
# /tools/tests/unit_tests/monitor_stress_12901965_src/monitor_stress.xcodeproj/
5160
/tools/tests/unit_tests/monitor_stress_12901965_src/monitor_stress.xcodeproj/xcuserdata
5261

5362
# /tools/tests/unit_tests/monitor_stress_12901965_src/monitor_stress.xcodeproj/project.xcworkspace/
5463
/tools/tests/unit_tests/monitor_stress_12901965_src/monitor_stress.xcodeproj/project.xcworkspace/xcuserdata
5564

65+
#/tools/tests/unit_tests/test_14395574/test_14395574.xcodeproj/
66+
/tools/tests/unit_tests/test_14395574/test_14395574.xcodeproj/xcuserdata
67+
5668
# /tools/tests/zero-to-n
5769
/tools/tests/zero-to-n/zn*
58-
BUILD.hdrs
59-
BUILD
70+
71+
# do not add *.orig, *.rej, use `git clean` instead

EXTERNAL_HEADERS/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ include $(MakeInc_def)
88

99
INSTINC_SUBDIRS = \
1010
architecture \
11-
mach-o
11+
mach-o \
12+
sys
1213

1314
INSTINC_SUBDIRS_X86_64 = \
1415
architecture
@@ -32,9 +33,7 @@ KERNEL_FILES = \
3233
stdatomic.h \
3334
stdbool.h \
3435
stddef.h \
35-
stdint.h
36-
37-
KERNEL_FILES += \
36+
stdint.h \
3837
ptrauth.h
3938

4039
INSTALL_MI_LIST =

EXTERNAL_HEADERS/architecture/i386/desc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
2+
* Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved.
33
*
44
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55
*
@@ -50,7 +50,8 @@ typedef struct code_desc {
5050
dpl :2,
5151
present :1;
5252
unsigned char limit16 :4,
53-
:2,
53+
:1,
54+
Lflag :1,
5455
opsz :1,
5556
#define DESC_CODE_16B 0
5657
#define DESC_CODE_32B 1

EXTERNAL_HEADERS/corecrypto/cc.h

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,41 @@
1616
#include <string.h>
1717
#include <stdint.h>
1818

19+
#if __has_feature(attribute_availability_with_replacement)
20+
#if __has_feature(attribute_availability_bridgeos)
21+
#ifndef __CC_BRIDGE_OS_DEPRECATED
22+
#define __CC_BRIDGEOS_DEPRECATED(_dep, _msg) __attribute__((availability(bridgeos,deprecated=_dep, replacement=_msg)))
23+
#endif
24+
#endif
25+
26+
#ifndef __CC_BRIDGEOS_DEPRECATED
27+
#define __CC_BRIDGEOS_DEPRECATED(_dep, _msg)
28+
#endif
29+
30+
#define cc_deprecate_with_replacement(replacement_message, ios_version, macos_version, tvos_version, watchos_version, bridgeos_version) \
31+
__attribute__((availability(macos,deprecated=macos_version, replacement=replacement_message)))\
32+
__attribute__((availability(ios,deprecated=ios_version, replacement=replacement_message)))\
33+
__attribute__((availability(watchos,deprecated=watchos_version, replacement=replacement_message)))\
34+
__attribute__((availability(tvos,deprecated=tvos_version, replacement=replacement_message)))\
35+
__CC_BRIDGEOS_DEPRECATED(bridgeos_version, replacement_message)
36+
37+
#else /* !__has_feature(attribute_availability_with_replacement) */
38+
39+
#define cc_deprecate_with_replacement(replacement_message, ios_version, macos_version, tvos_version, watchos_version, bridgeos_version)
40+
41+
#endif /* __has_feature(attribute_availability_with_replacement) */
42+
1943
/* Provide a general purpose macro concat method. */
2044
#define cc_concat_(a, b) a##b
2145
#define cc_concat(a, b) cc_concat_(a, b)
2246

2347
/* Manage asserts here because a few functions in header public files do use asserts */
48+
#if CORECRYPTO_DEBUG
2449
#define cc_assert(x) assert(x)
50+
#else
51+
#define cc_assert(x)
52+
#endif
53+
2554
#if CC_KERNEL
2655
#include <kern/assert.h>
2756
#elif CC_USE_S3
@@ -32,7 +61,7 @@
3261

3362
/* Provide a static assert that can be used to create compile-type failures. */
3463
#define cc_static_assert(e,m) \
35-
;enum { cc_concat(static_assert_, __COUNTER__) = 1/(int)(!!(e)) }
64+
enum { cc_concat(static_assert_, __COUNTER__) = 1/(int)(!!(e)) }
3665

3766
/* Declare a struct element with a guarenteed alignment of _alignment_.
3867
The resulting struct can be used to create arrays that are aligned by
@@ -42,6 +71,15 @@ typedef struct { \
4271
uint8_t b[_alignment_]; \
4372
} CC_ALIGNED(_alignment_)
4473

74+
#if defined(__BIGGEST_ALIGNMENT__)
75+
#define CC_MAX_ALIGNMENT __BIGGEST_ALIGNMENT__
76+
#else
77+
#define CC_MAX_ALIGNMENT 16
78+
#endif
79+
80+
/* pads a given size to be a multiple of the biggest alignment for any type */
81+
#define cc_pad_align(_size_) ((_size_ + CC_MAX_ALIGNMENT - 1) & (~(CC_MAX_ALIGNMENT - 1)))
82+
4583
/* number of array elements used in a cc_ctx_decl */
4684
#define cc_ctx_n(_type_, _size_) ((_size_ + sizeof(_type_) - 1) / sizeof(_type_))
4785

@@ -55,14 +93,14 @@ uint8_t b[_alignment_]; \
5593
3. Never use sizeof() operator for the variables declared with cc_ctx_decl(), because it is not be compatible with the _MSC_VER version of cc_ctx_decl().
5694
*/
5795
#if defined(_MSC_VER)
96+
#include <malloc.h>
5897
#define cc_ctx_decl(_type_, _size_, _name_) _type_ * _name_ = (_type_ *) _alloca(sizeof(_type_) * cc_ctx_n(_type_, _size_) )
5998
#else
6099
#define cc_ctx_decl(_type_, _size_, _name_) _type_ _name_ [cc_ctx_n(_type_, _size_)]
61100
#endif
62101

63-
/* bzero is deprecated. memset is the way to go */
64-
/* FWIW, L4, HEXAGON and ARMCC even with gnu compatibility mode don't have bzero */
65-
#define cc_zero(_size_,_data_) memset((_data_),0 ,(_size_))
102+
// cc_zero is deprecated, please use cc_clear instead.
103+
#define cc_zero(_size_,_data_) _Pragma ("corecrypto deprecation warning \"'cc_zero' macro is deprecated. Use 'cc_clear' instead.\"") cc_clear(_size_,_data_)
66104

67105
/*!
68106
@brief cc_clear(len, dst) zeroizes array dst and it will not be optimized out.
@@ -99,12 +137,16 @@ int cc_cmp_safe (size_t num, const void * ptr1, const void * ptr2);
99137
/* Exchange S and T of any type. NOTE: Both and S and T are evaluated
100138
mutliple times and MUST NOT be expressions. */
101139
#define CC_SWAP(S,T) do { \
102-
__typeof__(S) _cc_swap_tmp = S; S = T; T = _cc_swap_tmp; \
140+
volatile __typeof__(S) _cc_swap_tmp = S; S = T; T = _cc_swap_tmp; \
141+
_cc_swap_tmp = 0;\
103142
} while(0)
104143

105144
/* Return the maximum value between S and T. */
106145
#define CC_MAX(S, T) ({__typeof__(S) _cc_max_s = S; __typeof__(T) _cc_max_t = T; _cc_max_s > _cc_max_t ? _cc_max_s : _cc_max_t;})
107146

147+
/* Clone of CC_MAX() that evalutes S and T multiple times to allow nesting. */
148+
#define CC_MAX_EVAL(S, T) ((S) > (T) ? (S) : (T))
149+
108150
/* Return the minimum value between S and T. */
109151
#define CC_MIN(S, T) ({__typeof__(S) _cc_min_s = S; __typeof__(T) _cc_min_t = T; _cc_min_s <= _cc_min_t ? _cc_min_s : _cc_min_t;})
110152

0 commit comments

Comments
 (0)