Home | History | Annotate | Line # | Download | only in include
asm.h revision 1.7
      1  1.7      maxv /* $NetBSD: asm.h,v 1.7 2020/04/12 07:49:58 maxv Exp $ */
      2  1.1      matt 
      3  1.1      matt #ifndef _AARCH64_ASM_H_
      4  1.1      matt #define _AARCH64_ASM_H_
      5  1.1      matt 
      6  1.7      maxv #if defined(_KERNEL_OPT)
      7  1.7      maxv #include "opt_cpuoptions.h"
      8  1.7      maxv #endif
      9  1.7      maxv 
     10  1.1      matt #include <arm/asm.h>
     11  1.1      matt 
     12  1.4     joerg #ifdef __aarch64__
     13  1.6     skrll 
     14  1.6     skrll #ifdef __ASSEMBLER__
     15  1.6     skrll .macro	adrl 	reg, addr
     16  1.6     skrll 	adrp	\reg, \addr
     17  1.6     skrll 	add	\reg, \reg, #:lo12:\addr
     18  1.6     skrll .endm
     19  1.6     skrll #endif
     20  1.6     skrll 
     21  1.3  christos #define	fp	x29
     22  1.3  christos #define	lr	x30
     23  1.5       ryo 
     24  1.5       ryo /*
     25  1.5       ryo  * Add a speculation barrier after the 'eret'.
     26  1.5       ryo  * Some aarch64 cpus speculatively execute instructions after 'eret',
     27  1.5       ryo  * and this potentiates side-channel attacks.
     28  1.5       ryo  */
     29  1.5       ryo #define	ERET	\
     30  1.5       ryo 	eret; dsb sy; isb
     31  1.5       ryo 
     32  1.7      maxv /*
     33  1.7      maxv  * ARMv8 options to be made available for the compiler to use. Should be
     34  1.7      maxv  * inserted at the beginning of the ASM files that need them.
     35  1.7      maxv  *
     36  1.7      maxv  * For now the only option is PAC, needed for the compiler to recognize
     37  1.7      maxv  * the key registers.
     38  1.7      maxv  */
     39  1.7      maxv #ifdef ARMV83_PAC
     40  1.7      maxv #define ARMV8_DEFINE_OPTIONS	\
     41  1.7      maxv 	.arch armv8.3-a+pac
     42  1.7      maxv #else
     43  1.7      maxv #define ARMV8_DEFINE_OPTIONS	/* nothing */
     44  1.7      maxv #endif
     45  1.7      maxv 
     46  1.4     joerg #endif
     47  1.3  christos 
     48  1.1      matt #endif /* !_AARCH64_ASM_H_ */
     49