thermosphere: add sysreg list

This commit is contained in:
TuxSH 2019-07-23 04:47:57 +02:00
parent bcc72896fd
commit 4952b3c9bf
2 changed files with 529 additions and 0 deletions

View file

@ -0,0 +1,204 @@
/* TuxSH: I added INC/DEC_10 to INC/DEC_32; tuples */
#pragma once
/*=============================================================================
Copyright (c) 2015 Paul Fultz II
cloak.h
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
/*#ifndef CLOAK_GUARD_H
#define CLOAK_GUARD_H*/
#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__)
#define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
#define COMPL(b) PRIMITIVE_CAT(COMPL_, b)
#define COMPL_0 1
#define COMPL_1 0
#define BITAND(x) PRIMITIVE_CAT(BITAND_, x)
#define BITAND_0(y) 0
#define BITAND_1(y) y
#define INC(x) PRIMITIVE_CAT(INC_, x)
#define INC_0 1
#define INC_1 2
#define INC_2 3
#define INC_3 4
#define INC_4 5
#define INC_5 6
#define INC_6 7
#define INC_7 8
#define INC_8 9
#define INC_9 10
#define INC_10 11
#define INC_11 12
#define INC_12 13
#define INC_13 14
#define INC_14 15
#define INC_15 16
#define INC_16 17
#define INC_17 18
#define INC_18 19
#define INC_19 20
#define INC_20 21
#define INC_21 22
#define INC_22 23
#define INC_23 24
#define INC_24 25
#define INC_25 26
#define INC_26 27
#define INC_27 28
#define INC_28 29
#define INC_29 30
#define INC_30 31
#define INC_31 32
#define INC_32 32
#define INC_33 33
#define DEC(x) PRIMITIVE_CAT(DEC_, x)
#define DEC_0 0
#define DEC_1 0
#define DEC_2 1
#define DEC_3 2
#define DEC_4 3
#define DEC_5 4
#define DEC_6 5
#define DEC_7 6
#define DEC_8 7
#define DEC_9 8
#define DEC_10 9
#define DEC_11 10
#define DEC_12 11
#define DEC_13 12
#define DEC_14 13
#define DEC_15 14
#define DEC_16 15
#define DEC_17 16
#define DEC_18 17
#define DEC_19 18
#define DEC_20 19
#define DEC_21 20
#define DEC_22 21
#define DEC_23 22
#define DEC_24 23
#define DEC_25 24
#define DEC_26 25
#define DEC_27 26
#define DEC_28 27
#define DEC_29 28
#define DEC_30 29
#define DEC_31 30
#define DEC_32 31
#define DEC_33 32
#define CHECK_N(x, n, ...) n
#define CHECK(...) CHECK_N(__VA_ARGS__, 0,)
#define PROBE(x) x, 1,
#define IS_PAREN(x) CHECK(IS_PAREN_PROBE x)
#define IS_PAREN_PROBE(...) PROBE(~)
#define NOT(x) CHECK(PRIMITIVE_CAT(NOT_, x))
#define NOT_0 PROBE(~)
#define COMPL(b) PRIMITIVE_CAT(COMPL_, b)
#define COMPL_0 1
#define COMPL_1 0
#define BOOL(x) COMPL(NOT(x))
#define IIF(c) PRIMITIVE_CAT(IIF_, c)
#define IIF_0(t, ...) __VA_ARGS__
#define IIF_1(t, ...) t
#define IF(c) IIF(BOOL(c))
#define EAT(...)
#define EXPAND(...) __VA_ARGS__
#define WHEN(c) IF(c)(EXPAND, EAT)
#define EMPTY()
#define DEFER(id) id EMPTY()
#define OBSTRUCT(id) id DEFER(EMPTY)()
#define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__)))
#define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__)))
#define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__)))
#define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__)))
#define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__)))
#define EVAL5(...) __VA_ARGS__
#define REPEAT(count, macro, ...) \
WHEN(count) \
( \
OBSTRUCT(REPEAT_INDIRECT) () \
( \
DEC(count), macro, __VA_ARGS__ \
) \
OBSTRUCT(macro) \
( \
DEC(count), __VA_ARGS__ \
) \
)
#define REPEAT_INDIRECT() REPEAT
#define WHILE(pred, op, ...) \
IF(pred(__VA_ARGS__)) \
( \
OBSTRUCT(WHILE_INDIRECT) () \
( \
pred, op, op(__VA_ARGS__) \
), \
__VA_ARGS__ \
)
#define WHILE_INDIRECT() WHILE
#define PRIMITIVE_COMPARE(x, y) IS_PAREN \
( \
COMPARE_ ## x ( COMPARE_ ## y) (()) \
)
#define IS_COMPARABLE(x) IS_PAREN( CAT(COMPARE_, x) (()) )
#define NOT_EQUAL(x, y) \
IIF(BITAND(IS_COMPARABLE(x))(IS_COMPARABLE(y)) ) \
( \
PRIMITIVE_COMPARE, \
1 EAT \
)(x, y)
#define EQUAL(x, y) COMPL(NOT_EQUAL(x, y))
#define COMMA() ,
#define COMMA_IF(n) IF(n)(COMMA, EAT)()
#define PLUS() +
#define _TUPLE_ELEM_0(a, ...) a
#define _TUPLE_ELEM_1(a, b, ...) b
#define _TUPLE_ELEM_2(a, b, c, ...) c
#define _TUPLE_ELEM_3(a, b, c, d, ...) d
#define _TUPLE_ELEM_4(a, b, c, d, e, ...) e
#define TUPLE_ELEM_0(T) EVAL(_TUPLE_ELEM_0 T)
#define TUPLE_ELEM_1(T) EVAL(_TUPLE_ELEM_1 T)
#define TUPLE_ELEM_2(T) EVAL(_TUPLE_ELEM_2 T)
#define TUPLE_ELEM_3(T) EVAL(_TUPLE_ELEM_3 T)
#define TUPLE_ELEM_4(T) EVAL(_TUPLE_ELEM_4 T)
#define _TUPLE_FOLD_LEFT_0(i, T, op) (_TUPLE_ELEM_0 CAT(T,i)) op()
#define _TUPLE_FOLD_LEFT_1(i, T, op) (_TUPLE_ELEM_1 CAT(T,i)) op()
#define _TUPLE_FOLD_LEFT_2(i, T, op) (_TUPLE_ELEM_2 CAT(T,i)) op()
#define _TUPLE_FOLD_LEFT_3(i, T, op) (_TUPLE_ELEM_3 CAT(T,i)) op()
#define _TUPLE_FOLD_LEFT_4(i, T, op) (_TUPLE_ELEM_4 CAT(T,i)) op()
#define TUPLE_FOLD_LEFT_0(len, T, op) EVAL(REPEAT(len, _TUPLE_FOLD_LEFT_0, T, op))
#define TUPLE_FOLD_LEFT_1(len, T, op) EVAL(REPEAT(len, _TUPLE_FOLD_LEFT_1, T, op))
#define TUPLE_FOLD_LEFT_2(len, T, op) EVAL(REPEAT(len, _TUPLE_FOLD_LEFT_2, T, op))
#define TUPLE_FOLD_LEFT_3(len, T, op) EVAL(REPEAT(len, _TUPLE_FOLD_LEFT_3, T, op))
#define TUPLE_FOLD_LEFT_4(len, T, op) EVAL(REPEAT(len, _TUPLE_FOLD_LEFT_4, T, op))

