forked from OSchip/llvm-project
[NFC][compiler-rt][hwasan] Move GetCurrentThread to hwasan.cpp
We can reuse the same implementation for getting the current thread on fuchsia. Differential Revision: https://reviews.llvm.org/D104824
This commit is contained in:
parent
a9854045f6
commit
c4a00ed851
|
@ -228,6 +228,14 @@ void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame,
|
|||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
Thread *GetCurrentThread() {
|
||||
uptr *ThreadLongPtr = GetCurrentThreadLongPtr();
|
||||
if (UNLIKELY(*ThreadLongPtr == 0))
|
||||
return nullptr;
|
||||
auto *R = (StackAllocationsRingBuffer *)ThreadLongPtr;
|
||||
return hwasanThreadList().GetThreadByBufferAddress((uptr)R->Next());
|
||||
}
|
||||
|
||||
} // namespace __hwasan
|
||||
|
||||
using namespace __hwasan;
|
||||
|
|
|
@ -338,14 +338,6 @@ void AndroidTestTlsSlot() {
|
|||
void AndroidTestTlsSlot() {}
|
||||
#endif
|
||||
|
||||
Thread *GetCurrentThread() {
|
||||
uptr *ThreadLongPtr = GetCurrentThreadLongPtr();
|
||||
if (UNLIKELY(*ThreadLongPtr == 0))
|
||||
return nullptr;
|
||||
auto *R = (StackAllocationsRingBuffer *)ThreadLongPtr;
|
||||
return hwasanThreadList().GetThreadByBufferAddress((uptr)R->Next());
|
||||
}
|
||||
|
||||
static AccessInfo GetAccessInfo(siginfo_t *info, ucontext_t *uc) {
|
||||
// Access type is passed in a platform dependent way (see below) and encoded
|
||||
// as 0xXY, where X&1 is 1 for store, 0 for load, and X&2 is 1 if the error is
|
||||
|
|
Loading…
Reference in New Issue