xref: /linux/tools/testing/selftests/sigaltstack/current_stack_pointer.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
105107edcSNick Desaulniers /* SPDX-License-Identifier: GPL-2.0 */
205107edcSNick Desaulniers 
305107edcSNick Desaulniers #if __alpha__
405107edcSNick Desaulniers register unsigned long sp asm("$30");
505107edcSNick Desaulniers #elif __arm__ || __aarch64__ || __csky__ || __m68k__ || __mips__ || __riscv
605107edcSNick Desaulniers register unsigned long sp asm("sp");
705107edcSNick Desaulniers #elif __i386__
805107edcSNick Desaulniers register unsigned long sp asm("esp");
905107edcSNick Desaulniers #elif __loongarch64
1005107edcSNick Desaulniers register unsigned long sp asm("$sp");
11*17c743b9SMichael Ellerman #elif __powerpc__
1205107edcSNick Desaulniers register unsigned long sp asm("r1");
1305107edcSNick Desaulniers #elif __s390x__
1405107edcSNick Desaulniers register unsigned long sp asm("%15");
1505107edcSNick Desaulniers #elif __sh__
1605107edcSNick Desaulniers register unsigned long sp asm("r15");
1705107edcSNick Desaulniers #elif __x86_64__
1805107edcSNick Desaulniers register unsigned long sp asm("rsp");
1905107edcSNick Desaulniers #elif __XTENSA__
2005107edcSNick Desaulniers register unsigned long sp asm("a1");
2105107edcSNick Desaulniers #else
2205107edcSNick Desaulniers #error "implement current_stack_pointer equivalent"
2305107edcSNick Desaulniers #endif
24