325
thermosphere/src/sysreg.h Normal file
View file

@ -0,0 +1,325 @@
#pragma once
#include "preprocessor.h"
// Only for most EL1 regs, etc.
#define __BITL(n) (1ull << (n))
#define TUP_OSDTRRX_EL1 (2, 0, 0, 0, 2)
#define TUP_MDCCINT_EL1 (2, 0, 0, 2, 0)
#define TUP_MDSCR_EL1 (2, 0, 0, 2, 2)
#define TUP_OSDTRTX_EL1 (2, 0, 0, 3, 2)
#define TUP_OSECCR_EL1 (2, 0, 0, 6, 2)
#define TUP_DBGBVRn_EL1(n) (2, 0, 0, n, 4)
#define TUP_DBGBCRn_EL1(n) (2, 0, 0, n, 5)
#define TUP_DBGWVRn_EL1(n) (2, 0, 0, n, 6)
#define TUP_DBGWCRn_EL1(n) (2, 0, 0, n, 7)
#define TUP_MDRAR_EL1 (2, 0, 1, 0, 0)
#define TUP_OSLAR_EL1 (2, 0, 1, 0, 4)
#define TUP_OSLSR_EL1 (2, 0, 1, 1, 4)
#define TUP_OSDLR_EL1 (2, 0, 1, 3, 4)
#define TUP_DBGPRCR_EL1 (2, 0, 1, 4, 4)
#define TUP_DBGCLAIMSET_EL1 (2, 0, 7, 8, 6)
#define TUP_DBGCLAIMCLR_EL1 (2, 0, 7, 9, 6)
#define TUP_DBGAUTHSTATUS_EL1 (2, 0, 7, 14, 6)
#define TUP_MDCCSR_EL0 (2, 3, 0, 1, 0)
#define TUP_DBGDTR_EL0 (2, 3, 0, 4, 0)
#define TUP_DBGDTRRX_EL0 (2, 3, 0, 5, 0)
#define TUP_DBGDTRTX_EL0 (2, 3, 0, 5, 0)
#define TUP_DBGVCR32_EL2 (2, 4, 0, 7, 0)
#define TUP_MIDR_EL1 (3, 0, 0, 0, 0)
#define TUP_MPIDR_EL1 (3, 0, 0, 0, 5)
#define TUP_REVIDR_EL1 (3, 0, 0, 0, 6)
#define TUP_ID_PFR0_EL1 (3, 0, 0, 1, 0)
#define TUP_ID_PFR1_EL1 (3, 0, 0, 1, 1)
#define TUP_ID_DFR0_EL1 (3, 0, 0, 1, 2)
#define TUP_ID_AFR0_EL1 (3, 0, 0, 1, 3)
#define TUP_ID_MMFR0_EL1 (3, 0, 0, 1, 4)
#define TUP_ID_MMFR1_EL1 (3, 0, 0, 1, 5)
#define TUP_ID_MMFR2_EL1 (3, 0, 0, 1, 6)
#define TUP_ID_MMFR3_EL1 (3, 0, 0, 1, 7)
#define TUP_ID_ISAR0_EL1 (3, 0, 0, 2, 0)
#define TUP_ID_ISAR1_EL1 (3, 0, 0, 2, 1)
#define TUP_ID_ISAR2_EL1 (3, 0, 0, 2, 2)
#define TUP_ID_ISAR3_EL1 (3, 0, 0, 2, 3)
#define TUP_ID_ISAR4_EL1 (3, 0, 0, 2, 4)
#define TUP_ID_ISAR5_EL1 (3, 0, 0, 2, 5)
#define TUP_ID_MMFR4_EL1 (3, 0, 0, 2, 6)
#define TUP_MVFR0_EL1 (3, 0, 0, 3, 0)
#define TUP_MVFR1_EL1 (3, 0, 0, 3, 1)
#define TUP_MVFR2_EL1 (3, 0, 0, 3, 2)
#define TUP_ID_AA64PFR0_EL1 (3, 0, 0, 4, 0)
#define TUP_ID_AA64PFR1_EL1 (3, 0, 0, 4, 1)
#define TUP_ID_AA64ZFR0_EL1 (3, 0, 0, 4, 4)
#define TUP_ID_AA64DFR0_EL1 (3, 0, 0, 5, 0)
#define TUP_ID_AA64DFR1_EL1 (3, 0, 0, 5, 1)
#define TUP_ID_AA64AFR0_EL1 (3, 0, 0, 5, 4)
#define TUP_ID_AA64AFR1_EL1 (3, 0, 0, 5, 5)
#define TUP_ID_AA64ISAR0_EL1 (3, 0, 0, 6, 0)
#define TUP_ID_AA64ISAR1_EL1 (3, 0, 0, 6, 1)
#define TUP_ID_AA64MMFR0_EL1 (3, 0, 0, 7, 0)
#define TUP_ID_AA64MMFR1_EL1 (3, 0, 0, 7, 1)
#define TUP_ID_AA64MMFR2_EL1 (3, 0, 0, 7, 2)
#define TUP_SCTLR_EL1 (3, 0, 1, 0, 0)
#define TUP_ACTLR_EL1 (3, 0, 1, 0, 1)
#define TUP_CPACR_EL1 (3, 0, 1, 0, 2)
#define TUP_ZCR_EL1 (3, 0, 1, 2, 0)
#define TUP_TTBR0_EL1 (3, 0, 2, 0, 0)
#define TUP_TTBR1_EL1 (3, 0, 2, 0, 1)
#define TUP_TCR_EL1 (3, 0, 2, 0, 2)
#define TUP_APIAKEYLO_EL1 (3, 0, 2, 1, 0)
#define TUP_APIAKEYHI_EL1 (3, 0, 2, 1, 1)
#define TUP_APIBKEYLO_EL1 (3, 0, 2, 1, 2)
#define TUP_APIBKEYHI_EL1 (3, 0, 2, 1, 3)
#define TUP_APDAKEYLO_EL1 (3, 0, 2, 2, 0)
#define TUP_APDAKEYHI_EL1 (3, 0, 2, 2, 1)
#define TUP_APDBKEYLO_EL1 (3, 0, 2, 2, 2)
#define TUP_APDBKEYHI_EL1 (3, 0, 2, 2, 3)
#define TUP_APGAKEYLO_EL1 (3, 0, 2, 3, 0)
#define TUP_APGAKEYHI_EL1 (3, 0, 2, 3, 1)
#define TUP_ICC_PMR_EL1 (3, 0, 4, 6, 0)
#define TUP_AFSR0_EL1 (3, 0, 5, 1, 0)
#define TUP_AFSR1_EL1 (3, 0, 5, 1, 1)
#define TUP_ESR_EL1 (3, 0, 5, 2, 0)
#define TUP_ERRIDR_EL1 (3, 0, 5, 3, 0)
#define TUP_ERRSELR_EL1 (3, 0, 5, 3, 1)
#define TUP_ERXFR_EL1 (3, 0, 5, 4, 0)
#define TUP_ERXCTLR_EL1 (3, 0, 5, 4, 1)
#define TUP_ERXSTATUS_EL1 (3, 0, 5, 4, 2)
#define TUP_ERXADDR_EL1 (3, 0, 5, 4, 3)
#define TUP_ERXMISC0_EL1 (3, 0, 5, 5, 0)
#define TUP_ERXMISC1_EL1 (3, 0, 5, 5, 1)
#define TUP_FAR_EL1 (3, 0, 6, 0, 0)
#define TUP_PAR_EL1 (3, 0, 7, 4, 0)
#define TUP_PMSIDR_EL1 (3, 0, 9, 9, 7)
#define TUP_PMBIDR_EL1 (3, 0, 9, 10, 7)
#define TUP_PMSCR_EL1 (3, 0, 9, 9, 0)
#define TUP_PMSCR_EL2 (3, 4, 9, 9, 0)
#define TUP_PMSICR_EL1 (3, 0, 9, 9, 2)
#define TUP_PMSIRR_EL1 (3, 0, 9, 9, 3)
#define TUP_PMSFCR_EL1 (3, 0, 9, 9, 4)
#define TUP_PMSEVFR_EL1 (3, 0, 9, 9, 5)
#define TUP_PMSLATFR_EL1 (3, 0, 9, 9, 6)
#define TUP_PMBLIMITR_EL1 (3, 0, 9, 10, 0)
#define TUP_PMBPTR_EL1 (3, 0, 9, 10, 1)
#define TUP_PMBSR_EL1 (3, 0, 9, 10, 3)
#define TUP_PMINTENSET_EL1 (3, 0, 9, 14, 1)
#define TUP_PMINTENCLR_EL1 (3, 0, 9, 14, 2)
#define TUP_MAIR_EL1 (3, 0, 10, 2, 0)
#define TUP_AMAIR_EL1 (3, 0, 10, 3, 0)
#define TUP_LORSA_EL1 (3, 0, 10, 4, 0)
#define TUP_LOREA_EL1 (3, 0, 10, 4, 1)
#define TUP_LORN_EL1 (3, 0, 10, 4, 2)
#define TUP_LORC_EL1 (3, 0, 10, 4, 3)
#define TUP_LORID_EL1 (3, 0, 10, 4, 7)
#define TUP_VBAR_EL1 (3, 0, 12, 0, 0)
#define TUP_DISR_EL1 (3, 0, 12, 1, 1)
#define TUP_ICC_IAR0_EL1 (3, 0, 12, 8, 0)
#define TUP_ICC_EOIR0_EL1 (3, 0, 12, 8, 1)
#define TUP_ICC_HPPIR0_EL1 (3, 0, 12, 8, 2)
#define TUP_ICC_BPR0_EL1 (3, 0, 12, 8, 3)
#define TUP_ICC_AP0Rn_EL1(n) (3, 0, 12, 8, 4 | n)
#define TUP_ICC_AP0R0_EL1 TUP_ICC_AP0Rn_EL1(0)
#define TUP_ICC_AP0R1_EL1 TUP_ICC_AP0Rn_EL1(1)
#define TUP_ICC_AP0R2_EL1 TUP_ICC_AP0Rn_EL1(2)
#define TUP_ICC_AP0R3_EL1 TUP_ICC_AP0Rn_EL1(3)
#define TUP_ICC_AP1Rn_EL1(n) (3, 0, 12, 9, n)
#define TUP_ICC_AP1R0_EL1 TUP_ICC_AP1Rn_EL1(0)
#define TUP_ICC_AP1R1_EL1 TUP_ICC_AP1Rn_EL1(1)
#define TUP_ICC_AP1R2_EL1 TUP_ICC_AP1Rn_EL1(2)
#define TUP_ICC_AP1R3_EL1 TUP_ICC_AP1Rn_EL1(3)
#define TUP_ICC_DIR_EL1 (3, 0, 12, 11, 1)
#define TUP_ICC_RPR_EL1 (3, 0, 12, 11, 3)
#define TUP_ICC_SGI1R_EL1 (3, 0, 12, 11, 5)
#define TUP_ICC_ASGI1R_EL1 (3, 0, 12, 11, 6)
#define TUP_ICC_SGI0R_EL1 (3, 0, 12, 11, 7)
#define TUP_ICC_IAR1_EL1 (3, 0, 12, 12, 0)
#define TUP_ICC_EOIR1_EL1 (3, 0, 12, 12, 1)
#define TUP_ICC_HPPIR1_EL1 (3, 0, 12, 12, 2)
#define TUP_ICC_BPR1_EL1 (3, 0, 12, 12, 3)
#define TUP_ICC_CTLR_EL1 (3, 0, 12, 12, 4)
#define TUP_ICC_SRE_EL1 (3, 0, 12, 12, 5)
#define TUP_ICC_IGRPEN0_EL1 (3, 0, 12, 12, 6)
#define TUP_ICC_IGRPEN1_EL1 (3, 0, 12, 12, 7)
#define TUP_CONTEXTIDR_EL1 (3, 0, 13, 0, 1)
#define TUP_TPIDR_EL1 (3, 0, 13, 0, 4)
#define TUP_CNTKCTL_EL1 (3, 0, 14, 1, 0)
#define TUP_CCSIDR_EL1 (3, 1, 0, 0, 0)
#define TUP_CLIDR_EL1 (3, 1, 0, 0, 1)
#define TUP_AIDR_EL1 (3, 1, 0, 0, 7)
#define TUP_CSSELR_EL1 (3, 2, 0, 0, 0)
#define TUP_CTR_EL0 (3, 3, 0, 0, 1)
#define TUP_DCZID_EL0 (3, 3, 0, 0, 7)
#define TUP_PMCR_EL0 (3, 3, 9, 12, 0)
#define TUP_PMCNTENSET_EL0 (3, 3, 9, 12, 1)
#define TUP_PMCNTENCLR_EL0 (3, 3, 9, 12, 2)
#define TUP_PMOVSCLR_EL0 (3, 3, 9, 12, 3)
#define TUP_PMSWINC_EL0 (3, 3, 9, 12, 4)
#define TUP_PMSELR_EL0 (3, 3, 9, 12, 5)
#define TUP_PMCEID0_EL0 (3, 3, 9, 12, 6)
#define TUP_PMCEID1_EL0 (3, 3, 9, 12, 7)
#define TUP_PMCCNTR_EL0 (3, 3, 9, 13, 0)
#define TUP_PMXEVTYPER_EL0 (3, 3, 9, 13, 1)
#define TUP_PMXEVCNTR_EL0 (3, 3, 9, 13, 2)
#define TUP_PMUSERENR_EL0 (3, 3, 9, 14, 0)
#define TUP_PMOVSSET_EL0 (3, 3, 9, 14, 3)
#define TUP_TPIDR_EL0 (3, 3, 13, 0, 2)
#define TUP_TPIDRRO_EL0 (3, 3, 13, 0, 3)
#define TUP_CNTFRQ_EL0 (3, 3, 14, 0, 0)
#define TUP_CNTP_TVAL_EL0 (3, 3, 14, 2, 0)
#define TUP_CNTP_CTL_EL0 (3, 3, 14, 2, 1)
#define TUP_CNTP_CVAL_EL0 (3, 3, 14, 2, 2)
#define TUP_AARCH32_CNTP_TVAL (0, 0, 14, 2, 0)
#define TUP_AARCH32_CNTP_CTL (0, 0, 14, 2, 1)
#define TUP_AARCH32_CNTP_CVAL (0, 2, 0, 14, 0)
#define __field_PMEV_op2(n) ((n) & 0x7)
#define __field__CNTR_CRm(n) (0x8 | (((n) >> 3) & 0x3))
#define __field__TYPER_CRm(n) (0xC | (((n) >> 3) & 0x3))
#define TUP_PMEVCNTRn_EL0(n) (3, 3, 14, __field_CNTR_CRm(n), __field_PMEV_op2(n))
#define TUP_PMEVTYPERn_EL0(n) (3, 3, 14, __field_TYPER_CRm(n), __field_PMEV_op2(n))
#define TUP_PMCCFILTR_EL0 (3, 3, 14, 15, 7)
#define TUP_ZCR_EL2 (3, 4, 1, 2, 0)
#define TUP_DACR32_EL2 (3, 4, 3, 0, 0)
#define TUP_IFSR32_EL2 (3, 4, 5, 0, 1)
#define TUP_VSESR_EL2 (3, 4, 5, 2, 3)
#define TUP_FPEXC32_EL2 (3, 4, 5, 3, 0)
#define TUP_VDISR_EL2 (3, 4, 12, 1, 1)
#define TUP_ICH_AP0Rn_EL2(n) (3, 4, 12, 8, n)
#define TUP_ICH_AP0R0_EL2 TUP_ICH_AP0Rn_EL2(0)
#define TUP_ICH_AP0R1_EL2 TUP_ICH_AP0Rn_EL2(1)
#define TUP_ICH_AP0R2_EL2 TUP_ICH_AP0Rn_EL2(2)
#define TUP_ICH_AP0R3_EL2 TUP_ICH_AP0Rn_EL2(3)
#define TUP_AP1Rx_EL2(n) (3, 4, 12, 9, n)
#define TUP_ICH_AP1R0_EL2 TUP_ICH_AP1Rn_EL2(0)
#define TUP_ICH_AP1R1_EL2 TUP_ICH_AP1Rn_EL2(1)
#define TUP_ICH_AP1R2_EL2 TUP_ICH_AP1Rn_EL2(2)
#define TUP_ICH_AP1R3_EL2 TUP_ICH_AP1Rn_EL2(3)
#define TUP_ICH_VSEIR_EL2 (3, 4, 12, 9, 4)
#define TUP_ICC_SRE_EL2 (3, 4, 12, 9, 5)
#define TUP_ICH_HCR_EL2 (3, 4, 12, 11, 0)
#define TUP_ICH_VTR_EL2 (3, 4, 12, 11, 1)
#define TUP_ICH_MISR_EL2 (3, 4, 12, 11, 2)
#define TUP_ICH_EISR_EL2 (3, 4, 12, 11, 3)
#define TUP_ICH_ELRSR_EL2 (3, 4, 12, 11, 5)
#define TUP_ICH_VMCR_EL2 (3, 4, 12, 11, 7)
#define TUP_ICH_LRn_EL2(n) (3, 4, 12, 12 + (n)/8, n)
#define TUP_ICH_LR0_EL2 TUP_ICH_LRn_EL2(0)
#define TUP_ICH_LR1_EL2 TUP_ICH_LRn_EL2(1)
#define TUP_ICH_LR2_EL2 TUP_ICH_LRn_EL2(2)
#define TUP_ICH_LR3_EL2 TUP_ICH_LRn_EL2(3)
#define TUP_ICH_LR4_EL2 TUP_ICH_LRn_EL2(4)
#define TUP_ICH_LR5_EL2 TUP_ICH_LRn_EL2(5)
#define TUP_ICH_LR6_EL2 TUP_ICH_LRn_EL2(6)
#define TUP_ICH_LR7_EL2 TUP_ICH_LRn_EL2(7)
#define TUP_ICH_LR8_EL2 TUP_ICH_LRn_EL2(8)
#define TUP_ICH_LR9_EL2 TUP_ICH_LRn_EL2(9)
#define TUP_ICH_LR10_EL2 TUP_ICH_LRn_EL2(10)
#define TUP_ICH_LR11_EL2 TUP_ICH_LRn_EL2(11)
#define TUP_ICH_LR12_EL2 TUP_ICH_LRn_EL2(12)
#define TUP_ICH_LR13_EL2 TUP_ICH_LRn_EL2(13)
#define TUP_ICH_LR14_EL2 TUP_ICH_LRn_EL2(14)
#define TUP_ICH_LR15_EL2 TUP_ICH_LRn_EL2(15)
#define TUP_ZCR_EL12 (3, 5, 1, 2, 0)
#define SCTLR_ELx_DSSBS __BITL(44)
#define SCTLR_ELx_ENIA __BITL(31)
#define SCTLR_ELx_ENIB __BITL(30)
#define SCTLR_ELx_ENDA __BITL(27)
#define SCTLR_ELx_EE __BITL(25)
#define SCTLR_ELx_IESB __BITL(21)
#define SCTLR_ELx_WXN __BITL(19)
#define SCTLR_ELx_ENDB __BITL(13)
#define SCTLR_ELx_I __BITL(12)
#define SCTLR_ELx_SA __BITL(3)
#define SCTLR_ELx_C __BITL(2)
#define SCTLR_ELx_A __BITL(1)
#define SCTLR_ELx_M __BITL(0)
#define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_IESB)
#define SCTLR_EL2_RES1 (__BITL(4) | __BITL(5) | __BITL(11) | __BITL(16) | \
__BITL(18) | __BITL(22) | __BITL(23) | __BITL(28) | \
__BITL(29))
#define SCTLR_EL2_RES0 (__BITL(6) | __BITL(7) | __BITL(8) | __BITL(9) | \
__BITL(10) | __BITL(13) | __BITL(14) | __BITL(15) | \
__BITL(17) | __BITL(20) | __BITL(24) | __BITL(26) | \
__BITL(27) | __BITL(30) | __BITL(31) | \
(0xFFFFEFFFull << 32))
#define SCTLR_EL1_UCI __BITL(26)
#define SCTLR_EL1_E0E __BITL(24)
#define SCTLR_EL1_SPAN __BITL(23)
#define SCTLR_EL1_NTWE __BITL(18)
#define SCTLR_EL1_NTWI __BITL(16)
#define SCTLR_EL1_UCT __BITL(15)
#define SCTLR_EL1_DZE __BITL(14)
#define SCTLR_EL1_UMA __BITL(9)
#define SCTLR_EL1_SED __BITL(8)
#define SCTLR_EL1_ITD __BITL(7)
#define SCTLR_EL1_CP15BEN __BITL(5)
#define SCTLR_EL1_SA0 __BITL(4)
#define SCTLR_EL1_RES1 (__BITL(11) | __BITL(20) | __BITL(22) | __BITL(28) | __BITL(29))
#define SCTLR_EL1_RES0 (__BITL(6) | __BITL(10) | __BITL(13) | __BITL(17) | __BITL(27) | __BITL(30) | __BITL(31) | (0xFFFFEFFFull << 32))
#undef __BITL
#define ENCODE_SYSREG_FIELDS_MOV(op0, op1, crn, crm, op2) (((op0) << 19) | ((op1) << 16) | ((crn) << 12) | ((crm) << 8) | ((op2) << 5))
#define ENCODE_SYSREG_MOV(name) EVAL(ENCODE_SYSREG_FIELDS_MOV CAT(TUP_, name))
#define MAKE_MSR(name, Rt) (0xD5000000 | ENCODE_SYSREG_MOV(name) | ((Rt) & 0x1F))
#define MAKE_MRS(name, Rt) (0xD5200000 | ENCODE_SYSREG_MOV(name) | ((Rt) & 0x1F))
#define ENCODE_SYSREG_FIELDS_ISS(op0, op1, crn, crm, op2) (((op0) << 20) | ((op2) << 17) | ((op1) << 14) | ((crn) << 10) | ((crm) << 1))
#define ENCODE_SYSREG_ISS(name) EVAL(ENCODE_SYSREG_FIELDS_ISS CAT(TUP_, name))