From d3d47db72708458ff9927d8ca7b480886621f870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Balv=C3=ADn?= Date: Sun, 20 Sep 2026 00:57:02 +0200 Subject: [PATCH] test(verify): seed the arm64 ABI kernel arguments Assisted-by: GLM 5.3 --- verify/abi_arch_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/verify/abi_arch_test.go b/verify/abi_arch_test.go index f9583f7..012e4ac 100644 --- a/verify/abi_arch_test.go +++ b/verify/abi_arch_test.go @@ -42,8 +42,12 @@ func TestABIArm64(t *testing.T) { t.Errorf("cleanAdd: %s", report) } - // dirtyFP clobbers the frame pointer (R29). - out, report, err = k.CallFuncChecked("dirtyFP", make([]byte, 16)) + // dirtyFP clobbers the frame pointer (R29). The kernel passes its + // argument through, so the argument must carry the expected value the + // way the amd64 twin test seeds it. + args = make([]byte, 16) + PutUint64(args, 0, 0x1234) + out, report, err = k.CallFuncChecked("dirtyFP", args) if err != nil { t.Fatalf("CallFuncChecked: %v", err) } @@ -57,11 +61,17 @@ func TestABIArm64(t *testing.T) { t.Errorf("dirtyFP: only R29 should be clobbered: %s", report) } - // dirtyG clobbers the goroutine pointer (R28). - _, report, err = k.CallFuncChecked("dirtyG", make([]byte, 16)) + // dirtyG clobbers the goroutine pointer (R28) and still returns its + // argument. + args = make([]byte, 16) + PutUint64(args, 0, 0x5678) + out, report, err = k.CallFuncChecked("dirtyG", args) if err != nil { t.Fatalf("CallFuncChecked: %v", err) } + if got := int64(GetUint64(out, 8)); got != 0x5678 { + t.Errorf("dirtyG returned %d, want %d", got, int64(0x5678)) + } if !report.GClobbered { t.Error("dirtyG: expected g clobbered, but report says clean") }