github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/ring0/pagetables/pcids_aarch64.s (about) 1 // Copyright 2020 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //go:build arm64 16 // +build arm64 17 18 #include "funcdata.h" 19 #include "textflag.h" 20 21 #define ID_AA64MMFR0_ASIDBITS_SHIFT 4 22 #define ID_AA64MMFR0_ASIDBITS_16 2 23 #define TCR_EL1_AS_BIT 36 24 25 // GetASIDBits return the system ASID bits, 8 or 16 bits. 26 // 27 // func GetASIDBits() uint8 28 TEXT ·GetASIDBits(SB),NOSPLIT|NOFRAME,$0-1 29 // First, check whether 16bits ASID is supported. 30 // ID_AA64MMFR0_EL1.ASIDBITS[7:4] == 0010. 31 WORD $0xd5380700 // MRS ID_AA64MMFR0_EL1, R0 32 UBFX $ID_AA64MMFR0_ASIDBITS_SHIFT, R0, $4, R0 33 CMPW $ID_AA64MMFR0_ASIDBITS_16, R0 34 BNE bits_8 35 36 // Second, check whether 16bits ASID is enabled. 37 // TCR_EL1.AS[36] == 1. 38 WORD $0xd5382040 // MRS TCR_EL1, R0 39 TBZ $TCR_EL1_AS_BIT, R0, bits_8 40 MOVD $16, R0 41 B done 42 bits_8: 43 MOVD $8, R0 44 done: 45 MOVB R0, ret+0(FP) 46 RET