Path: blob/master/tools/testing/selftests/arm64/fp/assembler.h
26288 views
// SPDX-License-Identifier: GPL-2.0-only1// Copyright (C) 2015-2019 ARM Limited.2// Original author: Dave Martin <[email protected]>34#ifndef ASSEMBLER_H5#define ASSEMBLER_H67.macro __for from:req, to:req8.if (\from) == (\to)9_for__body %\from10.else11__for \from, %(\from) + ((\to) - (\from)) / 212__for %(\from) + ((\to) - (\from)) / 2 + 1, \to13.endif14.endm1516.macro _for var:req, from:req, to:req, insn:vararg17.macro _for__body \var:req18.noaltmacro19\insn20.altmacro21.endm2223.altmacro24__for \from, \to25.noaltmacro2627.purgem _for__body28.endm2930.macro function name31.macro endfunction32.type \name, @function33.purgem endfunction34.endm35\name:36.endm3738.macro define_accessor name, num, insn39.macro \name\()_entry n40\insn \n, 141ret42.endm4344function \name45adr x2, .L__accessor_tbl\@46add x2, x2, x0, lsl #347br x24849.L__accessor_tbl\@:50_for x, 0, (\num) - 1, \name\()_entry \x51endfunction5253.purgem \name\()_entry54.endm5556// Utility macro to print a literal string57// Clobbers x0-x4,x858.macro puts string59.pushsection .rodata.str1.1, "aMS", @progbits, 160.L__puts_literal\@: .string "\string"61.popsection6263ldr x0, =.L__puts_literal\@64bl puts65.endm6667#define PR_SET_SHADOW_STACK_STATUS 7568# define PR_SHADOW_STACK_ENABLE (1UL << 0)6970.macro enable_gcs71// Run with GCS72mov x0, PR_SET_SHADOW_STACK_STATUS73mov x1, PR_SHADOW_STACK_ENABLE74mov x2, xzr75mov x3, xzr76mov x4, xzr77mov x5, xzr78mov x8, #__NR_prctl79svc #080.endm8182#endif /* ! ASSEMBLER_H */838485