opnsense-src/sys/amd64/include
Olivier Certner 5e9a82e898
atomics: Constify loads
In order to match reality, allow using these functions with pointers on
const objects, and bring us closer to C11.

Remove the '+' modifier in the atomic_load_acq_64_i586()'s inline asm
statement's constraint for '*p' (the value to load).  CMPXCHG8B always
writes back some value, even when the value exchange does not happen in
which case what was read is written back.  atomic_load_acq_64_i586()
further takes care of the operation atomically writing back the same
value that was read in any case.  All in all, this makes the inline
asm's write back undetectable by any other code, whether executing on
other CPUs or code on the same CPU before and after the call to
atomic_load_acq_64_i586(), except for the fact that CMPXCHG8B will
trigger a #GP(0) if the memory address is part of a read-only mapping.
This unfortunate property is however out of scope of the C abstract
machine, and in particular independent of whether the 'uint64_t' pointed
to is declared 'const' or not.

Approved by:    markj (mentor)
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46887
2024-12-16 15:42:26 +01:00
..
pc sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
xen xen: add SPDX license tags to Xen headers 2023-12-15 14:59:25 +01:00
_align.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
_bus.h _bus.h: Use standard licnese text 2023-11-13 12:25:30 -07:00
_inttypes.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
_limits.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
_pmap.h amd64: move definition of the struct pmap_pcids into _pmap.h 2023-05-02 14:32:20 +03:00
_stdint.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
_types.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
acpica_machdep.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
apm_bios.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
asan.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
asm.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00
asmacros.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
atomic.h atomics: Constify loads 2024-12-16 15:42:26 +01:00
bus.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
bus_dma.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00
clock.h x86: Deduplicate clock.h 2021-12-06 10:39:08 -05:00
counter.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
cpu.h vmm: Correctly suspend and resume the vmm driver. 2024-11-29 14:38:35 -07:00
cpufunc.h amd64: Add wrappers for XRSTORS and XSAVES 2024-12-15 16:39:36 +01:00
cputypes.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
csan.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
db_machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
dump.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
efi.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
elf.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
endian.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
exec.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
fdt.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
float.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
floatingpoint.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
fpu.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
frame.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
gdb_machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieeefp.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
in_cksum.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
intr_machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
iodev.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
iommu.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
kdb.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
limits.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
md_var.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
memdev.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
metadata.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
minidump.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
msan.h msan: Fix typo 2024-04-11 11:28:09 -06:00
nexusvar.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
npx.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ofw_machdep.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
param.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00
pcb.h amd64 pcb.h: use 4 hex digits for pcb flags 2024-02-11 05:38:41 +02:00
pci_cfgreg.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pcpu.h amd64 pcpu: fix clobbers, suppress warnings, and clean up 2024-07-03 08:36:31 -07:00
pcpu_aux.h amd64 pcpu: fix clobbers, suppress warnings, and clean up 2024-07-03 08:36:31 -07:00
pmap.h amd64: add machine/pte.h 2024-11-26 21:48:27 +02:00
pmc_mdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
proc.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
procctl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
profile.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
psl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pte.h amd64: add machine/pte.h 2024-11-26 21:48:27 +02:00
ptrace.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pvclock.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
reg.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
reloc.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
resource.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00
runq.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sdt_machdep.h sdt: Use a multibyte nop for tracepoints on amd64 2024-07-08 11:40:06 -04:00
segments.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
setjmp.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
sf_buf.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00
sgx.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sgxreg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sigframe.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
signal.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
smp.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
specialreg.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
stack.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
stdarg.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
sysarch.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
tls.h Add <machine/tls.h> header to hold MD constants and helpers for TLS. 2021-12-09 13:17:13 -08:00
trap.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
tss.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
ucontext.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
vdso.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
vm.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vmm.h vmm: Correctly suspend and resume the vmm driver. 2024-11-29 14:38:35 -07:00
vmm_dev.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00
vmm_instruction_emul.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00
vmm_snapshot.h vmm: Fix compiling error with BHYVE_SNAPSHOT 2024-02-06 10:38:34 -05:00
vmparam.h Remove stray whitespaces from sys/amd64/ 2024-09-21 07:05:46 -06:00