MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / switch_context

Function switch_context

thread/thread.cpp:791–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

789 );
790
791 inline void switch_context(thread* from, thread* to) {
792 ASAN_SWITCH(to);
793 prepare_switch(from, to);
794 auto _t_ = to->stack.pointer_ref();
795 register auto f asm("rsi") = from->stack.pointer_ref();
796 register auto t asm("rdi") = _t_;
797 asm volatile("call _photon_switch_context" // (to, from)
798 : "+r"(t), "+r"(f)
799 : // "0"(t), "1"(f)
800 : "rax", "rbx", "rcx", "rdx", "r8", "r9", "r10", "r11",
801 "r12", "r13", "r14", "r15");
802 }
803
804 inline void switch_context_defer(thread* from, thread* to,
805 void (*defer)(void*), void* arg) {

Callers 5

thread_yieldFunction · 0.85
thread_yield_fastFunction · 0.85
thread_yield_toFunction · 0.85
thread_usleepFunction · 0.85
do_thread_usleepFunction · 0.85

Calls 2

prepare_switchFunction · 0.85
pointer_refMethod · 0.80

Tested by

no test coverage detected