69 lines · c
1// SPDX-License-Identifier: GPL-2.0-only2// Copyright (C) 2015-2019 ARM Limited.3// Original author: Dave Martin <Dave.Martin@arm.com>4 5#ifndef ASSEMBLER_H6#define ASSEMBLER_H7 8.macro __for from:req, to:req9 .if (\from) == (\to)10 _for__body %\from11 .else12 __for \from, %(\from) + ((\to) - (\from)) / 213 __for %(\from) + ((\to) - (\from)) / 2 + 1, \to14 .endif15.endm16 17.macro _for var:req, from:req, to:req, insn:vararg18 .macro _for__body \var:req19 .noaltmacro20 \insn21 .altmacro22 .endm23 24 .altmacro25 __for \from, \to26 .noaltmacro27 28 .purgem _for__body29.endm30 31.macro function name32 .macro endfunction33 .type \name, @function34 .purgem endfunction35 .endm36\name:37.endm38 39.macro define_accessor name, num, insn40 .macro \name\()_entry n41 \insn \n, 142 ret43 .endm44 45function \name46 adr x2, .L__accessor_tbl\@47 add x2, x2, x0, lsl #348 br x249 50.L__accessor_tbl\@:51 _for x, 0, (\num) - 1, \name\()_entry \x52endfunction53 54 .purgem \name\()_entry55.endm56 57// Utility macro to print a literal string58// Clobbers x0-x4,x859.macro puts string60 .pushsection .rodata.str1.1, "aMS", @progbits, 161.L__puts_literal\@: .string "\string"62 .popsection63 64 ldr x0, =.L__puts_literal\@65 bl puts66.endm67 68#endif /* ! ASSEMBLER_H */69