github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/time/muldiv_arm64.s (about) 1 // Copyright 2018 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 #include "funcdata.h" 16 #include "textflag.h" 17 18 // Documentation is available in parameters.go. 19 // 20 // func muldiv64(value, multiplier, divisor uint64) (uint64, bool) 21 TEXT ·muldiv64(SB),NOSPLIT,$40-33 22 GO_ARGS 23 NO_LOCAL_POINTERS 24 MOVD value+0(FP), R0 25 MOVD multiplier+8(FP), R1 26 MOVD divisor+16(FP), R2 27 28 UMULH R0, R1, R3 29 MUL R0, R1, R4 30 31 CMP R2, R3 32 BHS overflow 33 34 MOVD R3, 8(RSP) 35 MOVD R4, 16(RSP) 36 MOVD R2, 24(RSP) 37 CALL ·divWW(SB) 38 MOVD 32(RSP), R0 39 MOVD R0, ret+24(FP) 40 MOVD $1, R0 41 MOVB R0, ret1+32(FP) 42 RET 43 44 overflow: 45 MOVD ZR, ret+24(FP) 46 MOVB ZR, ret1+32(FP) 47 RET