Home | History | Annotate | Line # | Download | only in include
asm.h revision 1.6.4.1
      1  1.6.4.1    bouyer /* $NetBSD: asm.h,v 1.6.4.1 2020/04/20 11:28:51 bouyer 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.6.4.1    bouyer #if defined(_KERNEL_OPT)
      7  1.6.4.1    bouyer #include "opt_cpuoptions.h"
      8  1.6.4.1    bouyer #endif
      9  1.6.4.1    bouyer 
     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.6.4.1    bouyer /*
     33  1.6.4.1    bouyer  * ARMv8 options to be made available for the compiler to use. Should be
     34  1.6.4.1    bouyer  * inserted at the beginning of the ASM files that need them.
     35  1.6.4.1    bouyer  *
     36  1.6.4.1    bouyer  * For now the only option is PAC, needed for the compiler to recognize
     37  1.6.4.1    bouyer  * the key registers.
     38  1.6.4.1    bouyer  */
     39  1.6.4.1    bouyer #ifdef ARMV83_PAC
     40  1.6.4.1    bouyer #define ARMV8_DEFINE_OPTIONS	\
     41  1.6.4.1    bouyer 	.arch armv8.3-a+pac
     42  1.6.4.1    bouyer #else
     43  1.6.4.1    bouyer #define ARMV8_DEFINE_OPTIONS	/* nothing */
     44  1.6.4.1    bouyer #endif
     45  1.6.4.1    bouyer 
     46      1.4     joerg #endif
     47      1.3  christos 
     48      1.1      matt #endif /* !_AARCH64_ASM_H_ */
     49