-
Notifications
You must be signed in to change notification settings - Fork 18k
syscall: floating point parameters are not supported on windows/arm64 #62583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like windows/arm64 doesn't set float parameters into the dedicated floating point registers, which produces an exception down the line. For example, here is where the first cgo parameter is set: go/src/runtime/sys_windows_arm64.s Line 83 in 905b58b
But it should be something like this: MOVD (0*8)(R12), R0
FMOVD R0, F0 Unfortunately, the fix is not that easy. AArch64 calling convention allocates registers for integers and floating points independently. I.e., in I wonder how is this implemented in other arm64 OSes. @golang/compiler |
Also, worth noting that go/src/runtime/syscall_windows_test.go Lines 824 to 830 in 905b58b
Related to #6510. |
@qmuntal on other platforms we generally assume syscalls don't take floating point arguments. |
If floating point args are a general case for Windows syscalls, we probably need some other mechanism beyond |
@cherrymui Since we have |
I don't think we can have two variadic args, one for integer and one for floats. If there is a way to write such a variadic function and implement it, I'd be totally fine. |
Hmm, what about this API which accept a mix of integer and floating point arguments: // SyscallFPN is like SyscallN but for functions that accept floating point arguments.
// To flag an argument as floating point, set the corresponding bit in the floats bitmask.
// If floats is 1, all arguments are assumed to be floating point.
//
// For example, if the second and third argument are floating points, use
//
// syscall.SyscallFPN(trap, 1<<2|1<<3, a0, uintptr(math.Float64bits(a1)), uintptr(math.Float64bits(a2)), a3)
func SyscallFPN(trap uintptr, floats byte, args ...uintptr) (r1, r2 uintptr, err Errno) |
Related issue, but for Windows C APIs calling back to Go: #45300 I'd be much more comfortable with a typed API, perhaps something along the lines of:
This is essentially the inverse of how syscall.NewCallback works. I haven't thought through how this would be implemented. It would probably be tricky, and look something like a cross between NewCallback and reflect.makeMethodValue. In general, I quite dislike the Windows |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Cross build for Windows from a Linux machine.
amd64
build works as expected running on bothamd64
orarm64
machine.arm64
version crashes with a runtime exception.What did you expect to see?
Building on Linux:
Running on Windows ARM64:
What did you see instead?
The text was updated successfully, but these errors were encountered: