From ef1f2bce49b3c25187b4c8d8490983d1b2a18c7c Mon Sep 17 00:00:00 2001 From: luoliwoshang <2643523683@qq.com> Date: Thu, 21 Aug 2025 11:46:56 +0800 Subject: [PATCH] test:linux asmFull function test --- _demo/asmfullcall/asmfullcall_linux.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/_demo/asmfullcall/asmfullcall_linux.go b/_demo/asmfullcall/asmfullcall_linux.go index b0e60f75..8c485c63 100644 --- a/_demo/asmfullcall/asmfullcall_linux.go +++ b/_demo/asmfullcall/asmfullcall_linux.go @@ -1,4 +1,30 @@ +//go:build linux + package main +import "unsafe" + func verify() { + // 0 output & 0 input + asmFull("nop", nil) + + // 0 output & 1 input with memory address + addr := uintptr(unsafe.Pointer(&testVar)) + asmFull("movq {value}, ({addr})", map[string]any{ + "addr": addr, + "value": 43, + }) + check(43, testVar) + + // 1 output & 1 input + res1 := asmFull("movq {value}, {}", map[string]any{ + "value": 41, + }) + check(41, int(res1)) + + res2 := asmFull("movq {a}, {}; addq {b}, {}", map[string]any{ + "a": 25, + "b": 17, + }) + check(42, int(res2)) }