Module Name: src Committed By: maxv Date: Thu Sep 5 12:57:30 UTC 2019
Modified Files: src/sys/arch/amd64/amd64: lock_stubs.S Log Message: Remove unused, and style. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/amd64/lock_stubs.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/amd64/lock_stubs.S diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.31 src/sys/arch/amd64/amd64/lock_stubs.S:1.32 --- src/sys/arch/amd64/amd64/lock_stubs.S:1.31 Mon Feb 11 14:59:32 2019 +++ src/sys/arch/amd64/amd64/lock_stubs.S Thu Sep 5 12:57:30 2019 @@ -1,6 +1,6 @@ -/* $NetBSD: lock_stubs.S,v 1.31 2019/02/11 14:59:32 cherry Exp $ */ +/* $NetBSD: lock_stubs.S,v 1.32 2019/09/05 12:57:30 maxv Exp $ */ -/*- +/* * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. * All rights reserved. * @@ -15,7 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -29,15 +29,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* - * AMD64 lock stubs. Calling convention: - * - * %rdi arg 1 - * %rsi arg 2 - * %rdx arg 3 - * %rax return value - */ - #include "opt_multiprocessor.h" #include "opt_lockdebug.h" @@ -46,31 +37,30 @@ #include "assym.h" -#define ENDLABEL(name,a) .align a; LABEL(name) -#define LOCK(num) \ +#define LOCK \ HOTPATCH(HP_NAME_NOLOCK, 1) ; \ lock -#define RET(num) \ +#define RET \ HOTPATCH(HP_NAME_RETFENCE, 3) ; \ ret; nop; nop ; \ ret #ifndef LOCKDEBUG + .align 64 + /* * void mutex_enter(kmutex_t *mtx); * * Acquire a mutex and post a load fence. */ - .align 64 - ENTRY(mutex_enter) movq CPUVAR(CURLWP), %rcx xorq %rax, %rax - LOCK(1) + LOCK cmpxchgq %rcx, (%rdi) jnz 1f - RET(1) + RET 1: jmp _C_LABEL(mutex_vector_enter) END(mutex_enter) @@ -114,7 +104,7 @@ ENTRY(mutex_spin_enter) testb %al, %al jnz 1f #endif - RET(2) + RET 1: jmp _C_LABEL(mutex_spin_retry) /* failed; hard case */ END(mutex_spin_enter) @@ -211,11 +201,11 @@ ENTRY(rw_enter) 0: testb $(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al jnz 3f - leaq RW_READ_INCR(%rax), %rdx - LOCK(2) + leaq RW_READ_INCR(%rax), %rdx + LOCK cmpxchgq %rdx, (%rdi) jnz 1f - RET(3) + RET 1: jmp 0b @@ -225,10 +215,10 @@ ENTRY(rw_enter) 2: movq CPUVAR(CURLWP), %rcx xorq %rax, %rax orq $RW_WRITE_LOCKED, %rcx - LOCK(3) + LOCK cmpxchgq %rcx, (%rdi) jnz 3f - RET(4) + RET 3: jmp _C_LABEL(rw_vector_enter) END(rw_enter) @@ -251,7 +241,7 @@ ENTRY(rw_exit) cmpq $RW_READ_INCR, %rax jb 3f leaq -RW_READ_INCR(%rax), %rdx - LOCK(4) + LOCK cmpxchgq %rdx, (%rdi) jnz 1f ret @@ -264,7 +254,7 @@ ENTRY(rw_exit) 2: leaq -RW_WRITE_LOCKED(%rax), %rdx subq CPUVAR(CURLWP), %rdx jnz 3f - LOCK(5) + LOCK cmpxchgq %rdx, (%rdi) jnz 3f ret @@ -288,12 +278,12 @@ ENTRY(rw_tryenter) 0: testb $(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al jnz 4f - leaq RW_READ_INCR(%rax), %rdx - LOCK(8) + leaq RW_READ_INCR(%rax), %rdx + LOCK cmpxchgq %rdx, (%rdi) jnz 1f movl %edx, %eax /* nonzero */ - RET(5) + RET 1: jmp 0b @@ -303,12 +293,12 @@ ENTRY(rw_tryenter) 2: movq CPUVAR(CURLWP), %rcx xorq %rax, %rax orq $RW_WRITE_LOCKED, %rcx - LOCK(9) + LOCK cmpxchgq %rcx, (%rdi) movl $0, %eax setz %al 3: - RET(6) + RET ret 4: xorl %eax, %eax @@ -328,10 +318,10 @@ END(__cpu_simple_lock_init) ENTRY(__cpu_simple_lock) movl $0x0100, %eax 1: - LOCK(6) + LOCK cmpxchgb %ah, (%rdi) jnz 2f - RET(7) + RET 2: movl $0x0100, %eax pause @@ -349,10 +339,10 @@ END(__cpu_simple_unlock) ENTRY(__cpu_simple_lock_try) movl $0x0100, %eax - LOCK(7) + LOCK cmpxchgb %ah, (%rdi) movl $0, %eax setz %al - RET(8) + RET END(__cpu_simple_lock_try)