2026-08-30 11:27:54 +02:00
|
|
|
// 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 the goroutine pointer.
|
|
|
|
|
TEXT ·cleanAdd(SB), NOSPLIT, $0-24
|
|
|
|
|
MOV a+0(FP), X5
|
|
|
|
|
MOV b+8(FP), X6
|
|
|
|
|
ADD X5, X6, X5
|
|
|
|
|
MOV X5, ret+16(FP)
|
|
|
|
|
RET
|
|
|
|
|
|
|
|
|
|
// func dirtyG(a int64) int64
|
2026-09-20 00:38:24 +02:00
|
|
|
// Deliberately clobbers g, the goroutine pointer (X27; a serious ABI violation).
|
2026-08-30 11:27:54 +02:00
|
|
|
TEXT ·dirtyG(SB), NOSPLIT, $0-16
|
2026-09-20 00:38:24 +02:00
|
|
|
MOV $0x5678, g
|
2026-08-30 11:27:54 +02:00
|
|
|
MOV a+0(FP), X5
|
|
|
|
|
MOV X5, ret+8(FP)
|
|
|
|
|
RET
|