1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00
freebsd/sys/powerpc
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
..
aim pmap_growkernel: Use VM_ALLOC_NOFREE when allocating pagetable pages 2024-07-30 17:38:24 +02:00
amigaone sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
booke libkern: add ilog2 macro 2024-06-03 11:37:55 -05:00
conf conf: Remove kernel stack swapping support, part 12 2024-07-29 01:43:59 +00:00
cpufreq sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
fpu sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
include atomics: Constify loads 2024-12-16 15:42:26 +01:00
mambo Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
mikrotik sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
mpc85xx Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
ofw Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
powermac Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
powernv Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
powerpc Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
ps3 Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
pseries Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
psim Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00