29 lines
776 B
ArmAsm
29 lines
776 B
ArmAsm
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
|||
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
|
||
|
|
#include "textflag.h"
|
||
|
|
|
||
|
|
// func cleanAdd(a, b int64) int64
|
||
|
|
// A well-behaved function that preserves all callee-saved registers.
|
||
|
|
TEXT ·cleanAdd(SB), NOSPLIT, $0-24
|
||
|
|
MOVQ a+0(FP), AX
|
||
|
|
ADDQ b+8(FP), AX
|
||
|
|
MOVQ AX, ret+16(FP)
|
||
|
|
RET
|
||
|
|
|
||
|
|
// func dirtyBP(a int64) int64
|
||
|
|
// Deliberately clobbers BP (an ABI violation for a NOSPLIT frame=0 function).
|
||
|
|
TEXT ·dirtyBP(SB), NOSPLIT, $0-16
|
||
|
|
MOVQ $0x1234, BP
|
||
|
|
MOVQ a+0(FP), AX
|
||
|
|
MOVQ AX, ret+8(FP)
|
||
|
|
RET
|
||
|
|
|
||
|
|
// func dirtyR14(a int64) int64
|
||
|
|
// Deliberately clobbers R14 (the goroutine pointer — a serious ABI violation).
|
||
|
|
TEXT ·dirtyR14(SB), NOSPLIT, $0-16
|
||
|
|
MOVQ $0x5678, R14
|
||
|
|
MOVQ a+0(FP), AX
|
||
|
|
MOVQ AX, ret+8(FP)
|
||
|
|
RET
|