summaryrefslogtreecommitdiff
path: root/vendor/modernc.org/libc/libc_amd64.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/modernc.org/libc/libc_amd64.go')
-rw-r--r--vendor/modernc.org/libc/libc_amd64.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/modernc.org/libc/libc_amd64.go b/vendor/modernc.org/libc/libc_amd64.go
index c17aee5c1..de3e34974 100644
--- a/vendor/modernc.org/libc/libc_amd64.go
+++ b/vendor/modernc.org/libc/libc_amd64.go
@@ -22,3 +22,17 @@ func a_load_16(addr uintptr) uint32 {
return uint32(*(*uint16)(unsafe.Pointer(addr)))
}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}