1 | #include "hwasan_thread_list.h" |
---|---|
2 | |
3 | #include "sanitizer_common/sanitizer_placement_new.h" |
4 | #include "sanitizer_common/sanitizer_thread_arg_retval.h" |
5 | |
6 | namespace __hwasan { |
7 | |
8 | static HwasanThreadList *hwasan_thread_list; |
9 | static ThreadArgRetval *thread_data; |
10 | |
11 | HwasanThreadList &hwasanThreadList() { return *hwasan_thread_list; } |
12 | ThreadArgRetval &hwasanThreadArgRetval() { return *thread_data; } |
13 | |
14 | void InitThreadList(uptr storage, uptr size) { |
15 | CHECK_EQ(hwasan_thread_list, nullptr); |
16 | |
17 | static ALIGNED(alignof( |
18 | HwasanThreadList)) char thread_list_placeholder[sizeof(HwasanThreadList)]; |
19 | hwasan_thread_list = |
20 | new (thread_list_placeholder) HwasanThreadList(storage, size); |
21 | |
22 | CHECK_EQ(thread_data, nullptr); |
23 | |
24 | static ALIGNED(alignof( |
25 | ThreadArgRetval)) char thread_data_placeholder[sizeof(ThreadArgRetval)]; |
26 | thread_data = new (thread_data_placeholder) ThreadArgRetval(); |
27 | } |
28 | |
29 | } // namespace __hwasan |
30 |