golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.9k stars 17.65k forks source link

cmd/asm: add Intel architecture ISA extension for user interrupts #57502

Open markbrown314 opened 1 year ago

markbrown314 commented 1 year ago

What version of Go are you using (go version)?

$ go version
go version go1.19.4 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/XXXX/.cache/go-build"
GOENV="/home/XXXX/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/XXXX/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/XXXX/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/XXXX/Code/personal.XXXX.user.interrupts/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/XXXX/Code/personal.XXXX.user.interrupts/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2212410684=/tmp/go-build -gno-record-gcc-switches"

The issue

Go assembler for x86 does not currently have support for the user interrupts instructions: CLUI, STUI, SENDUIPI, TESTUI, UIRET. These instructions are supported by the Sapphire Rapids platform and specified in Intel ISA Extensions Reference (since rev 041). I believe the x86_64 is assembler instructions in aenum.go are generated from a csv generated from X86spec and Intel® 64 and IA-32 Architectures Software Developer's Manual. Given that I am not supposed to modify aenum.go and aenames.go there is no viable way to add extended ISA instructions to the assembler.

gopherbot commented 1 year ago

Change https://go.dev/cl/459935 mentions this issue: cmd/asm/internal: added user interrupts support

dmitshur commented 1 year ago

CC @golang/compiler.

cherrymui commented 1 year ago

Thanks for being interested in contribution!

aenum.go is generated from golang.org/x/arch/x86/x86avxgen , which in turn uses x86/xeddata. But there have been hand modifications to the file since then. You're welcome modify the code generator to have them generated. But if that is difficult, another hand modification is probably fine. Thanks.

markbrown314 commented 1 year ago

I will take a look at modifying it and resubmitting. Thank you!