chkstk_x86_64_win.c (847B)
1 /* 2 * Win64 stack probes. 3 * 4 * x64 callers pass the pending frame allocation size in rax, call the probe, 5 * then subtract rax from rsp. The probe touches each intervening page and 6 * returns with rax preserved. 7 */ 8 9 __asm__( 10 ".text\n" 11 ".globl __chkstk\n" 12 "__chkstk:\n" 13 ".globl ___chkstk_ms\n" 14 "___chkstk_ms:\n" 15 " movq %rsp, %r10\n" 16 " addq $8, %r10\n" 17 " movq %rax, %r11\n" 18 " cmpq $4096, %r11\n" 19 " jb __kit_chkstk_last\n" 20 "__kit_chkstk_loop:\n" 21 " subq $4096, %r10\n" 22 " movq (%r10), %rcx\n" 23 " subq $4096, %r11\n" 24 " cmpq $4096, %r11\n" 25 " jae __kit_chkstk_loop\n" 26 " testq %r11, %r11\n" 27 " je __kit_chkstk_done\n" 28 "__kit_chkstk_last:\n" 29 " subq %r11, %r10\n" 30 " movq (%r10), %rcx\n" 31 "__kit_chkstk_done:\n" 32 " ret\n");