github.com/containers/podman/v4@v4.9.4/pkg/machine/fedora_windows.go (about)

     1  package machine
     2  
     3  import (
     4  	"runtime"
     5  	"syscall"
     6  
     7  	"github.com/sirupsen/logrus"
     8  	"golang.org/x/sys/windows"
     9  )
    10  
    11  func DetermineMachineArch() string {
    12  	const fallbackMsg = "this may result in the wrong Linux arch under emulation"
    13  	var machine, native uint16
    14  	current, _ := syscall.GetCurrentProcess()
    15  
    16  	if err := windows.IsWow64Process2(windows.Handle(current), &machine, &native); err != nil {
    17  		logrus.Warnf("Failure detecting native system architecture, %s: %w", fallbackMsg, err)
    18  		// Fall-back to binary arch
    19  		return runtime.GOARCH
    20  	}
    21  
    22  	switch native {
    23  	// Only care about archs in use with WSL
    24  	case 0xAA64:
    25  		return "arm64"
    26  	case 0x8664:
    27  		return "amd64"
    28  	default:
    29  		logrus.Warnf("Unknown or unsupported native system architecture [%d], %s", fallbackMsg)
    30  		return runtime.GOARCH
    31  	}
    32  }