-/* $OpenBSD: fpgetround.c,v 1.3 2021/12/13 18:28:39 deraadt Exp $ */
+/* $OpenBSD: fpgetround.c,v 1.4 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (C) 2014 Andrew Turner
* All rights reserved.
{
uint32_t fpscr;
- __asm __volatile("mrs %x0, fpcr" : "=&r"(fpscr));
+ __asm volatile("mrs %x0, fpcr" : "=&r"(fpscr));
return ((fpscr >> 22) & 3);
}
-/* $OpenBSD: fpgetsticky.c,v 1.2 2021/12/13 18:28:39 deraadt Exp $ */
+/* $OpenBSD: fpgetsticky.c,v 1.3 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (C) 2014 Andrew Turner
* All rights reserved.
{
fp_except old;
- __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
+ __asm volatile("mrs %x0, fpcr" : "=&r"(old));
return (old & FP_X_MASK);
}
-/* $OpenBSD: fpsetround.c,v 1.3 2021/12/13 18:28:39 deraadt Exp $ */
+/* $OpenBSD: fpsetround.c,v 1.4 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (C) 2014 Andrew Turner
* All rights reserved.
{
uint32_t old, new;
- __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
+ __asm volatile("mrs %x0, fpcr" : "=&r"(old));
new = old & ~(3 << 22);
new |= rnd_dir << 22;
- __asm __volatile("msr fpcr, %x0" : : "r"(new));
+ __asm volatile("msr fpcr, %x0" : : "r"(new));
return ((old >> 22) & 3);
}
-/* $OpenBSD: fpsetsticky.c,v 1.2 2021/12/13 18:28:39 deraadt Exp $ */
+/* $OpenBSD: fpsetsticky.c,v 1.3 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (C) 2014 Andrew Turner
* All rights reserved.
{
fp_except old, new;
- __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
+ __asm volatile("mrs %x0, fpcr" : "=&r"(old));
new = old & ~(FP_X_MASK);
new &= ~except;
- __asm __volatile("msr fpcr, %x0" : : "r"(new));
+ __asm volatile("msr fpcr, %x0" : : "r"(new));
return (old & except);
}
-/* $OpenBSD: fenv.c,v 1.4 2020/07/09 22:13:29 kettenis Exp $ */
+/* $OpenBSD: fenv.c,v 1.5 2022/08/29 02:01:18 jsg Exp $ */
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
#define _FPUSW_SHIFT 8
#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT)
-#define __mrs_fpcr(r) __asm __volatile("mrs %x0, fpcr" : "=r" (r))
-#define __msr_fpcr(r) __asm __volatile("msr fpcr, %x0" : : "r" (r))
+#define __mrs_fpcr(r) __asm volatile("mrs %x0, fpcr" : "=r" (r))
+#define __msr_fpcr(r) __asm volatile("msr fpcr, %x0" : : "r" (r))
-#define __mrs_fpsr(r) __asm __volatile("mrs %x0, fpsr" : "=r" (r))
-#define __msr_fpsr(r) __asm __volatile("msr fpsr, %x0" : : "r" (r))
+#define __mrs_fpsr(r) __asm volatile("mrs %x0, fpsr" : "=r" (r))
+#define __msr_fpsr(r) __asm volatile("msr fpsr, %x0" : : "r" (r))
/*
* The following constant represents the default floating-point environment
-/* $OpenBSD: atomic.h,v 1.21 2021/03/11 11:16:55 jsg Exp $ */
+/* $OpenBSD: atomic.h,v 1.22 2022/08/29 02:01:18 jsg Exp $ */
/* $NetBSD: atomic.h,v 1.1 2003/04/26 18:39:37 fvdl Exp $ */
/*
* ourselves.
*/
-#define __membar(_f) do { __asm __volatile(_f ::: "memory"); } while (0)
+#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
#if defined(MULTIPROCESSOR) || !defined(_KERNEL)
#define membar_enter() __membar("mfence")
-/* $OpenBSD: vfp.c,v 1.4 2019/03/13 09:28:21 patrick Exp $ */
+/* $OpenBSD: vfp.c,v 1.5 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
static inline void
set_vfp_fpexc(uint32_t val)
{
- __asm __volatile(
+ __asm volatile(
".fpu vfpv3\n"
"vmsr fpexc, %0" :: "r" (val));
}
get_vfp_fpexc(void)
{
uint32_t val;
- __asm __volatile(
+ __asm volatile(
".fpu vfpv3\n"
"vmrs %0, fpexc" : "=r" (val));
return val;
uint32_t scratch;
if (get_vfp_fpexc() & VFPEXC_EN) {
- __asm __volatile(
+ __asm volatile(
".fpu vfpv3\n"
"vstmia %1!, {d0-d15}\n" /* d0-d15 */
"vstmia %1!, {d16-d31}\n" /* d16-d31 */
/* enable to be able to load ctx */
set_vfp_fpexc(VFPEXC_EN);
- __asm __volatile(
+ __asm volatile(
".fpu vfpv3\n"
"vldmia %1!, {d0-d15}\n" /* d0-d15 */
"vldmia %1!, {d16-d31}\n" /* d16-d31 */
-/* $OpenBSD: atomic.h,v 1.18 2017/07/31 11:52:49 kettenis Exp $ */
+/* $OpenBSD: atomic.h,v 1.19 2022/08/29 02:01:18 jsg Exp $ */
/* Public Domain */
#define atomic_sub_int_nv(_p, _v) _atomic_sub_int_nv((_p), (_v))
#define atomic_sub_long_nv(_p, _v) _atomic_sub_long_nv((_p), (_v))
-#define __membar(_f) do { __asm __volatile(_f ::: "memory"); } while (0)
+#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
#define membar_enter() __membar("dmb sy")
#define membar_exit() __membar("dmb sy")
-/* $OpenBSD: armreg.h,v 1.20 2022/08/24 22:01:16 kettenis Exp $ */
+/* $OpenBSD: armreg.h,v 1.21 2022/08/29 02:01:18 jsg Exp $ */
/*-
* Copyright (c) 2013, 2014 Andrew Turner
* Copyright (c) 2015 The FreeBSD Foundation
#define READ_SPECIALREG(reg) \
({ uint64_t val; \
- __asm __volatile("mrs %0, " __STRING(reg) : "=&r" (val)); \
+ __asm volatile("mrs %0, " __STRING(reg) : "=&r" (val)); \
val; \
})
#define WRITE_SPECIALREG(reg, val) \
- __asm __volatile("msr " __STRING(reg) ", %0" : : "r"((uint64_t)val))
+ __asm volatile("msr " __STRING(reg) ", %0" : : "r"((uint64_t)val))
/* CCSIDR_EL1 - Current Cache Size ID Register */
#define CCSIDR_SETS_MASK 0x0fffe000
-/* $OpenBSD: atomic.h,v 1.3 2017/05/12 08:48:31 mpi Exp $ */
+/* $OpenBSD: atomic.h,v 1.4 2022/08/29 02:01:18 jsg Exp $ */
/* Public Domain */
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
-#define __membar(_f) do { __asm __volatile(_f ::: "memory"); } while (0)
+#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
#define membar_enter() __membar("dmb sy")
#define membar_exit() __membar("dmb sy")
-/* $OpenBSD: cpu.h,v 1.27 2022/07/13 09:28:19 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.28 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
*
curcpu(void)
{
struct cpu_info *__ci = NULL;
- __asm __volatile("mrs %0, tpidr_el1" : "=r" (__ci));
+ __asm volatile("mrs %0, tpidr_el1" : "=r" (__ci));
return (__ci);
}
-/* $OpenBSD: atomic.h,v 1.19 2021/03/11 11:16:57 jsg Exp $ */
+/* $OpenBSD: atomic.h,v 1.20 2022/08/29 02:01:18 jsg Exp $ */
/* $NetBSD: atomic.h,v 1.1.2.2 2000/02/21 18:54:07 sommerfeld Exp $ */
/*-
* ourselves.
*/
-#define __membar(_f) do { __asm __volatile(_f ::: "memory"); } while (0)
+#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
#if defined(MULTIPROCESSOR) || !defined(_KERNEL)
#define membar_enter() __membar("lock; addl $0,0(%%esp)")
-/* $OpenBSD: atomic.h,v 1.15 2021/05/04 14:05:12 aoyama Exp $ */
+/* $OpenBSD: atomic.h,v 1.16 2022/08/29 02:01:18 jsg Exp $ */
/* Public Domain */
/* trap numbers below 128 would cause a privileged instruction fault */
#define __membar() do { \
- __asm __volatile("tb1 0, %%r0, 128" ::: "memory"); \
+ __asm volatile("tb1 0, %%r0, 128" ::: "memory"); \
} while (0)
#endif /* gcc < 4 */
-/* $OpenBSD: octeonvar.h,v 1.53 2021/03/11 11:16:59 jsg Exp $ */
+/* $OpenBSD: octeonvar.h,v 1.54 2022/08/29 02:01:18 jsg Exp $ */
/* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */
/*-
{
int ret;
- __asm __volatile ( \
+ __asm volatile ( \
_ASM_PROLOGUE_MIPS64
" clz %0, %1 \n"
_ASM_EPILOGUE
-/* $OpenBSD: atomic.h,v 1.12 2019/07/11 21:18:05 kettenis Exp $ */
+/* $OpenBSD: atomic.h,v 1.13 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
#define atomic_inc_long_nv(_p) _atomic_addic_long_nv((_p), 1)
#define atomic_dec_long_nv(_p) _atomic_addic_long_nv((_p), -1)
-#define __membar(_f) do { __asm __volatile(_f ::: "memory"); } while (0)
+#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
#if defined(MULTIPROCESSOR) || !defined(_KERNEL)
#define membar_enter() __membar("isync")
-/* $OpenBSD: atomic.h,v 1.2 2020/07/01 18:25:31 kettenis Exp $ */
+/* $OpenBSD: atomic.h,v 1.3 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
#define atomic_inc_long_nv(_p) _atomic_addic_long_nv((_p), 1)
#define atomic_dec_long_nv(_p) _atomic_addic_long_nv((_p), -1)
-#define __membar(_f) do { __asm __volatile(_f ::: "memory"); } while (0)
+#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
#if defined(MULTIPROCESSOR) || !defined(_KERNEL)
#define membar_enter() __membar("isync")
-/* $OpenBSD: syncicache.c,v 1.3 2020/06/26 20:58:38 kettenis Exp $ */
+/* $OpenBSD: syncicache.c,v 1.4 2022/08/29 02:01:18 jsg Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
__asm volatile ("sync");
p = (char *)from - off;
do {
- __asm __volatile ("icbi 0,%0" :: "r"(p));
+ __asm volatile ("icbi 0,%0" :: "r"(p));
p += cacheline_size;
len -= cacheline_size;
} while (len + cacheline_size > cacheline_size);
-/* $OpenBSD: atomic.h,v 1.3 2021/06/25 13:25:53 jsg Exp $ */
+/* $OpenBSD: atomic.h,v 1.4 2022/08/29 02:01:18 jsg Exp $ */
/* Public Domain */
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
-#define __membar(_f) do {__asm __volatile(_f ::: "memory"); } while (0)
+#define __membar(_f) do {__asm volatile(_f ::: "memory"); } while (0)
#define membar_enter() __membar("fence w,rw")
#define membar_exit() __membar("fence rw,w")
static inline void
atomic_setbits_int(volatile unsigned int *p, unsigned int v)
{
- __asm __volatile("amoor.w zero, %1, %0"
+ __asm volatile("amoor.w zero, %1, %0"
: "+A" (*p)
: "r" (v)
: "memory");
static inline void
atomic_store_64(volatile uint64_t *p, uint64_t v)
{
- __asm __volatile("amoor.d zero, %1, %0"
+ __asm volatile("amoor.d zero, %1, %0"
: "+A" (*p)
: "r" (v)
: "memory");
static inline void
atomic_clearbits_int(volatile unsigned int *p, unsigned int v)
{
- __asm __volatile("amoand.w zero, %1, %0"
+ __asm volatile("amoand.w zero, %1, %0"
: "+A" (*p)
: "r" (~v)
: "memory");
-/* $OpenBSD: cpu.h,v 1.13 2022/08/09 04:49:08 cheloha Exp $ */
+/* $OpenBSD: cpu.h,v 1.14 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>
curcpu(void)
{
struct cpu_info *__ci = NULL;
- __asm __volatile("mv %0, tp" : "=&r"(__ci));
+ __asm volatile("mv %0, tp" : "=&r"(__ci));
return (__ci);
}
static inline void
intr_enable(void)
{
- __asm __volatile("csrsi sstatus, %0" :: "i" (SSTATUS_SIE));
+ __asm volatile("csrsi sstatus, %0" :: "i" (SSTATUS_SIE));
}
static inline u_long
{
uint64_t ret;
- __asm __volatile(
+ __asm volatile(
"csrrci %0, sstatus, %1"
: "=&r" (ret) : "i" (SSTATUS_SIE)
);
static inline void
intr_restore(u_long s)
{
- __asm __volatile("csrs sstatus, %0" :: "r" (s));
+ __asm volatile("csrs sstatus, %0" :: "r" (s));
}
void delay (unsigned);
-/* $OpenBSD: cpufunc.h,v 1.4 2021/05/18 09:14:49 kettenis Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.5 2022/08/29 02:01:18 jsg Exp $ */
/*-
* Copyright (c) 2014 Andrew Turner
static __inline void
fence_i(void)
{
- __asm __volatile("fence.i" ::: "memory");
+ __asm volatile("fence.i" ::: "memory");
}
static __inline void
sfence_vma(void)
{
- __asm __volatile("sfence.vma" ::: "memory");
+ __asm volatile("sfence.vma" ::: "memory");
}
static __inline void
sfence_vma_page(uintptr_t addr)
{
- __asm __volatile("sfence.vma %0"
+ __asm volatile("sfence.vma %0"
:
: "r" (addr)
: "memory");
static __inline void
sfence_vma_asid(uint64_t asid)
{
- __asm __volatile("sfence.vma x0, %0"
+ __asm volatile("sfence.vma x0, %0"
:
: "r" (asid)
: "memory");
static __inline void
sfence_vma_page_asid(uintptr_t addr, uint64_t asid)
{
- __asm __volatile("sfence.vma %0, %1"
+ __asm volatile("sfence.vma %0, %1"
:
: "r" (addr), "r" (asid)
: "memory");
static __inline void
load_satp(uint64_t val)
{
- __asm __volatile("csrw satp, %0" :: "r"(val));
+ __asm volatile("csrw satp, %0" :: "r"(val));
}
#define cpufunc_nullop() riscv_nullop()
-/* $OpenBSD: riscvreg.h,v 1.4 2021/07/06 19:09:57 patrick Exp $ */
+/* $OpenBSD: riscvreg.h,v 1.5 2022/08/29 02:01:18 jsg Exp $ */
/*-
* Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>
#define csr_swap(csr, val) \
({ if (CSR_ZIMM(val)) \
- __asm __volatile("csrrwi %0, " #csr ", %1" \
+ __asm volatile("csrrwi %0, " #csr ", %1" \
: "=r" (val) : "i" (val)); \
else \
- __asm __volatile("csrrw %0, " #csr ", %1" \
+ __asm volatile("csrrw %0, " #csr ", %1" \
: "=r" (val) : "r" (val)); \
val; \
})
#define csr_write(csr, val) \
({ if (CSR_ZIMM(val)) \
- __asm __volatile("csrwi " #csr ", %0" :: "i" (val)); \
+ __asm volatile("csrwi " #csr ", %0" :: "i" (val)); \
else \
- __asm __volatile("csrw " #csr ", %0" :: "r" (val)); \
+ __asm volatile("csrw " #csr ", %0" :: "r" (val)); \
})
#define csr_set(csr, val) \
({ if (CSR_ZIMM(val)) \
- __asm __volatile("csrsi " #csr ", %0" :: "i" (val)); \
+ __asm volatile("csrsi " #csr ", %0" :: "i" (val)); \
else \
- __asm __volatile("csrs " #csr ", %0" :: "r" (val)); \
+ __asm volatile("csrs " #csr ", %0" :: "r" (val)); \
})
#define csr_clear(csr, val) \
({ if (CSR_ZIMM(val)) \
- __asm __volatile("csrci " #csr ", %0" :: "i" (val)); \
+ __asm volatile("csrci " #csr ", %0" :: "i" (val)); \
else \
- __asm __volatile("csrc " #csr ", %0" :: "r" (val)); \
+ __asm volatile("csrc " #csr ", %0" :: "r" (val)); \
})
#define csr_read(csr) \
({ u_long val; \
- __asm __volatile("csrr %0, " #csr : "=r" (val)); \
+ __asm volatile("csrr %0, " #csr : "=r" (val)); \
val; \
})
-/* $OpenBSD: sbi.h,v 1.4 2021/07/02 08:44:37 kettenis Exp $ */
+/* $OpenBSD: sbi.h,v 1.5 2022/08/29 02:01:18 jsg Exp $ */
/*-
* Copyright (c) 2016-2017 Ruslan Bukin <br@bsdpad.com>
register uintptr_t a6 __asm ("a6") = (uintptr_t)(arg6);
register uintptr_t a7 __asm ("a7") = (uintptr_t)(arg7);
- __asm __volatile( \
+ __asm volatile( \
"ecall" \
:"+r"(a0), "+r"(a1) \
:"r"(a2), "r"(a3), "r"(a6), "r"(a7) \
-/* $OpenBSD: pmap.c,v 1.21 2022/01/01 11:45:35 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.22 2022/08/29 02:01:18 jsg Exp $ */
/*
* Copyright (c) 2019-2020 Brian Bamsch <bbamsch@google.com>
//switching to new page table
uint64_t satp = pmap_kernel()->pm_satp;
- __asm __volatile("csrw satp, %0" :: "r" (satp) : "memory");
+ __asm volatile("csrw satp, %0" :: "r" (satp) : "memory");
printf("all mapped\n");