31 lines
811 B
ArmAsm
31 lines
811 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
|
|
MOVD a+0(FP), R0
|
|
MOVD b+8(FP), R1
|
|
ADD R0, R1, R0
|
|
MOVD R0, ret+16(FP)
|
|
RET
|
|
|
|
// func dirtyFP(a int64) int64
|
|
// Deliberately clobbers R29, the frame pointer (an ABI violation for a
|
|
// NOSPLIT frame=0 function).
|
|
TEXT ·dirtyFP(SB), NOSPLIT, $0-16
|
|
MOVD $0x1234, R29
|
|
MOVD a+0(FP), R0
|
|
MOVD R0, ret+8(FP)
|
|
RET
|
|
|
|
// func dirtyG(a int64) int64
|
|
// Deliberately clobbers g, the goroutine pointer (R28; a serious ABI violation).
|
|
TEXT ·dirtyG(SB), NOSPLIT, $0-16
|
|
MOVD $0x5678, g
|
|
MOVD a+0(FP), R0
|
|
MOVD R0, ret+8(FP)
|
|
RET
|