#
✕ nick:DannyB
#asahi-dev · 2023-11-28 14:46
DannyBand boot is
#asahi-dev · 2023-11-28 14:46
DannyB TCR_EL1_DTBI | TCR_EL1_ASID | TCR_EL1_EXTRA)
#asahi-dev · 2023-11-28 14:46
DannyB TCR_TBI0_TOPBYTE_IGNORED | (TCR_TBID0_ENABLE) | TCR_E0PD_VALUE | \
#asahi-dev · 2023-11-28 14:46
DannyB TCR_IRGN1_WRITEBACK | (TCR_TG1_GRANULE_SIZE) | \
#asahi-dev · 2023-11-28 14:46
DannyB TCR_IRGN0_WRITEBACK | (T0SZ_BOOT << TCR_T0SZ_SHIFT) | \
#asahi-dev · 2023-11-28 14:46
DannyB#define TCR_EL1_BASE \
#asahi-dev · 2023-11-28 14:46
DannyB TCR_SH1_OUTER | TCR_ORGN1_WRITEBACK | \
#asahi-dev · 2023-11-28 14:46
DannyB (TCR_IPS_VALUE | TCR_SH0_OUTER | TCR_ORGN0_WRITEBACK | \
#asahi-dev · 2023-11-28 14:46
DannyBBase is
#asahi-dev · 2023-11-28 14:45
DannyB#define TCR_EL1_BOOT (TCR_EL1_BASE | (T1SZ_BOOT << TCR_T1SZ_SHIFT) | (TCR_TG0_GRANULE_SIZE))
#asahi-dev · 2023-11-28 14:45
DannyBit sets it to
#asahi-dev · 2023-11-28 14:45
DannyBYeah
#asahi-dev · 2023-11-28 14:44
DannyBThey have set the TCR here for years
#asahi-dev · 2023-11-28 14:44
DannyBhttps://github.com/apple-oss-distributions/xnu/blob/xnu-10002.41.9/osfmk/arm64/start.s#L636
#asahi-dev · 2023-11-28 14:44
DannyBThe open source code of this part is actually correct (IE it matches the compiled kernels):
#asahi-dev · 2023-11-28 14:39
DannyBthey write it on all m2/m3
#asahi-dev · 2023-11-28 14:39
DannyBit's the first piece of common_start
#asahi-dev · 2023-11-28 14:39
DannyByes
#asahi-dev · 2023-11-28 14:38
DannyBin any case, i'll read the ID registers when i get back to the laptop
#asahi-dev · 2023-11-28 14:38
DannyBsince they should be equivalent
#asahi-dev · 2023-11-28 14:38
DannyBif so it would be easier to say "this bit affects all memory accesses"
#asahi-dev · 2023-11-28 14:38
DannyBi guess they mean it has effect if it would be translated if the translation was on, even if translation is off?
#asahi-dev · 2023-11-28 14:37
DannyBwhat does it mean to affect the address generation if they would be translated, but it has effect whether the translation is enabled or not?
#asahi-dev · 2023-11-28 14:37
DannyBis
#asahi-dev · 2023-11-28 14:37
DannyB"This affects addresses generated in EL0 and EL1 using AArch64 where the address would be translated by tables pointed to by TTBR0_EL1. It has an effect whether the EL1&0 translation regime is enabled or not."
#asahi-dev · 2023-11-28 14:37
DannyBBTW, can we talk about how weird
#asahi-dev · 2023-11-28 14:32
DannyBjust MTX1/0 and TBI1/0
#asahi-dev · 2023-11-28 14:32
DannyBi tink that's it
#asahi-dev · 2023-11-28 14:31
DannyBTop byte ignore
#asahi-dev · 2023-11-28 14:31
DannyB"This control has an effect regardless of whether stage 1 of the EL1&0 translation regime is enabled or not."
#asahi-dev · 2023-11-28 14:31
DannyBfor example
#asahi-dev · 2023-11-28 14:31
DannyBMTX0
#asahi-dev · 2023-11-28 14:31
DannyBBut there are things that matter in TCR even with MMU off
#asahi-dev · 2023-11-28 14:31
DannyBsetting it to 0 works
#asahi-dev · 2023-11-28 14:30
DannyBThere are things that matter regardless of SCTLR state
#asahi-dev · 2023-11-28 14:30
DannyBon
#asahi-dev · 2023-11-28 14:30
DannyBbecause we would bai and issue a message if SCTLR_M is not
#asahi-dev · 2023-11-28 14:29
DannyBIt's not
#asahi-dev · 2023-11-28 14:29
DannyBalso a good question
#asahi-dev · 2023-11-28 14:28
DannyBwith whatever the TCR is set to initially
#asahi-dev · 2023-11-28 14:28
DannyBso we do call memalign
#asahi-dev · 2023-11-28 14:28
DannyBwe configure TCR in mmu_configure after initing pagetables/etc
#asahi-dev · 2023-11-28 14:27
DannyBActually
#asahi-dev · 2023-11-28 14:27
DannyBright?
#asahi-dev · 2023-11-28 14:27
DannyBeven though nothing in between allocates memory
#asahi-dev · 2023-11-28 14:27
DannyByes
#asahi-dev · 2023-11-28 14:26
DannyBand the initial TCR set by XNU in common_start is 0x10800236511A511uLL
#asahi-dev · 2023-11-28 14:26
DannyBThe initial SPRR perms for EL1 (set by iboot i guess?) is 0x2020A5203020FAF5LL
#asahi-dev · 2023-11-28 14:25
DannyBi know the value but don't know what sets it
#asahi-dev · 2023-11-28 14:25
DannyBThere is a bootstrap SPRR set of perms

plus ›