Skip to content

Commit

Permalink
asm: rename XAdd to StoreXAdd
Browse files Browse the repository at this point in the history
XAdd is just another mode of the Store class, so keep the
naming consistent.
  • Loading branch information
lmb committed Sep 12, 2019
1 parent d27bf30 commit a632849
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions asm/load_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ func StoreImm(dst Register, offset int16, value int64, size Size) Instruction {
}
}

// XAddOp returns the OpCode to atomically add a register to a value in memory.
func XAddOp(size Size) OpCode {
// StoreXAddOp returns the OpCode to atomically add a register to a value in memory.
func StoreXAddOp(size Size) OpCode {
return OpCode(StXClass).SetMode(XAddMode).SetSize(size)
}

// XAdd atomically adds src to *dst.
func XAdd(dst, src Register, size Size) Instruction {
// StoreXAdd atomically adds src to *dst.
func StoreXAdd(dst, src Register, size Size) Instruction {
return Instruction{
OpCode: XAddOp(size),
OpCode: StoreXAddOp(size),
Dst: dst,
Src: src,
}
Expand Down
2 changes: 1 addition & 1 deletion example_sock_extract_dist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func newDistanceFilter() (*ebpf.Program, *ebpf.Map, error) {
// load ok? inc. Otherwise? jmp to mapupdate
asm.JEq.Imm(asm.R0, 0, "update-map"),
asm.Mov.Imm(asm.R1, 1),
asm.XAdd(asm.R0, asm.R1, asm.DWord),
asm.StoreXAdd(asm.R0, asm.R1, asm.DWord),
asm.Ja.Label("exit"),

// MapUpdate
Expand Down

0 comments on commit a632849

Please sign in to comment.