github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/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),NOSPLIT|NOFRAME,$0-12 20 MOVQ addr+0(FP), BX 21 MOVL val+8(FP), AX 22 LOCK 23 ANDL AX, 0(BX) 24 RET 25 26 TEXT ·orUint32(SB),NOSPLIT|NOFRAME,$0-12 27 MOVQ addr+0(FP), BX 28 MOVL val+8(FP), AX 29 LOCK 30 ORL AX, 0(BX) 31 RET 32 33 TEXT ·xorUint32(SB),NOSPLIT|NOFRAME,$0-12 34 MOVQ addr+0(FP), BX 35 MOVL val+8(FP), AX 36 LOCK 37 XORL AX, 0(BX) 38 RET 39 40 TEXT ·compareAndSwapUint32(SB),NOSPLIT|NOFRAME,$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),NOSPLIT|NOFRAME,$0-16 50 MOVQ addr+0(FP), BX 51 MOVQ val+8(FP), AX 52 LOCK 53 ANDQ AX, 0(BX) 54 RET 55 56 TEXT ·orUint64(SB),NOSPLIT|NOFRAME,$0-16 57 MOVQ addr+0(FP), BX 58 MOVQ val+8(FP), AX 59 LOCK 60 ORQ AX, 0(BX) 61 RET 62 63 TEXT ·xorUint64(SB),NOSPLIT|NOFRAME,$0-16 64 MOVQ addr+0(FP), BX 65 MOVQ val+8(FP), AX 66 LOCK 67 XORQ AX, 0(BX) 68 RET 69 70 TEXT ·compareAndSwapUint64(SB),NOSPLIT|NOFRAME,$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