Skip to content

Commit 4dbc061

Browse files
committed
fix switch context
1 parent c051d1d commit 4dbc061

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

thread/thread.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,11 @@ R"(
949949
"x2", "x3", "x4", "x5", "x6", "x7", "x8",
950950
// Corouptable register, may change ,should save
951951
"x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16",
952-
"x17", "x18");
952+
"x17", "x18",
953+
// Callee-saved SIMD/FP registers (low 64 bits of v8-v15)
954+
// must be preserved across the switch per AAPCS, just as
955+
// Win64 preserves xmm6-xmm15 above.
956+
"d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15");
953957
}
954958

955959
inline void switch_context_defer(thread* from, thread* to,
@@ -967,7 +971,8 @@ R"(
967971
: "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
968972
"x27", "x28", "x29", "x30", "x4", "x5", "x6", "x7", "x8",
969973
"x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16",
970-
"x17", "x18");
974+
"x17", "x18",
975+
"d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15");
971976
}
972977
#ifdef __clang__
973978
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)