github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/atomicbitops/atomicbitops_amd64.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 // +build amd64 16 17 #include "textflag.h" 18 19 TEXT ·AndUint32(SB),$0-12 20 MOVQ addr+0(FP), BP 21 MOVL val+8(FP), AX 22 LOCK 23 ANDL AX, 0(BP) 24 RET 25 26 TEXT ·OrUint32(SB),$0-12 27 MOVQ addr+0(FP), BP 28 MOVL val+8(FP), AX 29 LOCK 30 ORL AX, 0(BP) 31 RET 32 33 TEXT ·XorUint32(SB),$0-12 34 MOVQ addr+0(FP), BP 35 MOVL val+8(FP), AX 36 LOCK 37 XORL AX, 0(BP) 38 RET 39 40 TEXT ·CompareAndSwapUint32(SB),$0-20 41 MOVQ addr+0(FP), DI 42 MOVL old+8(FP), AX 43 MOVL new+12(FP), DX 44 LOCK 45 CMPXCHGL DX, 0(DI) 46 MOVL AX, ret+16(FP) 47 RET 48 49 TEXT ·AndUint64(SB),$0-16 50 MOVQ addr+0(FP), BP 51 MOVQ val+8(FP), AX 52 LOCK 53 ANDQ AX, 0(BP) 54 RET 55 56 TEXT ·OrUint64(SB),$0-16 57 MOVQ addr+0(FP), BP 58 MOVQ val+8(FP), AX 59 LOCK 60 ORQ AX, 0(BP) 61 RET 62 63 TEXT ·XorUint64(SB),$0-16 64 MOVQ addr+0(FP), BP 65 MOVQ val+8(FP), AX 66 LOCK 67 XORQ AX, 0(BP) 68 RET 69 70 TEXT ·CompareAndSwapUint64(SB),$0-32 71 MOVQ addr+0(FP), DI 72 MOVQ old+8(FP), AX 73 MOVQ new+16(FP), DX 74 LOCK 75 CMPXCHGQ DX, 0(DI) 76 MOVQ AX, ret+24(FP) 77 RET