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
6namespace __hwasan {
7
8static HwasanThreadList *hwasan_thread_list;
9static ThreadArgRetval *thread_data;
10
11HwasanThreadList &hwasanThreadList() { return *hwasan_thread_list; }
12ThreadArgRetval &hwasanThreadArgRetval() { return *thread_data; }
13
14void 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

source code of compiler-rt/lib/hwasan/hwasan_thread_list.cpp