github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/test/syscalls/linux/rseq/critical_arm64.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 // Restartable sequences critical sections. 16 17 // Loops continuously until aborted. 18 // 19 // void rseq_loop(struct rseq* r, struct rseq_cs* cs) 20 21 .text 22 .globl rseq_loop 23 .type rseq_loop, @function 24 25 rseq_loop: 26 b begin 27 28 // Abort block before the critical section. 29 // Abort signature. 30 .byte 0x90, 0x90, 0x90, 0x90 31 .globl rseq_loop_early_abort 32 rseq_loop_early_abort: 33 ret 34 35 begin: 36 // r->rseq_cs = cs 37 str x1, [x0, #8] 38 39 // N.B. rseq_cs will be cleared by any preempt, even outside the critical 40 // section. Thus it must be set in or immediately before the critical section 41 // to ensure it is not cleared before the section begins. 42 .globl rseq_loop_start 43 rseq_loop_start: 44 b rseq_loop_start 45 46 // "Pre-commit": extra instructions inside the critical section. These are 47 // used as the abort point in TestAbortPreCommit, which is not valid. 48 .globl rseq_loop_pre_commit 49 rseq_loop_pre_commit: 50 // Extra abort signature + nop for TestAbortPostCommit. 51 .byte 0x90, 0x90, 0x90, 0x90 52 nop 53 54 // "Post-commit": never reached in this case. 55 .globl rseq_loop_post_commit 56 rseq_loop_post_commit: 57 58 // Abort signature. 59 .byte 0x90, 0x90, 0x90, 0x90 60 61 .globl rseq_loop_abort 62 rseq_loop_abort: 63 ret 64 65 .size rseq_loop,.-rseq_loop 66 .section .note.GNU-stack,"",@progbits