test(verify): seed the arm64 ABI kernel arguments

Assisted-by: GLM 5.3
This commit is contained in:
2026-09-20 00:57:02 +02:00
parent 0758556b7d
commit d3d47db727
+14 -4
View File
@@ -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")
}