Skip to content

Commit a35bfa2

Browse files
committed
rt: Add {get,record}_sp_limit on Win64
Uses ArbitraryUserPointer area at gs:0x28.
1 parent 5118ef6 commit a35bfa2

File tree

1 file changed

+8
-0
lines changed
  • src/rt/arch/x86_64

1 file changed

+8
-0
lines changed

src/rt/arch/x86_64/sp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ extern "C" CDECL ALWAYS_INLINE uintptr_t get_sp_limit() {
4343
asm volatile (
4444
"movq %%fs:24, %0"
4545
: "=r"(limit));
46+
#elif defined(_WIN64)
47+
asm volatile (
48+
"movq %%gs:0x28, %0"
49+
: "=r"(limit));
4650
#endif
4751

4852
return limit;
@@ -65,6 +69,10 @@ extern "C" CDECL ALWAYS_INLINE void record_sp_limit(void *limit) {
6569
asm volatile (
6670
"movq %0, %%fs:24"
6771
:: "r"(limit));
72+
#elif defined(_WIN64)
73+
asm volatile (
74+
"movq %0, %%gs:0x28"
75+
:: "r"(limit));
6876
#endif
6977
}
7078

0 commit comments

Comments
 (0)