Module Name: src Committed By: ad Date: Wed May 20 18:39:25 UTC 2020
Modified Files: src/sys/arch/amd64/amd64: cpufunc.S Log Message: Deal with KMSAN fussiness. Pointed out by msaitoh@. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amd64/amd64/cpufunc.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/cpufunc.S diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.54 src/sys/arch/amd64/amd64/cpufunc.S:1.55 --- src/sys/arch/amd64/amd64/cpufunc.S:1.54 Tue May 19 21:54:10 2020 +++ src/sys/arch/amd64/amd64/cpufunc.S Wed May 20 18:39:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.S,v 1.54 2020/05/19 21:54:10 ad Exp $ */ +/* $NetBSD: cpufunc.S,v 1.55 2020/05/20 18:39:25 ad Exp $ */ /* * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc. @@ -206,7 +206,23 @@ ENTRY(x86_hotpatch) END(x86_hotpatch) #endif /* !XENPV */ -ENTRY(tsc_get_timecount) +/* Could be exact same as cpu_counter but for KASAN fussiness. */ +ENTRY(cpu_counter32) + movq CPUVAR(CURLWP), %rcx +1: + movq L_NCSW(%rcx), %rdi + rdtsc + addl CPUVAR(CC_SKEW), %eax + cmpq %rdi, L_NCSW(%rcx) + jne 2f + KMSAN_INIT_RET(4) + ret +2: + jmp 1b +END(cpu_counter32) +STRONG_ALIAS(tsc_get_timecount, cpu_counter32) + +ENTRY(cpu_counter) movq CPUVAR(CURLWP), %rcx 1: movq L_NCSW(%rcx), %rdi @@ -216,14 +232,11 @@ ENTRY(tsc_get_timecount) addq CPUVAR(CC_SKEW), %rax cmpq %rdi, L_NCSW(%rcx) jne 2f - KMSAN_INIT_RET(4) + KMSAN_INIT_RET(8) ret 2: jmp 1b -END(tsc_get_timecount) - -STRONG_ALIAS(cpu_counter, tsc_get_timecount) -STRONG_ALIAS(cpu_counter32, tsc_get_timecount) +END(cpu_counter) ENTRY(rdmsr_safe) movq CPUVAR(CURLWP), %r8