1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
// Copyright 2019 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "funcdata.h"
#include "textflag.h"
#define TLBI_ASID_SHIFT 48
TEXT ·FlushTlbByVA(SB),NOSPLIT,$0-8
MOVD addr+0(FP), R1
DSB $10 // dsb(ishst)
WORD $0xd50883a1 // tlbi vale1is, x1
DSB $11 // dsb(ish)
RET
TEXT ·FlushTlbByASID(SB),NOSPLIT,$0-8
MOVD asid+0(FP), R1
LSL $TLBI_ASID_SHIFT, R1, R1
DSB $10 // dsb(ishst)
WORD $0xd5088341 // tlbi aside1is, x1
DSB $11 // dsb(ish)
RET
TEXT ·LocalFlushTlbByASID(SB),NOSPLIT,$0-8
MOVD asid+0(FP), R1
LSL $TLBI_ASID_SHIFT, R1, R1
DSB $10 // dsb(ishst)
WORD $0xd5088741 // tlbi aside1, x1
DSB $11 // dsb(ish)
RET
TEXT ·LocalFlushTlbAll(SB),NOSPLIT,$0
DSB $6 // dsb(nshst)
WORD $0xd508871f // __tlbi(vmalle1)
DSB $7 // dsb(nsh)
ISB $15
RET
TEXT ·FlushTlbAll(SB),NOSPLIT,$0
DSB $10 // dsb(ishst)
WORD $0xd508831f // __tlbi(vmalle1is)
DSB $11 // dsb(ish)
ISB $15
RET
TEXT ·CPACREL1(SB),NOSPLIT,$0-8
WORD $0xd5381041 // MRS CPACR_EL1, R1
MOVD R1, value+0(FP)
RET
TEXT ·GetFPCR(SB),NOSPLIT,$0-8
MOVD FPCR, R1
MOVD R1, value+0(FP)
RET
TEXT ·GetFPSR(SB),NOSPLIT,$0-8
MOVD FPSR, R1
MOVD R1, value+0(FP)
RET
TEXT ·SetFPCR(SB),NOSPLIT,$0-8
MOVD value+0(FP), R1
MOVD R1, FPCR
RET
TEXT ·SetFPSR(SB),NOSPLIT,$0-8
MOVD value+0(FP), R1
MOVD R1, FPSR
RET
TEXT ·SaveVRegs(SB),NOSPLIT,$0-8
MOVD arg+0(FP), R0
// Skip aarch64_ctx, fpsr, fpcr.
ADD $16, R0, R0
WORD $0xad000400 // stp q0, q1, [x0]
WORD $0xad010c02 // stp q2, q3, [x0, #32]
WORD $0xad021404 // stp q4, q5, [x0, #64]
WORD $0xad031c06 // stp q6, q7, [x0, #96]
WORD $0xad042408 // stp q8, q9, [x0, #128]
WORD $0xad052c0a // stp q10, q11, [x0, #160]
WORD $0xad06340c // stp q12, q13, [x0, #192]
WORD $0xad073c0e // stp q14, q15, [x0, #224]
WORD $0xad084410 // stp q16, q17, [x0, #256]
WORD $0xad094c12 // stp q18, q19, [x0, #288]
WORD $0xad0a5414 // stp q20, q21, [x0, #320]
WORD $0xad0b5c16 // stp q22, q23, [x0, #352]
WORD $0xad0c6418 // stp q24, q25, [x0, #384]
WORD $0xad0d6c1a // stp q26, q27, [x0, #416]
WORD $0xad0e741c // stp q28, q29, [x0, #448]
WORD $0xad0f7c1e // stp q30, q31, [x0, #480]
RET
TEXT ·LoadVRegs(SB),NOSPLIT,$0-8
MOVD arg+0(FP), R0
// Skip aarch64_ctx, fpsr, fpcr.
ADD $16, R0, R0
WORD $0xad400400 // ldp q0, q1, [x0]
WORD $0xad410c02 // ldp q2, q3, [x0, #32]
WORD $0xad421404 // ldp q4, q5, [x0, #64]
WORD $0xad431c06 // ldp q6, q7, [x0, #96]
WORD $0xad442408 // ldp q8, q9, [x0, #128]
WORD $0xad452c0a // ldp q10, q11, [x0, #160]
WORD $0xad46340c // ldp q12, q13, [x0, #192]
WORD $0xad473c0e // ldp q14, q15, [x0, #224]
WORD $0xad484410 // ldp q16, q17, [x0, #256]
WORD $0xad494c12 // ldp q18, q19, [x0, #288]
WORD $0xad4a5414 // ldp q20, q21, [x0, #320]
WORD $0xad4b5c16 // ldp q22, q23, [x0, #352]
WORD $0xad4c6418 // ldp q24, q25, [x0, #384]
WORD $0xad4d6c1a // ldp q26, q27, [x0, #416]
WORD $0xad4e741c // ldp q28, q29, [x0, #448]
WORD $0xad4f7c1e // ldp q30, q31, [x0, #480]
RET
TEXT ·LoadFloatingPoint(SB),NOSPLIT,$0-8
MOVD arg+0(FP), R0
MOVD 0(R0), R1
MOVD R1, FPSR
MOVD 8(R0), R1
MOVD R1, FPCR
ADD $16, R0, R0
WORD $0xad400400 // ldp q0, q1, [x0]
WORD $0xad410c02 // ldp q2, q3, [x0, #32]
WORD $0xad421404 // ldp q4, q5, [x0, #64]
WORD $0xad431c06 // ldp q6, q7, [x0, #96]
WORD $0xad442408 // ldp q8, q9, [x0, #128]
WORD $0xad452c0a // ldp q10, q11, [x0, #160]
WORD $0xad46340c // ldp q12, q13, [x0, #192]
WORD $0xad473c0e // ldp q14, q15, [x0, #224]
WORD $0xad484410 // ldp q16, q17, [x0, #256]
WORD $0xad494c12 // ldp q18, q19, [x0, #288]
WORD $0xad4a5414 // ldp q20, q21, [x0, #320]
WORD $0xad4b5c16 // ldp q22, q23, [x0, #352]
WORD $0xad4c6418 // ldp q24, q25, [x0, #384]
WORD $0xad4d6c1a // ldp q26, q27, [x0, #416]
WORD $0xad4e741c // ldp q28, q29, [x0, #448]
WORD $0xad4f7c1e // ldp q30, q31, [x0, #480]
RET
TEXT ·SaveFloatingPoint(SB),NOSPLIT,$0-8
MOVD arg+0(FP), R0
MOVD FPSR, R1
MOVD R1, 0(R0)
MOVD FPCR, R1
MOVD R1, 8(R0)
ADD $16, R0, R0
WORD $0xad000400 // stp q0, q1, [x0]
WORD $0xad010c02 // stp q2, q3, [x0, #32]
WORD $0xad021404 // stp q4, q5, [x0, #64]
WORD $0xad031c06 // stp q6, q7, [x0, #96]
WORD $0xad042408 // stp q8, q9, [x0, #128]
WORD $0xad052c0a // stp q10, q11, [x0, #160]
WORD $0xad06340c // stp q12, q13, [x0, #192]
WORD $0xad073c0e // stp q14, q15, [x0, #224]
WORD $0xad084410 // stp q16, q17, [x0, #256]
WORD $0xad094c12 // stp q18, q19, [x0, #288]
WORD $0xad0a5414 // stp q20, q21, [x0, #320]
WORD $0xad0b5c16 // stp q22, q23, [x0, #352]
WORD $0xad0c6418 // stp q24, q25, [x0, #384]
WORD $0xad0d6c1a // stp q26, q27, [x0, #416]
WORD $0xad0e741c // stp q28, q29, [x0, #448]
WORD $0xad0f7c1e // stp q30, q31, [x0, #480]
RET
|