Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/internal/runtime/atomic/atomic_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func Xchg64(ptr *uint64, new uint64) uint64
//go:noescape
func Xchg(ptr *uint32, new uint32) uint32

//go:noescape
func Xchg8(ptr *uint8, new uint8) uint8

//go:noescape
func Xchguintptr(ptr *uintptr, new uintptr) uintptr

Expand Down
8 changes: 8 additions & 0 deletions src/internal/runtime/atomic/atomic_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ addloop:
MOVL CX, ret_hi+16(FP)
RET

// uint8 Xchg8(uint8 *ptr, uint8 new)
TEXT ·Xchg8(SB), NOSPLIT, $0-9
MOVL ptr+0(FP), BX
MOVB new+4(FP), AX
XCHGB AX, 0(BX)
MOVB AX, ret+8(FP)
RET

TEXT ·Xchg(SB), NOSPLIT, $0-12
MOVL ptr+0(FP), BX
MOVL new+4(FP), AX
Expand Down
2 changes: 1 addition & 1 deletion src/internal/runtime/atomic/xchg8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build amd64 || arm64 || ppc64 || ppc64le
//go:build 386 || amd64 || arm64 || ppc64 || ppc64le

package atomic_test

Expand Down