VmThreadUtils.cpp 560 B

12345678910111213141516171819202122
  1. #include "VmThreadUtils.h"
  2. #include "os/Thread.h"
  3. namespace il2cpp
  4. {
  5. namespace utils
  6. {
  7. Il2CppStackPointerResult VmThreadUtils::PointerIsOnCurrentThreadStack(void* ptr)
  8. {
  9. void* low;
  10. void* high;
  11. if (il2cpp::os::Thread::GetCurrentThreadStackBounds(&low, &high))
  12. {
  13. if ((uintptr_t)ptr >= (uintptr_t)low && (uintptr_t)ptr <= (uintptr_t)high)
  14. return Il2CppStackPointerIsOnStack;
  15. return Il2CppStackPointerIsNotOnStack;
  16. }
  17. return Il2CppStackPointerNotSupported;
  18. }
  19. }
  20. }