xref: /linux/tools/testing/selftests/x86/clang_helpers_64.S (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
111586553SJohn Hubbard/* SPDX-License-Identifier: GPL-2.0-only */
211586553SJohn Hubbard/*
311586553SJohn Hubbard * 64-bit assembly helpers for asm operations that lack support in both gcc and
411586553SJohn Hubbard * clang. For example, clang asm does not support segment prefixes.
511586553SJohn Hubbard */
611586553SJohn Hubbard.global dereference_seg_base
711586553SJohn Hubbard
811586553SJohn Hubbarddereference_seg_base:
911586553SJohn Hubbard	mov %gs:(0), %rax
1011586553SJohn Hubbard	ret
1111586553SJohn Hubbard
12*2ab9c93dSJohn Hubbard.global test_page
13*2ab9c93dSJohn Hubbard.global test_syscall_insn
14*2ab9c93dSJohn Hubbard
15*2ab9c93dSJohn Hubbard.pushsection ".text", "ax"
16*2ab9c93dSJohn Hubbard.balign 4096
17*2ab9c93dSJohn Hubbardtest_page: .globl test_page
18*2ab9c93dSJohn Hubbard	.fill 4094,1,0xcc
19*2ab9c93dSJohn Hubbard
20*2ab9c93dSJohn Hubbardtest_syscall_insn:
21*2ab9c93dSJohn Hubbard	syscall
22*2ab9c93dSJohn Hubbard
23*2ab9c93dSJohn Hubbard.ifne . - test_page - 4096
24*2ab9c93dSJohn Hubbard	.error "test page is not one page long"
25*2ab9c93dSJohn Hubbard.endif
26*2ab9c93dSJohn Hubbard.popsection
27*2ab9c93dSJohn Hubbard
2811586553SJohn Hubbard.section .note.GNU-stack,"",%progbits
29