amd64: Make curlwp and curcpu() flushable.

The only effect of the `volatile' qualifier on an asm block with
outputs is to force the instructions to appear in the generated code,
even if the outputs end up being unused.  Since these instructions
have no (architectural) side effects -- provided %gs is set
correctly, which must be the case here -- there's no need for the
volatile qualifier, so nix it.
This commit is contained in:
riastradh 2023-04-09 08:17:56 +00:00
parent 83045faf04
commit e0aed50401
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.70 2021/11/02 11:26:03 ryo Exp $ */ /* $NetBSD: cpu.h,v 1.71 2023/04/09 08:17:56 riastradh Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -53,7 +53,7 @@ x86_curcpu(void)
{ {
struct cpu_info *ci; struct cpu_info *ci;
__asm volatile("movq %%gs:%1, %0" : __asm("movq %%gs:%1, %0" :
"=r" (ci) : "=r" (ci) :
"m" "m"
(*(struct cpu_info * const *)offsetof(struct cpu_info, ci_self))); (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_self)));
@ -65,7 +65,7 @@ x86_curlwp(void)
{ {
lwp_t *l; lwp_t *l;
__asm volatile("movq %%gs:%1, %0" : __asm("movq %%gs:%1, %0" :
"=r" (l) : "=r" (l) :
"m" "m"
(*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp))); (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));