From 23b15d0eb6d75af04bbee3f14b2e4454ec68881b Mon Sep 17 00:00:00 2001 From: Evan Raw Date: Tue, 21 Apr 2026 17:40:35 -0500 Subject: [PATCH] AUTH-4699, AUTH-8460, TUN-10179: Vendor gopsutil/v4 for cross-platform process identification --- go.mod | 10 +- go.sum | 22 +- .../github.com/ebitengine/purego/.gitignore | 1 + vendor/github.com/ebitengine/purego/LICENSE | 201 + vendor/github.com/ebitengine/purego/README.md | 119 + .../github.com/ebitengine/purego/abi_amd64.h | 99 + .../github.com/ebitengine/purego/abi_arm64.h | 39 + .../ebitengine/purego/abi_loong64.h | 60 + vendor/github.com/ebitengine/purego/cgo.go | 19 + .../github.com/ebitengine/purego/dlerror.go | 17 + vendor/github.com/ebitengine/purego/dlfcn.go | 99 + .../ebitengine/purego/dlfcn_android.go | 34 + .../ebitengine/purego/dlfcn_darwin.go | 20 + .../ebitengine/purego/dlfcn_freebsd.go | 14 + .../ebitengine/purego/dlfcn_linux.go | 16 + .../ebitengine/purego/dlfcn_netbsd.go | 15 + .../ebitengine/purego/dlfcn_nocgo_freebsd.go | 11 + .../ebitengine/purego/dlfcn_nocgo_linux.go | 19 + .../ebitengine/purego/dlfcn_nocgo_netbsd.go | 9 + .../ebitengine/purego/dlfcn_playground.go | 24 + .../ebitengine/purego/dlfcn_stubs.s | 22 + vendor/github.com/ebitengine/purego/func.go | 571 +++ vendor/github.com/ebitengine/purego/gen.go | 6 + .../ebitengine/purego/go_runtime.go | 13 + .../purego/internal/cgo/dlfcn_cgo_unix.go | 56 + .../ebitengine/purego/internal/cgo/empty.go | 6 + .../purego/internal/cgo/syscall_cgo_unix.go | 55 + .../purego/internal/fakecgo/abi_amd64.h | 99 + .../purego/internal/fakecgo/abi_arm64.h | 39 + .../purego/internal/fakecgo/abi_loong64.h | 60 + .../purego/internal/fakecgo/abi_ppc64x.h | 195 + .../purego/internal/fakecgo/asm_386.s | 29 + .../purego/internal/fakecgo/asm_amd64.s | 39 + .../purego/internal/fakecgo/asm_arm.s | 52 + .../purego/internal/fakecgo/asm_arm64.s | 36 + .../purego/internal/fakecgo/asm_loong64.s | 40 + .../purego/internal/fakecgo/asm_ppc64le.s | 82 + .../purego/internal/fakecgo/asm_riscv64.s | 78 + .../purego/internal/fakecgo/asm_s390x.s | 55 + .../purego/internal/fakecgo/callbacks.go | 93 + .../ebitengine/purego/internal/fakecgo/doc.go | 32 + .../purego/internal/fakecgo/fakecgo.go | 14 + .../purego/internal/fakecgo/freebsd.go | 27 + .../purego/internal/fakecgo/go_darwin.go | 88 + .../purego/internal/fakecgo/go_freebsd.go | 100 + .../purego/internal/fakecgo/go_libinit.go | 72 + .../purego/internal/fakecgo/go_linux.go | 100 + .../purego/internal/fakecgo/go_netbsd.go | 106 + .../purego/internal/fakecgo/go_setenv.go | 18 + .../purego/internal/fakecgo/go_util.go | 38 + .../purego/internal/fakecgo/iscgo.go | 19 + .../purego/internal/fakecgo/libcgo.go | 39 + .../purego/internal/fakecgo/libcgo_darwin.go | 26 + .../purego/internal/fakecgo/libcgo_freebsd.go | 20 + .../purego/internal/fakecgo/libcgo_linux.go | 20 + .../purego/internal/fakecgo/libcgo_netbsd.go | 26 + .../purego/internal/fakecgo/netbsd.go | 23 + .../purego/internal/fakecgo/setenv.go | 19 + .../purego/internal/fakecgo/trampolines_386.s | 107 + .../internal/fakecgo/trampolines_amd64.s | 107 + .../purego/internal/fakecgo/trampolines_arm.s | 81 + .../internal/fakecgo/trampolines_arm64.s | 84 + .../internal/fakecgo/trampolines_loong64.s | 88 + .../internal/fakecgo/trampolines_ppc64le.s | 227 + .../internal/fakecgo/trampolines_riscv64.s | 72 + .../purego/internal/fakecgo/zsymbols.go | 165 + .../internal/fakecgo/zsymbols_darwin.go | 59 + .../internal/fakecgo/zsymbols_freebsd.go | 48 + .../purego/internal/fakecgo/zsymbols_linux.go | 48 + .../internal/fakecgo/zsymbols_netbsd.go | 59 + .../internal/fakecgo/ztrampolines_darwin.s | 19 + .../internal/fakecgo/ztrampolines_freebsd.s | 16 + .../internal/fakecgo/ztrampolines_linux.s | 16 + .../internal/fakecgo/ztrampolines_netbsd.s | 19 + .../internal/fakecgo/ztrampolines_stubs.s | 55 + .../purego/internal/strings/strings.go | 40 + .../purego/internal/xreflect/reflect_go124.go | 15 + .../purego/internal/xreflect/reflect_go125.go | 12 + vendor/github.com/ebitengine/purego/is_ios.go | 13 + vendor/github.com/ebitengine/purego/nocgo.go | 25 + .../ebitengine/purego/struct_386.go | 41 + .../ebitengine/purego/struct_amd64.go | 286 ++ .../ebitengine/purego/struct_arm.go | 85 + .../ebitengine/purego/struct_arm64.go | 549 +++ .../ebitengine/purego/struct_loong64.go | 213 + .../ebitengine/purego/struct_ppc64le.go | 143 + .../ebitengine/purego/struct_riscv64.go | 143 + .../ebitengine/purego/struct_s390x.go | 143 + vendor/github.com/ebitengine/purego/sys_386.s | 147 + .../github.com/ebitengine/purego/sys_amd64.s | 170 + vendor/github.com/ebitengine/purego/sys_arm.s | 142 + .../github.com/ebitengine/purego/sys_arm64.s | 97 + .../ebitengine/purego/sys_loong64.s | 96 + .../ebitengine/purego/sys_ppc64le.s | 120 + .../ebitengine/purego/sys_riscv64.s | 101 + .../github.com/ebitengine/purego/sys_s390x.s | 114 + .../ebitengine/purego/sys_unix_386.s | 226 + .../ebitengine/purego/sys_unix_arm.s | 89 + .../ebitengine/purego/sys_unix_arm64.s | 70 + .../ebitengine/purego/sys_unix_loong64.s | 75 + .../ebitengine/purego/sys_unix_ppc64le.s | 114 + .../ebitengine/purego/sys_unix_riscv64.s | 79 + .../ebitengine/purego/sys_unix_s390x.s | 109 + .../github.com/ebitengine/purego/syscall.go | 83 + .../ebitengine/purego/syscall_32bit.go | 109 + .../ebitengine/purego/syscall_cgo_linux.go | 21 + .../ebitengine/purego/syscall_sysv.go | 320 ++ .../ebitengine/purego/syscall_sysv_others.go | 28 + .../purego/syscall_sysv_stackargs.go | 33 + .../ebitengine/purego/syscall_windows.go | 46 + .../ebitengine/purego/zcallback_386.s | 4014 ++++++++++++++++ .../ebitengine/purego/zcallback_amd64.s | 2014 ++++++++ .../ebitengine/purego/zcallback_arm.s | 4014 ++++++++++++++++ .../ebitengine/purego/zcallback_arm64.s | 4014 ++++++++++++++++ .../ebitengine/purego/zcallback_loong64.s | 4014 ++++++++++++++++ .../ebitengine/purego/zcallback_ppc64le.s | 4014 ++++++++++++++++ .../ebitengine/purego/zcallback_riscv64.s | 4051 +++++++++++++++++ .../ebitengine/purego/zcallback_s390x.s | 4015 ++++++++++++++++ vendor/github.com/go-ole/go-ole/.travis.yml | 8 + vendor/github.com/go-ole/go-ole/ChangeLog.md | 49 + vendor/github.com/go-ole/go-ole/LICENSE | 21 + vendor/github.com/go-ole/go-ole/README.md | 46 + vendor/github.com/go-ole/go-ole/appveyor.yml | 54 + vendor/github.com/go-ole/go-ole/com.go | 344 ++ vendor/github.com/go-ole/go-ole/com_func.go | 174 + vendor/github.com/go-ole/go-ole/connect.go | 192 + vendor/github.com/go-ole/go-ole/constants.go | 153 + vendor/github.com/go-ole/go-ole/error.go | 51 + vendor/github.com/go-ole/go-ole/error_func.go | 8 + .../github.com/go-ole/go-ole/error_windows.go | 24 + vendor/github.com/go-ole/go-ole/guid.go | 284 ++ .../go-ole/go-ole/iconnectionpoint.go | 20 + .../go-ole/go-ole/iconnectionpoint_func.go | 21 + .../go-ole/go-ole/iconnectionpoint_windows.go | 43 + .../go-ole/iconnectionpointcontainer.go | 17 + .../go-ole/iconnectionpointcontainer_func.go | 11 + .../iconnectionpointcontainer_windows.go | 25 + vendor/github.com/go-ole/go-ole/idispatch.go | 94 + .../go-ole/go-ole/idispatch_func.go | 19 + .../go-ole/go-ole/idispatch_windows.go | 202 + .../github.com/go-ole/go-ole/ienumvariant.go | 19 + .../go-ole/go-ole/ienumvariant_func.go | 19 + .../go-ole/go-ole/ienumvariant_windows.go | 63 + .../github.com/go-ole/go-ole/iinspectable.go | 18 + .../go-ole/go-ole/iinspectable_func.go | 15 + .../go-ole/go-ole/iinspectable_windows.go | 72 + .../go-ole/go-ole/iprovideclassinfo.go | 21 + .../go-ole/go-ole/iprovideclassinfo_func.go | 7 + .../go-ole/iprovideclassinfo_windows.go | 21 + vendor/github.com/go-ole/go-ole/itypeinfo.go | 34 + .../go-ole/go-ole/itypeinfo_func.go | 7 + .../go-ole/go-ole/itypeinfo_windows.go | 21 + vendor/github.com/go-ole/go-ole/iunknown.go | 57 + .../github.com/go-ole/go-ole/iunknown_func.go | 19 + .../go-ole/go-ole/iunknown_windows.go | 58 + vendor/github.com/go-ole/go-ole/ole.go | 190 + .../go-ole/go-ole/oleutil/connection.go | 100 + .../go-ole/go-ole/oleutil/connection_func.go | 10 + .../go-ole/oleutil/connection_windows.go | 58 + .../go-ole/go-ole/oleutil/go-get.go | 6 + .../go-ole/go-ole/oleutil/oleutil.go | 127 + vendor/github.com/go-ole/go-ole/safearray.go | 27 + .../go-ole/go-ole/safearray_func.go | 211 + .../go-ole/go-ole/safearray_windows.go | 337 ++ .../go-ole/go-ole/safearrayconversion.go | 140 + .../go-ole/go-ole/safearrayslices.go | 33 + vendor/github.com/go-ole/go-ole/utility.go | 101 + vendor/github.com/go-ole/go-ole/variables.go | 15 + vendor/github.com/go-ole/go-ole/variant.go | 105 + .../github.com/go-ole/go-ole/variant_386.go | 11 + .../github.com/go-ole/go-ole/variant_amd64.go | 12 + .../github.com/go-ole/go-ole/variant_arm.go | 11 + .../github.com/go-ole/go-ole/variant_arm64.go | 13 + .../go-ole/go-ole/variant_date_386.go | 22 + .../go-ole/go-ole/variant_date_amd64.go | 20 + .../go-ole/go-ole/variant_date_arm.go | 22 + .../go-ole/go-ole/variant_date_arm64.go | 23 + .../go-ole/go-ole/variant_ppc64le.go | 12 + .../github.com/go-ole/go-ole/variant_s390x.go | 12 + vendor/github.com/go-ole/go-ole/vt_string.go | 58 + vendor/github.com/go-ole/go-ole/winrt.go | 99 + vendor/github.com/go-ole/go-ole/winrt_doc.go | 36 + vendor/github.com/lufia/plan9stats/.gitignore | 12 + vendor/github.com/lufia/plan9stats/LICENSE | 29 + vendor/github.com/lufia/plan9stats/README.md | 2 + vendor/github.com/lufia/plan9stats/cpu.go | 288 ++ vendor/github.com/lufia/plan9stats/doc.go | 2 + vendor/github.com/lufia/plan9stats/host.go | 303 ++ vendor/github.com/lufia/plan9stats/int.go | 31 + vendor/github.com/lufia/plan9stats/opts.go | 21 + vendor/github.com/lufia/plan9stats/stats.go | 88 + .../github.com/power-devops/perfstat/LICENSE | 23 + .../power-devops/perfstat/c_helpers.c | 159 + .../power-devops/perfstat/c_helpers.h | 58 + .../power-devops/perfstat/config.go | 19 + .../power-devops/perfstat/cpustat.go | 138 + .../power-devops/perfstat/diskstat.go | 138 + .../github.com/power-devops/perfstat/doc.go | 316 ++ .../power-devops/perfstat/fsstat.go | 32 + .../power-devops/perfstat/helpers.go | 819 ++++ .../power-devops/perfstat/lparstat.go | 40 + .../power-devops/perfstat/lvmstat.go | 73 + .../power-devops/perfstat/memstat.go | 85 + .../power-devops/perfstat/netstat.go | 118 + .../power-devops/perfstat/procstat.go | 76 + .../power-devops/perfstat/sysconf.go | 196 + .../power-devops/perfstat/systemcfg.go | 662 +++ .../power-devops/perfstat/types_cpu.go | 186 + .../power-devops/perfstat/types_disk.go | 176 + .../power-devops/perfstat/types_fs.go | 195 + .../power-devops/perfstat/types_lpar.go | 129 + .../power-devops/perfstat/types_lvm.go | 31 + .../power-devops/perfstat/types_memory.go | 101 + .../power-devops/perfstat/types_network.go | 163 + .../power-devops/perfstat/types_process.go | 43 + .../power-devops/perfstat/uptime.go | 36 + vendor/github.com/shirou/gopsutil/v4/LICENSE | 61 + .../shirou/gopsutil/v4/common/env.go | 25 + .../github.com/shirou/gopsutil/v4/cpu/cpu.go | 202 + .../shirou/gopsutil/v4/cpu/cpu_aix.go | 16 + .../shirou/gopsutil/v4/cpu/cpu_aix_cgo.go | 79 + .../shirou/gopsutil/v4/cpu/cpu_aix_nocgo.go | 157 + .../shirou/gopsutil/v4/cpu/cpu_darwin.go | 195 + .../gopsutil/v4/cpu/cpu_darwin_arm64.go | 83 + .../gopsutil/v4/cpu/cpu_darwin_fallback.go | 13 + .../shirou/gopsutil/v4/cpu/cpu_dragonfly.go | 162 + .../gopsutil/v4/cpu/cpu_dragonfly_amd64.go | 10 + .../shirou/gopsutil/v4/cpu/cpu_fallback.go | 31 + .../shirou/gopsutil/v4/cpu/cpu_freebsd.go | 174 + .../shirou/gopsutil/v4/cpu/cpu_freebsd_386.go | 10 + .../gopsutil/v4/cpu/cpu_freebsd_amd64.go | 10 + .../shirou/gopsutil/v4/cpu/cpu_freebsd_arm.go | 10 + .../gopsutil/v4/cpu/cpu_freebsd_arm64.go | 10 + .../shirou/gopsutil/v4/cpu/cpu_linux.go | 531 +++ .../shirou/gopsutil/v4/cpu/cpu_netbsd.go | 121 + .../gopsutil/v4/cpu/cpu_netbsd_amd64.go | 10 + .../shirou/gopsutil/v4/cpu/cpu_netbsd_arm.go | 10 + .../gopsutil/v4/cpu/cpu_netbsd_arm64.go | 10 + .../shirou/gopsutil/v4/cpu/cpu_openbsd.go | 139 + .../shirou/gopsutil/v4/cpu/cpu_openbsd_386.go | 11 + .../gopsutil/v4/cpu/cpu_openbsd_amd64.go | 11 + .../shirou/gopsutil/v4/cpu/cpu_openbsd_arm.go | 11 + .../gopsutil/v4/cpu/cpu_openbsd_arm64.go | 11 + .../gopsutil/v4/cpu/cpu_openbsd_riscv64.go | 11 + .../shirou/gopsutil/v4/cpu/cpu_plan9.go | 51 + .../shirou/gopsutil/v4/cpu/cpu_solaris.go | 267 ++ .../shirou/gopsutil/v4/cpu/cpu_windows.go | 477 ++ .../gopsutil/v4/internal/common/common.go | 475 ++ .../gopsutil/v4/internal/common/common_aix.go | 131 + .../v4/internal/common/common_darwin.go | 577 +++ .../v4/internal/common/common_freebsd.go | 65 + .../v4/internal/common/common_linux.go | 343 ++ .../v4/internal/common/common_netbsd.go | 49 + .../v4/internal/common/common_openbsd.go | 49 + .../v4/internal/common/common_unix.go | 42 + .../v4/internal/common/common_windows.go | 305 ++ .../gopsutil/v4/internal/common/endian.go | 11 + .../v4/internal/common/readlink_linux.go | 53 + .../gopsutil/v4/internal/common/sleep.go | 22 + .../gopsutil/v4/internal/common/warnings.go | 53 + .../shirou/gopsutil/v4/mem/ex_linux.go | 42 + .../shirou/gopsutil/v4/mem/ex_windows.go | 62 + .../github.com/shirou/gopsutil/v4/mem/mem.go | 122 + .../shirou/gopsutil/v4/mem/mem_aix.go | 22 + .../shirou/gopsutil/v4/mem/mem_aix_cgo.go | 51 + .../shirou/gopsutil/v4/mem/mem_aix_nocgo.go | 78 + .../shirou/gopsutil/v4/mem/mem_bsd.go | 87 + .../shirou/gopsutil/v4/mem/mem_darwin.go | 127 + .../shirou/gopsutil/v4/mem/mem_fallback.go | 34 + .../shirou/gopsutil/v4/mem/mem_freebsd.go | 168 + .../shirou/gopsutil/v4/mem/mem_linux.go | 524 +++ .../shirou/gopsutil/v4/mem/mem_netbsd.go | 87 + .../shirou/gopsutil/v4/mem/mem_openbsd.go | 103 + .../shirou/gopsutil/v4/mem/mem_openbsd_386.go | 38 + .../gopsutil/v4/mem/mem_openbsd_amd64.go | 33 + .../shirou/gopsutil/v4/mem/mem_openbsd_arm.go | 38 + .../gopsutil/v4/mem/mem_openbsd_arm64.go | 38 + .../gopsutil/v4/mem/mem_openbsd_riscv64.go | 38 + .../shirou/gopsutil/v4/mem/mem_plan9.go | 69 + .../shirou/gopsutil/v4/mem/mem_solaris.go | 211 + .../shirou/gopsutil/v4/mem/mem_windows.go | 189 + .../github.com/shirou/gopsutil/v4/net/net.go | 356 ++ .../shirou/gopsutil/v4/net/net_aix.go | 300 ++ .../shirou/gopsutil/v4/net/net_aix_cgo.go | 37 + .../shirou/gopsutil/v4/net/net_aix_nocgo.go | 95 + .../shirou/gopsutil/v4/net/net_darwin.go | 265 ++ .../shirou/gopsutil/v4/net/net_fallback.go | 71 + .../shirou/gopsutil/v4/net/net_freebsd.go | 108 + .../shirou/gopsutil/v4/net/net_linux.go | 817 ++++ .../shirou/gopsutil/v4/net/net_openbsd.go | 339 ++ .../shirou/gopsutil/v4/net/net_solaris.go | 169 + .../shirou/gopsutil/v4/net/net_unix.go | 184 + .../shirou/gopsutil/v4/net/net_windows.go | 731 +++ .../shirou/gopsutil/v4/process/process.go | 645 +++ .../shirou/gopsutil/v4/process/process_bsd.go | 72 + .../gopsutil/v4/process/process_darwin.go | 523 +++ .../v4/process/process_darwin_amd64.go | 303 ++ .../v4/process/process_darwin_arm64.go | 279 ++ .../gopsutil/v4/process/process_fallback.go | 203 + .../gopsutil/v4/process/process_freebsd.go | 367 ++ .../v4/process/process_freebsd_386.go | 218 + .../v4/process/process_freebsd_amd64.go | 224 + .../v4/process/process_freebsd_arm.go | 218 + .../v4/process/process_freebsd_arm64.go | 226 + .../gopsutil/v4/process/process_linux.go | 1204 +++++ .../gopsutil/v4/process/process_openbsd.go | 401 ++ .../v4/process/process_openbsd_386.go | 203 + .../v4/process/process_openbsd_amd64.go | 202 + .../v4/process/process_openbsd_arm.go | 203 + .../v4/process/process_openbsd_arm64.go | 204 + .../v4/process/process_openbsd_riscv64.go | 205 + .../gopsutil/v4/process/process_plan9.go | 203 + .../gopsutil/v4/process/process_posix.go | 187 + .../gopsutil/v4/process/process_solaris.go | 304 ++ .../gopsutil/v4/process/process_windows.go | 1213 +++++ .../v4/process/process_windows_32bit.go | 104 + .../v4/process/process_windows_64bit.go | 77 + .../tklauser/go-sysconf/.cirrus.yml | 23 + .../github.com/tklauser/go-sysconf/.gitignore | 1 + vendor/github.com/tklauser/go-sysconf/LICENSE | 29 + .../github.com/tklauser/go-sysconf/README.md | 46 + .../github.com/tklauser/go-sysconf/sysconf.go | 21 + .../tklauser/go-sysconf/sysconf_bsd.go | 37 + .../tklauser/go-sysconf/sysconf_darwin.go | 307 ++ .../tklauser/go-sysconf/sysconf_dragonfly.go | 220 + .../tklauser/go-sysconf/sysconf_freebsd.go | 226 + .../tklauser/go-sysconf/sysconf_generic.go | 45 + .../tklauser/go-sysconf/sysconf_linux.go | 353 ++ .../tklauser/go-sysconf/sysconf_netbsd.go | 246 + .../tklauser/go-sysconf/sysconf_openbsd.go | 271 ++ .../tklauser/go-sysconf/sysconf_posix.go | 82 + .../tklauser/go-sysconf/sysconf_solaris.go | 14 + .../go-sysconf/sysconf_unsupported.go | 16 + .../go-sysconf/zsysconf_defs_darwin.go | 252 + .../go-sysconf/zsysconf_defs_dragonfly.go | 227 + .../go-sysconf/zsysconf_defs_freebsd.go | 228 + .../go-sysconf/zsysconf_defs_linux.go | 146 + .../go-sysconf/zsysconf_defs_netbsd.go | 163 + .../go-sysconf/zsysconf_defs_openbsd.go | 262 ++ .../go-sysconf/zsysconf_defs_solaris.go | 138 + .../go-sysconf/zsysconf_values_freebsd_386.go | 11 + .../zsysconf_values_freebsd_amd64.go | 11 + .../go-sysconf/zsysconf_values_freebsd_arm.go | 11 + .../zsysconf_values_freebsd_arm64.go | 11 + .../zsysconf_values_freebsd_riscv64.go | 11 + .../go-sysconf/zsysconf_values_linux_386.go | 113 + .../go-sysconf/zsysconf_values_linux_amd64.go | 113 + .../go-sysconf/zsysconf_values_linux_arm.go | 113 + .../go-sysconf/zsysconf_values_linux_arm64.go | 113 + .../zsysconf_values_linux_loong64.go | 113 + .../go-sysconf/zsysconf_values_linux_mips.go | 113 + .../zsysconf_values_linux_mips64.go | 113 + .../zsysconf_values_linux_mips64le.go | 113 + .../zsysconf_values_linux_mipsle.go | 113 + .../go-sysconf/zsysconf_values_linux_ppc64.go | 113 + .../zsysconf_values_linux_ppc64le.go | 113 + .../zsysconf_values_linux_riscv64.go | 113 + .../go-sysconf/zsysconf_values_linux_s390x.go | 113 + .../go-sysconf/zsysconf_values_netbsd_386.go | 10 + .../zsysconf_values_netbsd_amd64.go | 10 + .../go-sysconf/zsysconf_values_netbsd_arm.go | 10 + .../zsysconf_values_netbsd_arm64.go | 10 + .../github.com/tklauser/numcpus/.cirrus.yml | 23 + vendor/github.com/tklauser/numcpus/LICENSE | 202 + vendor/github.com/tklauser/numcpus/README.md | 52 + vendor/github.com/tklauser/numcpus/numcpus.go | 98 + .../tklauser/numcpus/numcpus_bsd.go | 65 + .../tklauser/numcpus/numcpus_linux.go | 192 + .../numcpus/numcpus_list_unsupported.go | 33 + .../tklauser/numcpus/numcpus_solaris.go | 55 + .../tklauser/numcpus/numcpus_unsupported.go | 41 + .../tklauser/numcpus/numcpus_windows.go | 41 + vendor/github.com/yusufpapurcu/wmi/LICENSE | 20 + vendor/github.com/yusufpapurcu/wmi/README.md | 6 + .../yusufpapurcu/wmi/swbemservices.go | 261 ++ vendor/github.com/yusufpapurcu/wmi/wmi.go | 603 +++ vendor/golang.org/x/sys/cpu/cpu_arm64.go | 2 +- .../golang.org/x/sys/cpu/cpu_other_arm64.go | 2 +- .../golang.org/x/sys/cpu/cpu_windows_arm64.go | 42 + vendor/golang.org/x/sys/unix/ioctl_signed.go | 11 +- .../golang.org/x/sys/unix/ioctl_unsigned.go | 11 +- .../golang.org/x/sys/unix/syscall_solaris.go | 8 - vendor/golang.org/x/sys/unix/syscall_unix.go | 10 +- .../x/sys/windows/syscall_windows.go | 1 + .../golang.org/x/sys/windows/types_windows.go | 85 + .../x/sys/windows/zsyscall_windows.go | 7 + vendor/modules.txt | 36 +- 387 files changed, 73204 insertions(+), 23 deletions(-) create mode 100644 vendor/github.com/ebitengine/purego/.gitignore create mode 100644 vendor/github.com/ebitengine/purego/LICENSE create mode 100644 vendor/github.com/ebitengine/purego/README.md create mode 100644 vendor/github.com/ebitengine/purego/abi_amd64.h create mode 100644 vendor/github.com/ebitengine/purego/abi_arm64.h create mode 100644 vendor/github.com/ebitengine/purego/abi_loong64.h create mode 100644 vendor/github.com/ebitengine/purego/cgo.go create mode 100644 vendor/github.com/ebitengine/purego/dlerror.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_android.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_darwin.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_freebsd.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_linux.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_netbsd.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_nocgo_freebsd.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_nocgo_linux.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_nocgo_netbsd.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_playground.go create mode 100644 vendor/github.com/ebitengine/purego/dlfcn_stubs.s create mode 100644 vendor/github.com/ebitengine/purego/func.go create mode 100644 vendor/github.com/ebitengine/purego/gen.go create mode 100644 vendor/github.com/ebitengine/purego/go_runtime.go create mode 100644 vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go create mode 100644 vendor/github.com/ebitengine/purego/internal/cgo/empty.go create mode 100644 vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/abi_amd64.h create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/abi_arm64.h create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/abi_ppc64x.h create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_386.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_amd64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_ppc64le.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_riscv64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/asm_s390x.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/fakecgo.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/freebsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/go_darwin.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/go_freebsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_386.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_amd64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_ppc64le.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_riscv64.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_darwin.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_freebsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_linux.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_netbsd.go create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_darwin.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_freebsd.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_linux.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_netbsd.s create mode 100644 vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_stubs.s create mode 100644 vendor/github.com/ebitengine/purego/internal/strings/strings.go create mode 100644 vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go124.go create mode 100644 vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go125.go create mode 100644 vendor/github.com/ebitengine/purego/is_ios.go create mode 100644 vendor/github.com/ebitengine/purego/nocgo.go create mode 100644 vendor/github.com/ebitengine/purego/struct_386.go create mode 100644 vendor/github.com/ebitengine/purego/struct_amd64.go create mode 100644 vendor/github.com/ebitengine/purego/struct_arm.go create mode 100644 vendor/github.com/ebitengine/purego/struct_arm64.go create mode 100644 vendor/github.com/ebitengine/purego/struct_loong64.go create mode 100644 vendor/github.com/ebitengine/purego/struct_ppc64le.go create mode 100644 vendor/github.com/ebitengine/purego/struct_riscv64.go create mode 100644 vendor/github.com/ebitengine/purego/struct_s390x.go create mode 100644 vendor/github.com/ebitengine/purego/sys_386.s create mode 100644 vendor/github.com/ebitengine/purego/sys_amd64.s create mode 100644 vendor/github.com/ebitengine/purego/sys_arm.s create mode 100644 vendor/github.com/ebitengine/purego/sys_arm64.s create mode 100644 vendor/github.com/ebitengine/purego/sys_loong64.s create mode 100644 vendor/github.com/ebitengine/purego/sys_ppc64le.s create mode 100644 vendor/github.com/ebitengine/purego/sys_riscv64.s create mode 100644 vendor/github.com/ebitengine/purego/sys_s390x.s create mode 100644 vendor/github.com/ebitengine/purego/sys_unix_386.s create mode 100644 vendor/github.com/ebitengine/purego/sys_unix_arm.s create mode 100644 vendor/github.com/ebitengine/purego/sys_unix_arm64.s create mode 100644 vendor/github.com/ebitengine/purego/sys_unix_loong64.s create mode 100644 vendor/github.com/ebitengine/purego/sys_unix_ppc64le.s create mode 100644 vendor/github.com/ebitengine/purego/sys_unix_riscv64.s create mode 100644 vendor/github.com/ebitengine/purego/sys_unix_s390x.s create mode 100644 vendor/github.com/ebitengine/purego/syscall.go create mode 100644 vendor/github.com/ebitengine/purego/syscall_32bit.go create mode 100644 vendor/github.com/ebitengine/purego/syscall_cgo_linux.go create mode 100644 vendor/github.com/ebitengine/purego/syscall_sysv.go create mode 100644 vendor/github.com/ebitengine/purego/syscall_sysv_others.go create mode 100644 vendor/github.com/ebitengine/purego/syscall_sysv_stackargs.go create mode 100644 vendor/github.com/ebitengine/purego/syscall_windows.go create mode 100644 vendor/github.com/ebitengine/purego/zcallback_386.s create mode 100644 vendor/github.com/ebitengine/purego/zcallback_amd64.s create mode 100644 vendor/github.com/ebitengine/purego/zcallback_arm.s create mode 100644 vendor/github.com/ebitengine/purego/zcallback_arm64.s create mode 100644 vendor/github.com/ebitengine/purego/zcallback_loong64.s create mode 100644 vendor/github.com/ebitengine/purego/zcallback_ppc64le.s create mode 100644 vendor/github.com/ebitengine/purego/zcallback_riscv64.s create mode 100644 vendor/github.com/ebitengine/purego/zcallback_s390x.s create mode 100644 vendor/github.com/go-ole/go-ole/.travis.yml create mode 100644 vendor/github.com/go-ole/go-ole/ChangeLog.md create mode 100644 vendor/github.com/go-ole/go-ole/LICENSE create mode 100644 vendor/github.com/go-ole/go-ole/README.md create mode 100644 vendor/github.com/go-ole/go-ole/appveyor.yml create mode 100644 vendor/github.com/go-ole/go-ole/com.go create mode 100644 vendor/github.com/go-ole/go-ole/com_func.go create mode 100644 vendor/github.com/go-ole/go-ole/connect.go create mode 100644 vendor/github.com/go-ole/go-ole/constants.go create mode 100644 vendor/github.com/go-ole/go-ole/error.go create mode 100644 vendor/github.com/go-ole/go-ole/error_func.go create mode 100644 vendor/github.com/go-ole/go-ole/error_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/guid.go create mode 100644 vendor/github.com/go-ole/go-ole/iconnectionpoint.go create mode 100644 vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go create mode 100644 vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/iconnectionpointcontainer.go create mode 100644 vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go create mode 100644 vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/idispatch.go create mode 100644 vendor/github.com/go-ole/go-ole/idispatch_func.go create mode 100644 vendor/github.com/go-ole/go-ole/idispatch_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/ienumvariant.go create mode 100644 vendor/github.com/go-ole/go-ole/ienumvariant_func.go create mode 100644 vendor/github.com/go-ole/go-ole/ienumvariant_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/iinspectable.go create mode 100644 vendor/github.com/go-ole/go-ole/iinspectable_func.go create mode 100644 vendor/github.com/go-ole/go-ole/iinspectable_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/iprovideclassinfo.go create mode 100644 vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go create mode 100644 vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/itypeinfo.go create mode 100644 vendor/github.com/go-ole/go-ole/itypeinfo_func.go create mode 100644 vendor/github.com/go-ole/go-ole/itypeinfo_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/iunknown.go create mode 100644 vendor/github.com/go-ole/go-ole/iunknown_func.go create mode 100644 vendor/github.com/go-ole/go-ole/iunknown_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/ole.go create mode 100644 vendor/github.com/go-ole/go-ole/oleutil/connection.go create mode 100644 vendor/github.com/go-ole/go-ole/oleutil/connection_func.go create mode 100644 vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/oleutil/go-get.go create mode 100644 vendor/github.com/go-ole/go-ole/oleutil/oleutil.go create mode 100644 vendor/github.com/go-ole/go-ole/safearray.go create mode 100644 vendor/github.com/go-ole/go-ole/safearray_func.go create mode 100644 vendor/github.com/go-ole/go-ole/safearray_windows.go create mode 100644 vendor/github.com/go-ole/go-ole/safearrayconversion.go create mode 100644 vendor/github.com/go-ole/go-ole/safearrayslices.go create mode 100644 vendor/github.com/go-ole/go-ole/utility.go create mode 100644 vendor/github.com/go-ole/go-ole/variables.go create mode 100644 vendor/github.com/go-ole/go-ole/variant.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_386.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_amd64.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_arm.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_arm64.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_date_386.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_date_amd64.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_date_arm.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_date_arm64.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_ppc64le.go create mode 100644 vendor/github.com/go-ole/go-ole/variant_s390x.go create mode 100644 vendor/github.com/go-ole/go-ole/vt_string.go create mode 100644 vendor/github.com/go-ole/go-ole/winrt.go create mode 100644 vendor/github.com/go-ole/go-ole/winrt_doc.go create mode 100644 vendor/github.com/lufia/plan9stats/.gitignore create mode 100644 vendor/github.com/lufia/plan9stats/LICENSE create mode 100644 vendor/github.com/lufia/plan9stats/README.md create mode 100644 vendor/github.com/lufia/plan9stats/cpu.go create mode 100644 vendor/github.com/lufia/plan9stats/doc.go create mode 100644 vendor/github.com/lufia/plan9stats/host.go create mode 100644 vendor/github.com/lufia/plan9stats/int.go create mode 100644 vendor/github.com/lufia/plan9stats/opts.go create mode 100644 vendor/github.com/lufia/plan9stats/stats.go create mode 100644 vendor/github.com/power-devops/perfstat/LICENSE create mode 100644 vendor/github.com/power-devops/perfstat/c_helpers.c create mode 100644 vendor/github.com/power-devops/perfstat/c_helpers.h create mode 100644 vendor/github.com/power-devops/perfstat/config.go create mode 100644 vendor/github.com/power-devops/perfstat/cpustat.go create mode 100644 vendor/github.com/power-devops/perfstat/diskstat.go create mode 100644 vendor/github.com/power-devops/perfstat/doc.go create mode 100644 vendor/github.com/power-devops/perfstat/fsstat.go create mode 100644 vendor/github.com/power-devops/perfstat/helpers.go create mode 100644 vendor/github.com/power-devops/perfstat/lparstat.go create mode 100644 vendor/github.com/power-devops/perfstat/lvmstat.go create mode 100644 vendor/github.com/power-devops/perfstat/memstat.go create mode 100644 vendor/github.com/power-devops/perfstat/netstat.go create mode 100644 vendor/github.com/power-devops/perfstat/procstat.go create mode 100644 vendor/github.com/power-devops/perfstat/sysconf.go create mode 100644 vendor/github.com/power-devops/perfstat/systemcfg.go create mode 100644 vendor/github.com/power-devops/perfstat/types_cpu.go create mode 100644 vendor/github.com/power-devops/perfstat/types_disk.go create mode 100644 vendor/github.com/power-devops/perfstat/types_fs.go create mode 100644 vendor/github.com/power-devops/perfstat/types_lpar.go create mode 100644 vendor/github.com/power-devops/perfstat/types_lvm.go create mode 100644 vendor/github.com/power-devops/perfstat/types_memory.go create mode 100644 vendor/github.com/power-devops/perfstat/types_network.go create mode 100644 vendor/github.com/power-devops/perfstat/types_process.go create mode 100644 vendor/github.com/power-devops/perfstat/uptime.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/LICENSE create mode 100644 vendor/github.com/shirou/gopsutil/v4/common/env.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_cgo.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_nocgo.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_fallback.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_fallback.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_386.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_linux.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_386.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_riscv64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_plan9.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_solaris.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_aix.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_unix.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/endian.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/readlink_linux.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/sleep.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/ex_linux.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/ex_windows.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_aix.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_cgo.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_nocgo.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_bsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_darwin.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_fallback.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_freebsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_linux.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_netbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_386.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_riscv64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_plan9.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_solaris.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/mem/mem_windows.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_aix.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_aix_cgo.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_aix_nocgo.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_linux.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_unix.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/net/net_windows.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_bsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_darwin_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_darwin_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_fallback.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_linux.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_openbsd.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_386.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_amd64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_riscv64.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_plan9.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_posix.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_windows.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_windows_32bit.go create mode 100644 vendor/github.com/shirou/gopsutil/v4/process/process_windows_64bit.go create mode 100644 vendor/github.com/tklauser/go-sysconf/.cirrus.yml create mode 100644 vendor/github.com/tklauser/go-sysconf/.gitignore create mode 100644 vendor/github.com/tklauser/go-sysconf/LICENSE create mode 100644 vendor/github.com/tklauser/go-sysconf/README.md create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_dragonfly.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_freebsd.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_generic.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_linux.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_openbsd.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_posix.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_solaris.go create mode 100644 vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go create mode 100644 vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go create mode 100644 vendor/github.com/tklauser/numcpus/.cirrus.yml create mode 100644 vendor/github.com/tklauser/numcpus/LICENSE create mode 100644 vendor/github.com/tklauser/numcpus/README.md create mode 100644 vendor/github.com/tklauser/numcpus/numcpus.go create mode 100644 vendor/github.com/tklauser/numcpus/numcpus_bsd.go create mode 100644 vendor/github.com/tklauser/numcpus/numcpus_linux.go create mode 100644 vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go create mode 100644 vendor/github.com/tklauser/numcpus/numcpus_solaris.go create mode 100644 vendor/github.com/tklauser/numcpus/numcpus_unsupported.go create mode 100644 vendor/github.com/tklauser/numcpus/numcpus_windows.go create mode 100644 vendor/github.com/yusufpapurcu/wmi/LICENSE create mode 100644 vendor/github.com/yusufpapurcu/wmi/README.md create mode 100644 vendor/github.com/yusufpapurcu/wmi/swbemservices.go create mode 100644 vendor/github.com/yusufpapurcu/wmi/wmi.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go diff --git a/go.mod b/go.mod index d94efc49..886269fa 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( github.com/prometheus/client_model v0.6.2 github.com/quic-go/quic-go v0.52.0 github.com/rs/zerolog v1.20.0 + github.com/shirou/gopsutil/v4 v4.26.3 github.com/stretchr/testify v1.11.1 github.com/urfave/cli/v2 v2.3.0 go.opentelemetry.io/contrib/propagators v0.22.0 @@ -37,7 +38,7 @@ require ( golang.org/x/crypto v0.38.0 golang.org/x/net v0.40.0 golang.org/x/sync v0.14.0 - golang.org/x/sys v0.40.0 + golang.org/x/sys v0.41.0 golang.org/x/term v0.32.0 google.golang.org/protobuf v1.36.6 gopkg.in/natefinch/lumberjack.v2 v2.0.0 @@ -53,6 +54,7 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/ebitengine/purego v0.10.0 // indirect github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 // indirect github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect @@ -60,6 +62,7 @@ require ( github.com/gin-gonic/gin v1.9.1 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-playground/validator/v10 v10.15.1 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gobwas/httphead v0.1.0 // indirect @@ -68,6 +71,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -75,10 +79,14 @@ require ( github.com/onsi/ginkgo/v2 v2.23.4 // indirect github.com/pelletier/go-toml/v2 v2.0.9 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/common v0.64.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/tinylib/msgp v1.6.3 // indirect + github.com/tklauser/go-sysconf v0.3.16 // indirect + github.com/tklauser/numcpus v0.11.0 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/otel/metric v1.40.0 // indirect golang.org/x/arch v0.4.0 // indirect diff --git a/go.sum b/go.sum index 53d21d9b..4d620f86 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= +github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 h1:wWke/RUCl7VRjQhwPlR/v0glZXNYzBHdNUzf/Am2Nmg= @@ -63,6 +65,8 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -126,6 +130,8 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= @@ -158,6 +164,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= @@ -176,6 +184,8 @@ github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= +github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -190,6 +200,10 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= +github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= +github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= +github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= +github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= @@ -197,6 +211,8 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/propagators v0.22.0 h1:KGdv58M2//veiYLIhb31mofaI2LgkIPXXAZVeYVyfd8= @@ -244,13 +260,15 @@ golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= -golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/ebitengine/purego/.gitignore b/vendor/github.com/ebitengine/purego/.gitignore new file mode 100644 index 00000000..b25c15b8 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/vendor/github.com/ebitengine/purego/LICENSE b/vendor/github.com/ebitengine/purego/LICENSE new file mode 100644 index 00000000..8dada3ed --- /dev/null +++ b/vendor/github.com/ebitengine/purego/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/ebitengine/purego/README.md b/vendor/github.com/ebitengine/purego/README.md new file mode 100644 index 00000000..8fb85c2c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/README.md @@ -0,0 +1,119 @@ +# purego +[![Go Reference](https://pkg.go.dev/badge/github.com/ebitengine/purego?GOOS=darwin.svg)](https://pkg.go.dev/github.com/ebitengine/purego?GOOS=darwin) + +A library for calling C functions from Go without Cgo. + +> This is beta software so expect bugs and potentially API breaking changes +> but each release will be tagged to avoid breaking people's code. +> Bug reports are encouraged. + +## Motivation + +The [Ebitengine](https://github.com/hajimehoshi/ebiten) game engine was ported to use only Go on Windows. This enabled +cross-compiling to Windows from any other operating system simply by setting `GOOS=windows`. The purego project was +born to bring that same vision to the other platforms supported by Ebitengine. + +## Benefits + +- **Simple Cross-Compilation**: No C means you can build for other platforms easily without a C compiler. +- **Faster Compilation**: Efficiently cache your entirely Go builds. +- **Smaller Binaries**: Using Cgo generates a C wrapper function for each C function called. Purego doesn't! +- **Dynamic Linking**: Load symbols at runtime and use it as a plugin system. +- **Foreign Function Interface**: Call into other languages that are compiled into shared objects. +- **Cgo Fallback**: Works even with CGO_ENABLED=1 so incremental porting is possible. +This also means unsupported GOARCHs (freebsd/riscv64, linux/mips, etc.) will still work +except for float arguments and return values. + +## Supported Platforms + +### Tier 1 + +Tier 1 platforms are the primary targets officially supported by PureGo. When a new version of PureGo is released, any critical bugs found on Tier 1 platforms are treated as release blockers. The release will be postponed until such issues are resolved. + +- **Android**: amd641, arm641 +- **iOS**: amd641, arm641 +- **Linux**: amd64, arm64 +- **macOS**: amd64, arm64 +- **Windows**: amd64, arm64 + +### Tier 2 + +Tier 2 platforms are supported by PureGo on a best-effort basis. Critical bugs on Tier 2 platforms do not block new PureGo releases. However, fixes contributed by external contributors are very welcome and encouraged. + +- **Android**: 3861, arm1 +- **FreeBSD**: amd642, arm642 +- **Linux**: 386, arm, loong64, ppc64le, riscv64, s390x1 +- **Windows**: 3863, arm3,4 + +#### Support Notes + +1. These architectures require CGO_ENABLED=1 to compile +2. These architectures require the special flag `-gcflags="github.com/ebitengine/purego/internal/fakecgo=-std"` to compile with CGO_ENABLED=0 +3. These architectures only support `SyscallN` and `NewCallback` +4. These architectures are no longer supported as of Go 1.26 + +## Example + +The example below only showcases purego use for macOS and Linux. The other platforms require special handling which can +be seen in the complete example at [examples/libc](https://github.com/ebitengine/purego/tree/main/examples/libc) which supports FreeBSD and Windows. + +```go +package main + +import ( + "fmt" + "runtime" + + "github.com/ebitengine/purego" +) + +func getSystemLibrary() string { + switch runtime.GOOS { + case "darwin": + return "/usr/lib/libSystem.B.dylib" + case "linux": + return "libc.so.6" + default: + panic(fmt.Errorf("GOOS=%s is not supported", runtime.GOOS)) + } +} + +func main() { + libc, err := purego.Dlopen(getSystemLibrary(), purego.RTLD_NOW|purego.RTLD_GLOBAL) + if err != nil { + panic(err) + } + var puts func(string) + purego.RegisterLibFunc(&puts, libc, "puts") + puts("Calling C from Go without Cgo!") +} +``` + +Then to run: `CGO_ENABLED=0 go run main.go` + +## Questions + +If you have questions about how to incorporate purego in your project or want to discuss +how it works join the [Discord](https://discord.gg/HzGZVD6BkY)! + +### External Code + +Purego uses code that originates from the Go runtime. These files are under the BSD-3 +License that can be found [in the Go Source](https://github.com/golang/go/blob/master/LICENSE). +This is a list of the copied files: + +* `abi_*.h` from package `runtime/cgo` +* `wincallback.go` from package `runtime` +* `zcallback_darwin_*.s` from package `runtime` +* `internal/fakecgo/abi_*.h` from package `runtime/cgo` +* `internal/fakecgo/asm_GOARCH.s` from package `runtime/cgo` +* `internal/fakecgo/callbacks.go` from package `runtime/cgo` +* `internal/fakecgo/iscgo.go` from package `runtime/cgo` +* `internal/fakecgo/setenv.go` from package `runtime/cgo` +* `internal/fakecgo/freebsd.go` from package `runtime/cgo` +* `internal/fakecgo/netbsd.go` from package `runtime/cgo` + +The `internal/fakecgo/go_GOOS.go` files were modified from `runtime/cgo/gcc_GOOS_GOARCH.go`. + +The files `abi_*.h` and `internal/fakecgo/abi_*.h` are the same because Bazel does not support cross-package use of +`#include` so we need each one once per package. (cf. [issue](https://github.com/bazelbuild/rules_go/issues/3636)) diff --git a/vendor/github.com/ebitengine/purego/abi_amd64.h b/vendor/github.com/ebitengine/purego/abi_amd64.h new file mode 100644 index 00000000..9949435f --- /dev/null +++ b/vendor/github.com/ebitengine/purego/abi_amd64.h @@ -0,0 +1,99 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These save the frame pointer, so in general, functions that use +// these should have zero frame size to suppress the automatic frame +// pointer, though it's harmless to not do this. + +#ifdef GOOS_windows + +// REGS_HOST_TO_ABI0_STACK is the stack bytes used by +// PUSH_REGS_HOST_TO_ABI0. +#define REGS_HOST_TO_ABI0_STACK (28*8 + 8) + +// PUSH_REGS_HOST_TO_ABI0 prepares for transitioning from +// the host ABI to Go ABI0 code. It saves all registers that are +// callee-save in the host ABI and caller-save in Go ABI0 and prepares +// for entry to Go. +// +// Save DI SI BP BX R12 R13 R14 R15 X6-X15 registers and the DF flag. +// Clear the DF flag for the Go ABI. +// MXCSR matches the Go ABI, so we don't have to set that, +// and Go doesn't modify it, so we don't have to save it. +#define PUSH_REGS_HOST_TO_ABI0() \ + PUSHFQ \ + CLD \ + ADJSP $(REGS_HOST_TO_ABI0_STACK - 8) \ + MOVQ DI, (0*0)(SP) \ + MOVQ SI, (1*8)(SP) \ + MOVQ BP, (2*8)(SP) \ + MOVQ BX, (3*8)(SP) \ + MOVQ R12, (4*8)(SP) \ + MOVQ R13, (5*8)(SP) \ + MOVQ R14, (6*8)(SP) \ + MOVQ R15, (7*8)(SP) \ + MOVUPS X6, (8*8)(SP) \ + MOVUPS X7, (10*8)(SP) \ + MOVUPS X8, (12*8)(SP) \ + MOVUPS X9, (14*8)(SP) \ + MOVUPS X10, (16*8)(SP) \ + MOVUPS X11, (18*8)(SP) \ + MOVUPS X12, (20*8)(SP) \ + MOVUPS X13, (22*8)(SP) \ + MOVUPS X14, (24*8)(SP) \ + MOVUPS X15, (26*8)(SP) + +#define POP_REGS_HOST_TO_ABI0() \ + MOVQ (0*0)(SP), DI \ + MOVQ (1*8)(SP), SI \ + MOVQ (2*8)(SP), BP \ + MOVQ (3*8)(SP), BX \ + MOVQ (4*8)(SP), R12 \ + MOVQ (5*8)(SP), R13 \ + MOVQ (6*8)(SP), R14 \ + MOVQ (7*8)(SP), R15 \ + MOVUPS (8*8)(SP), X6 \ + MOVUPS (10*8)(SP), X7 \ + MOVUPS (12*8)(SP), X8 \ + MOVUPS (14*8)(SP), X9 \ + MOVUPS (16*8)(SP), X10 \ + MOVUPS (18*8)(SP), X11 \ + MOVUPS (20*8)(SP), X12 \ + MOVUPS (22*8)(SP), X13 \ + MOVUPS (24*8)(SP), X14 \ + MOVUPS (26*8)(SP), X15 \ + ADJSP $-(REGS_HOST_TO_ABI0_STACK - 8) \ + POPFQ + +#else +// SysV ABI + +#define REGS_HOST_TO_ABI0_STACK (6*8) + +// SysV MXCSR matches the Go ABI, so we don't have to set that, +// and Go doesn't modify it, so we don't have to save it. +// Both SysV and Go require DF to be cleared, so that's already clear. +// The SysV and Go frame pointer conventions are compatible. +#define PUSH_REGS_HOST_TO_ABI0() \ + ADJSP $(REGS_HOST_TO_ABI0_STACK) \ + MOVQ BP, (5*8)(SP) \ + LEAQ (5*8)(SP), BP \ + MOVQ BX, (0*8)(SP) \ + MOVQ R12, (1*8)(SP) \ + MOVQ R13, (2*8)(SP) \ + MOVQ R14, (3*8)(SP) \ + MOVQ R15, (4*8)(SP) + +#define POP_REGS_HOST_TO_ABI0() \ + MOVQ (0*8)(SP), BX \ + MOVQ (1*8)(SP), R12 \ + MOVQ (2*8)(SP), R13 \ + MOVQ (3*8)(SP), R14 \ + MOVQ (4*8)(SP), R15 \ + MOVQ (5*8)(SP), BP \ + ADJSP $-(REGS_HOST_TO_ABI0_STACK) + +#endif diff --git a/vendor/github.com/ebitengine/purego/abi_arm64.h b/vendor/github.com/ebitengine/purego/abi_arm64.h new file mode 100644 index 00000000..5d5061ec --- /dev/null +++ b/vendor/github.com/ebitengine/purego/abi_arm64.h @@ -0,0 +1,39 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These macros save and restore the callee-saved registers +// from the stack, but they don't adjust stack pointer, so +// the user should prepare stack space in advance. +// SAVE_R19_TO_R28(offset) saves R19 ~ R28 to the stack space +// of ((offset)+0*8)(RSP) ~ ((offset)+9*8)(RSP). +// +// SAVE_F8_TO_F15(offset) saves F8 ~ F15 to the stack space +// of ((offset)+0*8)(RSP) ~ ((offset)+7*8)(RSP). +// +// R29 is not saved because Go will save and restore it. + +#define SAVE_R19_TO_R28(offset) \ + STP (R19, R20), ((offset)+0*8)(RSP) \ + STP (R21, R22), ((offset)+2*8)(RSP) \ + STP (R23, R24), ((offset)+4*8)(RSP) \ + STP (R25, R26), ((offset)+6*8)(RSP) \ + STP (R27, g), ((offset)+8*8)(RSP) +#define RESTORE_R19_TO_R28(offset) \ + LDP ((offset)+0*8)(RSP), (R19, R20) \ + LDP ((offset)+2*8)(RSP), (R21, R22) \ + LDP ((offset)+4*8)(RSP), (R23, R24) \ + LDP ((offset)+6*8)(RSP), (R25, R26) \ + LDP ((offset)+8*8)(RSP), (R27, g) /* R28 */ +#define SAVE_F8_TO_F15(offset) \ + FSTPD (F8, F9), ((offset)+0*8)(RSP) \ + FSTPD (F10, F11), ((offset)+2*8)(RSP) \ + FSTPD (F12, F13), ((offset)+4*8)(RSP) \ + FSTPD (F14, F15), ((offset)+6*8)(RSP) +#define RESTORE_F8_TO_F15(offset) \ + FLDPD ((offset)+0*8)(RSP), (F8, F9) \ + FLDPD ((offset)+2*8)(RSP), (F10, F11) \ + FLDPD ((offset)+4*8)(RSP), (F12, F13) \ + FLDPD ((offset)+6*8)(RSP), (F14, F15) diff --git a/vendor/github.com/ebitengine/purego/abi_loong64.h b/vendor/github.com/ebitengine/purego/abi_loong64.h new file mode 100644 index 00000000..b10d8373 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/abi_loong64.h @@ -0,0 +1,60 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These macros save and restore the callee-saved registers +// from the stack, but they don't adjust stack pointer, so +// the user should prepare stack space in advance. +// SAVE_R22_TO_R31(offset) saves R22 ~ R31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+9*8)(R3). +// +// SAVE_F24_TO_F31(offset) saves F24 ~ F31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+7*8)(R3). +// +// Note: g is R22 + +#define SAVE_R22_TO_R31(offset) \ + MOVV g, ((offset)+(0*8))(R3) \ + MOVV R23, ((offset)+(1*8))(R3) \ + MOVV R24, ((offset)+(2*8))(R3) \ + MOVV R25, ((offset)+(3*8))(R3) \ + MOVV R26, ((offset)+(4*8))(R3) \ + MOVV R27, ((offset)+(5*8))(R3) \ + MOVV R28, ((offset)+(6*8))(R3) \ + MOVV R29, ((offset)+(7*8))(R3) \ + MOVV R30, ((offset)+(8*8))(R3) \ + MOVV R31, ((offset)+(9*8))(R3) + +#define SAVE_F24_TO_F31(offset) \ + MOVD F24, ((offset)+(0*8))(R3) \ + MOVD F25, ((offset)+(1*8))(R3) \ + MOVD F26, ((offset)+(2*8))(R3) \ + MOVD F27, ((offset)+(3*8))(R3) \ + MOVD F28, ((offset)+(4*8))(R3) \ + MOVD F29, ((offset)+(5*8))(R3) \ + MOVD F30, ((offset)+(6*8))(R3) \ + MOVD F31, ((offset)+(7*8))(R3) + +#define RESTORE_R22_TO_R31(offset) \ + MOVV ((offset)+(0*8))(R3), g \ + MOVV ((offset)+(1*8))(R3), R23 \ + MOVV ((offset)+(2*8))(R3), R24 \ + MOVV ((offset)+(3*8))(R3), R25 \ + MOVV ((offset)+(4*8))(R3), R26 \ + MOVV ((offset)+(5*8))(R3), R27 \ + MOVV ((offset)+(6*8))(R3), R28 \ + MOVV ((offset)+(7*8))(R3), R29 \ + MOVV ((offset)+(8*8))(R3), R30 \ + MOVV ((offset)+(9*8))(R3), R31 + +#define RESTORE_F24_TO_F31(offset) \ + MOVD ((offset)+(0*8))(R3), F24 \ + MOVD ((offset)+(1*8))(R3), F25 \ + MOVD ((offset)+(2*8))(R3), F26 \ + MOVD ((offset)+(3*8))(R3), F27 \ + MOVD ((offset)+(4*8))(R3), F28 \ + MOVD ((offset)+(5*8))(R3), F29 \ + MOVD ((offset)+(6*8))(R3), F30 \ + MOVD ((offset)+(7*8))(R3), F31 diff --git a/vendor/github.com/ebitengine/purego/cgo.go b/vendor/github.com/ebitengine/purego/cgo.go new file mode 100644 index 00000000..b6def570 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/cgo.go @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build cgo && (darwin || freebsd || linux || netbsd) + +package purego + +// if CGO_ENABLED=1 import the Cgo runtime to ensure that it is set up properly. +// This is required since some frameworks need TLS setup the C way which Go doesn't do. +// We currently don't support ios in fakecgo mode so force Cgo or fail. +// Even if CGO_ENABLED=1 the Cgo runtime is not imported unless `import "C"` is used, +// which will import this package automatically. Normally this isn't an issue since it +// usually isn't possible to call into C without using that import. However, with purego +// it is since we don't use `import "C"`! +import ( + _ "runtime/cgo" + + _ "github.com/ebitengine/purego/internal/cgo" +) diff --git a/vendor/github.com/ebitengine/purego/dlerror.go b/vendor/github.com/ebitengine/purego/dlerror.go new file mode 100644 index 00000000..ad52b436 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/dlerror.go @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2023 The Ebitengine Authors + +//go:build darwin || freebsd || linux || netbsd + +package purego + +// Dlerror represents an error value returned from Dlopen, Dlsym, or Dlclose. +// +// This type is not available on Windows as there is no counterpart to it on Windows. +type Dlerror struct { + s string +} + +func (e Dlerror) Error() string { + return e.s +} diff --git a/vendor/github.com/ebitengine/purego/dlfcn.go b/vendor/github.com/ebitengine/purego/dlfcn.go new file mode 100644 index 00000000..2730d82c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/dlfcn.go @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build (darwin || freebsd || linux || netbsd) && !android && !faketime + +package purego + +import ( + "unsafe" +) + +// Unix Specification for dlfcn.h: https://pubs.opengroup.org/onlinepubs/7908799/xsh/dlfcn.h.html + +var ( + fnDlopen func(path string, mode int) uintptr + fnDlsym func(handle uintptr, name string) uintptr + fnDlerror func() string + fnDlclose func(handle uintptr) bool +) + +func init() { + RegisterFunc(&fnDlopen, dlopenABI0) + RegisterFunc(&fnDlsym, dlsymABI0) + RegisterFunc(&fnDlerror, dlerrorABI0) + RegisterFunc(&fnDlclose, dlcloseABI0) +} + +// Dlopen examines the dynamic library or bundle file specified by path. If the file is compatible +// with the current process and has not already been loaded into the +// current process, it is loaded and linked. After being linked, if it contains +// any initializer functions, they are called, before Dlopen +// returns. It returns a handle that can be used with Dlsym and Dlclose. +// A second call to Dlopen with the same path will return the same handle, but the internal +// reference count for the handle will be incremented. Therefore, all +// Dlopen calls should be balanced with a Dlclose call. +// +// This function is not available on Windows. +// Use [golang.org/x/sys/windows.LoadLibrary], [golang.org/x/sys/windows.LoadLibraryEx], +// [golang.org/x/sys/windows.NewLazyDLL], or [golang.org/x/sys/windows.NewLazySystemDLL] for Windows instead. +func Dlopen(path string, mode int) (uintptr, error) { + u := fnDlopen(path, mode) + if u == 0 { + return 0, Dlerror{fnDlerror()} + } + return u, nil +} + +// Dlsym takes a "handle" of a dynamic library returned by Dlopen and the symbol name. +// It returns the address where that symbol is loaded into memory. If the symbol is not found, +// in the specified library or any of the libraries that were automatically loaded by Dlopen +// when that library was loaded, Dlsym returns zero. +// +// This function is not available on Windows. +// Use [golang.org/x/sys/windows.GetProcAddress] for Windows instead. +func Dlsym(handle uintptr, name string) (uintptr, error) { + u := fnDlsym(handle, name) + if u == 0 { + return 0, Dlerror{fnDlerror()} + } + return u, nil +} + +// Dlclose decrements the reference count on the dynamic library handle. +// If the reference count drops to zero and no other loaded libraries +// use symbols in it, then the dynamic library is unloaded. +// +// This function is not available on Windows. +// Use [golang.org/x/sys/windows.FreeLibrary] for Windows instead. +func Dlclose(handle uintptr) error { + if fnDlclose(handle) { + return Dlerror{fnDlerror()} + } + return nil +} + +func loadSymbol(handle uintptr, name string) (uintptr, error) { + return Dlsym(handle, name) +} + +// these functions exist in dlfcn_stubs.s and are calling C functions linked to in dlfcn_GOOS.go +// the indirection is necessary because a function is actually a pointer to the pointer to the code. +// sadly, I do not know of anyway to remove the assembly stubs entirely because //go:linkname doesn't +// appear to work if you link directly to the C function on darwin arm64. + +//go:linkname dlopen dlopen +var dlopen uint8 +var dlopenABI0 = uintptr(unsafe.Pointer(&dlopen)) + +//go:linkname dlsym dlsym +var dlsym uint8 +var dlsymABI0 = uintptr(unsafe.Pointer(&dlsym)) + +//go:linkname dlclose dlclose +var dlclose uint8 +var dlcloseABI0 = uintptr(unsafe.Pointer(&dlclose)) + +//go:linkname dlerror dlerror +var dlerror uint8 +var dlerrorABI0 = uintptr(unsafe.Pointer(&dlerror)) diff --git a/vendor/github.com/ebitengine/purego/dlfcn_android.go b/vendor/github.com/ebitengine/purego/dlfcn_android.go new file mode 100644 index 00000000..0d534176 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/dlfcn_android.go @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2024 The Ebitengine Authors + +package purego + +import "github.com/ebitengine/purego/internal/cgo" + +// Source for constants: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/dlfcn.h + +const ( + is64bit = 1 << (^uintptr(0) >> 63) / 2 + is32bit = 1 - is64bit + RTLD_DEFAULT = is32bit * 0xffffffff + RTLD_LAZY = 0x00000001 + RTLD_NOW = is64bit * 0x00000002 + RTLD_LOCAL = 0x00000000 + RTLD_GLOBAL = is64bit*0x00100 | is32bit*0x00000002 +) + +func Dlopen(path string, mode int) (uintptr, error) { + return cgo.Dlopen(path, mode) +} + +func Dlsym(handle uintptr, name string) (uintptr, error) { + return cgo.Dlsym(handle, name) +} + +func Dlclose(handle uintptr) error { + return cgo.Dlclose(handle) +} + +func loadSymbol(handle uintptr, name string) (uintptr, error) { + return Dlsym(handle, name) +} diff --git a/vendor/github.com/ebitengine/purego/dlfcn_darwin.go b/vendor/github.com/ebitengine/purego/dlfcn_darwin.go new file mode 100644 index 00000000..5dd44468 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/dlfcn_darwin.go @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +package purego + +// Source for constants: https://opensource.apple.com/source/dyld/dyld-360.14/include/dlfcn.h.auto.html + +const ( + RTLD_DEFAULT = 1<<64 - 2 // Pseudo-handle for dlsym so search for any loaded symbol + RTLD_LAZY = 0x1 // Relocations are performed at an implementation-dependent time. + RTLD_NOW = 0x2 // Relocations are performed when the object is loaded. + RTLD_LOCAL = 0x4 // All symbols are not made available for relocation processing by other modules. + RTLD_GLOBAL = 0x8 // All symbols are available for relocation processing of other modules. +) + +//go:cgo_import_dynamic purego_dlopen dlopen "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_dlsym dlsym "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_dlerror dlerror "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_dlclose dlclose "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_error __error "/usr/lib/libSystem.B.dylib" diff --git a/vendor/github.com/ebitengine/purego/dlfcn_freebsd.go b/vendor/github.com/ebitengine/purego/dlfcn_freebsd.go new file mode 100644 index 00000000..6b371620 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/dlfcn_freebsd.go @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +package purego + +// Constants as defined in https://github.com/freebsd/freebsd-src/blob/main/include/dlfcn.h +const ( + intSize = 32 << (^uint(0) >> 63) // 32 or 64 + RTLD_DEFAULT = 1<> 63) // 32 or 64 + RTLD_DEFAULT = 1< C) +// +// string <=> char* +// bool <=> _Bool +// uintptr <=> uintptr_t +// uint <=> uint32_t or uint64_t +// uint8 <=> uint8_t +// uint16 <=> uint16_t +// uint32 <=> uint32_t +// uint64 <=> uint64_t +// int <=> int32_t or int64_t +// int8 <=> int8_t +// int16 <=> int16_t +// int32 <=> int32_t +// int64 <=> int64_t +// float32 <=> float +// float64 <=> double +// struct <=> struct (darwin amd64/arm64, linux amd64/arm64) +// func <=> C function +// unsafe.Pointer, *T <=> void* +// []T => void* +// +// There is a special case when the last argument of fptr is a variadic interface (or []interface} +// it will be expanded into a call to the C function as if it had the arguments in that slice. +// This means that using arg ...any is like a cast to the function with the arguments inside arg. +// This is not the same as C variadic. +// +// # Memory +// +// In general it is not possible for purego to guarantee the lifetimes of objects returned or received from +// calling functions using RegisterFunc. For arguments to a C function it is important that the C function doesn't +// hold onto a reference to Go memory. This is the same as the [Cgo rules]. +// +// However, there are some special cases. When passing a string as an argument if the string does not end in a null +// terminated byte (\x00) then the string will be copied into memory maintained by purego. The memory is only valid for +// that specific call. Therefore, if the C code keeps a reference to that string it may become invalid at some +// undefined time. However, if the string does already contain a null-terminated byte then no copy is done. +// It is then the responsibility of the caller to ensure the string stays alive as long as it's needed in C memory. +// This can be done using runtime.KeepAlive or allocating the string in C memory using malloc. When a C function +// returns a null-terminated pointer to char a Go string can be used. Purego will allocate a new string in Go memory +// and copy the data over. This string will be garbage collected whenever Go decides it's no longer referenced. +// This C created string will not be freed by purego. If the pointer to char is not null-terminated or must continue +// to point to C memory (because it's a buffer for example) then use a pointer to byte and then convert that to a slice +// using unsafe.Slice. Doing this means that it becomes the responsibility of the caller to care about the lifetime +// of the pointer +// +// # Structs +// +// Purego can handle the most common structs that have fields of builtin types like int8, uint16, float32, etc. However, +// it does not support aligning fields properly. It is therefore the responsibility of the caller to ensure +// that all padding is added to the Go struct to match the C one. See `BoolStructFn` in struct_test.go for an example. +// +// On Darwin ARM64, purego handles proper alignment of struct arguments when passing them on the stack, +// following the C ABI's byte-level packing rules. +// +// # Example +// +// All functions below call this C function: +// +// char *foo(char *str); +// +// // Let purego convert types +// var foo func(s string) string +// goString := foo("copied") +// // Go will garbage collect this string +// +// // Manually, handle allocations +// var foo2 func(b string) *byte +// mustFree := foo2("not copied\x00") +// defer free(mustFree) +// +// [Cgo rules]: https://pkg.go.dev/cmd/cgo#hdr-Go_references_to_C +func RegisterFunc(fptr any, cfn uintptr) { + const is32bit = unsafe.Sizeof(uintptr(0)) == 4 + fn := reflect.ValueOf(fptr).Elem() + ty := fn.Type() + if ty.Kind() != reflect.Func { + panic("purego: fptr must be a function pointer") + } + if ty.NumOut() > 1 { + panic("purego: function can only return zero or one values") + } + if cfn == 0 { + panic("purego: cfn is nil") + } + if ty.NumOut() == 1 && (ty.Out(0).Kind() == reflect.Float32 || ty.Out(0).Kind() == reflect.Float64) && + runtime.GOARCH != "arm" && runtime.GOARCH != "arm64" && runtime.GOARCH != "386" && runtime.GOARCH != "amd64" && runtime.GOARCH != "loong64" && runtime.GOARCH != "ppc64le" && runtime.GOARCH != "riscv64" && runtime.GOARCH != "s390x" { + panic("purego: float returns are not supported") + } + { + // this code checks how many registers and stack this function will use + // to avoid crashing with too many arguments + var ints int + var floats int + var stack int + for i := 0; i < ty.NumIn(); i++ { + arg := ty.In(i) + switch arg.Kind() { + case reflect.Func: + // This only does preliminary testing to ensure the CDecl argument + // is the first argument. Full testing is done when the callback is actually + // created in NewCallback. + for j := 0; j < arg.NumIn(); j++ { + in := arg.In(j) + if !in.AssignableTo(reflect.TypeOf(CDecl{})) { + continue + } + if j != 0 { + panic("purego: CDecl must be the first argument") + } + } + case reflect.String, reflect.Uintptr, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Ptr, reflect.UnsafePointer, + reflect.Slice, reflect.Bool: + if ints < numOfIntegerRegisters() { + ints++ + } else { + stack++ + } + case reflect.Float32, reflect.Float64: + if floats < numOfFloatRegisters() { + floats++ + } else { + stack++ + } + case reflect.Struct: + ensureStructSupportedForRegisterFunc() + if arg.Size() == 0 { + continue + } + addInt := func(u uintptr) { + ints++ + } + addFloat := func(u uintptr) { + floats++ + } + addStack := func(u uintptr) { + stack++ + } + _ = addStruct(reflect.New(arg).Elem(), &ints, &floats, &stack, addInt, addFloat, addStack, nil) + default: + panic("purego: unsupported kind " + arg.Kind().String()) + } + } + if ty.NumOut() == 1 && ty.Out(0).Kind() == reflect.Struct { + ensureStructSupportedForRegisterFunc() + outType := ty.Out(0) + checkStructFieldsSupported(outType) + if runtime.GOARCH == "amd64" && outType.Size() > maxRegAllocStructSize { + // on amd64 if struct is bigger than 16 bytes allocate the return struct + // and pass it in as a hidden first argument. + ints++ + } + } + + sizeOfStack := maxArgs - numOfIntegerRegisters() + // On Darwin ARM64, use byte-based validation since arguments pack efficiently. + // See https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms + if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + stackBytes := estimateStackBytes(ty) + maxStackBytes := sizeOfStack * 8 + if stackBytes > maxStackBytes { + panic("purego: too many stack arguments") + } + } else { + if stack > sizeOfStack { + panic("purego: too many stack arguments") + } + } + } + + v := reflect.MakeFunc(ty, func(args []reflect.Value) (results []reflect.Value) { + var sysargs [maxArgs]uintptr + // Use maxArgs instead of numOfFloatRegisters() to keep this code path allocation-free, + // since numOfFloatRegisters() is a function call, not a constant. + // maxArgs is always greater than or equal to numOfFloatRegisters() so this is safe. + var floats [maxArgs]uintptr + var numInts int + var numFloats int + var numStack int + var addStack, addInt, addFloat func(x uintptr) + if runtime.GOARCH == "arm64" || runtime.GOOS != "windows" { + // Windows arm64 uses the same calling convention as macOS and Linux + addStack = func(x uintptr) { + sysargs[numOfIntegerRegisters()+numStack] = x + numStack++ + } + addInt = func(x uintptr) { + if numInts >= numOfIntegerRegisters() { + addStack(x) + } else { + sysargs[numInts] = x + numInts++ + } + } + addFloat = func(x uintptr) { + if numFloats < numOfFloatRegisters() { + floats[numFloats] = x + numFloats++ + } else { + addStack(x) + } + } + } else { + // On Windows amd64 the arguments are passed in the numbered registered. + // So the first int is in the first integer register and the first float + // is in the second floating register if there is already a first int. + // This is in contrast to how macOS and Linux pass arguments which + // tries to use as many registers as possible in the calling convention. + addStack = func(x uintptr) { + sysargs[numStack] = x + numStack++ + } + addInt = addStack + addFloat = addStack + } + + var keepAlive []any + defer func() { + runtime.KeepAlive(keepAlive) + runtime.KeepAlive(args) + }() + + var arm64_r8 uintptr + if ty.NumOut() == 1 && ty.Out(0).Kind() == reflect.Struct { + outType := ty.Out(0) + if (runtime.GOARCH == "amd64" || runtime.GOARCH == "loong64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "s390x") && outType.Size() > maxRegAllocStructSize { + val := reflect.New(outType) + keepAlive = append(keepAlive, val) + addInt(val.Pointer()) + } else if runtime.GOARCH == "arm64" && outType.Size() > maxRegAllocStructSize { + isAllFloats, numFields := isAllSameFloat(outType) + if !isAllFloats || numFields > 4 { + val := reflect.New(outType) + keepAlive = append(keepAlive, val) + arm64_r8 = val.Pointer() + } + } + } + for i, v := range args { + if variadic, ok := xreflect.TypeAssert[[]any](args[i]); ok { + if i != len(args)-1 { + panic("purego: can only expand last parameter") + } + for _, x := range variadic { + keepAlive = addValue(reflect.ValueOf(x), keepAlive, addInt, addFloat, addStack, &numInts, &numFloats, &numStack) + } + continue + } + // Check if we need to start Darwin ARM64 C-style stack packing + if runtime.GOARCH == "arm64" && runtime.GOOS == "darwin" && shouldBundleStackArgs(v, numInts, numFloats) { + // Collect and separate remaining args into register vs stack + stackArgs, newKeepAlive := collectStackArgs(args, i, numInts, numFloats, + keepAlive, addInt, addFloat, addStack, &numInts, &numFloats, &numStack) + keepAlive = newKeepAlive + + // Bundle stack arguments with C-style packing + bundleStackArgs(stackArgs, addStack) + break + } + keepAlive = addValue(v, keepAlive, addInt, addFloat, addStack, &numInts, &numFloats, &numStack) + } + + syscall := thePool.Get().(*syscall15Args) + defer thePool.Put(syscall) + + if runtime.GOARCH == "loong64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "s390x" { + syscall.Set(cfn, sysargs[:], floats[:], 0) + runtime_cgocall(syscall15XABI0, unsafe.Pointer(syscall)) + } else if runtime.GOARCH == "arm64" || runtime.GOOS != "windows" { + // Use the normal arm64 calling convention even on Windows + syscall.Set(cfn, sysargs[:], floats[:], arm64_r8) + runtime_cgocall(syscall15XABI0, unsafe.Pointer(syscall)) + } else { + *syscall = syscall15Args{} + // This is a fallback for Windows amd64, 386, and arm. Note this may not support floats + syscall.a1, syscall.a2, _ = syscall_syscall15X(cfn, sysargs[0], sysargs[1], sysargs[2], sysargs[3], sysargs[4], + sysargs[5], sysargs[6], sysargs[7], sysargs[8], sysargs[9], sysargs[10], sysargs[11], + sysargs[12], sysargs[13], sysargs[14]) + syscall.f1 = syscall.a2 // on amd64 a2 stores the float return. On 32bit platforms floats aren't support + } + if ty.NumOut() == 0 { + return nil + } + outType := ty.Out(0) + v := reflect.New(outType).Elem() + switch outType.Kind() { + case reflect.Uintptr, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + v.SetUint(uint64(syscall.a1)) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + v.SetInt(int64(syscall.a1)) + case reflect.Bool: + v.SetBool(byte(syscall.a1) != 0) + case reflect.UnsafePointer: + // We take the address and then dereference it to trick go vet from creating a possible miss-use of unsafe.Pointer + v.SetPointer(*(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1))) + case reflect.Ptr: + v = reflect.NewAt(outType, unsafe.Pointer(&syscall.a1)).Elem() + case reflect.Func: + // wrap this C function in a nicely typed Go function + v = reflect.New(outType) + RegisterFunc(v.Interface(), syscall.a1) + case reflect.String: + v.SetString(strings.GoString(syscall.a1)) + case reflect.Float32: + // NOTE: syscall.r2 is only the floating return value on 64bit platforms. + // On 32bit platforms syscall.r2 is the upper part of a 64bit return. + // On 386, x87 FPU returns floats as float64 in ST(0), so we read as float64 and convert. + // On PPC64LE, C ABI converts float32 to double in FPR, so we read as float64. + // On S390X (big-endian), float32 is in upper 32 bits of the 64-bit FP register. + switch runtime.GOARCH { + case "386": + v.SetFloat(math.Float64frombits(uint64(syscall.f1) | (uint64(syscall.f2) << 32))) + case "ppc64le": + v.SetFloat(math.Float64frombits(uint64(syscall.f1))) + case "s390x": + // S390X is big-endian: float32 in upper 32 bits of 64-bit register + v.SetFloat(float64(math.Float32frombits(uint32(syscall.f1 >> 32)))) + default: + v.SetFloat(float64(math.Float32frombits(uint32(syscall.f1)))) + } + case reflect.Float64: + // NOTE: syscall.r2 is only the floating return value on 64bit platforms. + // On 32bit platforms syscall.r2 is the upper part of a 64bit return. + if is32bit { + v.SetFloat(math.Float64frombits(uint64(syscall.f1) | (uint64(syscall.f2) << 32))) + } else { + v.SetFloat(math.Float64frombits(uint64(syscall.f1))) + } + case reflect.Struct: + v = getStruct(outType, *syscall) + default: + panic("purego: unsupported return kind: " + outType.Kind().String()) + } + if len(args) > 0 { + // reuse args slice instead of allocating one when possible + args[0] = v + return args[:1] + } else { + return []reflect.Value{v} + } + }) + fn.Set(v) +} + +func addValue(v reflect.Value, keepAlive []any, addInt func(x uintptr), addFloat func(x uintptr), addStack func(x uintptr), numInts *int, numFloats *int, numStack *int) []any { + const is32bit = unsafe.Sizeof(uintptr(0)) == 4 + switch v.Kind() { + case reflect.String: + ptr := strings.CString(v.String()) + keepAlive = append(keepAlive, ptr) + addInt(uintptr(unsafe.Pointer(ptr))) + case reflect.Uintptr, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + addInt(uintptr(v.Uint())) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + addInt(uintptr(v.Int())) + case reflect.Ptr, reflect.UnsafePointer, reflect.Slice: + // There is no need to keepAlive this pointer separately because it is kept alive in the args variable + addInt(v.Pointer()) + case reflect.Func: + addInt(NewCallback(v.Interface())) + case reflect.Bool: + if v.Bool() { + addInt(1) + } else { + addInt(0) + } + case reflect.Float32: + // On S390X big-endian, float32 goes in upper 32 bits of 64-bit FP register + if runtime.GOARCH == "s390x" { + addFloat(uintptr(math.Float32bits(float32(v.Float()))) << 32) + } else { + addFloat(uintptr(math.Float32bits(float32(v.Float())))) + } + case reflect.Float64: + if is32bit { + bits := math.Float64bits(v.Float()) + addFloat(uintptr(bits)) + addFloat(uintptr(bits >> 32)) + } else { + addFloat(uintptr(math.Float64bits(v.Float()))) + } + case reflect.Struct: + keepAlive = addStruct(v, numInts, numFloats, numStack, addInt, addFloat, addStack, keepAlive) + default: + panic("purego: unsupported kind: " + v.Kind().String()) + } + return keepAlive +} + +// maxRegAllocStructSize is the biggest a struct can be while still fitting in registers. +// if it is bigger than this than enough space must be allocated on the heap and then passed into +// the function as the first parameter on amd64 or in R8 on arm64. +// +// If you change this make sure to update it in objc_runtime_darwin.go +const maxRegAllocStructSize = 16 + +func isAllSameFloat(ty reflect.Type) (allFloats bool, numFields int) { + allFloats = true + root := ty.Field(0).Type + for root.Kind() == reflect.Struct { + root = root.Field(0).Type + } + first := root.Kind() + if first != reflect.Float32 && first != reflect.Float64 { + allFloats = false + } + for i := 0; i < ty.NumField(); i++ { + f := ty.Field(i).Type + if f.Kind() == reflect.Struct { + var structNumFields int + allFloats, structNumFields = isAllSameFloat(f) + numFields += structNumFields + continue + } + numFields++ + if f.Kind() != first { + allFloats = false + } + } + return allFloats, numFields +} + +func checkStructFieldsSupported(ty reflect.Type) { + for i := 0; i < ty.NumField(); i++ { + f := ty.Field(i).Type + if f.Kind() == reflect.Array { + f = f.Elem() + } else if f.Kind() == reflect.Struct { + checkStructFieldsSupported(f) + continue + } + switch f.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Uintptr, reflect.Ptr, reflect.UnsafePointer, reflect.Float64, reflect.Float32, + reflect.Bool: + default: + panic(fmt.Sprintf("purego: struct field type %s is not supported", f)) + } + } +} + +func ensureStructSupportedForRegisterFunc() { + if runtime.GOARCH != "amd64" && runtime.GOARCH != "arm64" { + panic("purego: struct arguments are only supported on amd64 and arm64") + } + if runtime.GOOS != "darwin" && runtime.GOOS != "linux" { + panic("purego: struct arguments are only supported on darwin and linux") + } +} + +func roundUpTo8(val uintptr) uintptr { + return (val + align8ByteMask) &^ align8ByteMask +} + +func numOfFloatRegisters() int { + switch runtime.GOARCH { + case "amd64", "arm64", "loong64", "ppc64le", "riscv64": + return 8 + case "s390x": + return 4 + case "arm": + return 16 + case "386": + // i386 SysV ABI passes all arguments on the stack, including floats + return 0 + default: + // since this platform isn't supported and can therefore only access + // integer registers it is safest to return 8 + return 8 + } +} + +func numOfIntegerRegisters() int { + switch runtime.GOARCH { + case "arm64", "loong64", "ppc64le", "riscv64": + return 8 + case "amd64": + return 6 + case "s390x": + // S390X uses R2-R6 for integer arguments + return 5 + case "arm": + return 4 + case "386": + // i386 SysV ABI passes all arguments on the stack + return 0 + default: + // since this platform isn't supported and can therefore only access + // integer registers it is fine to return the maxArgs + return maxArgs + } +} + +// estimateStackBytes estimates stack bytes needed for Darwin ARM64 validation. +// This is a conservative estimate used only for early error detection. +func estimateStackBytes(ty reflect.Type) int { + var numInts, numFloats int + var stackBytes int + + for i := 0; i < ty.NumIn(); i++ { + arg := ty.In(i) + size := int(arg.Size()) + + // Check if this goes to register or stack + usesInt := arg.Kind() != reflect.Float32 && arg.Kind() != reflect.Float64 + if usesInt && numInts < numOfIntegerRegisters() { + numInts++ + } else if !usesInt && numFloats < numOfFloatRegisters() { + numFloats++ + } else { + // Goes to stack - accumulate total bytes + stackBytes += size + } + } + // Round total to 8-byte boundary + if stackBytes > 0 && stackBytes%align8ByteSize != 0 { + stackBytes = int(roundUpTo8(uintptr(stackBytes))) + } + return stackBytes +} diff --git a/vendor/github.com/ebitengine/purego/gen.go b/vendor/github.com/ebitengine/purego/gen.go new file mode 100644 index 00000000..9cb7c453 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/gen.go @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +package purego + +//go:generate go run wincallback.go diff --git a/vendor/github.com/ebitengine/purego/go_runtime.go b/vendor/github.com/ebitengine/purego/go_runtime.go new file mode 100644 index 00000000..b327f786 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/go_runtime.go @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build darwin || freebsd || linux || netbsd || windows + +package purego + +import ( + "unsafe" +) + +//go:linkname runtime_cgocall runtime.cgocall +func runtime_cgocall(fn uintptr, arg unsafe.Pointer) int32 // from runtime/sys_libc.go diff --git a/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go b/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go new file mode 100644 index 00000000..6d0571ab --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2024 The Ebitengine Authors + +//go:build freebsd || linux || netbsd + +package cgo + +/* +#cgo !netbsd LDFLAGS: -ldl + +#include +#include +*/ +import "C" + +import ( + "errors" + "unsafe" +) + +func Dlopen(filename string, flag int) (uintptr, error) { + cfilename := C.CString(filename) + defer C.free(unsafe.Pointer(cfilename)) + handle := C.dlopen(cfilename, C.int(flag)) + if handle == nil { + return 0, errors.New(C.GoString(C.dlerror())) + } + return uintptr(handle), nil +} + +func Dlsym(handle uintptr, symbol string) (uintptr, error) { + csymbol := C.CString(symbol) + defer C.free(unsafe.Pointer(csymbol)) + symbolAddr := C.dlsym(*(*unsafe.Pointer)(unsafe.Pointer(&handle)), csymbol) + if symbolAddr == nil { + return 0, errors.New(C.GoString(C.dlerror())) + } + return uintptr(symbolAddr), nil +} + +func Dlclose(handle uintptr) error { + result := C.dlclose(*(*unsafe.Pointer)(unsafe.Pointer(&handle))) + if result != 0 { + return errors.New(C.GoString(C.dlerror())) + } + return nil +} + +// all that is needed is to assign each dl function because then its +// symbol will then be made available to the linker and linked to inside dlfcn.go +var ( + _ = C.dlopen + _ = C.dlsym + _ = C.dlerror + _ = C.dlclose +) diff --git a/vendor/github.com/ebitengine/purego/internal/cgo/empty.go b/vendor/github.com/ebitengine/purego/internal/cgo/empty.go new file mode 100644 index 00000000..1d7cffe2 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/cgo/empty.go @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2024 The Ebitengine Authors + +package cgo + +// Empty so that importing this package doesn't cause issue for certain platforms. diff --git a/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go b/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go new file mode 100644 index 00000000..1e39de3b --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build freebsd || (linux && !(386 || amd64 || arm || arm64 || loong64 || ppc64le || riscv64)) || netbsd + +package cgo + +// this file is placed inside internal/cgo and not package purego +// because Cgo and assembly files can't be in the same package. + +/* +#cgo !netbsd LDFLAGS: -ldl + +#include +#include +#include +#include + +typedef struct syscall15Args { + uintptr_t fn; + uintptr_t a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15; + uintptr_t f1, f2, f3, f4, f5, f6, f7, f8; + uintptr_t err; +} syscall15Args; + +void syscall15(struct syscall15Args *args) { + assert((args->f1|args->f2|args->f3|args->f4|args->f5|args->f6|args->f7|args->f8) == 0); + uintptr_t (*func_name)(uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, + uintptr_t a7, uintptr_t a8, uintptr_t a9, uintptr_t a10, uintptr_t a11, uintptr_t a12, + uintptr_t a13, uintptr_t a14, uintptr_t a15); + *(void**)(&func_name) = (void*)(args->fn); + uintptr_t r1 = func_name(args->a1,args->a2,args->a3,args->a4,args->a5,args->a6,args->a7,args->a8,args->a9, + args->a10,args->a11,args->a12,args->a13,args->a14,args->a15); + args->a1 = r1; + args->err = errno; +} + +*/ +import "C" +import "unsafe" + +// assign purego.syscall15XABI0 to the C version of this function. +var Syscall15XABI0 = unsafe.Pointer(C.syscall15) + +//go:nosplit +func Syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { + args := C.syscall15Args{ + C.uintptr_t(fn), C.uintptr_t(a1), C.uintptr_t(a2), C.uintptr_t(a3), + C.uintptr_t(a4), C.uintptr_t(a5), C.uintptr_t(a6), + C.uintptr_t(a7), C.uintptr_t(a8), C.uintptr_t(a9), C.uintptr_t(a10), C.uintptr_t(a11), C.uintptr_t(a12), + C.uintptr_t(a13), C.uintptr_t(a14), C.uintptr_t(a15), 0, 0, 0, 0, 0, 0, 0, 0, 0, + } + C.syscall15(&args) + return uintptr(args.a1), 0, uintptr(args.err) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_amd64.h b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_amd64.h new file mode 100644 index 00000000..9949435f --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_amd64.h @@ -0,0 +1,99 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These save the frame pointer, so in general, functions that use +// these should have zero frame size to suppress the automatic frame +// pointer, though it's harmless to not do this. + +#ifdef GOOS_windows + +// REGS_HOST_TO_ABI0_STACK is the stack bytes used by +// PUSH_REGS_HOST_TO_ABI0. +#define REGS_HOST_TO_ABI0_STACK (28*8 + 8) + +// PUSH_REGS_HOST_TO_ABI0 prepares for transitioning from +// the host ABI to Go ABI0 code. It saves all registers that are +// callee-save in the host ABI and caller-save in Go ABI0 and prepares +// for entry to Go. +// +// Save DI SI BP BX R12 R13 R14 R15 X6-X15 registers and the DF flag. +// Clear the DF flag for the Go ABI. +// MXCSR matches the Go ABI, so we don't have to set that, +// and Go doesn't modify it, so we don't have to save it. +#define PUSH_REGS_HOST_TO_ABI0() \ + PUSHFQ \ + CLD \ + ADJSP $(REGS_HOST_TO_ABI0_STACK - 8) \ + MOVQ DI, (0*0)(SP) \ + MOVQ SI, (1*8)(SP) \ + MOVQ BP, (2*8)(SP) \ + MOVQ BX, (3*8)(SP) \ + MOVQ R12, (4*8)(SP) \ + MOVQ R13, (5*8)(SP) \ + MOVQ R14, (6*8)(SP) \ + MOVQ R15, (7*8)(SP) \ + MOVUPS X6, (8*8)(SP) \ + MOVUPS X7, (10*8)(SP) \ + MOVUPS X8, (12*8)(SP) \ + MOVUPS X9, (14*8)(SP) \ + MOVUPS X10, (16*8)(SP) \ + MOVUPS X11, (18*8)(SP) \ + MOVUPS X12, (20*8)(SP) \ + MOVUPS X13, (22*8)(SP) \ + MOVUPS X14, (24*8)(SP) \ + MOVUPS X15, (26*8)(SP) + +#define POP_REGS_HOST_TO_ABI0() \ + MOVQ (0*0)(SP), DI \ + MOVQ (1*8)(SP), SI \ + MOVQ (2*8)(SP), BP \ + MOVQ (3*8)(SP), BX \ + MOVQ (4*8)(SP), R12 \ + MOVQ (5*8)(SP), R13 \ + MOVQ (6*8)(SP), R14 \ + MOVQ (7*8)(SP), R15 \ + MOVUPS (8*8)(SP), X6 \ + MOVUPS (10*8)(SP), X7 \ + MOVUPS (12*8)(SP), X8 \ + MOVUPS (14*8)(SP), X9 \ + MOVUPS (16*8)(SP), X10 \ + MOVUPS (18*8)(SP), X11 \ + MOVUPS (20*8)(SP), X12 \ + MOVUPS (22*8)(SP), X13 \ + MOVUPS (24*8)(SP), X14 \ + MOVUPS (26*8)(SP), X15 \ + ADJSP $-(REGS_HOST_TO_ABI0_STACK - 8) \ + POPFQ + +#else +// SysV ABI + +#define REGS_HOST_TO_ABI0_STACK (6*8) + +// SysV MXCSR matches the Go ABI, so we don't have to set that, +// and Go doesn't modify it, so we don't have to save it. +// Both SysV and Go require DF to be cleared, so that's already clear. +// The SysV and Go frame pointer conventions are compatible. +#define PUSH_REGS_HOST_TO_ABI0() \ + ADJSP $(REGS_HOST_TO_ABI0_STACK) \ + MOVQ BP, (5*8)(SP) \ + LEAQ (5*8)(SP), BP \ + MOVQ BX, (0*8)(SP) \ + MOVQ R12, (1*8)(SP) \ + MOVQ R13, (2*8)(SP) \ + MOVQ R14, (3*8)(SP) \ + MOVQ R15, (4*8)(SP) + +#define POP_REGS_HOST_TO_ABI0() \ + MOVQ (0*8)(SP), BX \ + MOVQ (1*8)(SP), R12 \ + MOVQ (2*8)(SP), R13 \ + MOVQ (3*8)(SP), R14 \ + MOVQ (4*8)(SP), R15 \ + MOVQ (5*8)(SP), BP \ + ADJSP $-(REGS_HOST_TO_ABI0_STACK) + +#endif diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_arm64.h b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_arm64.h new file mode 100644 index 00000000..5d5061ec --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_arm64.h @@ -0,0 +1,39 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These macros save and restore the callee-saved registers +// from the stack, but they don't adjust stack pointer, so +// the user should prepare stack space in advance. +// SAVE_R19_TO_R28(offset) saves R19 ~ R28 to the stack space +// of ((offset)+0*8)(RSP) ~ ((offset)+9*8)(RSP). +// +// SAVE_F8_TO_F15(offset) saves F8 ~ F15 to the stack space +// of ((offset)+0*8)(RSP) ~ ((offset)+7*8)(RSP). +// +// R29 is not saved because Go will save and restore it. + +#define SAVE_R19_TO_R28(offset) \ + STP (R19, R20), ((offset)+0*8)(RSP) \ + STP (R21, R22), ((offset)+2*8)(RSP) \ + STP (R23, R24), ((offset)+4*8)(RSP) \ + STP (R25, R26), ((offset)+6*8)(RSP) \ + STP (R27, g), ((offset)+8*8)(RSP) +#define RESTORE_R19_TO_R28(offset) \ + LDP ((offset)+0*8)(RSP), (R19, R20) \ + LDP ((offset)+2*8)(RSP), (R21, R22) \ + LDP ((offset)+4*8)(RSP), (R23, R24) \ + LDP ((offset)+6*8)(RSP), (R25, R26) \ + LDP ((offset)+8*8)(RSP), (R27, g) /* R28 */ +#define SAVE_F8_TO_F15(offset) \ + FSTPD (F8, F9), ((offset)+0*8)(RSP) \ + FSTPD (F10, F11), ((offset)+2*8)(RSP) \ + FSTPD (F12, F13), ((offset)+4*8)(RSP) \ + FSTPD (F14, F15), ((offset)+6*8)(RSP) +#define RESTORE_F8_TO_F15(offset) \ + FLDPD ((offset)+0*8)(RSP), (F8, F9) \ + FLDPD ((offset)+2*8)(RSP), (F10, F11) \ + FLDPD ((offset)+4*8)(RSP), (F12, F13) \ + FLDPD ((offset)+6*8)(RSP), (F14, F15) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h new file mode 100644 index 00000000..b10d8373 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h @@ -0,0 +1,60 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These macros save and restore the callee-saved registers +// from the stack, but they don't adjust stack pointer, so +// the user should prepare stack space in advance. +// SAVE_R22_TO_R31(offset) saves R22 ~ R31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+9*8)(R3). +// +// SAVE_F24_TO_F31(offset) saves F24 ~ F31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+7*8)(R3). +// +// Note: g is R22 + +#define SAVE_R22_TO_R31(offset) \ + MOVV g, ((offset)+(0*8))(R3) \ + MOVV R23, ((offset)+(1*8))(R3) \ + MOVV R24, ((offset)+(2*8))(R3) \ + MOVV R25, ((offset)+(3*8))(R3) \ + MOVV R26, ((offset)+(4*8))(R3) \ + MOVV R27, ((offset)+(5*8))(R3) \ + MOVV R28, ((offset)+(6*8))(R3) \ + MOVV R29, ((offset)+(7*8))(R3) \ + MOVV R30, ((offset)+(8*8))(R3) \ + MOVV R31, ((offset)+(9*8))(R3) + +#define SAVE_F24_TO_F31(offset) \ + MOVD F24, ((offset)+(0*8))(R3) \ + MOVD F25, ((offset)+(1*8))(R3) \ + MOVD F26, ((offset)+(2*8))(R3) \ + MOVD F27, ((offset)+(3*8))(R3) \ + MOVD F28, ((offset)+(4*8))(R3) \ + MOVD F29, ((offset)+(5*8))(R3) \ + MOVD F30, ((offset)+(6*8))(R3) \ + MOVD F31, ((offset)+(7*8))(R3) + +#define RESTORE_R22_TO_R31(offset) \ + MOVV ((offset)+(0*8))(R3), g \ + MOVV ((offset)+(1*8))(R3), R23 \ + MOVV ((offset)+(2*8))(R3), R24 \ + MOVV ((offset)+(3*8))(R3), R25 \ + MOVV ((offset)+(4*8))(R3), R26 \ + MOVV ((offset)+(5*8))(R3), R27 \ + MOVV ((offset)+(6*8))(R3), R28 \ + MOVV ((offset)+(7*8))(R3), R29 \ + MOVV ((offset)+(8*8))(R3), R30 \ + MOVV ((offset)+(9*8))(R3), R31 + +#define RESTORE_F24_TO_F31(offset) \ + MOVD ((offset)+(0*8))(R3), F24 \ + MOVD ((offset)+(1*8))(R3), F25 \ + MOVD ((offset)+(2*8))(R3), F26 \ + MOVD ((offset)+(3*8))(R3), F27 \ + MOVD ((offset)+(4*8))(R3), F28 \ + MOVD ((offset)+(5*8))(R3), F29 \ + MOVD ((offset)+(6*8))(R3), F30 \ + MOVD ((offset)+(7*8))(R3), F31 diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_ppc64x.h b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_ppc64x.h new file mode 100644 index 00000000..245a5266 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_ppc64x.h @@ -0,0 +1,195 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI +// +// On PPC64/ELFv2 targets, the following registers are callee +// saved when called from C. They must be preserved before +// calling into Go which does not preserve any of them. +// +// R14-R31 +// CR2-4 +// VR20-31 +// F14-F31 +// +// xcoff(aix) and ELFv1 are similar, but may only require a +// subset of these. +// +// These macros assume a 16 byte aligned stack pointer. This +// is required by ELFv1, ELFv2, and AIX PPC64. + +#define SAVE_GPR_SIZE (18*8) +#define SAVE_GPR(offset) \ + MOVD R14, (offset+8*0)(R1) \ + MOVD R15, (offset+8*1)(R1) \ + MOVD R16, (offset+8*2)(R1) \ + MOVD R17, (offset+8*3)(R1) \ + MOVD R18, (offset+8*4)(R1) \ + MOVD R19, (offset+8*5)(R1) \ + MOVD R20, (offset+8*6)(R1) \ + MOVD R21, (offset+8*7)(R1) \ + MOVD R22, (offset+8*8)(R1) \ + MOVD R23, (offset+8*9)(R1) \ + MOVD R24, (offset+8*10)(R1) \ + MOVD R25, (offset+8*11)(R1) \ + MOVD R26, (offset+8*12)(R1) \ + MOVD R27, (offset+8*13)(R1) \ + MOVD R28, (offset+8*14)(R1) \ + MOVD R29, (offset+8*15)(R1) \ + MOVD g, (offset+8*16)(R1) \ + MOVD R31, (offset+8*17)(R1) + +#define RESTORE_GPR(offset) \ + MOVD (offset+8*0)(R1), R14 \ + MOVD (offset+8*1)(R1), R15 \ + MOVD (offset+8*2)(R1), R16 \ + MOVD (offset+8*3)(R1), R17 \ + MOVD (offset+8*4)(R1), R18 \ + MOVD (offset+8*5)(R1), R19 \ + MOVD (offset+8*6)(R1), R20 \ + MOVD (offset+8*7)(R1), R21 \ + MOVD (offset+8*8)(R1), R22 \ + MOVD (offset+8*9)(R1), R23 \ + MOVD (offset+8*10)(R1), R24 \ + MOVD (offset+8*11)(R1), R25 \ + MOVD (offset+8*12)(R1), R26 \ + MOVD (offset+8*13)(R1), R27 \ + MOVD (offset+8*14)(R1), R28 \ + MOVD (offset+8*15)(R1), R29 \ + MOVD (offset+8*16)(R1), g \ + MOVD (offset+8*17)(R1), R31 + +#define SAVE_FPR_SIZE (18*8) +#define SAVE_FPR(offset) \ + FMOVD F14, (offset+8*0)(R1) \ + FMOVD F15, (offset+8*1)(R1) \ + FMOVD F16, (offset+8*2)(R1) \ + FMOVD F17, (offset+8*3)(R1) \ + FMOVD F18, (offset+8*4)(R1) \ + FMOVD F19, (offset+8*5)(R1) \ + FMOVD F20, (offset+8*6)(R1) \ + FMOVD F21, (offset+8*7)(R1) \ + FMOVD F22, (offset+8*8)(R1) \ + FMOVD F23, (offset+8*9)(R1) \ + FMOVD F24, (offset+8*10)(R1) \ + FMOVD F25, (offset+8*11)(R1) \ + FMOVD F26, (offset+8*12)(R1) \ + FMOVD F27, (offset+8*13)(R1) \ + FMOVD F28, (offset+8*14)(R1) \ + FMOVD F29, (offset+8*15)(R1) \ + FMOVD F30, (offset+8*16)(R1) \ + FMOVD F31, (offset+8*17)(R1) + +#define RESTORE_FPR(offset) \ + FMOVD (offset+8*0)(R1), F14 \ + FMOVD (offset+8*1)(R1), F15 \ + FMOVD (offset+8*2)(R1), F16 \ + FMOVD (offset+8*3)(R1), F17 \ + FMOVD (offset+8*4)(R1), F18 \ + FMOVD (offset+8*5)(R1), F19 \ + FMOVD (offset+8*6)(R1), F20 \ + FMOVD (offset+8*7)(R1), F21 \ + FMOVD (offset+8*8)(R1), F22 \ + FMOVD (offset+8*9)(R1), F23 \ + FMOVD (offset+8*10)(R1), F24 \ + FMOVD (offset+8*11)(R1), F25 \ + FMOVD (offset+8*12)(R1), F26 \ + FMOVD (offset+8*13)(R1), F27 \ + FMOVD (offset+8*14)(R1), F28 \ + FMOVD (offset+8*15)(R1), F29 \ + FMOVD (offset+8*16)(R1), F30 \ + FMOVD (offset+8*17)(R1), F31 + +// Save and restore VR20-31 (aka VSR56-63). These +// macros must point to a 16B aligned offset. +#define SAVE_VR_SIZE (12*16) +#define SAVE_VR(offset, rtmp) \ + MOVD $(offset+16*0), rtmp \ + STVX V20, (rtmp)(R1) \ + MOVD $(offset+16*1), rtmp \ + STVX V21, (rtmp)(R1) \ + MOVD $(offset+16*2), rtmp \ + STVX V22, (rtmp)(R1) \ + MOVD $(offset+16*3), rtmp \ + STVX V23, (rtmp)(R1) \ + MOVD $(offset+16*4), rtmp \ + STVX V24, (rtmp)(R1) \ + MOVD $(offset+16*5), rtmp \ + STVX V25, (rtmp)(R1) \ + MOVD $(offset+16*6), rtmp \ + STVX V26, (rtmp)(R1) \ + MOVD $(offset+16*7), rtmp \ + STVX V27, (rtmp)(R1) \ + MOVD $(offset+16*8), rtmp \ + STVX V28, (rtmp)(R1) \ + MOVD $(offset+16*9), rtmp \ + STVX V29, (rtmp)(R1) \ + MOVD $(offset+16*10), rtmp \ + STVX V30, (rtmp)(R1) \ + MOVD $(offset+16*11), rtmp \ + STVX V31, (rtmp)(R1) + +#define RESTORE_VR(offset, rtmp) \ + MOVD $(offset+16*0), rtmp \ + LVX (rtmp)(R1), V20 \ + MOVD $(offset+16*1), rtmp \ + LVX (rtmp)(R1), V21 \ + MOVD $(offset+16*2), rtmp \ + LVX (rtmp)(R1), V22 \ + MOVD $(offset+16*3), rtmp \ + LVX (rtmp)(R1), V23 \ + MOVD $(offset+16*4), rtmp \ + LVX (rtmp)(R1), V24 \ + MOVD $(offset+16*5), rtmp \ + LVX (rtmp)(R1), V25 \ + MOVD $(offset+16*6), rtmp \ + LVX (rtmp)(R1), V26 \ + MOVD $(offset+16*7), rtmp \ + LVX (rtmp)(R1), V27 \ + MOVD $(offset+16*8), rtmp \ + LVX (rtmp)(R1), V28 \ + MOVD $(offset+16*9), rtmp \ + LVX (rtmp)(R1), V29 \ + MOVD $(offset+16*10), rtmp \ + LVX (rtmp)(R1), V30 \ + MOVD $(offset+16*11), rtmp \ + LVX (rtmp)(R1), V31 + +// LR and CR are saved in the caller's frame. The callee must +// make space for all other callee-save registers. +#define SAVE_ALL_REG_SIZE (SAVE_GPR_SIZE+SAVE_FPR_SIZE+SAVE_VR_SIZE) + +// Stack a frame and save all callee-save registers following the +// host OS's ABI. Fortunately, this is identical for AIX, ELFv1, and +// ELFv2. All host ABIs require the stack pointer to maintain 16 byte +// alignment, and save the callee-save registers in the same places. +// +// To restate, R1 is assumed to be aligned when this macro is used. +// This assumes the caller's frame is compliant with the host ABI. +// CR and LR are saved into the caller's frame per the host ABI. +// R0 is initialized to $0 as expected by Go. +#define STACK_AND_SAVE_HOST_TO_GO_ABI(extra) \ + MOVD LR, R0 \ + MOVD R0, 16(R1) \ + MOVW CR, R0 \ + MOVD R0, 8(R1) \ + MOVDU R1, -(extra)-FIXED_FRAME-SAVE_ALL_REG_SIZE(R1) \ + SAVE_GPR(extra+FIXED_FRAME) \ + SAVE_FPR(extra+FIXED_FRAME+SAVE_GPR_SIZE) \ + SAVE_VR(extra+FIXED_FRAME+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R0) \ + MOVD $0, R0 + +// This unstacks the frame, restoring all callee-save registers +// as saved by STACK_AND_SAVE_HOST_TO_GO_ABI. +// +// R0 is not guaranteed to contain $0 after this macro. +#define UNSTACK_AND_RESTORE_GO_TO_HOST_ABI(extra) \ + RESTORE_GPR(extra+FIXED_FRAME) \ + RESTORE_FPR(extra+FIXED_FRAME+SAVE_GPR_SIZE) \ + RESTORE_VR(extra+FIXED_FRAME+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R0) \ + ADD $(extra+FIXED_FRAME+SAVE_ALL_REG_SIZE), R1 \ + MOVD 16(R1), R0 \ + MOVD R0, LR \ + MOVD 8(R1), R0 \ + MOVW R0, CR diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_386.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_386.s new file mode 100644 index 00000000..7475ec8a --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_386.s @@ -0,0 +1,29 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +TEXT crosscall2(SB), NOSPLIT, $28-16 + MOVL BP, 24(SP) + MOVL BX, 20(SP) + MOVL SI, 16(SP) + MOVL DI, 12(SP) + + MOVL ctxt+12(FP), AX + MOVL AX, 8(SP) + MOVL a+4(FP), AX + MOVL AX, 4(SP) + MOVL fn+0(FP), AX + MOVL AX, 0(SP) + CALL runtime·cgocallback(SB) + + MOVL 12(SP), DI + MOVL 16(SP), SI + MOVL 20(SP), BX + MOVL 24(SP), BP + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_amd64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_amd64.s new file mode 100644 index 00000000..2b7eb57f --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_amd64.s @@ -0,0 +1,39 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "abi_amd64.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +// This signature is known to SWIG, so we can't change it. +TEXT crosscall2(SB), NOSPLIT, $0-0 + PUSH_REGS_HOST_TO_ABI0() + + // Make room for arguments to cgocallback. + ADJSP $0x18 + +#ifndef GOOS_windows + MOVQ DI, 0x0(SP) // fn + MOVQ SI, 0x8(SP) // arg + + // Skip n in DX. + MOVQ CX, 0x10(SP) // ctxt + +#else + MOVQ CX, 0x0(SP) // fn + MOVQ DX, 0x8(SP) // arg + + // Skip n in R8. + MOVQ R9, 0x10(SP) // ctxt + +#endif + + CALL runtime·cgocallback(SB) + + ADJSP $-0x18 + POP_REGS_HOST_TO_ABI0() + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm.s new file mode 100644 index 00000000..68034e60 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm.s @@ -0,0 +1,52 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +TEXT crosscall2(SB), NOSPLIT|NOFRAME, $0 + SUB $(8*9), R13 // Reserve space for the floating point registers. + + // The C arguments arrive in R0, R1, R2, and R3. We want to + // pass R0, R1, and R3 to Go, so we push those on the stack. + // Also, save C callee-save registers R4-R12. + MOVM.WP [R0, R1, R3, R4, R5, R6, R7, R8, R9, g, R11, R12], (R13) + + // Finally, save the link register R14. This also puts the + // arguments we pushed for cgocallback where they need to be, + // starting at 4(R13). + MOVW.W R14, -4(R13) + + // Save VFP callee-saved registers D8-D15 (same as S16-S31). + // Note: We always save these since we target hard-float ABI. + MOVD F8, (13*4+8*1)(R13) + MOVD F9, (13*4+8*2)(R13) + MOVD F10, (13*4+8*3)(R13) + MOVD F11, (13*4+8*4)(R13) + MOVD F12, (13*4+8*5)(R13) + MOVD F13, (13*4+8*6)(R13) + MOVD F14, (13*4+8*7)(R13) + MOVD F15, (13*4+8*8)(R13) + + BL runtime·load_g(SB) + + // We set up the arguments to cgocallback when saving registers above. + BL runtime·cgocallback(SB) + + MOVD (13*4+8*1)(R13), F8 + MOVD (13*4+8*2)(R13), F9 + MOVD (13*4+8*3)(R13), F10 + MOVD (13*4+8*4)(R13), F11 + MOVD (13*4+8*5)(R13), F12 + MOVD (13*4+8*6)(R13), F13 + MOVD (13*4+8*7)(R13), F14 + MOVD (13*4+8*8)(R13), F15 + + MOVW.P 4(R13), R14 + MOVM.IAW (R13), [R0, R1, R3, R4, R5, R6, R7, R8, R9, g, R11, R12] + ADD $(8*9), R13 + MOVW R14, R15 diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm64.s new file mode 100644 index 00000000..50e5261d --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm64.s @@ -0,0 +1,36 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "abi_arm64.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +TEXT crosscall2(SB), NOSPLIT|NOFRAME, $0 +/* + * We still need to save all callee save register as before, and then + * push 3 args for fn (R0, R1, R3), skipping R2. + * Also note that at procedure entry in gc world, 8(RSP) will be the + * first arg. + */ + SUB $(8*24), RSP + STP (R0, R1), (8*1)(RSP) + MOVD R3, (8*3)(RSP) + + SAVE_R19_TO_R28(8*4) + SAVE_F8_TO_F15(8*14) + STP (R29, R30), (8*22)(RSP) + + // Initialize Go ABI environment + BL runtime·load_g(SB) + BL runtime·cgocallback(SB) + + RESTORE_R19_TO_R28(8*4) + RESTORE_F8_TO_F15(8*14) + LDP (8*22)(RSP), (R29, R30) + + ADD $(8*24), RSP + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s new file mode 100644 index 00000000..e81df86a --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s @@ -0,0 +1,40 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "abi_loong64.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +TEXT crosscall2(SB), NOSPLIT|NOFRAME, $0 +/* + * We still need to save all callee save register as before, and then + * push 3 args for fn (R4, R5, R7), skipping R6. + * Also note that at procedure entry in gc world, 8(R29) will be the + * first arg. + */ + + ADDV $(-23*8), R3 + MOVV R4, (1*8)(R3) // fn unsafe.Pointer + MOVV R5, (2*8)(R3) // a unsafe.Pointer + MOVV R7, (3*8)(R3) // ctxt uintptr + + SAVE_R22_TO_R31((4*8)) + SAVE_F24_TO_F31((14*8)) + MOVV R1, (22*8)(R3) + + // Initialize Go ABI environment + JAL runtime·load_g(SB) + + JAL runtime·cgocallback(SB) + + RESTORE_R22_TO_R31((4*8)) + RESTORE_F24_TO_F31((14*8)) + MOVV (22*8)(R3), R1 + + ADDV $(23*8), R3 + + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_ppc64le.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_ppc64le.s new file mode 100644 index 00000000..6d1938cd --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_ppc64le.s @@ -0,0 +1,82 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "abi_ppc64x.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +// +// This is a simplified version that only saves GPR and FPR registers, +// not vector registers. This keeps the stack frame smaller to avoid +// exceeding the nosplit stack limit. +// +// On PPC64LE ELFv2, callee-save registers are: +// R14-R31 (18 GPRs = 144 bytes) +// F14-F31 (18 FPRs = 144 bytes) +// CR2-CR4 (saved in CR field) +// +// Stack layout (must be 16-byte aligned): +// 32 (FIXED_FRAME) + 24 (args) + 144 (GPR) + 144 (FPR) = 344 +// Rounded to 352 for 16-byte alignment. + +#define FIXED_FRAME 32 +#define SAVE_SIZE 352 +#define GPR_OFFSET (FIXED_FRAME+24) +#define FPR_OFFSET (GPR_OFFSET+SAVE_GPR_SIZE) + +TEXT crosscall2(SB), NOSPLIT|NOFRAME, $0 + // Save LR and CR in caller's frame per ELFv2 ABI + MOVD LR, R0 + MOVD R0, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + // Allocate our stack frame + MOVDU R1, -SAVE_SIZE(R1) + + // Save TOC (R2) in case needed + MOVD R2, 24(R1) + + // Save callee-save GPRs + SAVE_GPR(GPR_OFFSET) + + // Save callee-save FPRs + SAVE_FPR(FPR_OFFSET) + + // Initialize R0 to 0 as expected by Go + MOVD $0, R0 + + // Load the current g. + BL runtime·load_g(SB) + + // Set up arguments for cgocallback + MOVD R3, FIXED_FRAME+0(R1) // fn unsafe.Pointer + MOVD R4, FIXED_FRAME+8(R1) // a unsafe.Pointer + + // Skip R5 = n uint32 + MOVD R6, FIXED_FRAME+16(R1) // ctxt uintptr + BL runtime·cgocallback(SB) + + // Restore callee-save FPRs + RESTORE_FPR(FPR_OFFSET) + + // Restore callee-save GPRs + RESTORE_GPR(GPR_OFFSET) + + // Restore TOC + MOVD 24(R1), R2 + + // Deallocate stack frame + ADD $SAVE_SIZE, R1 + + // Restore LR and CR from caller's frame + MOVD 16(R1), R0 + MOVD R0, LR + MOVD 8(R1), R0 + MOVW R0, CR + + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_riscv64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_riscv64.s new file mode 100644 index 00000000..acf82c1b --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_riscv64.s @@ -0,0 +1,78 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +TEXT crosscall2(SB), NOSPLIT|NOFRAME, $0 +/* + * Push arguments for fn (X10, X11, X13), along with all callee-save + * registers. Note that at procedure entry the first argument is at + * 8(X2). + */ + ADD $(-8*29), X2 + MOV X10, (8*1)(X2) // fn unsafe.Pointer + MOV X11, (8*2)(X2) // a unsafe.Pointer + MOV X13, (8*3)(X2) // ctxt uintptr + MOV X8, (8*4)(X2) + MOV X9, (8*5)(X2) + MOV X18, (8*6)(X2) + MOV X19, (8*7)(X2) + MOV X20, (8*8)(X2) + MOV X21, (8*9)(X2) + MOV X22, (8*10)(X2) + MOV X23, (8*11)(X2) + MOV X24, (8*12)(X2) + MOV X25, (8*13)(X2) + MOV X26, (8*14)(X2) + MOV g, (8*15)(X2) + MOV X1, (8*16)(X2) + MOVD F8, (8*17)(X2) + MOVD F9, (8*18)(X2) + MOVD F18, (8*19)(X2) + MOVD F19, (8*20)(X2) + MOVD F20, (8*21)(X2) + MOVD F21, (8*22)(X2) + MOVD F22, (8*23)(X2) + MOVD F23, (8*24)(X2) + MOVD F24, (8*25)(X2) + MOVD F25, (8*26)(X2) + MOVD F26, (8*27)(X2) + MOVD F27, (8*28)(X2) + + // Initialize Go ABI environment + CALL runtime·load_g(SB) + CALL runtime·cgocallback(SB) + + MOV (8*4)(X2), X8 + MOV (8*5)(X2), X9 + MOV (8*6)(X2), X18 + MOV (8*7)(X2), X19 + MOV (8*8)(X2), X20 + MOV (8*9)(X2), X21 + MOV (8*10)(X2), X22 + MOV (8*11)(X2), X23 + MOV (8*12)(X2), X24 + MOV (8*13)(X2), X25 + MOV (8*14)(X2), X26 + MOV (8*15)(X2), g + MOV (8*16)(X2), X1 + MOVD (8*17)(X2), F8 + MOVD (8*18)(X2), F9 + MOVD (8*19)(X2), F18 + MOVD (8*20)(X2), F19 + MOVD (8*21)(X2), F20 + MOVD (8*22)(X2), F21 + MOVD (8*23)(X2), F22 + MOVD (8*24)(X2), F23 + MOVD (8*25)(X2), F24 + MOVD (8*26)(X2), F25 + MOVD (8*27)(X2), F26 + MOVD (8*28)(X2), F27 + ADD $(8*29), X2 + + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_s390x.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_s390x.s new file mode 100644 index 00000000..b6446650 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_s390x.s @@ -0,0 +1,55 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +TEXT crosscall2(SB), NOSPLIT|NOFRAME, $0 + // Start with standard C stack frame layout and linkage. + + // Save R6-R15 in the register save area of the calling function. + STMG R6, R15, 48(R15) + + // Allocate 96 bytes on the stack. + MOVD $-96(R15), R15 + + // Save F8-F15 in our stack frame. + FMOVD F8, 32(R15) + FMOVD F9, 40(R15) + FMOVD F10, 48(R15) + FMOVD F11, 56(R15) + FMOVD F12, 64(R15) + FMOVD F13, 72(R15) + FMOVD F14, 80(R15) + FMOVD F15, 88(R15) + + // Initialize Go ABI environment. + BL runtime·load_g(SB) + + MOVD R2, 8(R15) // fn unsafe.Pointer + MOVD R3, 16(R15) // a unsafe.Pointer + + // Skip R4 = n uint32 + MOVD R5, 24(R15) // ctxt uintptr + BL runtime·cgocallback(SB) + + FMOVD 32(R15), F8 + FMOVD 40(R15), F9 + FMOVD 48(R15), F10 + FMOVD 56(R15), F11 + FMOVD 64(R15), F12 + FMOVD 72(R15), F13 + FMOVD 80(R15), F14 + FMOVD 88(R15), F15 + + // De-allocate stack frame. + MOVD $96(R15), R15 + + // Restore R6-R15. + LMG 48(R15), R6, R15 + + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go new file mode 100644 index 00000000..27d4c98c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go @@ -0,0 +1,93 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +import ( + _ "unsafe" +) + +// TODO: decide if we need _runtime_cgo_panic_internal + +//go:linkname x_cgo_init_trampoline x_cgo_init_trampoline +//go:linkname _cgo_init _cgo_init +var x_cgo_init_trampoline byte +var _cgo_init = &x_cgo_init_trampoline + +// Creates a new system thread without updating any Go state. +// +// This method is invoked during shared library loading to create a new OS +// thread to perform the runtime initialization. This method is similar to +// _cgo_sys_thread_start except that it doesn't update any Go state. + +//go:linkname x_cgo_thread_start_trampoline x_cgo_thread_start_trampoline +//go:linkname _cgo_thread_start _cgo_thread_start +var x_cgo_thread_start_trampoline byte +var _cgo_thread_start = &x_cgo_thread_start_trampoline + +// Notifies that the runtime has been initialized. +// +// We currently block at every CGO entry point (via _cgo_wait_runtime_init_done) +// to ensure that the runtime has been initialized before the CGO call is +// executed. This is necessary for shared libraries where we kickoff runtime +// initialization in a separate thread and return without waiting for this +// thread to complete the init. + +//go:linkname x_cgo_notify_runtime_init_done_trampoline x_cgo_notify_runtime_init_done_trampoline +//go:linkname _cgo_notify_runtime_init_done _cgo_notify_runtime_init_done +var x_cgo_notify_runtime_init_done_trampoline byte +var _cgo_notify_runtime_init_done = &x_cgo_notify_runtime_init_done_trampoline + +// Indicates whether a dummy thread key has been created or not. +// +// When calling go exported function from C, we register a destructor +// callback, for a dummy thread key, by using pthread_key_create. + +//go:linkname _cgo_pthread_key_created _cgo_pthread_key_created +var x_cgo_pthread_key_created uintptr +var _cgo_pthread_key_created = &x_cgo_pthread_key_created + +// Set the x_crosscall2_ptr C function pointer variable point to crosscall2. +// It's for the runtime package to call at init time. +func set_crosscall2() { + // nothing needs to be done here for fakecgo + // because it's possible to just call cgocallback directly +} + +//go:linkname _set_crosscall2 runtime.set_crosscall2 +var _set_crosscall2 = set_crosscall2 + +// Store the g into the thread-specific value. +// So that pthread_key_destructor will dropm when the thread is exiting. + +//go:linkname x_cgo_bindm_trampoline x_cgo_bindm_trampoline +//go:linkname _cgo_bindm _cgo_bindm +var x_cgo_bindm_trampoline byte +var _cgo_bindm = &x_cgo_bindm_trampoline + +// TODO: decide if we need x_cgo_set_context_function +// TODO: decide if we need _cgo_yield + +var ( + // In Go 1.20 the race detector was rewritten to pure Go + // on darwin. This means that when CGO_ENABLED=0 is set + // fakecgo is built with race detector code. This is not + // good since this code is pretending to be C. The go:norace + // pragma is not enough, since it only applies to the native + // ABIInternal function. The ABIO wrapper (which is necessary, + // since all references to text symbols from assembly will use it) + // does not inherit the go:norace pragma, so it will still be + // instrumented by the race detector. + // + // To circumvent this issue, using closure calls in the + // assembly, which forces the compiler to use the ABIInternal + // native implementation (which has go:norace) instead. + threadentry_call = threadentry + x_cgo_init_call = x_cgo_init + x_cgo_setenv_call = x_cgo_setenv + x_cgo_unsetenv_call = x_cgo_unsetenv + x_cgo_thread_start_call = x_cgo_thread_start +) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go new file mode 100644 index 00000000..e482c120 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +// Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go. +// This allows code that calls into C to function properly when CGO_ENABLED=0. +// +// # Goals +// +// fakecgo attempts to replicate the same naming structure as in the runtime. +// For example, functions that have the prefix "gcc_*" are named "go_*". +// This makes it easier to port other GOOSs and GOARCHs as well as to keep +// it in sync with runtime/cgo. +// +// # Support +// +// Currently, fakecgo only supports macOS on amd64 & arm64. It also cannot +// be used with -buildmode=c-archive because that requires special initialization +// that fakecgo does not implement at the moment. +// +// # Usage +// +// Using fakecgo is easy just import _ "github.com/ebitengine/purego" and then +// set the environment variable CGO_ENABLED=0. +// The recommended usage for fakecgo is to prefer using runtime/cgo if possible +// but if cross-compiling or fast build times are important fakecgo is available. +// Purego will pick which ever Cgo runtime is available and prefer the one that +// comes with Go (runtime/cgo). +package fakecgo + +//go:generate go run gen.go diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/fakecgo.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/fakecgo.go new file mode 100644 index 00000000..384dab2a --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/fakecgo.go @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +import _ "unsafe" + +// setg_trampoline calls setg with the G provided +func setg_trampoline(setg uintptr, G uintptr) + +// call5 takes fn the C function and 5 arguments and calls the function with those arguments +func call5(fn, a1, a2, a3, a4, a5 uintptr) uintptr diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/freebsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/freebsd.go new file mode 100644 index 00000000..bb73a709 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/freebsd.go @@ -0,0 +1,27 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build freebsd && !cgo + +package fakecgo + +import _ "unsafe" // for go:linkname + +// Supply environ and __progname, because we don't +// link against the standard FreeBSD crt0.o and the +// libc dynamic library needs them. + +// Note: when building with cross-compiling or CGO_ENABLED=0, add +// the following argument to `go` so that these symbols are defined by +// making fakecgo the Cgo. +// -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" + +//go:linkname _environ environ +//go:linkname _progname __progname + +//go:cgo_export_dynamic environ +//go:cgo_export_dynamic __progname + +var _environ uintptr +var _progname uintptr diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_darwin.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_darwin.go new file mode 100644 index 00000000..d0868f0f --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_darwin.go @@ -0,0 +1,88 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:nosplit +//go:norace +func _cgo_sys_thread_start(ts *ThreadStart) { + var attr pthread_attr_t + var ign, oset sigset_t + var p pthread_t + var size size_t + var err int + + sigfillset(&ign) + pthread_sigmask(SIG_SETMASK, &ign, &oset) + + size = pthread_get_stacksize_np(pthread_self()) + pthread_attr_init(&attr) + pthread_attr_setstacksize(&attr, size) + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts.g.stackhi = uintptr(size) + + err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts) + + pthread_sigmask(SIG_SETMASK, &oset, nil) + + if err != 0 { + print("fakecgo: pthread_create failed: ") + println(err) + abort() + } +} + +// threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function +// +//go:linkname x_threadentry_trampoline threadentry_trampoline +var x_threadentry_trampoline byte +var threadentry_trampolineABI0 = &x_threadentry_trampoline + +//go:nosplit +//go:norace +func threadentry(v unsafe.Pointer) unsafe.Pointer { + ts := *(*ThreadStart)(v) + free(v) + + // TODO: support ios + //#if TARGET_OS_IPHONE + // darwin_arm_init_thread_exception_port(); + //#endif + setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g))) + + // faking funcs in go is a bit a... involved - but the following works :) + fn := uintptr(unsafe.Pointer(&ts.fn)) + (*(*func())(unsafe.Pointer(&fn)))() + + return nil +} + +// here we will store a pointer to the provided setg func +var setg_func uintptr + +// x_cgo_init(G *g, void (*setg)(void*)) (runtime/cgo/gcc_linux_amd64.c) +// This get's called during startup, adjusts stacklo, and provides a pointer to setg_gcc for us +// Additionally, if we set _cgo_init to non-null, go won't do it's own TLS setup +// This function can't be go:systemstack since go is not in a state where the systemcheck would work. +// +//go:nosplit +//go:norace +func x_cgo_init(g *G, setg uintptr) { + var size size_t + + setg_func = setg + size = pthread_get_stacksize_np(pthread_self()) + g.stacklo = uintptr(unsafe.Add(unsafe.Pointer(&size), -size+4096)) + + //TODO: support ios + //#if TARGET_OS_IPHONE + // darwin_arm_init_mach_exception_handler(); + // darwin_arm_init_thread_exception_port(); + // init_working_dir(); + //#endif +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_freebsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_freebsd.go new file mode 100644 index 00000000..a3ba6bc8 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_freebsd.go @@ -0,0 +1,100 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:nosplit +func _cgo_sys_thread_start(ts *ThreadStart) { + var attr pthread_attr_t + var ign, oset sigset_t + var p pthread_t + var size size_t + var err int + + // fprintf(stderr, "runtime/cgo: _cgo_sys_thread_start: fn=%p, g=%p\n", ts->fn, ts->g); // debug + sigfillset(&ign) + pthread_sigmask(SIG_SETMASK, &ign, &oset) + + pthread_attr_init(&attr) + pthread_attr_getstacksize(&attr, &size) + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts.g.stackhi = uintptr(size) + + err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts) + + pthread_sigmask(SIG_SETMASK, &oset, nil) + + if err != 0 { + print("fakecgo: pthread_create failed: ") + println(err) + abort() + } +} + +// threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function +// +//go:linkname x_threadentry_trampoline threadentry_trampoline +var x_threadentry_trampoline byte +var threadentry_trampolineABI0 = &x_threadentry_trampoline + +//go:nosplit +func threadentry(v unsafe.Pointer) unsafe.Pointer { + ts := *(*ThreadStart)(v) + free(v) + + setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g))) + + // faking funcs in go is a bit a... involved - but the following works :) + fn := uintptr(unsafe.Pointer(&ts.fn)) + (*(*func())(unsafe.Pointer(&fn)))() + + return nil +} + +// here we will store a pointer to the provided setg func +var setg_func uintptr + +// x_cgo_init(G *g, void (*setg)(void*)) (runtime/cgo/gcc_linux_amd64.c) +// This get's called during startup, adjusts stacklo, and provides a pointer to setg_gcc for us +// Additionally, if we set _cgo_init to non-null, go won't do it's own TLS setup +// This function can't be go:systemstack since go is not in a state where the systemcheck would work. +// +//go:nosplit +func x_cgo_init(g *G, setg uintptr) { + var size size_t + var attr *pthread_attr_t + + /* The memory sanitizer distributed with versions of clang + before 3.8 has a bug: if you call mmap before malloc, mmap + may return an address that is later overwritten by the msan + library. Avoid this problem by forcing a call to malloc + here, before we ever call malloc. + + This is only required for the memory sanitizer, so it's + unfortunate that we always run it. It should be possible + to remove this when we no longer care about versions of + clang before 3.8. The test for this is + misc/cgo/testsanitizers. + + GCC works hard to eliminate a seemingly unnecessary call to + malloc, so we actually use the memory we allocate. */ + + setg_func = setg + attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) + if attr == nil { + println("fakecgo: malloc failed") + abort() + } + pthread_attr_init(attr) + pthread_attr_getstacksize(attr, &size) + // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` + // but this should be OK since we are taking the address of the first variable in this function. + g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 + pthread_attr_destroy(attr) + free(unsafe.Pointer(attr)) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go new file mode 100644 index 00000000..0c463066 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +import ( + "syscall" + "unsafe" +) + +var ( + pthread_g pthread_key_t + + runtime_init_cond = PTHREAD_COND_INITIALIZER + runtime_init_mu = PTHREAD_MUTEX_INITIALIZER + runtime_init_done int +) + +//go:nosplit +//go:norace +func x_cgo_notify_runtime_init_done() { + pthread_mutex_lock(&runtime_init_mu) + runtime_init_done = 1 + pthread_cond_broadcast(&runtime_init_cond) + pthread_mutex_unlock(&runtime_init_mu) +} + +// Store the g into a thread-specific value associated with the pthread key pthread_g. +// And pthread_key_destructor will dropm when the thread is exiting. +// +//go:norace +func x_cgo_bindm(g unsafe.Pointer) { + // We assume this will always succeed, otherwise, there might be extra M leaking, + // when a C thread exits after a cgo call. + // We only invoke this function once per thread in runtime.needAndBindM, + // and the next calls just reuse the bound m. + pthread_setspecific(pthread_g, g) +} + +// _cgo_try_pthread_create retries pthread_create if it fails with +// EAGAIN. +// +//go:nosplit +//go:norace +func _cgo_try_pthread_create(thread *pthread_t, attr *pthread_attr_t, pfn unsafe.Pointer, arg *ThreadStart) int { + var ts syscall.Timespec + // tries needs to be the same type as syscall.Timespec.Nsec + // but the fields are int32 on 32bit and int64 on 64bit. + // tries is assigned to syscall.Timespec.Nsec in order to match its type. + tries := ts.Nsec + var err int + + for tries = 0; tries < 20; tries++ { + // inlined this call because it ran out of stack when inlining was disabled + err = int(call5(pthread_createABI0, uintptr(unsafe.Pointer(thread)), uintptr(unsafe.Pointer(attr)), uintptr(pfn), uintptr(unsafe.Pointer(arg)), 0)) + if err == 0 { + // inlined this call because it ran out of stack when inlining was disabled + call5(pthread_detachABI0, uintptr(*thread), 0, 0, 0, 0) + return 0 + } + if err != int(syscall.EAGAIN) { + return err + } + ts.Sec = 0 + ts.Nsec = (tries + 1) * 1000 * 1000 // Milliseconds. + // inlined this call because it ran out of stack when inlining was disabled + call5(nanosleepABI0, uintptr(unsafe.Pointer(&ts)), 0, 0, 0, 0) + } + return int(syscall.EAGAIN) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux.go new file mode 100644 index 00000000..9f380c1b --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux.go @@ -0,0 +1,100 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:nosplit +func _cgo_sys_thread_start(ts *ThreadStart) { + var attr pthread_attr_t + var ign, oset sigset_t + var p pthread_t + var size size_t + var err int + + //fprintf(stderr, "runtime/cgo: _cgo_sys_thread_start: fn=%p, g=%p\n", ts->fn, ts->g); // debug + sigfillset(&ign) + pthread_sigmask(SIG_SETMASK, &ign, &oset) + + pthread_attr_init(&attr) + pthread_attr_getstacksize(&attr, &size) + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts.g.stackhi = uintptr(size) + + err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts) + + pthread_sigmask(SIG_SETMASK, &oset, nil) + + if err != 0 { + print("fakecgo: pthread_create failed: ") + println(err) + abort() + } +} + +// threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function +// +//go:linkname x_threadentry_trampoline threadentry_trampoline +var x_threadentry_trampoline byte +var threadentry_trampolineABI0 = &x_threadentry_trampoline + +//go:nosplit +func threadentry(v unsafe.Pointer) unsafe.Pointer { + ts := *(*ThreadStart)(v) + free(v) + + setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g))) + + // faking funcs in go is a bit a... involved - but the following works :) + fn := uintptr(unsafe.Pointer(&ts.fn)) + (*(*func())(unsafe.Pointer(&fn)))() + + return nil +} + +// here we will store a pointer to the provided setg func +var setg_func uintptr + +// x_cgo_init(G *g, void (*setg)(void*)) (runtime/cgo/gcc_linux_amd64.c) +// This get's called during startup, adjusts stacklo, and provides a pointer to setg_gcc for us +// Additionally, if we set _cgo_init to non-null, go won't do it's own TLS setup +// This function can't be go:systemstack since go is not in a state where the systemcheck would work. +// +//go:nosplit +func x_cgo_init(g *G, setg uintptr) { + var size size_t + var attr *pthread_attr_t + + /* The memory sanitizer distributed with versions of clang + before 3.8 has a bug: if you call mmap before malloc, mmap + may return an address that is later overwritten by the msan + library. Avoid this problem by forcing a call to malloc + here, before we ever call malloc. + + This is only required for the memory sanitizer, so it's + unfortunate that we always run it. It should be possible + to remove this when we no longer care about versions of + clang before 3.8. The test for this is + misc/cgo/testsanitizers. + + GCC works hard to eliminate a seemingly unnecessary call to + malloc, so we actually use the memory we allocate. */ + + setg_func = setg + attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) + if attr == nil { + println("fakecgo: malloc failed") + abort() + } + pthread_attr_init(attr) + pthread_attr_getstacksize(attr, &size) + // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` + // but this should be OK since we are taking the address of the first variable in this function. + g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 + pthread_attr_destroy(attr) + free(unsafe.Pointer(attr)) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go new file mode 100644 index 00000000..935a334f --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go @@ -0,0 +1,106 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo && (amd64 || arm64) + +package fakecgo + +import "unsafe" + +//go:nosplit +func _cgo_sys_thread_start(ts *ThreadStart) { + var attr pthread_attr_t + var ign, oset sigset_t + var p pthread_t + var size size_t + var err int + + // fprintf(stderr, "runtime/cgo: _cgo_sys_thread_start: fn=%p, g=%p\n", ts->fn, ts->g); // debug + sigfillset(&ign) + pthread_sigmask(SIG_SETMASK, &ign, &oset) + + pthread_attr_init(&attr) + pthread_attr_getstacksize(&attr, &size) + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts.g.stackhi = uintptr(size) + + err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts) + + pthread_sigmask(SIG_SETMASK, &oset, nil) + + if err != 0 { + print("fakecgo: pthread_create failed: ") + println(err) + abort() + } +} + +// threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function +// +//go:linkname x_threadentry_trampoline threadentry_trampoline +var x_threadentry_trampoline byte +var threadentry_trampolineABI0 = &x_threadentry_trampoline + +//go:nosplit +func threadentry(v unsafe.Pointer) unsafe.Pointer { + var ss stack_t + ts := *(*ThreadStart)(v) + free(v) + + // On NetBSD, a new thread inherits the signal stack of the + // creating thread. That confuses minit, so we remove that + // signal stack here before calling the regular mstart. It's + // a bit baroque to remove a signal stack here only to add one + // in minit, but it's a simple change that keeps NetBSD + // working like other OS's. At this point all signals are + // blocked, so there is no race. + ss.ss_flags = SS_DISABLE + sigaltstack(&ss, nil) + + setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g))) + + // faking funcs in go is a bit a... involved - but the following works :) + fn := uintptr(unsafe.Pointer(&ts.fn)) + (*(*func())(unsafe.Pointer(&fn)))() + + return nil +} + +// here we will store a pointer to the provided setg func +var setg_func uintptr + +//go:nosplit +func x_cgo_init(g *G, setg uintptr) { + var size size_t + var attr *pthread_attr_t + + /* The memory sanitizer distributed with versions of clang + before 3.8 has a bug: if you call mmap before malloc, mmap + may return an address that is later overwritten by the msan + library. Avoid this problem by forcing a call to malloc + here, before we ever call malloc. + + This is only required for the memory sanitizer, so it's + unfortunate that we always run it. It should be possible + to remove this when we no longer care about versions of + clang before 3.8. The test for this is + misc/cgo/testsanitizers. + + GCC works hard to eliminate a seemingly unnecessary call to + malloc, so we actually use the memory we allocate. */ + + setg_func = setg + attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) + if attr == nil { + println("fakecgo: malloc failed") + abort() + } + pthread_attr_init(attr) + pthread_attr_getstacksize(attr, &size) + // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` + // but this should be OK since we are taking the address of the first variable in this function. + g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 + pthread_attr_destroy(attr) + free(unsafe.Pointer(attr)) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go new file mode 100644 index 00000000..dfc6629e --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +//go:nosplit +//go:norace +func x_cgo_setenv(arg *[2]*byte) { + setenv(arg[0], arg[1], 1) +} + +//go:nosplit +//go:norace +func x_cgo_unsetenv(arg *[1]*byte) { + unsetenv(arg[0]) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go new file mode 100644 index 00000000..ee993baa --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +import "unsafe" + +// _cgo_thread_start is split into three parts in cgo since only one part is system dependent (keep it here for easier handling) + +// _cgo_thread_start(ThreadStart *arg) (runtime/cgo/gcc_util.c) +// This get's called instead of the go code for creating new threads +// -> pthread_* stuff is used, so threads are setup correctly for C +// If this is missing, TLS is only setup correctly on thread 1! +// This function should be go:systemstack instead of go:nosplit (but that requires runtime) +// +//go:nosplit +//go:norace +func x_cgo_thread_start(arg *ThreadStart) { + var ts *ThreadStart + // Make our own copy that can persist after we return. + // _cgo_tsan_acquire(); + ts = (*ThreadStart)(malloc(unsafe.Sizeof(*ts))) + // _cgo_tsan_release(); + if ts == nil { + println("fakecgo: out of memory in thread_start") + abort() + } + // *ts = *arg would cause a writebarrier so copy using slices + const ptrSize = unsafe.Sizeof(uintptr(0)) + s1 := unsafe.Slice((*uintptr)(unsafe.Pointer(ts)), unsafe.Sizeof(*ts)/ptrSize) + s2 := unsafe.Slice((*uintptr)(unsafe.Pointer(arg)), unsafe.Sizeof(*arg)/ptrSize) + for i := range s2 { + s1[i] = s2[i] + } + _cgo_sys_thread_start(ts) // OS-dependent half +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go new file mode 100644 index 00000000..12e52147 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go @@ -0,0 +1,19 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +// The runtime package contains an uninitialized definition +// for runtime·iscgo. Override it to tell the runtime we're here. +// There are various function pointers that should be set too, +// but those depend on dynamic linker magic to get initialized +// correctly, and sometimes they break. This variable is a +// backup: it depends only on old C style static linking rules. + +package fakecgo + +import _ "unsafe" // for go:linkname + +//go:linkname _iscgo runtime.iscgo +var _iscgo bool = true diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go new file mode 100644 index 00000000..94fd8bea --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +type ( + size_t uintptr + // Sources: + // Darwin (32 bytes) - https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/_types.h#L74 + // FreeBSD (32 bytes) - https://github.com/DoctorWkt/xv6-freebsd/blob/d2a294c2a984baed27676068b15ed9a29b06ab6f/include/signal.h#L98C9-L98C21 + // Linux (128 bytes) - https://github.com/torvalds/linux/blob/ab75170520d4964f3acf8bb1f91d34cbc650688e/arch/x86/include/asm/signal.h#L25 + sigset_t [128]byte + pthread_attr_t [64]byte + pthread_t int + pthread_key_t uint64 +) + +// for pthread_sigmask: + +type sighow int32 + +const ( + SIG_BLOCK sighow = 0 + SIG_UNBLOCK sighow = 1 + SIG_SETMASK sighow = 2 +) + +type G struct { + stacklo uintptr + stackhi uintptr +} + +type ThreadStart struct { + g *G + tls *uintptr + fn uintptr +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go new file mode 100644 index 00000000..ecdcb2e7 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +type ( + pthread_mutex_t struct { + sig int64 + opaque [56]byte + } + pthread_cond_t struct { + sig int64 + opaque [40]byte + } +) + +var ( + PTHREAD_COND_INITIALIZER = pthread_cond_t{sig: 0x3CB0B1BB} + PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{sig: 0x32AAABA7} +) + +type stack_t struct { + /* not implemented */ +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go new file mode 100644 index 00000000..4bfb70c3 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +type ( + pthread_cond_t uintptr + pthread_mutex_t uintptr +) + +var ( + PTHREAD_COND_INITIALIZER = pthread_cond_t(0) + PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0) +) + +type stack_t struct { + /* not implemented */ +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go new file mode 100644 index 00000000..b08a44a1 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +type ( + pthread_cond_t [48]byte + pthread_mutex_t [48]byte +) + +var ( + PTHREAD_COND_INITIALIZER = pthread_cond_t{} + PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{} +) + +type stack_t struct { + /* not implemented */ +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go new file mode 100644 index 00000000..650f6953 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +type ( + pthread_cond_t uintptr + pthread_mutex_t uintptr +) + +var ( + PTHREAD_COND_INITIALIZER = pthread_cond_t(0) + PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0) +) + +// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/compat/linux/arch/m68k/linux_signal.h#L133 +type stack_t struct { + ss_sp uintptr + ss_flags int32 + ss_size uintptr +} + +// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L261 +const SS_DISABLE = 0x004 diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go new file mode 100644 index 00000000..2d499814 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go @@ -0,0 +1,23 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build netbsd + +package fakecgo + +import _ "unsafe" // for go:linkname + +// Supply environ and __progname, because we don't +// link against the standard NetBSD crt0.o and the +// libc dynamic library needs them. + +//go:linkname _environ environ +//go:linkname _progname __progname +//go:linkname ___ps_strings __ps_strings + +var ( + _environ uintptr + _progname uintptr + ___ps_strings uintptr +) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go new file mode 100644 index 00000000..82308b8c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go @@ -0,0 +1,19 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +import _ "unsafe" // for go:linkname + +//go:linkname x_cgo_setenv_trampoline x_cgo_setenv_trampoline +//go:linkname _cgo_setenv runtime._cgo_setenv +var x_cgo_setenv_trampoline byte +var _cgo_setenv = &x_cgo_setenv_trampoline + +//go:linkname x_cgo_unsetenv_trampoline x_cgo_unsetenv_trampoline +//go:linkname _cgo_unsetenv runtime._cgo_unsetenv +var x_cgo_unsetenv_trampoline byte +var _cgo_unsetenv = &x_cgo_unsetenv_trampoline diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_386.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_386.s new file mode 100644 index 00000000..cd3492ea --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_386.s @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build !cgo && (freebsd || linux) + +#include "textflag.h" +#include "go_asm.h" + +// These trampolines map the gcc ABI to Go ABI0 and then call into the Go equivalent functions. +// On i386, both GCC and Go use stack-based calling conventions. +// +// When C calls a function, the stack looks like: +// 0(SP) = return address +// 4(SP) = arg1 +// 8(SP) = arg2 +// ... +// +// When we declare a Go function with frame size $N-0, Go's prologue +// effectively does SUB $N, SP, so the C arguments shift up by N bytes: +// N+0(SP) = return address +// N+4(SP) = arg1 +// N+8(SP) = arg2 +// +// Go ABI0 on 386 expects arguments starting at 0(FP) which equals N+4(SP) +// after the prologue (where N is the local frame size). + +TEXT x_cgo_init_trampoline(SB), NOSPLIT, $8-0 + // C args at 12(SP) and 16(SP) after frame setup (8 bytes local + 4 bytes ret addr) + // Go function expects args at 0(SP) and 4(SP) in local frame + MOVL 12(SP), AX // first C arg + MOVL 16(SP), BX // second C arg + MOVL AX, 0(SP) // Go arg 1 + MOVL BX, 4(SP) // Go arg 2 + MOVL ·x_cgo_init_call(SB), CX + MOVL (CX), CX + CALL CX + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $4-0 + // C args at 8(SP) after frame setup (4 bytes local + 4 bytes ret addr) + MOVL 8(SP), AX // first C arg + MOVL AX, 0(SP) // Go arg 1 + MOVL ·x_cgo_thread_start_call(SB), CX + MOVL (CX), CX + CALL CX + RET + +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $4-0 + MOVL 8(SP), AX // first C arg + MOVL AX, 0(SP) // Go arg 1 + MOVL ·x_cgo_setenv_call(SB), CX + MOVL (CX), CX + CALL CX + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $4-0 + MOVL 8(SP), AX // first C arg + MOVL AX, 0(SP) // Go arg 1 + MOVL ·x_cgo_unsetenv_call(SB), CX + MOVL (CX), CX + CALL CX + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0-0 + CALL ·x_cgo_notify_runtime_init_done(SB) + RET + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_bindm(SB) + RET + +// func setg_trampoline(setg uintptr, g uintptr) +// This is called from Go, so args are at normal FP positions +TEXT ·setg_trampoline(SB), NOSPLIT, $4-8 + MOVL g+4(FP), AX + MOVL setg+0(FP), BX + + // setg expects g in 0(SP) + MOVL AX, 0(SP) + CALL BX + RET + +TEXT threadentry_trampoline(SB), NOSPLIT, $4-0 + MOVL 8(SP), AX // first C arg + MOVL AX, 0(SP) // Go arg 1 + MOVL ·threadentry_call(SB), CX + MOVL (CX), CX + CALL CX + RET + +TEXT ·call5(SB), NOSPLIT, $20-28 + MOVL fn+0(FP), AX + MOVL a1+4(FP), BX + MOVL a2+8(FP), CX + MOVL a3+12(FP), DX + MOVL a4+16(FP), SI + MOVL a5+20(FP), DI + + // Place arguments on local stack frame for C calling convention + MOVL BX, 0(SP) // a1 + MOVL CX, 4(SP) // a2 + MOVL DX, 8(SP) // a3 + MOVL SI, 12(SP) // a4 + MOVL DI, 16(SP) // a5 + CALL AX + MOVL AX, r1+24(FP) + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_amd64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_amd64.s new file mode 100644 index 00000000..e4e4c75a --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_amd64.s @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || linux || freebsd) + +/* +trampoline for emulating required C functions for cgo in go (see cgo.go) +(we convert cdecl calling convention to go and vice-versa) + +C Calling convention cdecl used here (we only need integer args): +1. arg: DI +2. arg: SI +3. arg: DX +4. arg: CX +5. arg: R8 +6. arg: R9 +We don't need floats with these functions -> AX=0 +return value will be in AX +temporary register is R11 +*/ +#include "textflag.h" +#include "go_asm.h" +#include "abi_amd64.h" + +// these trampolines map the gcc ABI to Go ABI and then calls into the Go equivalent functions. + +TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16 + MOVQ DI, AX + MOVQ SI, BX + MOVQ ·x_cgo_init_call(SB), R11 + MOVQ (R11), R11 + CALL R11 + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8 + MOVQ DI, AX + MOVQ ·x_cgo_thread_start_call(SB), R11 + MOVQ (R11), R11 + CALL R11 + RET + +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8 + MOVQ DI, AX + MOVQ ·x_cgo_setenv_call(SB), R11 + MOVQ (R11), R11 + CALL R11 + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8 + MOVQ DI, AX + MOVQ ·x_cgo_unsetenv_call(SB), R11 + MOVQ (R11), R11 + CALL R11 + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0 + JMP ·x_cgo_notify_runtime_init_done(SB) + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 + JMP ·x_cgo_bindm(SB) + +// func setg_trampoline(setg uintptr, g uintptr) +TEXT ·setg_trampoline(SB), NOSPLIT, $0-16 + MOVQ G+8(FP), DI + MOVQ setg+0(FP), R11 + XORL AX, AX + CALL R11 + RET + +TEXT threadentry_trampoline(SB), NOSPLIT, $0 + // See crosscall2. + PUSH_REGS_HOST_TO_ABI0() + + // X15 is designated by Go as a fixed zero register. + // Calling directly into ABIInternal, ensure it is zero. + PXOR X15, X15 + + MOVQ DI, AX + MOVQ ·threadentry_call(SB), R11 + MOVQ (R11), R11 + CALL R11 + + POP_REGS_HOST_TO_ABI0() + RET + +TEXT ·call5(SB), NOSPLIT, $0-56 + MOVQ fn+0(FP), R11 + MOVQ a1+8(FP), DI + MOVQ a2+16(FP), SI + MOVQ a3+24(FP), DX + MOVQ a4+32(FP), CX + MOVQ a5+40(FP), R8 + + XORL AX, AX // no floats + + PUSHQ BP // save BP + MOVQ SP, BP // save SP inside BP bc BP is callee-saved + SUBQ $16, SP // allocate space for alignment + ANDQ $-16, SP // align on 16 bytes for SSE + + CALL R11 + + MOVQ BP, SP // get SP back + POPQ BP // restore BP + + MOVQ AX, ret+48(FP) + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm.s new file mode 100644 index 00000000..00b3177e --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm.s @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build !cgo && (freebsd || linux) + +#include "textflag.h" +#include "go_asm.h" + +// These trampolines map the gcc ABI to Go ABI0 and then call into the Go equivalent functions. +// On ARM32, Go ABI0 uses stack-based calling convention. +// Arguments are placed on the stack starting at 4(SP) after the prologue. + +TEXT x_cgo_init_trampoline(SB), NOSPLIT, $8-0 + MOVW R0, 4(R13) + MOVW R1, 8(R13) + MOVW ·x_cgo_init_call(SB), R12 + MOVW (R12), R12 + CALL (R12) + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8-0 + MOVW R0, 4(R13) + MOVW ·x_cgo_thread_start_call(SB), R12 + MOVW (R12), R12 + CALL (R12) + RET + +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8-0 + MOVW R0, 4(R13) + MOVW ·x_cgo_setenv_call(SB), R12 + MOVW (R12), R12 + CALL (R12) + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8-0 + MOVW R0, 4(R13) + MOVW ·x_cgo_unsetenv_call(SB), R12 + MOVW (R12), R12 + CALL (R12) + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0-0 + CALL ·x_cgo_notify_runtime_init_done(SB) + RET + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_bindm(SB) + RET + +// func setg_trampoline(setg uintptr, g uintptr) +TEXT ·setg_trampoline(SB), NOSPLIT, $0-8 + MOVW G+4(FP), R0 + MOVW setg+0(FP), R12 + BL (R12) + RET + +TEXT threadentry_trampoline(SB), NOSPLIT, $8-0 + // See crosscall2. + MOVW R0, 4(R13) + MOVW ·threadentry_call(SB), R12 + MOVW (R12), R12 + CALL (R12) + RET + +TEXT ·call5(SB), NOSPLIT, $8-28 + MOVW fn+0(FP), R12 + MOVW a1+4(FP), R0 + MOVW a2+8(FP), R1 + MOVW a3+12(FP), R2 + MOVW a4+16(FP), R3 + MOVW a5+20(FP), R4 + + // Store 5th arg below SP (in local frame area) + MOVW R4, arg5-8(SP) + + // Align SP to 8 bytes for call (required by ARM AAPCS) + SUB $8, R13 + CALL (R12) + ADD $8, R13 + MOVW R0, r1+24(FP) + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm64.s new file mode 100644 index 00000000..dceb1cac --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm64.s @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux) + +#include "textflag.h" +#include "go_asm.h" +#include "abi_arm64.h" + +// These trampolines map the gcc ABI to Go ABIInternal and then calls into the Go equivalent functions. +// Note that C arguments are passed in R0-R7, which matches Go ABIInternal for the first eight arguments. +// R9 is used as a temporary register. + +TEXT x_cgo_init_trampoline(SB), NOSPLIT, $0-0 + MOVD ·x_cgo_init_call(SB), R9 + MOVD (R9), R9 + CALL R9 + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $0-0 + MOVD ·x_cgo_thread_start_call(SB), R9 + MOVD (R9), R9 + CALL R9 + RET + +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $0-0 + MOVD ·x_cgo_setenv_call(SB), R9 + MOVD (R9), R9 + CALL R9 + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $0-0 + MOVD ·x_cgo_unsetenv_call(SB), R9 + MOVD (R9), R9 + CALL R9 + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0-0 + CALL ·x_cgo_notify_runtime_init_done(SB) + RET + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_bindm(SB) + RET + +// func setg_trampoline(setg uintptr, g uintptr) +TEXT ·setg_trampoline(SB), NOSPLIT, $0-16 + MOVD G+8(FP), R0 + MOVD setg+0(FP), R9 + CALL R9 + RET + +TEXT threadentry_trampoline(SB), NOSPLIT, $0-0 + // See crosscall2. + SUB $(8*24), RSP + STP (R0, R1), (8*1)(RSP) + MOVD R3, (8*3)(RSP) + + SAVE_R19_TO_R28(8*4) + SAVE_F8_TO_F15(8*14) + STP (R29, R30), (8*22)(RSP) + + MOVD ·threadentry_call(SB), R9 + MOVD (R9), R9 + CALL R9 + MOVD $0, R0 // TODO: get the return value from threadentry + + RESTORE_R19_TO_R28(8*4) + RESTORE_F8_TO_F15(8*14) + LDP (8*22)(RSP), (R29, R30) + + ADD $(8*24), RSP + RET + +TEXT ·call5(SB), NOSPLIT, $0-0 + MOVD fn+0(FP), R9 + MOVD a1+8(FP), R0 + MOVD a2+16(FP), R1 + MOVD a3+24(FP), R2 + MOVD a4+32(FP), R3 + MOVD a5+40(FP), R4 + CALL R9 + MOVD R0, ret+48(FP) + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s new file mode 100644 index 00000000..7596f0da --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build !cgo && linux + +#include "textflag.h" +#include "go_asm.h" +#include "abi_loong64.h" + +// these trampolines map the gcc ABI to Go ABI and then calls into the Go equivalent functions. +// R23 is used as temporary register. + +TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16 + MOVV R4, 8(R3) + MOVV R5, 16(R3) + MOVV ·x_cgo_init_call(SB), R23 + MOVV (R23), R23 + CALL (R23) + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8 + MOVV R4, 8(R3) + MOVV ·x_cgo_thread_start_call(SB), R23 + MOVV (R23), R23 + CALL (R23) + RET + +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8 + MOVV R4, 8(R3) + MOVV ·x_cgo_setenv_call(SB), R23 + MOVV (R23), R23 + CALL (R23) + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8 + MOVV R4, 8(R3) + MOVV ·x_cgo_unsetenv_call(SB), R23 + MOVV (R23), R23 + CALL (R23) + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_notify_runtime_init_done(SB) + RET + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_bindm(SB) + RET + +// func setg_trampoline(setg uintptr, g uintptr) +TEXT ·setg_trampoline(SB), NOSPLIT, $0 + MOVV G+8(FP), R4 + MOVV setg+0(FP), R23 + CALL (R23) + RET + +TEXT threadentry_trampoline(SB), NOSPLIT, $0 + // See crosscall2. + ADDV $(-23*8), R3 + MOVV R4, (1*8)(R3) // fn unsafe.Pointer + MOVV R5, (2*8)(R3) // a unsafe.Pointer + MOVV R7, (3*8)(R3) // ctxt uintptr + + SAVE_R22_TO_R31((4*8)) + SAVE_F24_TO_F31((14*8)) + MOVV R1, (22*8)(R3) + + MOVV ·threadentry_call(SB), R23 + MOVV (R23), R23 + CALL (R23) + + RESTORE_R22_TO_R31((4*8)) + RESTORE_F24_TO_F31((14*8)) + MOVV (22*8)(R3), R1 + + ADDV $(23*8), R3 + RET + +TEXT ·call5(SB), NOSPLIT, $0-0 + MOVV fn+0(FP), R23 + MOVV a1+8(FP), R4 + MOVV a2+16(FP), R5 + MOVV a3+24(FP), R6 + MOVV a4+32(FP), R7 + MOVV a5+40(FP), R8 + CALL (R23) + MOVV R4, ret+48(FP) + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_ppc64le.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_ppc64le.s new file mode 100644 index 00000000..85f89556 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_ppc64le.s @@ -0,0 +1,227 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build !cgo && linux + +#include "textflag.h" +#include "go_asm.h" + +// These trampolines map the C ABI to Go ABI and call into the Go equivalent functions. +// +// PPC64LE ELFv2 ABI stack frame layout: +// 0(R1) = backchain (pointer to caller's frame) +// 8(R1) = CR save area +// 16(R1) = LR save area +// 24(R1) = reserved +// 32(R1) = parameter save area (minimum 64 bytes for 8 args) +// +// Two patterns are used depending on call direction: +// +// C→Go trampolines: The C caller already provides a 32-byte linkage area. +// Save LR/CR into caller's frame at 16(R1)/8(R1) BEFORE allocating, +// then use MOVDU to allocate and set backchain atomically. +// +// Go→C trampolines: Go callers don't provide ELFv2 linkage area. +// Allocate frame first with MOVDU, then save LR/CR into OUR frame. + +TEXT x_cgo_init_trampoline(SB), NOSPLIT|NOFRAME, $0-0 + MOVD LR, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + MOVDU R1, -32(R1) + + // R3, R4 already have the arguments + MOVD ·x_cgo_init_call(SB), R12 + MOVD (R12), R12 + MOVD R12, CTR + CALL CTR + + ADD $32, R1 + + MOVD 16(R1), LR + MOVD 8(R1), R0 + MOVW R0, CR + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT|NOFRAME, $0-0 + MOVD LR, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + MOVDU R1, -32(R1) + + MOVD ·x_cgo_thread_start_call(SB), R12 + MOVD (R12), R12 + MOVD R12, CTR + CALL CTR + + ADD $32, R1 + + MOVD 16(R1), LR + MOVD 8(R1), R0 + MOVW R0, CR + RET + +// void (*_cgo_setenv)(char**) +// C arg: R3 = pointer to env +// This is C→Go: caller is C ABI. +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT|NOFRAME, $0-0 + MOVD LR, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + MOVDU R1, -32(R1) + + MOVD ·x_cgo_setenv_call(SB), R12 + MOVD (R12), R12 + MOVD R12, CTR + CALL CTR + + ADD $32, R1 + + MOVD 16(R1), LR + MOVD 8(R1), R0 + MOVW R0, CR + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT|NOFRAME, $0-0 + MOVD LR, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + MOVDU R1, -32(R1) + + MOVD ·x_cgo_unsetenv_call(SB), R12 + MOVD (R12), R12 + MOVD R12, CTR + CALL CTR + + ADD $32, R1 + + MOVD 16(R1), LR + MOVD 8(R1), R0 + MOVW R0, CR + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT|NOFRAME, $0-0 + MOVD LR, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + MOVDU R1, -32(R1) + + CALL ·x_cgo_notify_runtime_init_done(SB) + + ADD $32, R1 + + MOVD 16(R1), LR + MOVD 8(R1), R0 + MOVW R0, CR + RET + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT|NOFRAME, $0-0 + MOVD LR, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + MOVDU R1, -32(R1) + + CALL ·x_cgo_bindm(SB) + + ADD $32, R1 + + MOVD 16(R1), LR + MOVD 8(R1), R0 + MOVW R0, CR + RET + +TEXT ·setg_trampoline(SB), NOSPLIT|NOFRAME, $0-16 + // Save LR, CR, and R31 to non-volatile registers (C ABI preserves R14-R31) + MOVD LR, R20 + MOVW CR, R21 + MOVD R31, R22 // save R31 because load_g clobbers it + + // Load arguments from Go stack + MOVD 32(R1), R12 // setg function pointer + MOVD 40(R1), R3 // g pointer → first C arg + + // Allocate ELFv2 frame for the C callee (32 bytes minimum) + MOVDU R1, -32(R1) + + // Call setg_gcc which stores g to TLS + MOVD R12, CTR + CALL CTR + + // setg_gcc stored g to TLS but restored old g in R30. + // Call load_g to reload g from TLS into R30. + // Note: load_g clobbers R31 + CALL runtime·load_g(SB) + + // Deallocate frame + ADD $32, R1 + + // Clear R0 before returning to Go code. + // Go uses R0 as a constant 0 for things like "std r0,X(r1)" to zero stack locations. + // C/assembly functions may leave garbage in R0. + XOR R0, R0, R0 + + // Restore LR, CR, and R31 from non-volatile registers + MOVD R22, R31 // restore R31 + MOVD R20, LR + MOVW R21, CR + RET + +TEXT threadentry_trampoline(SB), NOSPLIT|NOFRAME, $0-0 + MOVD LR, 16(R1) + MOVW CR, R0 + MOVD R0, 8(R1) + + MOVDU R1, -32(R1) + + MOVD ·threadentry_call(SB), R12 + MOVD (R12), R12 + MOVD R12, CTR + CALL CTR + + ADD $32, R1 + + MOVD 16(R1), LR + MOVD 8(R1), R0 + MOVW R0, CR + RET + +TEXT ·call5(SB), NOSPLIT|NOFRAME, $0-56 + MOVD LR, R20 + MOVW CR, R21 + + // Load arguments from Go stack into C argument registers + // Go placed args at 32(R1), 40(R1), etc. + MOVD 32(R1), R12 // fn + MOVD 40(R1), R3 // a1 → first C arg + MOVD 48(R1), R4 // a2 → second C arg + MOVD 56(R1), R5 // a3 → third C arg + MOVD 64(R1), R6 // a4 → fourth C arg + MOVD 72(R1), R7 // a5 → fifth C arg + + MOVDU R1, -32(R1) + + MOVD R12, CTR + CALL CTR + + // Store return value + // After MOVDU -32, original 80(R1) is now at 80+32=112(R1) + MOVD R3, (80+32)(R1) + + // Deallocate frame + ADD $32, R1 + + // Clear R0 before returning to Go code. + // Go uses R0 as a constant 0 register for things like "std r0,X(r1)" + // to zero stack locations. C functions may leave garbage in R0. + XOR R0, R0, R0 + + // Restore LR/CR from non-volatile registers + MOVD R20, LR + MOVW R21, CR + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_riscv64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_riscv64.s new file mode 100644 index 00000000..9298f8c7 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_riscv64.s @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build !cgo && linux + +#include "textflag.h" +#include "go_asm.h" + +// these trampolines map the gcc ABI to Go ABI and then calls into the Go equivalent functions. +// X5 is used as temporary register. + +TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16 + MOV X10, 8(SP) + MOV X11, 16(SP) + MOV ·x_cgo_init_call(SB), X5 + MOV (X5), X5 + CALL X5 + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8 + MOV X10, 8(SP) + MOV ·x_cgo_thread_start_call(SB), X5 + MOV (X5), X5 + CALL X5 + RET + +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8 + MOV X10, 8(SP) + MOV ·x_cgo_setenv_call(SB), X5 + MOV (X5), X5 + CALL X5 + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8 + MOV X10, 8(SP) + MOV ·x_cgo_unsetenv_call(SB), X5 + MOV (X5), X5 + CALL X5 + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_notify_runtime_init_done(SB) + RET + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_bindm(SB) + RET + +// func setg_trampoline(setg uintptr, g uintptr) +TEXT ·setg_trampoline(SB), NOSPLIT, $0 + MOV gp+8(FP), X10 + MOV setg+0(FP), X5 + CALL X5 + RET + +TEXT threadentry_trampoline(SB), NOSPLIT, $16 + MOV X10, 8(SP) + MOV ·threadentry_call(SB), X5 + MOV (X5), X5 + CALL X5 + RET + +TEXT ·call5(SB), NOSPLIT, $0-48 + MOV fn+0(FP), X5 + MOV a1+8(FP), X10 + MOV a2+16(FP), X11 + MOV a3+24(FP), X12 + MOV a4+32(FP), X13 + MOV a5+40(FP), X14 + CALL X5 + MOV X10, ret+48(FP) + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols.go new file mode 100644 index 00000000..cc552e7d --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols.go @@ -0,0 +1,165 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package fakecgo + +import ( + "syscall" + "unsafe" +) + +//go:nosplit +//go:norace +func malloc(size uintptr) unsafe.Pointer { + ret := call5(mallocABI0, uintptr(size), 0, 0, 0, 0) + // this indirection is to avoid go vet complaining about possible misuse of unsafe.Pointer + return *(*unsafe.Pointer)(unsafe.Pointer(&ret)) +} + +//go:nosplit +//go:norace +func free(ptr unsafe.Pointer) { + call5(freeABI0, uintptr(ptr), 0, 0, 0, 0) +} + +//go:nosplit +//go:norace +func setenv(name *byte, value *byte, overwrite int32) int32 { + return int32(call5(setenvABI0, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), uintptr(overwrite), 0, 0)) +} + +//go:nosplit +//go:norace +func unsetenv(name *byte) int32 { + return int32(call5(unsetenvABI0, uintptr(unsafe.Pointer(name)), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func sigfillset(set *sigset_t) int32 { + return int32(call5(sigfillsetABI0, uintptr(unsafe.Pointer(set)), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func nanosleep(ts *syscall.Timespec, rem *syscall.Timespec) int32 { + return int32(call5(nanosleepABI0, uintptr(unsafe.Pointer(ts)), uintptr(unsafe.Pointer(rem)), 0, 0, 0)) +} + +//go:nosplit +//go:norace +func abort() { + call5(abortABI0, 0, 0, 0, 0, 0) +} + +//go:nosplit +//go:norace +func pthread_attr_init(attr *pthread_attr_t) int32 { + return int32(call5(pthread_attr_initABI0, uintptr(unsafe.Pointer(attr)), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_create(thread *pthread_t, attr *pthread_attr_t, start unsafe.Pointer, arg unsafe.Pointer) int32 { + return int32(call5(pthread_createABI0, uintptr(unsafe.Pointer(thread)), uintptr(unsafe.Pointer(attr)), uintptr(start), uintptr(arg), 0)) +} + +//go:nosplit +//go:norace +func pthread_detach(thread pthread_t) int32 { + return int32(call5(pthread_detachABI0, uintptr(thread), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_sigmask(how sighow, ign *sigset_t, oset *sigset_t) int32 { + return int32(call5(pthread_sigmaskABI0, uintptr(how), uintptr(unsafe.Pointer(ign)), uintptr(unsafe.Pointer(oset)), 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_mutex_lock(mutex *pthread_mutex_t) int32 { + return int32(call5(pthread_mutex_lockABI0, uintptr(unsafe.Pointer(mutex)), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_mutex_unlock(mutex *pthread_mutex_t) int32 { + return int32(call5(pthread_mutex_unlockABI0, uintptr(unsafe.Pointer(mutex)), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_cond_broadcast(cond *pthread_cond_t) int32 { + return int32(call5(pthread_cond_broadcastABI0, uintptr(unsafe.Pointer(cond)), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_setspecific(key pthread_key_t, value unsafe.Pointer) int32 { + return int32(call5(pthread_setspecificABI0, uintptr(key), uintptr(value), 0, 0, 0)) +} + +//go:linkname _malloc _malloc +var _malloc uint8 +var mallocABI0 = uintptr(unsafe.Pointer(&_malloc)) + +//go:linkname _free _free +var _free uint8 +var freeABI0 = uintptr(unsafe.Pointer(&_free)) + +//go:linkname _setenv _setenv +var _setenv uint8 +var setenvABI0 = uintptr(unsafe.Pointer(&_setenv)) + +//go:linkname _unsetenv _unsetenv +var _unsetenv uint8 +var unsetenvABI0 = uintptr(unsafe.Pointer(&_unsetenv)) + +//go:linkname _sigfillset _sigfillset +var _sigfillset uint8 +var sigfillsetABI0 = uintptr(unsafe.Pointer(&_sigfillset)) + +//go:linkname _nanosleep _nanosleep +var _nanosleep uint8 +var nanosleepABI0 = uintptr(unsafe.Pointer(&_nanosleep)) + +//go:linkname _abort _abort +var _abort uint8 +var abortABI0 = uintptr(unsafe.Pointer(&_abort)) + +//go:linkname _pthread_attr_init _pthread_attr_init +var _pthread_attr_init uint8 +var pthread_attr_initABI0 = uintptr(unsafe.Pointer(&_pthread_attr_init)) + +//go:linkname _pthread_create _pthread_create +var _pthread_create uint8 +var pthread_createABI0 = uintptr(unsafe.Pointer(&_pthread_create)) + +//go:linkname _pthread_detach _pthread_detach +var _pthread_detach uint8 +var pthread_detachABI0 = uintptr(unsafe.Pointer(&_pthread_detach)) + +//go:linkname _pthread_sigmask _pthread_sigmask +var _pthread_sigmask uint8 +var pthread_sigmaskABI0 = uintptr(unsafe.Pointer(&_pthread_sigmask)) + +//go:linkname _pthread_mutex_lock _pthread_mutex_lock +var _pthread_mutex_lock uint8 +var pthread_mutex_lockABI0 = uintptr(unsafe.Pointer(&_pthread_mutex_lock)) + +//go:linkname _pthread_mutex_unlock _pthread_mutex_unlock +var _pthread_mutex_unlock uint8 +var pthread_mutex_unlockABI0 = uintptr(unsafe.Pointer(&_pthread_mutex_unlock)) + +//go:linkname _pthread_cond_broadcast _pthread_cond_broadcast +var _pthread_cond_broadcast uint8 +var pthread_cond_broadcastABI0 = uintptr(unsafe.Pointer(&_pthread_cond_broadcast)) + +//go:linkname _pthread_setspecific _pthread_setspecific +var _pthread_setspecific uint8 +var pthread_setspecificABI0 = uintptr(unsafe.Pointer(&_pthread_setspecific)) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_darwin.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_darwin.go new file mode 100644 index 00000000..960f8168 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_darwin.go @@ -0,0 +1,59 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:cgo_import_dynamic purego_malloc malloc "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_free free "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_setenv setenv "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_unsetenv unsetenv "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_sigfillset sigfillset "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_nanosleep nanosleep "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_abort abort "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_create pthread_create "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_detach pthread_detach "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_sigmask pthread_sigmask "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_mutex_lock pthread_mutex_lock "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_mutex_unlock pthread_mutex_unlock "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_cond_broadcast pthread_cond_broadcast "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_setspecific pthread_setspecific "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_self pthread_self "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_get_stacksize_np pthread_get_stacksize_np "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_pthread_attr_setstacksize pthread_attr_setstacksize "/usr/lib/libSystem.B.dylib" + +//go:nosplit +//go:norace +func pthread_self() pthread_t { + return pthread_t(call5(pthread_selfABI0, 0, 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_get_stacksize_np(thread pthread_t) size_t { + return size_t(call5(pthread_get_stacksize_npABI0, uintptr(thread), 0, 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_attr_setstacksize(attr *pthread_attr_t, size size_t) int32 { + return int32(call5(pthread_attr_setstacksizeABI0, uintptr(unsafe.Pointer(attr)), uintptr(size), 0, 0, 0)) +} + +//go:linkname _pthread_self _pthread_self +var _pthread_self uint8 +var pthread_selfABI0 = uintptr(unsafe.Pointer(&_pthread_self)) + +//go:linkname _pthread_get_stacksize_np _pthread_get_stacksize_np +var _pthread_get_stacksize_np uint8 +var pthread_get_stacksize_npABI0 = uintptr(unsafe.Pointer(&_pthread_get_stacksize_np)) + +//go:linkname _pthread_attr_setstacksize _pthread_attr_setstacksize +var _pthread_attr_setstacksize uint8 +var pthread_attr_setstacksizeABI0 = uintptr(unsafe.Pointer(&_pthread_attr_setstacksize)) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_freebsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_freebsd.go new file mode 100644 index 00000000..d6977559 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_freebsd.go @@ -0,0 +1,48 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:cgo_import_dynamic purego_malloc malloc "libc.so.7" +//go:cgo_import_dynamic purego_free free "libc.so.7" +//go:cgo_import_dynamic purego_setenv setenv "libc.so.7" +//go:cgo_import_dynamic purego_unsetenv unsetenv "libc.so.7" +//go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so.7" +//go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so.7" +//go:cgo_import_dynamic purego_abort abort "libc.so.7" +//go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so" +//go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so" +//go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so" +//go:cgo_import_dynamic purego_pthread_sigmask pthread_sigmask "libpthread.so" +//go:cgo_import_dynamic purego_pthread_mutex_lock pthread_mutex_lock "libpthread.so" +//go:cgo_import_dynamic purego_pthread_mutex_unlock pthread_mutex_unlock "libpthread.so" +//go:cgo_import_dynamic purego_pthread_cond_broadcast pthread_cond_broadcast "libpthread.so" +//go:cgo_import_dynamic purego_pthread_setspecific pthread_setspecific "libpthread.so" +//go:cgo_import_dynamic purego_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so" +//go:cgo_import_dynamic purego_pthread_attr_destroy pthread_attr_destroy "libpthread.so" + +//go:nosplit +//go:norace +func pthread_attr_getstacksize(attr *pthread_attr_t, stacksize *size_t) int32 { + return int32(call5(pthread_attr_getstacksizeABI0, uintptr(unsafe.Pointer(attr)), uintptr(unsafe.Pointer(stacksize)), 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_attr_destroy(attr *pthread_attr_t) int32 { + return int32(call5(pthread_attr_destroyABI0, uintptr(unsafe.Pointer(attr)), 0, 0, 0, 0)) +} + +//go:linkname _pthread_attr_getstacksize _pthread_attr_getstacksize +var _pthread_attr_getstacksize uint8 +var pthread_attr_getstacksizeABI0 = uintptr(unsafe.Pointer(&_pthread_attr_getstacksize)) + +//go:linkname _pthread_attr_destroy _pthread_attr_destroy +var _pthread_attr_destroy uint8 +var pthread_attr_destroyABI0 = uintptr(unsafe.Pointer(&_pthread_attr_destroy)) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_linux.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_linux.go new file mode 100644 index 00000000..f6bad22c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_linux.go @@ -0,0 +1,48 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:cgo_import_dynamic purego_malloc malloc "libc.so.6" +//go:cgo_import_dynamic purego_free free "libc.so.6" +//go:cgo_import_dynamic purego_setenv setenv "libc.so.6" +//go:cgo_import_dynamic purego_unsetenv unsetenv "libc.so.6" +//go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so.6" +//go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so.6" +//go:cgo_import_dynamic purego_abort abort "libc.so.6" +//go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_sigmask pthread_sigmask "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_mutex_lock pthread_mutex_lock "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_mutex_unlock pthread_mutex_unlock "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_cond_broadcast pthread_cond_broadcast "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_setspecific pthread_setspecific "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so.0" +//go:cgo_import_dynamic purego_pthread_attr_destroy pthread_attr_destroy "libpthread.so.0" + +//go:nosplit +//go:norace +func pthread_attr_getstacksize(attr *pthread_attr_t, stacksize *size_t) int32 { + return int32(call5(pthread_attr_getstacksizeABI0, uintptr(unsafe.Pointer(attr)), uintptr(unsafe.Pointer(stacksize)), 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_attr_destroy(attr *pthread_attr_t) int32 { + return int32(call5(pthread_attr_destroyABI0, uintptr(unsafe.Pointer(attr)), 0, 0, 0, 0)) +} + +//go:linkname _pthread_attr_getstacksize _pthread_attr_getstacksize +var _pthread_attr_getstacksize uint8 +var pthread_attr_getstacksizeABI0 = uintptr(unsafe.Pointer(&_pthread_attr_getstacksize)) + +//go:linkname _pthread_attr_destroy _pthread_attr_destroy +var _pthread_attr_destroy uint8 +var pthread_attr_destroyABI0 = uintptr(unsafe.Pointer(&_pthread_attr_destroy)) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_netbsd.go new file mode 100644 index 00000000..774402cf --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/zsymbols_netbsd.go @@ -0,0 +1,59 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:cgo_import_dynamic purego_malloc malloc "libc.so" +//go:cgo_import_dynamic purego_free free "libc.so" +//go:cgo_import_dynamic purego_setenv setenv "libc.so" +//go:cgo_import_dynamic purego_unsetenv unsetenv "libc.so" +//go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so" +//go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so" +//go:cgo_import_dynamic purego_abort abort "libc.so" +//go:cgo_import_dynamic purego_sigaltstack sigaltstack "libc.so" +//go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so" +//go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so" +//go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so" +//go:cgo_import_dynamic purego_pthread_sigmask pthread_sigmask "libpthread.so" +//go:cgo_import_dynamic purego_pthread_mutex_lock pthread_mutex_lock "libpthread.so" +//go:cgo_import_dynamic purego_pthread_mutex_unlock pthread_mutex_unlock "libpthread.so" +//go:cgo_import_dynamic purego_pthread_cond_broadcast pthread_cond_broadcast "libpthread.so" +//go:cgo_import_dynamic purego_pthread_setspecific pthread_setspecific "libpthread.so" +//go:cgo_import_dynamic purego_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so" +//go:cgo_import_dynamic purego_pthread_attr_destroy pthread_attr_destroy "libpthread.so" + +//go:nosplit +//go:norace +func sigaltstack(ss *stack_t, old_ss *stack_t) int32 { + return int32(call5(sigaltstackABI0, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(old_ss)), 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_attr_getstacksize(attr *pthread_attr_t, stacksize *size_t) int32 { + return int32(call5(pthread_attr_getstacksizeABI0, uintptr(unsafe.Pointer(attr)), uintptr(unsafe.Pointer(stacksize)), 0, 0, 0)) +} + +//go:nosplit +//go:norace +func pthread_attr_destroy(attr *pthread_attr_t) int32 { + return int32(call5(pthread_attr_destroyABI0, uintptr(unsafe.Pointer(attr)), 0, 0, 0, 0)) +} + +//go:linkname _sigaltstack _sigaltstack +var _sigaltstack uint8 +var sigaltstackABI0 = uintptr(unsafe.Pointer(&_sigaltstack)) + +//go:linkname _pthread_attr_getstacksize _pthread_attr_getstacksize +var _pthread_attr_getstacksize uint8 +var pthread_attr_getstacksizeABI0 = uintptr(unsafe.Pointer(&_pthread_attr_getstacksize)) + +//go:linkname _pthread_attr_destroy _pthread_attr_destroy +var _pthread_attr_destroy uint8 +var pthread_attr_destroyABI0 = uintptr(unsafe.Pointer(&_pthread_attr_destroy)) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_darwin.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_darwin.s new file mode 100644 index 00000000..35ef7ac1 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_darwin.s @@ -0,0 +1,19 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +#include "textflag.h" + +// these stubs are here because it is not possible to go:linkname directly the C functions + +TEXT _pthread_self(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_self(SB) + +TEXT _pthread_get_stacksize_np(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_get_stacksize_np(SB) + +TEXT _pthread_attr_setstacksize(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_setstacksize(SB) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_freebsd.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_freebsd.s new file mode 100644 index 00000000..da07005c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_freebsd.s @@ -0,0 +1,16 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +#include "textflag.h" + +// these stubs are here because it is not possible to go:linkname directly the C functions + +TEXT _pthread_attr_getstacksize(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_getstacksize(SB) + +TEXT _pthread_attr_destroy(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_destroy(SB) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_linux.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_linux.s new file mode 100644 index 00000000..da07005c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_linux.s @@ -0,0 +1,16 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +#include "textflag.h" + +// these stubs are here because it is not possible to go:linkname directly the C functions + +TEXT _pthread_attr_getstacksize(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_getstacksize(SB) + +TEXT _pthread_attr_destroy(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_destroy(SB) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_netbsd.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_netbsd.s new file mode 100644 index 00000000..81ef76f5 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_netbsd.s @@ -0,0 +1,19 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +#include "textflag.h" + +// these stubs are here because it is not possible to go:linkname directly the C functions + +TEXT _sigaltstack(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_sigaltstack(SB) + +TEXT _pthread_attr_getstacksize(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_getstacksize(SB) + +TEXT _pthread_attr_destroy(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_destroy(SB) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_stubs.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_stubs.s new file mode 100644 index 00000000..8e1afff7 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/ztrampolines_stubs.s @@ -0,0 +1,55 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +#include "textflag.h" + +// these stubs are here because it is not possible to go:linkname directly the C functions + +TEXT _malloc(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_malloc(SB) + +TEXT _free(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_free(SB) + +TEXT _setenv(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_setenv(SB) + +TEXT _unsetenv(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_unsetenv(SB) + +TEXT _sigfillset(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_sigfillset(SB) + +TEXT _nanosleep(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_nanosleep(SB) + +TEXT _abort(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_abort(SB) + +TEXT _pthread_attr_init(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_attr_init(SB) + +TEXT _pthread_create(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_create(SB) + +TEXT _pthread_detach(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_detach(SB) + +TEXT _pthread_sigmask(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_sigmask(SB) + +TEXT _pthread_mutex_lock(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_mutex_lock(SB) + +TEXT _pthread_mutex_unlock(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_mutex_unlock(SB) + +TEXT _pthread_cond_broadcast(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_cond_broadcast(SB) + +TEXT _pthread_setspecific(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_pthread_setspecific(SB) diff --git a/vendor/github.com/ebitengine/purego/internal/strings/strings.go b/vendor/github.com/ebitengine/purego/internal/strings/strings.go new file mode 100644 index 00000000..5b0d2522 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/strings/strings.go @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +package strings + +import ( + "unsafe" +) + +// hasSuffix tests whether the string s ends with suffix. +func hasSuffix(s, suffix string) bool { + return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix +} + +// CString converts a go string to *byte that can be passed to C code. +func CString(name string) *byte { + if hasSuffix(name, "\x00") { + return &(*(*[]byte)(unsafe.Pointer(&name)))[0] + } + b := make([]byte, len(name)+1) + copy(b, name) + return &b[0] +} + +// GoString copies a null-terminated char* to a Go string. +func GoString(c uintptr) string { + // We take the address and then dereference it to trick go vet from creating a possible misuse of unsafe.Pointer + ptr := *(*unsafe.Pointer)(unsafe.Pointer(&c)) + if ptr == nil { + return "" + } + var length int + for { + if *(*byte)(unsafe.Add(ptr, uintptr(length))) == '\x00' { + break + } + length++ + } + return string(unsafe.Slice((*byte)(ptr), length)) +} diff --git a/vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go124.go b/vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go124.go new file mode 100644 index 00000000..5eb0580e --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go124.go @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build !go1.25 + +package xreflect + +import "reflect" + +// TODO: remove this and use Go 1.25's reflect.TypeAssert when minimum go.mod version is 1.25 + +func TypeAssert[T any](v reflect.Value) (T, bool) { + v2, ok := v.Interface().(T) + return v2, ok +} diff --git a/vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go125.go b/vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go125.go new file mode 100644 index 00000000..62ee13d6 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/xreflect/reflect_go125.go @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build go1.25 + +package xreflect + +import "reflect" + +func TypeAssert[T any](v reflect.Value) (T, bool) { + return reflect.TypeAssert[T](v) +} diff --git a/vendor/github.com/ebitengine/purego/is_ios.go b/vendor/github.com/ebitengine/purego/is_ios.go new file mode 100644 index 00000000..ed31da97 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/is_ios.go @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package purego + +// if you are getting this error it means that you have +// CGO_ENABLED=0 while trying to build for ios. +// purego does not support this mode yet. +// the fix is to set CGO_ENABLED=1 which will require +// a C compiler. +var _ = _PUREGO_REQUIRES_CGO_ON_IOS diff --git a/vendor/github.com/ebitengine/purego/nocgo.go b/vendor/github.com/ebitengine/purego/nocgo.go new file mode 100644 index 00000000..b91b9796 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/nocgo.go @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo && (darwin || freebsd || linux || netbsd) + +package purego + +// if CGO_ENABLED=0 import fakecgo to setup the Cgo runtime correctly. +// This is required since some frameworks need TLS setup the C way which Go doesn't do. +// We currently don't support ios in fakecgo mode so force Cgo or fail +// +// The way that the Cgo runtime (runtime/cgo) works is by setting some variables found +// in runtime with non-null GCC compiled functions. The variables that are replaced are +// var ( +// iscgo bool // in runtime/cgo.go +// _cgo_init unsafe.Pointer // in runtime/cgo.go +// _cgo_thread_start unsafe.Pointer // in runtime/cgo.go +// _cgo_notify_runtime_init_done unsafe.Pointer // in runtime/cgo.go +// _cgo_setenv unsafe.Pointer // in runtime/env_posix.go +// _cgo_unsetenv unsafe.Pointer // in runtime/env_posix.go +// ) +// importing fakecgo will set these (using //go:linkname) with functions written +// entirely in Go (except for some assembly trampolines to change GCC ABI to Go ABI). +// Doing so makes it possible to build applications that call into C without CGO_ENABLED=1. +import _ "github.com/ebitengine/purego/internal/fakecgo" diff --git a/vendor/github.com/ebitengine/purego/struct_386.go b/vendor/github.com/ebitengine/purego/struct_386.go new file mode 100644 index 00000000..02c8ac45 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_386.go @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +package purego + +import "reflect" + +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { + panic("purego: struct arguments are not supported") +} + +func getStruct(outType reflect.Type, syscall syscall15Args) (v reflect.Value) { + panic("purego: struct returns are not supported") +} + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + panic("purego: placeRegisters not implemented on 386") +} + +// shouldBundleStackArgs always returns false on 386 +// since C-style stack argument bundling is only needed on Darwin ARM64. +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + return false +} + +// structFitsInRegisters is not used on 386. +func structFitsInRegisters(val reflect.Value, tempNumInts, tempNumFloats int) (bool, int, int) { + panic("purego: structFitsInRegisters should not be called on 386") +} + +// collectStackArgs is not used on 386. +func collectStackArgs(args []reflect.Value, startIdx int, numInts, numFloats int, + keepAlive []any, addInt, addFloat, addStack func(uintptr), + pNumInts, pNumFloats, pNumStack *int) ([]reflect.Value, []any) { + panic("purego: collectStackArgs should not be called on 386") +} + +// bundleStackArgs is not used on 386. +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + panic("purego: bundleStackArgs should not be called on 386") +} diff --git a/vendor/github.com/ebitengine/purego/struct_amd64.go b/vendor/github.com/ebitengine/purego/struct_amd64.go new file mode 100644 index 00000000..c56f957a --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_amd64.go @@ -0,0 +1,286 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2024 The Ebitengine Authors + +package purego + +import ( + "math" + "reflect" + "unsafe" +) + +func getStruct(outType reflect.Type, syscall syscall15Args) (v reflect.Value) { + outSize := outType.Size() + switch { + case outSize == 0: + return reflect.New(outType).Elem() + case outSize <= 8: + if isAllFloats(outType) { + // 2 float32s or 1 float64s are return in the float register + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a uintptr }{syscall.f1})).Elem() + } + // up to 8 bytes is returned in RAX + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a uintptr }{syscall.a1})).Elem() + case outSize <= 16: + r1, r2 := syscall.a1, syscall.a2 + if isAllFloats(outType) { + r1 = syscall.f1 + r2 = syscall.f2 + } else { + // check first 8 bytes if it's floats + hasFirstFloat := false + f1 := outType.Field(0).Type + if f1.Kind() == reflect.Float64 || f1.Kind() == reflect.Float32 && outType.Field(1).Type.Kind() == reflect.Float32 { + r1 = syscall.f1 + hasFirstFloat = true + } + + // find index of the field that starts the second 8 bytes + var i int + for i = 0; i < outType.NumField(); i++ { + if outType.Field(i).Offset == 8 { + break + } + } + + // check last 8 bytes if they are floats + f1 = outType.Field(i).Type + if f1.Kind() == reflect.Float64 || f1.Kind() == reflect.Float32 && i+1 == outType.NumField() { + r2 = syscall.f1 + } else if hasFirstFloat { + // if the first field was a float then that means the second integer field + // comes from the first integer register + r2 = syscall.a1 + } + } + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a, b uintptr }{r1, r2})).Elem() + default: + // create struct from the Go pointer created above + // weird pointer dereference to circumvent go vet + return reflect.NewAt(outType, *(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1))).Elem() + } +} + +func isAllFloats(ty reflect.Type) bool { + for i := 0; i < ty.NumField(); i++ { + f := ty.Field(i) + switch f.Type.Kind() { + case reflect.Float64, reflect.Float32: + default: + return false + } + } + return true +} + +// https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf +// https://gitlab.com/x86-psABIs/x86-64-ABI +// Class determines where the 8 byte value goes. +// Higher value classes win over lower value classes +const ( + _NO_CLASS = 0b0000 + _SSE = 0b0001 + _X87 = 0b0011 // long double not used in Go + _INTEGER = 0b0111 + _MEMORY = 0b1111 +) + +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { + if v.Type().Size() == 0 { + return keepAlive + } + + // if greater than 64 bytes place on stack + if v.Type().Size() > 8*8 { + placeStack(v, addStack) + return keepAlive + } + var ( + savedNumFloats = *numFloats + savedNumInts = *numInts + savedNumStack = *numStack + ) + placeOnStack := postMerger(v.Type()) || !tryPlaceRegister(v, addFloat, addInt) + if placeOnStack { + // reset any values placed in registers + *numFloats = savedNumFloats + *numInts = savedNumInts + *numStack = savedNumStack + placeStack(v, addStack) + } + return keepAlive +} + +func postMerger(t reflect.Type) (passInMemory bool) { + // (c) If the size of the aggregate exceeds two eightbytes and the first eight- byte isn’t SSE or any other + // eightbyte isn’t SSEUP, the whole argument is passed in memory. + if t.Kind() != reflect.Struct { + return false + } + if t.Size() <= 2*8 { + return false + } + return true // Go does not have an SSE/SSEUP type so this is always true +} + +func tryPlaceRegister(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) (ok bool) { + ok = true + var val uint64 + var shift byte // # of bits to shift + var flushed bool + class := _NO_CLASS + flushIfNeeded := func() { + if flushed { + return + } + flushed = true + if class == _SSE { + addFloat(uintptr(val)) + } else { + addInt(uintptr(val)) + } + val = 0 + shift = 0 + class = _NO_CLASS + } + var place func(v reflect.Value) + place = func(v reflect.Value) { + var numFields int + if v.Kind() == reflect.Struct { + numFields = v.Type().NumField() + } else { + numFields = v.Type().Len() + } + + for i := 0; i < numFields; i++ { + flushed = false + var f reflect.Value + if v.Kind() == reflect.Struct { + f = v.Field(i) + } else { + f = v.Index(i) + } + switch f.Kind() { + case reflect.Struct: + place(f) + case reflect.Bool: + if f.Bool() { + val |= 1 << shift + } + shift += 8 + class |= _INTEGER + case reflect.Pointer, reflect.UnsafePointer: + val = uint64(f.Pointer()) + shift = 64 + class = _INTEGER + case reflect.Int8: + val |= uint64(f.Int()&0xFF) << shift + shift += 8 + class |= _INTEGER + case reflect.Int16: + val |= uint64(f.Int()&0xFFFF) << shift + shift += 16 + class |= _INTEGER + case reflect.Int32: + val |= uint64(f.Int()&0xFFFF_FFFF) << shift + shift += 32 + class |= _INTEGER + case reflect.Int64, reflect.Int: + val = uint64(f.Int()) + shift = 64 + class = _INTEGER + case reflect.Uint8: + val |= f.Uint() << shift + shift += 8 + class |= _INTEGER + case reflect.Uint16: + val |= f.Uint() << shift + shift += 16 + class |= _INTEGER + case reflect.Uint32: + val |= f.Uint() << shift + shift += 32 + class |= _INTEGER + case reflect.Uint64, reflect.Uint, reflect.Uintptr: + val = f.Uint() + shift = 64 + class = _INTEGER + case reflect.Float32: + val |= uint64(math.Float32bits(float32(f.Float()))) << shift + shift += 32 + class |= _SSE + case reflect.Float64: + if v.Type().Size() > 16 { + ok = false + return + } + val = uint64(math.Float64bits(f.Float())) + shift = 64 + class = _SSE + case reflect.Array: + place(f) + default: + panic("purego: unsupported kind " + f.Kind().String()) + } + + if shift == 64 { + flushIfNeeded() + } else if shift > 64 { + // Should never happen, but may if we forget to reset shift after flush (or forget to flush), + // better fall apart here, than corrupt arguments. + panic("purego: tryPlaceRegisters shift > 64") + } + } + } + + place(v) + flushIfNeeded() + return ok +} + +func placeStack(v reflect.Value, addStack func(uintptr)) { + // Copy the struct as a contiguous block of memory in eightbyte (8-byte) + // chunks. The x86-64 ABI requires structs passed on the stack to be + // laid out exactly as in memory, including padding and field packing + // within eightbytes. Decomposing field-by-field would place each field + // as a separate stack slot, breaking structs with mixed-type fields + // that share an eightbyte (e.g. int32 + float32). + if !v.CanAddr() { + tmp := reflect.New(v.Type()).Elem() + tmp.Set(v) + v = tmp + } + ptr := v.Addr().UnsafePointer() + size := v.Type().Size() + for off := uintptr(0); off < size; off += 8 { + chunk := *(*uintptr)(unsafe.Add(ptr, off)) + addStack(chunk) + } +} + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + panic("purego: placeRegisters not implemented on amd64") +} + +// shouldBundleStackArgs always returns false on non-Darwin platforms +// since C-style stack argument bundling is only needed on Darwin ARM64. +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + return false +} + +// structFitsInRegisters is not used on amd64. +func structFitsInRegisters(val reflect.Value, tempNumInts, tempNumFloats int) (bool, int, int) { + panic("purego: structFitsInRegisters should not be called on amd64") +} + +// collectStackArgs is not used on amd64. +func collectStackArgs(args []reflect.Value, startIdx int, numInts, numFloats int, + keepAlive []any, addInt, addFloat, addStack func(uintptr), + pNumInts, pNumFloats, pNumStack *int) ([]reflect.Value, []any) { + panic("purego: collectStackArgs should not be called on amd64") +} + +// bundleStackArgs is not used on amd64. +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + panic("purego: bundleStackArgs should not be called on amd64") +} diff --git a/vendor/github.com/ebitengine/purego/struct_arm.go b/vendor/github.com/ebitengine/purego/struct_arm.go new file mode 100644 index 00000000..1b580585 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_arm.go @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +package purego + +import ( + "reflect" + "unsafe" +) + +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { + size := v.Type().Size() + if size == 0 { + return keepAlive + } + + // TODO: ARM EABI: small structs are passed in registers or on stack + // For simplicity, pass by pointer for now + ptr := v.Addr().UnsafePointer() + keepAlive = append(keepAlive, ptr) + if *numInts < 4 { + addInt(uintptr(ptr)) + *numInts++ + } else { + addStack(uintptr(ptr)) + *numStack++ + } + return keepAlive +} + +func getStruct(outType reflect.Type, syscall syscall15Args) (v reflect.Value) { + outSize := outType.Size() + if outSize == 0 { + return reflect.New(outType).Elem() + } + if outSize <= 4 { + // Fits in one register + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a uintptr }{syscall.a1})).Elem() + } + if outSize <= 8 { + // Fits in two registers + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a, b uintptr }{syscall.a1, syscall.a2})).Elem() + } + // Larger structs returned via pointer in a1 + return reflect.NewAt(outType, *(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1))).Elem() +} + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + // TODO: For ARM32, just pass the struct data directly + // This is a simplified implementation + size := v.Type().Size() + if size == 0 { + return + } + ptr := unsafe.Pointer(v.UnsafeAddr()) + if size <= 4 { + addInt(*(*uintptr)(ptr)) + } else if size <= 8 { + addInt(*(*uintptr)(ptr)) + addInt(*(*uintptr)(unsafe.Add(ptr, 4))) + } +} + +// shouldBundleStackArgs always returns false on arm +// since C-style stack argument bundling is only needed on Darwin ARM64. +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + return false +} + +// structFitsInRegisters is not used on arm. +func structFitsInRegisters(val reflect.Value, tempNumInts, tempNumFloats int) (bool, int, int) { + panic("purego: structFitsInRegisters should not be called on arm") +} + +// collectStackArgs is not used on arm. +func collectStackArgs(args []reflect.Value, startIdx int, numInts, numFloats int, + keepAlive []any, addInt, addFloat, addStack func(uintptr), + pNumInts, pNumFloats, pNumStack *int) ([]reflect.Value, []any) { + panic("purego: collectStackArgs should not be called on arm") +} + +// bundleStackArgs is not used on arm. +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + panic("purego: bundleStackArgs should not be called on arm") +} diff --git a/vendor/github.com/ebitengine/purego/struct_arm64.go b/vendor/github.com/ebitengine/purego/struct_arm64.go new file mode 100644 index 00000000..5f347c83 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_arm64.go @@ -0,0 +1,549 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2024 The Ebitengine Authors + +package purego + +import ( + "math" + "reflect" + "runtime" + "strconv" + stdstrings "strings" + "unsafe" + + "github.com/ebitengine/purego/internal/strings" +) + +func getStruct(outType reflect.Type, syscall syscall15Args) (v reflect.Value) { + outSize := outType.Size() + switch { + case outSize == 0: + return reflect.New(outType).Elem() + case outSize <= 8: + r1 := syscall.a1 + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + r1 = syscall.f1 + if numFields == 2 { + r1 = syscall.f2<<32 | syscall.f1 + } + } + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a uintptr }{r1})).Elem() + case outSize <= 16: + r1, r2 := syscall.a1, syscall.a2 + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + switch numFields { + case 4: + r1 = syscall.f2<<32 | syscall.f1 + r2 = syscall.f4<<32 | syscall.f3 + case 3: + r1 = syscall.f2<<32 | syscall.f1 + r2 = syscall.f3 + case 2: + r1 = syscall.f1 + r2 = syscall.f2 + default: + panic("unreachable") + } + } + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a, b uintptr }{r1, r2})).Elem() + default: + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats && numFields <= 4 { + switch numFields { + case 4: + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a, b, c, d uintptr }{syscall.f1, syscall.f2, syscall.f3, syscall.f4})).Elem() + case 3: + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a, b, c uintptr }{syscall.f1, syscall.f2, syscall.f3})).Elem() + default: + panic("unreachable") + } + } + // create struct from the Go pointer created in arm64_r8 + // weird pointer dereference to circumvent go vet + return reflect.NewAt(outType, *(*unsafe.Pointer)(unsafe.Pointer(&syscall.arm64_r8))).Elem() + } +} + +// https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst +const ( + _NO_CLASS = 0b00 + _FLOAT = 0b01 + _INT = 0b11 +) + +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { + if v.Type().Size() == 0 { + return keepAlive + } + + if hva, hfa, size := isHVA(v.Type()), isHFA(v.Type()), v.Type().Size(); hva || hfa || size <= 16 { + // if this doesn't fit entirely in registers then + // each element goes onto the stack + if hfa && *numFloats+v.NumField() > numOfFloatRegisters() { + *numFloats = numOfFloatRegisters() + } else if hva && *numInts+v.NumField() > numOfIntegerRegisters() { + *numInts = numOfIntegerRegisters() + } + + placeRegisters(v, addFloat, addInt) + } else { + keepAlive = placeStack(v, keepAlive, addInt) + } + return keepAlive // the struct was allocated so don't panic +} + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + if runtime.GOOS == "darwin" { + placeRegistersDarwin(v, addFloat, addInt) + return + } + placeRegistersArm64(v, addFloat, addInt) +} + +func placeRegistersArm64(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + var val uint64 + var shift byte + var flushed bool + class := _NO_CLASS + var place func(v reflect.Value) + place = func(v reflect.Value) { + var numFields int + if v.Kind() == reflect.Struct { + numFields = v.Type().NumField() + } else { + numFields = v.Type().Len() + } + for k := 0; k < numFields; k++ { + flushed = false + var f reflect.Value + if v.Kind() == reflect.Struct { + f = v.Field(k) + } else { + f = v.Index(k) + } + align := byte(f.Type().Align()*8 - 1) + shift = (shift + align) &^ align + if shift >= 64 { + shift = 0 + flushed = true + if class == _FLOAT { + addFloat(uintptr(val)) + } else { + addInt(uintptr(val)) + } + val = 0 + class = _NO_CLASS + } + switch f.Type().Kind() { + case reflect.Struct: + place(f) + case reflect.Bool: + if f.Bool() { + val |= 1 << shift + } + shift += 8 + class |= _INT + case reflect.Uint8: + val |= f.Uint() << shift + shift += 8 + class |= _INT + case reflect.Uint16: + val |= f.Uint() << shift + shift += 16 + class |= _INT + case reflect.Uint32: + val |= f.Uint() << shift + shift += 32 + class |= _INT + case reflect.Uint64, reflect.Uint, reflect.Uintptr: + addInt(uintptr(f.Uint())) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Int8: + val |= uint64(f.Int()&0xFF) << shift + shift += 8 + class |= _INT + case reflect.Int16: + val |= uint64(f.Int()&0xFFFF) << shift + shift += 16 + class |= _INT + case reflect.Int32: + val |= uint64(f.Int()&0xFFFF_FFFF) << shift + shift += 32 + class |= _INT + case reflect.Int64, reflect.Int: + addInt(uintptr(f.Int())) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Float32: + if class == _FLOAT { + addFloat(uintptr(val)) + val = 0 + shift = 0 + } + val |= uint64(math.Float32bits(float32(f.Float()))) << shift + shift += 32 + class |= _FLOAT + case reflect.Float64: + addFloat(uintptr(math.Float64bits(float64(f.Float())))) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Ptr, reflect.UnsafePointer: + addInt(f.Pointer()) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Array: + place(f) + default: + panic("purego: unsupported kind " + f.Kind().String()) + } + } + } + place(v) + if !flushed { + if class == _FLOAT { + addFloat(uintptr(val)) + } else { + addInt(uintptr(val)) + } + } +} + +func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any { + // Struct is too big to be placed in registers. + // Copy to heap and place the pointer in register + ptrStruct := reflect.New(v.Type()) + ptrStruct.Elem().Set(v) + ptr := ptrStruct.Elem().Addr().UnsafePointer() + keepAlive = append(keepAlive, ptr) + addInt(uintptr(ptr)) + return keepAlive +} + +// isHFA reports a Homogeneous Floating-point Aggregate (HFA) which is a Fundamental Data Type that is a +// Floating-Point type and at most four uniquely addressable members (5.9.5.1 in [Arm64 Calling Convention]). +// This type of struct will be placed more compactly than the individual fields. +// +// [Arm64 Calling Convention]: https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst +func isHFA(t reflect.Type) bool { + // round up struct size to nearest 8 see section B.4 + structSize := roundUpTo8(t.Size()) + if structSize == 0 || t.NumField() > 4 { + return false + } + first := t.Field(0) + switch first.Type.Kind() { + case reflect.Float32, reflect.Float64: + firstKind := first.Type.Kind() + for i := 0; i < t.NumField(); i++ { + if t.Field(i).Type.Kind() != firstKind { + return false + } + } + return true + case reflect.Array: + switch first.Type.Elem().Kind() { + case reflect.Float32, reflect.Float64: + return true + default: + return false + } + case reflect.Struct: + for i := 0; i < first.Type.NumField(); i++ { + if !isHFA(first.Type) { + return false + } + } + return true + default: + return false + } +} + +// isHVA reports a Homogeneous Aggregate with a Fundamental Data Type that is a Short-Vector type +// and at most four uniquely addressable members (5.9.5.2 in [Arm64 Calling Convention]). +// A short vector is a machine type that is composed of repeated instances of one fundamental integral or +// floating-point type. It may be 8 or 16 bytes in total size (5.4 in [Arm64 Calling Convention]). +// This type of struct will be placed more compactly than the individual fields. +// +// [Arm64 Calling Convention]: https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst +func isHVA(t reflect.Type) bool { + // round up struct size to nearest 8 see section B.4 + structSize := roundUpTo8(t.Size()) + if structSize == 0 || (structSize != 8 && structSize != 16) { + return false + } + first := t.Field(0) + switch first.Type.Kind() { + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Int8, reflect.Int16, reflect.Int32: + firstKind := first.Type.Kind() + for i := 0; i < t.NumField(); i++ { + if t.Field(i).Type.Kind() != firstKind { + return false + } + } + return true + case reflect.Array: + switch first.Type.Elem().Kind() { + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Int8, reflect.Int16, reflect.Int32: + return true + default: + return false + } + default: + return false + } +} + +// copyStruct8ByteChunks copies struct memory in 8-byte chunks to the provided callback. +// This is used for Darwin ARM64's byte-level packing of non-HFA/HVA structs. +func copyStruct8ByteChunks(ptr unsafe.Pointer, size uintptr, addChunk func(uintptr)) { + if runtime.GOOS != "darwin" { + panic("purego: should only be called on darwin") + } + for offset := uintptr(0); offset < size; offset += 8 { + var chunk uintptr + remaining := size - offset + if remaining >= 8 { + chunk = *(*uintptr)(unsafe.Add(ptr, offset)) + } else { + // Read byte-by-byte to avoid reading beyond allocation + for i := uintptr(0); i < remaining; i++ { + b := *(*byte)(unsafe.Add(ptr, offset+i)) + chunk |= uintptr(b) << (i * 8) + } + } + addChunk(chunk) + } +} + +// placeRegisters implements Darwin ARM64 calling convention for struct arguments. +// +// For HFA/HVA structs, each element must go in a separate register (or stack slot for elements +// that don't fit in registers). We use placeRegistersArm64 for this. +// +// For non-HFA/HVA structs, Darwin uses byte-level packing. We copy the struct memory in +// 8-byte chunks, which works correctly for both register and stack placement. +func placeRegistersDarwin(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + if runtime.GOOS != "darwin" { + panic("purego: placeRegistersDarwin should only be called on darwin") + } + // Check if this is an HFA/HVA + hfa := isHFA(v.Type()) + hva := isHVA(v.Type()) + + // For HFA/HVA structs, use the standard ARM64 logic which places each element separately + if hfa || hva { + placeRegistersArm64(v, addFloat, addInt) + return + } + + // For non-HFA/HVA structs, use byte-level copying + // If the value is not addressable, create an addressable copy + if !v.CanAddr() { + addressable := reflect.New(v.Type()).Elem() + addressable.Set(v) + v = addressable + } + ptr := unsafe.Pointer(v.Addr().Pointer()) + size := v.Type().Size() + copyStruct8ByteChunks(ptr, size, addInt) +} + +// shouldBundleStackArgs determines if we need to start C-style packing for +// Darwin ARM64 stack arguments. This happens when registers are exhausted. +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + if runtime.GOOS != "darwin" { + return false + } + + kind := v.Kind() + isFloat := kind == reflect.Float32 || kind == reflect.Float64 + isInt := !isFloat && kind != reflect.Struct + primitiveOnStack := + (isInt && numInts >= numOfIntegerRegisters()) || + (isFloat && numFloats >= numOfFloatRegisters()) + if primitiveOnStack { + return true + } + if kind != reflect.Struct { + return false + } + hfa := isHFA(v.Type()) + hva := isHVA(v.Type()) + size := v.Type().Size() + eligible := hfa || hva || size <= 16 + if !eligible { + return false + } + + if hfa { + need := v.NumField() + return numFloats+need > numOfFloatRegisters() + } + + if hva { + need := v.NumField() + return numInts+need > numOfIntegerRegisters() + } + + slotsNeeded := int((size + align8ByteMask) / align8ByteSize) + return numInts+slotsNeeded > numOfIntegerRegisters() +} + +// structFitsInRegisters determines if a struct can still fit in remaining +// registers, used during stack argument bundling to decide if a struct +// should go through normal register allocation or be bundled with stack args. +func structFitsInRegisters(val reflect.Value, tempNumInts, tempNumFloats int) (bool, int, int) { + if runtime.GOOS != "darwin" { + panic("purego: structFitsInRegisters should only be called on darwin") + } + hfa := isHFA(val.Type()) + hva := isHVA(val.Type()) + size := val.Type().Size() + + if hfa { + // HFA: check if elements fit in float registers + if tempNumFloats+val.NumField() <= numOfFloatRegisters() { + return true, tempNumInts, tempNumFloats + val.NumField() + } + } else if hva { + // HVA: check if elements fit in int registers + if tempNumInts+val.NumField() <= numOfIntegerRegisters() { + return true, tempNumInts + val.NumField(), tempNumFloats + } + } else if size <= 16 { + // Non-HFA/HVA small structs use int registers for byte-packing + slotsNeeded := int((size + align8ByteMask) / align8ByteSize) + if tempNumInts+slotsNeeded <= numOfIntegerRegisters() { + return true, tempNumInts + slotsNeeded, tempNumFloats + } + } + + return false, tempNumInts, tempNumFloats +} + +// collectStackArgs separates remaining arguments into those that fit in registers vs those that go on stack. +// It returns the stack arguments and processes register arguments through addValue. +func collectStackArgs(args []reflect.Value, startIdx int, numInts, numFloats int, + keepAlive []any, addInt, addFloat, addStack func(uintptr), + pNumInts, pNumFloats, pNumStack *int) ([]reflect.Value, []any) { + if runtime.GOOS != "darwin" { + panic("purego: collectStackArgs should only be called on darwin") + } + + var stackArgs []reflect.Value + tempNumInts := numInts + tempNumFloats := numFloats + + for j, val := range args[startIdx:] { + // Determine if this argument goes to register or stack + var fitsInRegister bool + var newNumInts, newNumFloats int + + if val.Kind() == reflect.Struct { + // Check if struct still fits in remaining registers + fitsInRegister, newNumInts, newNumFloats = structFitsInRegisters(val, tempNumInts, tempNumFloats) + } else { + // Primitive argument + isFloat := val.Kind() == reflect.Float32 || val.Kind() == reflect.Float64 + if isFloat { + fitsInRegister = tempNumFloats < numOfFloatRegisters() + newNumFloats = tempNumFloats + 1 + newNumInts = tempNumInts + } else { + fitsInRegister = tempNumInts < numOfIntegerRegisters() + newNumInts = tempNumInts + 1 + newNumFloats = tempNumFloats + } + } + + if fitsInRegister { + // Process through normal register allocation + tempNumInts = newNumInts + tempNumFloats = newNumFloats + keepAlive = addValue(val, keepAlive, addInt, addFloat, addStack, pNumInts, pNumFloats, pNumStack) + } else { + // Convert strings to C strings before bundling + if val.Kind() == reflect.String { + ptr := strings.CString(val.String()) + keepAlive = append(keepAlive, ptr) + val = reflect.ValueOf(ptr) + args[startIdx+j] = val + } + stackArgs = append(stackArgs, val) + } + } + + return stackArgs, keepAlive +} + +const ( + paddingFieldPrefix = "Pad" +) + +// bundleStackArgs bundles remaining arguments for Darwin ARM64 C-style stack packing. +// It creates a packed struct with proper alignment and copies it to the stack in 8-byte chunks. +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + if runtime.GOOS != "darwin" { + panic("purego: bundleStackArgs should only be called on darwin") + } + if len(stackArgs) == 0 { + return + } + + // Build struct fields with proper C alignment and padding + var fields []reflect.StructField + currentOffset := uintptr(0) + fieldIndex := 0 + + for j, val := range stackArgs { + valSize := val.Type().Size() + valAlign := val.Type().Align() + + // ARM64 requires 8-byte alignment for 8-byte or larger structs + if val.Kind() == reflect.Struct && valSize >= 8 { + valAlign = 8 + } + + // Add padding field if needed for alignment + if currentOffset%uintptr(valAlign) != 0 { + paddingNeeded := uintptr(valAlign) - (currentOffset % uintptr(valAlign)) + fields = append(fields, reflect.StructField{ + Name: paddingFieldPrefix + strconv.Itoa(fieldIndex), + Type: reflect.ArrayOf(int(paddingNeeded), reflect.TypeOf(byte(0))), + }) + currentOffset += paddingNeeded + fieldIndex++ + } + + fields = append(fields, reflect.StructField{ + Name: "X" + strconv.Itoa(j), + Type: val.Type(), + }) + currentOffset += valSize + fieldIndex++ + } + + // Create and populate the packed struct + structType := reflect.StructOf(fields) + structInstance := reflect.New(structType).Elem() + + // Set values (skip padding fields) + argIndex := 0 + for j := 0; j < structInstance.NumField(); j++ { + fieldName := structType.Field(j).Name + if stdstrings.HasPrefix(fieldName, paddingFieldPrefix) { + continue + } + structInstance.Field(j).Set(stackArgs[argIndex]) + argIndex++ + } + + ptr := unsafe.Pointer(structInstance.Addr().Pointer()) + size := structType.Size() + copyStruct8ByteChunks(ptr, size, addStack) +} diff --git a/vendor/github.com/ebitengine/purego/struct_loong64.go b/vendor/github.com/ebitengine/purego/struct_loong64.go new file mode 100644 index 00000000..e5891401 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_loong64.go @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +package purego + +import ( + "math" + "reflect" + "unsafe" +) + +func getStruct(outType reflect.Type, syscall syscall15Args) (v reflect.Value) { + outSize := outType.Size() + switch { + case outSize == 0: + return reflect.New(outType).Elem() + case outSize <= 8: + r1 := syscall.a1 + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + r1 = syscall.f1 + if numFields == 2 { + r1 = syscall.f2<<32 | syscall.f1 + } + } + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a uintptr }{r1})).Elem() + case outSize <= 16: + r1, r2 := syscall.a1, syscall.a2 + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + switch numFields { + case 4: + r1 = syscall.f2<<32 | syscall.f1 + r2 = syscall.f4<<32 | syscall.f3 + case 3: + r1 = syscall.f2<<32 | syscall.f1 + r2 = syscall.f3 + case 2: + r1 = syscall.f1 + r2 = syscall.f2 + default: + panic("unreachable") + } + } + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a, b uintptr }{r1, r2})).Elem() + default: + // create struct from the Go pointer created above + // weird pointer dereference to circumvent go vet + return reflect.NewAt(outType, *(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1))).Elem() + } +} + +const ( + _NO_CLASS = 0b00 + _FLOAT = 0b01 + _INT = 0b11 +) + +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { + if v.Type().Size() == 0 { + return keepAlive + } + + if size := v.Type().Size(); size <= 16 { + placeRegisters(v, addFloat, addInt) + } else { + keepAlive = placeStack(v, keepAlive, addInt) + } + return keepAlive // the struct was allocated so don't panic +} + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + var val uint64 + var shift byte + var flushed bool + class := _NO_CLASS + var place func(v reflect.Value) + place = func(v reflect.Value) { + var numFields int + if v.Kind() == reflect.Struct { + numFields = v.Type().NumField() + } else { + numFields = v.Type().Len() + } + for k := 0; k < numFields; k++ { + flushed = false + var f reflect.Value + if v.Kind() == reflect.Struct { + f = v.Field(k) + } else { + f = v.Index(k) + } + align := byte(f.Type().Align()*8 - 1) + shift = (shift + align) &^ align + if shift >= 64 { + shift = 0 + flushed = true + if class == _FLOAT { + addFloat(uintptr(val)) + } else { + addInt(uintptr(val)) + } + } + switch f.Type().Kind() { + case reflect.Struct: + place(f) + case reflect.Bool: + if f.Bool() { + val |= 1 << shift + } + shift += 8 + class |= _INT + case reflect.Uint8: + val |= f.Uint() << shift + shift += 8 + class |= _INT + case reflect.Uint16: + val |= f.Uint() << shift + shift += 16 + class |= _INT + case reflect.Uint32: + val |= f.Uint() << shift + shift += 32 + class |= _INT + case reflect.Uint64, reflect.Uint, reflect.Uintptr: + addInt(uintptr(f.Uint())) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Int8: + val |= uint64(f.Int()&0xFF) << shift + shift += 8 + class |= _INT + case reflect.Int16: + val |= uint64(f.Int()&0xFFFF) << shift + shift += 16 + class |= _INT + case reflect.Int32: + val |= uint64(f.Int()&0xFFFF_FFFF) << shift + shift += 32 + class |= _INT + case reflect.Int64, reflect.Int: + addInt(uintptr(f.Int())) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Float32: + if class == _FLOAT { + addFloat(uintptr(val)) + val = 0 + shift = 0 + } + val |= uint64(math.Float32bits(float32(f.Float()))) << shift + shift += 32 + class |= _FLOAT + case reflect.Float64: + addFloat(uintptr(math.Float64bits(float64(f.Float())))) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Ptr, reflect.UnsafePointer: + addInt(f.Pointer()) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Array: + place(f) + default: + panic("purego: unsupported kind " + f.Kind().String()) + } + } + } + place(v) + if !flushed { + if class == _FLOAT { + addFloat(uintptr(val)) + } else { + addInt(uintptr(val)) + } + } +} + +func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any { + // Struct is too big to be placed in registers. + // Copy to heap and place the pointer in register + ptrStruct := reflect.New(v.Type()) + ptrStruct.Elem().Set(v) + ptr := ptrStruct.Elem().Addr().UnsafePointer() + keepAlive = append(keepAlive, ptr) + addInt(uintptr(ptr)) + return keepAlive +} + +// shouldBundleStackArgs always returns false on loong64 +// since C-style stack argument bundling is only needed on Darwin ARM64. +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + return false +} + +// structFitsInRegisters is not used on loong64. +func structFitsInRegisters(val reflect.Value, tempNumInts, tempNumFloats int) (bool, int, int) { + panic("purego: structFitsInRegisters should not be called on loong64") +} + +// collectStackArgs is not used on loong64. +func collectStackArgs(args []reflect.Value, startIdx int, numInts, numFloats int, + keepAlive []any, addInt, addFloat, addStack func(uintptr), + pNumInts, pNumFloats, pNumStack *int) ([]reflect.Value, []any) { + panic("purego: collectStackArgs should not be called on loong64") +} + +// bundleStackArgs is not used on loong64. +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + panic("purego: bundleStackArgs should not be called on loong64") +} diff --git a/vendor/github.com/ebitengine/purego/struct_ppc64le.go b/vendor/github.com/ebitengine/purego/struct_ppc64le.go new file mode 100644 index 00000000..7c50dcbb --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_ppc64le.go @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +package purego + +import ( + "reflect" + "unsafe" +) + +func getStruct(outType reflect.Type, syscall syscall15Args) reflect.Value { + outSize := outType.Size() + + switch { + case outSize == 0: + return reflect.New(outType).Elem() + + case outSize <= 16: + // Reconstruct from registers by copying raw bytes + var buf [16]byte + + // Integer registers + *(*uintptr)(unsafe.Pointer(&buf[0])) = syscall.a1 + if outSize > 8 { + *(*uintptr)(unsafe.Pointer(&buf[8])) = syscall.a2 + } + + // Homogeneous float aggregates override integer regs + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + if outType.Field(0).Type.Kind() == reflect.Float32 { + // float32 values in FP regs + f := []uintptr{syscall.f1, syscall.f2, syscall.f3, syscall.f4} + for i := 0; i < numFields; i++ { + *(*uint32)(unsafe.Pointer(&buf[i*4])) = uint32(f[i]) + } + } else { + // float64: whole register value is valid + *(*uintptr)(unsafe.Pointer(&buf[0])) = syscall.f1 + if outSize > 8 { + *(*uintptr)(unsafe.Pointer(&buf[8])) = syscall.f2 + } + } + } + + return reflect.NewAt(outType, unsafe.Pointer(&buf[0])).Elem() + + default: + // Returned indirectly via pointer in a1 + ptr := *(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1)) + return reflect.NewAt(outType, ptr).Elem() + } +} + +func addStruct( + v reflect.Value, + numInts, numFloats, numStack *int, + addInt, addFloat, addStack func(uintptr), + keepAlive []any, +) []any { + size := v.Type().Size() + if size == 0 { + return keepAlive + } + + if size <= 16 { + return placeSmallAggregatePPC64LE(v, addFloat, addInt, keepAlive) + } + + return placeStack(v, keepAlive, addInt) +} + +func placeSmallAggregatePPC64LE( + v reflect.Value, + addFloat, addInt func(uintptr), + keepAlive []any, +) []any { + size := v.Type().Size() + + var ptr unsafe.Pointer + if v.CanAddr() { + ptr = v.Addr().UnsafePointer() + } else { + tmp := reflect.New(v.Type()) + tmp.Elem().Set(v) + ptr = tmp.UnsafePointer() + keepAlive = append(keepAlive, tmp.Interface()) + } + + var buf [16]byte + src := unsafe.Slice((*byte)(ptr), size) + copy(buf[:], src) + + w0 := *(*uintptr)(unsafe.Pointer(&buf[0])) + w1 := uintptr(0) + if size > 8 { + w1 = *(*uintptr)(unsafe.Pointer(&buf[8])) + } + + if isFloats, _ := isAllSameFloat(v.Type()); isFloats { + addFloat(w0) + if size > 8 { + addFloat(w1) + } + } else { + addInt(w0) + if size > 8 { + addInt(w1) + } + } + + return keepAlive +} + +// placeStack is a fallback for structs that are too large to fit in registers +func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any { + if v.CanAddr() { + addInt(v.Addr().Pointer()) + return keepAlive + } + ptr := reflect.New(v.Type()) + ptr.Elem().Set(v) + addInt(ptr.Pointer()) + return append(keepAlive, ptr.Interface()) +} + +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + // PPC64LE does not bundle stack args + return false +} + +func collectStackArgs( + args []reflect.Value, + i, numInts, numFloats int, + keepAlive []any, + addInt, addFloat, addStack func(uintptr), + numIntsPtr, numFloatsPtr, numStackPtr *int, +) ([]reflect.Value, []any) { + return nil, keepAlive +} + +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + panic("bundleStackArgs not supported on PPC64LE") +} diff --git a/vendor/github.com/ebitengine/purego/struct_riscv64.go b/vendor/github.com/ebitengine/purego/struct_riscv64.go new file mode 100644 index 00000000..eac0b880 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_riscv64.go @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +package purego + +import ( + "reflect" + "unsafe" +) + +func getStruct(outType reflect.Type, syscall syscall15Args) reflect.Value { + outSize := outType.Size() + + switch { + case outSize == 0: + return reflect.New(outType).Elem() + + case outSize <= 16: + // Reconstruct from registers by copying raw bytes + var buf [16]byte + + // Integer registers + *(*uintptr)(unsafe.Pointer(&buf[0])) = syscall.a1 + if outSize > 8 { + *(*uintptr)(unsafe.Pointer(&buf[8])) = syscall.a2 + } + + // Homogeneous float aggregates override integer regs + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + if outType.Field(0).Type.Kind() == reflect.Float32 { + // float32 values are NaN-boxed in FP regs; use low 32 bits only + f := []uintptr{syscall.f1, syscall.f2, syscall.f3, syscall.f4} + for i := 0; i < numFields; i++ { + *(*uint32)(unsafe.Pointer(&buf[i*4])) = uint32(f[i]) + } + } else { + // float64: whole register value is valid + *(*uintptr)(unsafe.Pointer(&buf[0])) = syscall.f1 + if outSize > 8 { + *(*uintptr)(unsafe.Pointer(&buf[8])) = syscall.f2 + } + } + } + + return reflect.NewAt(outType, unsafe.Pointer(&buf[0])).Elem() + + default: + // Returned indirectly via pointer in a1 + ptr := *(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1)) + return reflect.NewAt(outType, ptr).Elem() + } +} + +func addStruct( + v reflect.Value, + numInts, numFloats, numStack *int, + addInt, addFloat, addStack func(uintptr), + keepAlive []any, +) []any { + size := v.Type().Size() + if size == 0 { + return keepAlive + } + + if size <= 16 { + return placeSmallAggregateRISCV64(v, addFloat, addInt, keepAlive) + } + + return placeStack(v, keepAlive, addInt) +} + +func placeSmallAggregateRISCV64( + v reflect.Value, + addFloat, addInt func(uintptr), + keepAlive []any, +) []any { + size := v.Type().Size() + + var ptr unsafe.Pointer + if v.CanAddr() { + ptr = v.Addr().UnsafePointer() + } else { + tmp := reflect.New(v.Type()) + tmp.Elem().Set(v) + ptr = tmp.UnsafePointer() + keepAlive = append(keepAlive, tmp.Interface()) + } + + var buf [16]byte + src := unsafe.Slice((*byte)(ptr), size) + copy(buf[:], src) + + w0 := *(*uintptr)(unsafe.Pointer(&buf[0])) + w1 := uintptr(0) + if size > 8 { + w1 = *(*uintptr)(unsafe.Pointer(&buf[8])) + } + + if isFloats, _ := isAllSameFloat(v.Type()); isFloats { + addFloat(w0) + if size > 8 { + addFloat(w1) + } + } else { + addInt(w0) + if size > 8 { + addInt(w1) + } + } + + return keepAlive +} + +// placeStack is a fallback for structs that are too large to fit in registers +func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any { + if v.CanAddr() { + addInt(v.Addr().Pointer()) + return keepAlive + } + ptr := reflect.New(v.Type()) + ptr.Elem().Set(v) + addInt(ptr.Pointer()) + return append(keepAlive, ptr.Interface()) +} + +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + // RISCV64 does not bundle stack args + return false +} + +func collectStackArgs( + args []reflect.Value, + i, numInts, numFloats int, + keepAlive []any, + addInt, addFloat, addStack func(uintptr), + numIntsPtr, numFloatsPtr, numStackPtr *int, +) ([]reflect.Value, []any) { + return nil, keepAlive +} + +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + panic("bundleStackArgs not supported on RISCV64") +} diff --git a/vendor/github.com/ebitengine/purego/struct_s390x.go b/vendor/github.com/ebitengine/purego/struct_s390x.go new file mode 100644 index 00000000..7ec5e813 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_s390x.go @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +package purego + +import ( + "reflect" + "unsafe" +) + +func getStruct(outType reflect.Type, syscall syscall15Args) reflect.Value { + outSize := outType.Size() + + switch { + case outSize == 0: + return reflect.New(outType).Elem() + + case outSize <= 16: + // Reconstruct from registers by copying raw bytes + var buf [16]byte + + // Integer registers + *(*uintptr)(unsafe.Pointer(&buf[0])) = syscall.a1 + if outSize > 8 { + *(*uintptr)(unsafe.Pointer(&buf[8])) = syscall.a2 + } + + // Homogeneous float aggregates override integer regs + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + if outType.Field(0).Type.Kind() == reflect.Float32 { + // float32 values in FP regs + f := []uintptr{syscall.f1, syscall.f2, syscall.f3, syscall.f4} + for i := 0; i < numFields; i++ { + *(*uint32)(unsafe.Pointer(&buf[i*4])) = uint32(f[i]) + } + } else { + // float64: whole register value is valid + *(*uintptr)(unsafe.Pointer(&buf[0])) = syscall.f1 + if outSize > 8 { + *(*uintptr)(unsafe.Pointer(&buf[8])) = syscall.f2 + } + } + } + + return reflect.NewAt(outType, unsafe.Pointer(&buf[0])).Elem() + + default: + // Returned indirectly via pointer in a1 + ptr := *(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1)) + return reflect.NewAt(outType, ptr).Elem() + } +} + +func addStruct( + v reflect.Value, + numInts, numFloats, numStack *int, + addInt, addFloat, addStack func(uintptr), + keepAlive []any, +) []any { + size := v.Type().Size() + if size == 0 { + return keepAlive + } + + if size <= 16 { + return placeSmallAggregateS390X(v, addFloat, addInt, keepAlive) + } + + return placeStack(v, keepAlive, addInt) +} + +func placeSmallAggregateS390X( + v reflect.Value, + addFloat, addInt func(uintptr), + keepAlive []any, +) []any { + size := v.Type().Size() + + var ptr unsafe.Pointer + if v.CanAddr() { + ptr = v.Addr().UnsafePointer() + } else { + tmp := reflect.New(v.Type()) + tmp.Elem().Set(v) + ptr = tmp.UnsafePointer() + keepAlive = append(keepAlive, tmp.Interface()) + } + + var buf [16]byte + src := unsafe.Slice((*byte)(ptr), size) + copy(buf[:], src) + + w0 := *(*uintptr)(unsafe.Pointer(&buf[0])) + w1 := uintptr(0) + if size > 8 { + w1 = *(*uintptr)(unsafe.Pointer(&buf[8])) + } + + if isFloats, _ := isAllSameFloat(v.Type()); isFloats { + addFloat(w0) + if size > 8 { + addFloat(w1) + } + } else { + addInt(w0) + if size > 8 { + addInt(w1) + } + } + + return keepAlive +} + +// placeStack is a fallback for structs that are too large to fit in registers +func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any { + if v.CanAddr() { + addInt(v.Addr().Pointer()) + return keepAlive + } + ptr := reflect.New(v.Type()) + ptr.Elem().Set(v) + addInt(ptr.Pointer()) + return append(keepAlive, ptr.Interface()) +} + +func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool { + // S390X does not bundle stack args + return false +} + +func collectStackArgs( + args []reflect.Value, + i, numInts, numFloats int, + keepAlive []any, + addInt, addFloat, addStack func(uintptr), + numIntsPtr, numFloatsPtr, numStackPtr *int, +) ([]reflect.Value, []any) { + return nil, keepAlive +} + +func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) { + panic("bundleStackArgs not supported on S390X") +} diff --git a/vendor/github.com/ebitengine/purego/sys_386.s b/vendor/github.com/ebitengine/purego/sys_386.s new file mode 100644 index 00000000..82931413 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_386.s @@ -0,0 +1,147 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +#define STACK_SIZE 160 +#define PTR_ADDRESS (STACK_SIZE - 4) + +// syscall15X calls a function in libc on behalf of the syscall package. +// syscall15X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// ... +// a32 uintptr +// f1 uintptr +// ... +// f16 uintptr +// arm64_r8 uintptr +// } +// syscall15X must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// On i386 System V ABI, all arguments are passed on the stack. +// Return value is in EAX (and EDX for 64-bit values). +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $4 +DATA ·syscall15XABI0(SB)/4, $syscall15X(SB) +TEXT syscall15X(SB), NOSPLIT|NOFRAME, $0-0 + // Called via C calling convention: argument pointer at 4(SP) + // NOT via Go calling convention + // On i386, the first argument is at 4(SP) after CALL pushes return address + MOVL 4(SP), AX // get pointer to syscall15Args + + // Save callee-saved registers + PUSHL BP + PUSHL BX + PUSHL SI + PUSHL DI + + MOVL AX, BX // save args pointer in BX + + // Allocate stack space for C function arguments + // i386 SysV: all 32 args on stack = 32 * 4 = 128 bytes + // Plus 16 bytes for alignment and local storage + SUBL $STACK_SIZE, SP + MOVL BX, PTR_ADDRESS(SP) // save args pointer + + // Load function pointer + MOVL syscall15Args_fn(BX), AX + MOVL AX, (PTR_ADDRESS-4)(SP) // save fn pointer + + // Push all integer arguments onto the stack (a1-a32) + // i386 SysV ABI: arguments pushed right-to-left, but we're + // setting up the stack from low to high addresses + MOVL syscall15Args_a1(BX), AX + MOVL AX, 0(SP) + MOVL syscall15Args_a2(BX), AX + MOVL AX, 4(SP) + MOVL syscall15Args_a3(BX), AX + MOVL AX, 8(SP) + MOVL syscall15Args_a4(BX), AX + MOVL AX, 12(SP) + MOVL syscall15Args_a5(BX), AX + MOVL AX, 16(SP) + MOVL syscall15Args_a6(BX), AX + MOVL AX, 20(SP) + MOVL syscall15Args_a7(BX), AX + MOVL AX, 24(SP) + MOVL syscall15Args_a8(BX), AX + MOVL AX, 28(SP) + MOVL syscall15Args_a9(BX), AX + MOVL AX, 32(SP) + MOVL syscall15Args_a10(BX), AX + MOVL AX, 36(SP) + MOVL syscall15Args_a11(BX), AX + MOVL AX, 40(SP) + MOVL syscall15Args_a12(BX), AX + MOVL AX, 44(SP) + MOVL syscall15Args_a13(BX), AX + MOVL AX, 48(SP) + MOVL syscall15Args_a14(BX), AX + MOVL AX, 52(SP) + MOVL syscall15Args_a15(BX), AX + MOVL AX, 56(SP) + MOVL syscall15Args_a16(BX), AX + MOVL AX, 60(SP) + MOVL syscall15Args_a17(BX), AX + MOVL AX, 64(SP) + MOVL syscall15Args_a18(BX), AX + MOVL AX, 68(SP) + MOVL syscall15Args_a19(BX), AX + MOVL AX, 72(SP) + MOVL syscall15Args_a20(BX), AX + MOVL AX, 76(SP) + MOVL syscall15Args_a21(BX), AX + MOVL AX, 80(SP) + MOVL syscall15Args_a22(BX), AX + MOVL AX, 84(SP) + MOVL syscall15Args_a23(BX), AX + MOVL AX, 88(SP) + MOVL syscall15Args_a24(BX), AX + MOVL AX, 92(SP) + MOVL syscall15Args_a25(BX), AX + MOVL AX, 96(SP) + MOVL syscall15Args_a26(BX), AX + MOVL AX, 100(SP) + MOVL syscall15Args_a27(BX), AX + MOVL AX, 104(SP) + MOVL syscall15Args_a28(BX), AX + MOVL AX, 108(SP) + MOVL syscall15Args_a29(BX), AX + MOVL AX, 112(SP) + MOVL syscall15Args_a30(BX), AX + MOVL AX, 116(SP) + MOVL syscall15Args_a31(BX), AX + MOVL AX, 120(SP) + MOVL syscall15Args_a32(BX), AX + MOVL AX, 124(SP) + + // Call the C function + MOVL (PTR_ADDRESS-4)(SP), AX + CALL AX + + // Get args pointer back and save results + MOVL PTR_ADDRESS(SP), BX + MOVL AX, syscall15Args_a1(BX) // return value r1 + MOVL DX, syscall15Args_a2(BX) // return value r2 (for 64-bit returns) + + // Save x87 FPU return value (ST0) to f1 field + // On i386 System V ABI, float/double returns are in ST(0) + // We save as float64 (8 bytes) to preserve precision + FMOVDP F0, syscall15Args_f1(BX) + + // Clean up stack + ADDL $STACK_SIZE, SP + + // Restore callee-saved registers + POPL DI + POPL SI + POPL BX + POPL BP + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_amd64.s b/vendor/github.com/ebitengine/purego/sys_amd64.s new file mode 100644 index 00000000..15b24dd2 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_amd64.s @@ -0,0 +1,170 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build darwin || freebsd || linux || netbsd + +#include "textflag.h" +#include "abi_amd64.h" +#include "go_asm.h" +#include "funcdata.h" + +#define STACK_SIZE 80 +#define PTR_ADDRESS (STACK_SIZE - 8) + +// syscall15X calls a function in libc on behalf of the syscall package. +// syscall15X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// a11 uintptr +// a12 uintptr +// a13 uintptr +// a14 uintptr +// a15 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall15X must be called on the g0 stack with the +// C calling convention (use libcCall). +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $8 +DATA ·syscall15XABI0(SB)/8, $syscall15X(SB) +TEXT syscall15X(SB), NOSPLIT|NOFRAME, $0 + PUSHQ BP + MOVQ SP, BP + SUBQ $STACK_SIZE, SP + MOVQ DI, PTR_ADDRESS(BP) // save the pointer + MOVQ DI, R11 + + MOVQ syscall15Args_f1(R11), X0 // f1 + MOVQ syscall15Args_f2(R11), X1 // f2 + MOVQ syscall15Args_f3(R11), X2 // f3 + MOVQ syscall15Args_f4(R11), X3 // f4 + MOVQ syscall15Args_f5(R11), X4 // f5 + MOVQ syscall15Args_f6(R11), X5 // f6 + MOVQ syscall15Args_f7(R11), X6 // f7 + MOVQ syscall15Args_f8(R11), X7 // f8 + + MOVQ syscall15Args_a1(R11), DI // a1 + MOVQ syscall15Args_a2(R11), SI // a2 + MOVQ syscall15Args_a3(R11), DX // a3 + MOVQ syscall15Args_a4(R11), CX // a4 + MOVQ syscall15Args_a5(R11), R8 // a5 + MOVQ syscall15Args_a6(R11), R9 // a6 + + // push the remaining paramters onto the stack + MOVQ syscall15Args_a7(R11), R12 + MOVQ R12, 0(SP) // push a7 + MOVQ syscall15Args_a8(R11), R12 + MOVQ R12, 8(SP) // push a8 + MOVQ syscall15Args_a9(R11), R12 + MOVQ R12, 16(SP) // push a9 + MOVQ syscall15Args_a10(R11), R12 + MOVQ R12, 24(SP) // push a10 + MOVQ syscall15Args_a11(R11), R12 + MOVQ R12, 32(SP) // push a11 + MOVQ syscall15Args_a12(R11), R12 + MOVQ R12, 40(SP) // push a12 + MOVQ syscall15Args_a13(R11), R12 + MOVQ R12, 48(SP) // push a13 + MOVQ syscall15Args_a14(R11), R12 + MOVQ R12, 56(SP) // push a14 + MOVQ syscall15Args_a15(R11), R12 + MOVQ R12, 64(SP) // push a15 + XORL AX, AX // vararg: say "no float args" + + MOVQ syscall15Args_fn(R11), R10 // fn + CALL R10 + + MOVQ PTR_ADDRESS(BP), DI // get the pointer back + MOVQ AX, syscall15Args_a1(DI) // r1 + MOVQ DX, syscall15Args_a2(DI) // r3 + MOVQ X0, syscall15Args_f1(DI) // f1 + MOVQ X1, syscall15Args_f2(DI) // f2 + +#ifdef GOOS_darwin + CALL purego_error(SB) + MOVD (AX), AX + MOVD AX, syscall15Args_a3(DI) // save errno +#endif + + XORL AX, AX // no error (it's ignored anyway) + ADDQ $STACK_SIZE, SP + MOVQ BP, SP + POPQ BP + RET + +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + MOVQ 0(SP), AX // save the return address to calculate the cb index + MOVQ 8(SP), R10 // get the return SP so that we can align register args with stack args + ADDQ $8, SP // remove return address from stack, we are not returning to callbackasm, but to its caller. + + // make space for first six int and 8 float arguments below the frame + ADJSP $14*8, SP + MOVSD X0, (1*8)(SP) + MOVSD X1, (2*8)(SP) + MOVSD X2, (3*8)(SP) + MOVSD X3, (4*8)(SP) + MOVSD X4, (5*8)(SP) + MOVSD X5, (6*8)(SP) + MOVSD X6, (7*8)(SP) + MOVSD X7, (8*8)(SP) + MOVQ DI, (9*8)(SP) + MOVQ SI, (10*8)(SP) + MOVQ DX, (11*8)(SP) + MOVQ CX, (12*8)(SP) + MOVQ R8, (13*8)(SP) + MOVQ R9, (14*8)(SP) + LEAQ 8(SP), R8 // R8 = address of args vector + + PUSHQ R10 // push the stack pointer below registers + + // Switch from the host ABI to the Go ABI. + PUSH_REGS_HOST_TO_ABI0() + + // determine index into runtime·cbs table + MOVQ $callbackasm(SB), DX + SUBQ DX, AX + MOVQ $0, DX + MOVQ $5, CX // divide by 5 because each call instruction in ·callbacks is 5 bytes long + DIVL CX + SUBQ $1, AX // subtract 1 because return PC is to the next slot + + // Create a struct callbackArgs on our stack to be passed as + // the "frame" to cgocallback and on to callbackWrap. + // $24 to make enough room for the arguments to runtime.cgocallback + SUBQ $(24+callbackArgs__size), SP + MOVQ AX, (24+callbackArgs_index)(SP) // callback index + MOVQ R8, (24+callbackArgs_args)(SP) // address of args vector + MOVQ $0, (24+callbackArgs_result)(SP) // result + LEAQ 24(SP), AX // take the address of callbackArgs + + // Call cgocallback, which will call callbackWrap(frame). + MOVQ ·callbackWrap_call(SB), DI // Get the ABIInternal function pointer + MOVQ (DI), DI // without by using a closure. + MOVQ AX, SI // frame (address of callbackArgs) + MOVQ $0, CX // context + + CALL crosscall2(SB) // runtime.cgocallback(fn, frame, ctxt uintptr) + + // Get callback result. + MOVQ (24+callbackArgs_result)(SP), AX + ADDQ $(24+callbackArgs__size), SP // remove callbackArgs struct + + POP_REGS_HOST_TO_ABI0() + + POPQ R10 // get the SP back + ADJSP $-14*8, SP // remove arguments + + MOVQ R10, 0(SP) + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_arm.s b/vendor/github.com/ebitengine/purego/sys_arm.s new file mode 100644 index 00000000..3a8ce0d0 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_arm.s @@ -0,0 +1,142 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +#define STACK_SIZE 128 +#define PTR_ADDRESS (STACK_SIZE - 4) + +// syscall15X calls a function in libc on behalf of the syscall package. +// syscall15X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// ... +// a32 uintptr +// f1 uintptr +// ... +// f16 uintptr +// arm64_r8 uintptr +// } +// syscall15X must be called on the g0 stack with the +// C calling convention (use libcCall). +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $4 +DATA ·syscall15XABI0(SB)/4, $syscall15X(SB) +TEXT syscall15X(SB), NOSPLIT|NOFRAME, $0-0 + // Called via C calling convention: R0 = pointer to syscall15Args + // NOT via Go calling convention + // Save link register and callee-saved registers first + MOVW.W R14, -4(R13) // save LR (decrement and store) + MOVM.DB.W [R4, R5, R6, R7, R8, R9, R11], (R13) // save callee-saved regs + + MOVW R0, R8 + SUB $STACK_SIZE, R13 + MOVW R8, PTR_ADDRESS(R13) + + // Load function pointer first (before anything can corrupt R8) + MOVW syscall15Args_fn(R8), R5 + MOVW R5, (PTR_ADDRESS-4)(R13) // save fn at offset 56 + + // Load floating point arguments + // Each float64 spans 2 uintptr slots (8 bytes) on ARM32, so we skip by 2 + MOVD syscall15Args_f1(R8), F0 // f1+f2 -> D0 + MOVD syscall15Args_f3(R8), F1 // f3+f4 -> D1 + MOVD syscall15Args_f5(R8), F2 // f5+f6 -> D2 + MOVD syscall15Args_f7(R8), F3 // f7+f8 -> D3 + MOVD syscall15Args_f9(R8), F4 // f9+f10 -> D4 + MOVD syscall15Args_f11(R8), F5 // f11+f12 -> D5 + MOVD syscall15Args_f13(R8), F6 // f13+f14 -> D6 + MOVD syscall15Args_f15(R8), F7 // f15+f16 -> D7 + + // Load integer arguments into registers (R0-R3 for ARM EABI) + MOVW syscall15Args_a1(R8), R0 // a1 + MOVW syscall15Args_a2(R8), R1 // a2 + MOVW syscall15Args_a3(R8), R2 // a3 + MOVW syscall15Args_a4(R8), R3 // a4 + + // push a5-a32 onto stack + MOVW syscall15Args_a5(R8), R4 + MOVW R4, 0(R13) + MOVW syscall15Args_a6(R8), R4 + MOVW R4, 4(R13) + MOVW syscall15Args_a7(R8), R4 + MOVW R4, 8(R13) + MOVW syscall15Args_a8(R8), R4 + MOVW R4, 12(R13) + MOVW syscall15Args_a9(R8), R4 + MOVW R4, 16(R13) + MOVW syscall15Args_a10(R8), R4 + MOVW R4, 20(R13) + MOVW syscall15Args_a11(R8), R4 + MOVW R4, 24(R13) + MOVW syscall15Args_a12(R8), R4 + MOVW R4, 28(R13) + MOVW syscall15Args_a13(R8), R4 + MOVW R4, 32(R13) + MOVW syscall15Args_a14(R8), R4 + MOVW R4, 36(R13) + MOVW syscall15Args_a15(R8), R4 + MOVW R4, 40(R13) + MOVW syscall15Args_a16(R8), R4 + MOVW R4, 44(R13) + MOVW syscall15Args_a17(R8), R4 + MOVW R4, 48(R13) + MOVW syscall15Args_a18(R8), R4 + MOVW R4, 52(R13) + MOVW syscall15Args_a19(R8), R4 + MOVW R4, 56(R13) + MOVW syscall15Args_a20(R8), R4 + MOVW R4, 60(R13) + MOVW syscall15Args_a21(R8), R4 + MOVW R4, 64(R13) + MOVW syscall15Args_a22(R8), R4 + MOVW R4, 68(R13) + MOVW syscall15Args_a23(R8), R4 + MOVW R4, 72(R13) + MOVW syscall15Args_a24(R8), R4 + MOVW R4, 76(R13) + MOVW syscall15Args_a25(R8), R4 + MOVW R4, 80(R13) + MOVW syscall15Args_a26(R8), R4 + MOVW R4, 84(R13) + MOVW syscall15Args_a27(R8), R4 + MOVW R4, 88(R13) + MOVW syscall15Args_a28(R8), R4 + MOVW R4, 92(R13) + MOVW syscall15Args_a29(R8), R4 + MOVW R4, 96(R13) + MOVW syscall15Args_a30(R8), R4 + MOVW R4, 100(R13) + MOVW syscall15Args_a31(R8), R4 + MOVW R4, 104(R13) + MOVW syscall15Args_a32(R8), R4 + MOVW R4, 108(R13) + + // Load saved function pointer and call + MOVW (PTR_ADDRESS-4)(R13), R4 + + // Use BLX for Thumb interworking - Go assembler doesn't support BLX Rn + // BLX R4 = 0xE12FFF34 (ARM encoding, always condition) + WORD $0xE12FFF34 // blx r4 + + // pop structure pointer + MOVW PTR_ADDRESS(R13), R8 + ADD $STACK_SIZE, R13 + + // save R0, R1 + MOVW R0, syscall15Args_a1(R8) + MOVW R1, syscall15Args_a2(R8) + + // save f0-f3 (each float64 spans 2 uintptr slots on ARM32) + MOVD F0, syscall15Args_f1(R8) + MOVD F1, syscall15Args_f3(R8) + MOVD F2, syscall15Args_f5(R8) + MOVD F3, syscall15Args_f7(R8) + + // Restore callee-saved registers and return + MOVM.IA.W (R13), [R4, R5, R6, R7, R8, R9, R11] + MOVW.P 4(R13), R15 // pop LR into PC (return) diff --git a/vendor/github.com/ebitengine/purego/sys_arm64.s b/vendor/github.com/ebitengine/purego/sys_arm64.s new file mode 100644 index 00000000..40a2f4c1 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_arm64.s @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build darwin || freebsd || linux || netbsd || windows + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +#define STACK_SIZE 64 +#define PTR_ADDRESS (STACK_SIZE - 8) + +// syscall15X calls a function in libc on behalf of the syscall package. +// syscall15X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// a11 uintptr +// a12 uintptr +// a13 uintptr +// a14 uintptr +// a15 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall15X must be called on the g0 stack with the +// C calling convention (use libcCall). +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $8 +DATA ·syscall15XABI0(SB)/8, $syscall15X(SB) +TEXT syscall15X(SB), NOSPLIT, $0 + SUB $STACK_SIZE, RSP // push structure pointer + MOVD R0, PTR_ADDRESS(RSP) + MOVD R0, R9 + + FMOVD syscall15Args_f1(R9), F0 // f1 + FMOVD syscall15Args_f2(R9), F1 // f2 + FMOVD syscall15Args_f3(R9), F2 // f3 + FMOVD syscall15Args_f4(R9), F3 // f4 + FMOVD syscall15Args_f5(R9), F4 // f5 + FMOVD syscall15Args_f6(R9), F5 // f6 + FMOVD syscall15Args_f7(R9), F6 // f7 + FMOVD syscall15Args_f8(R9), F7 // f8 + + MOVD syscall15Args_a1(R9), R0 // a1 + MOVD syscall15Args_a2(R9), R1 // a2 + MOVD syscall15Args_a3(R9), R2 // a3 + MOVD syscall15Args_a4(R9), R3 // a4 + MOVD syscall15Args_a5(R9), R4 // a5 + MOVD syscall15Args_a6(R9), R5 // a6 + MOVD syscall15Args_a7(R9), R6 // a7 + MOVD syscall15Args_a8(R9), R7 // a8 + MOVD syscall15Args_arm64_r8(R9), R8 // r8 + + MOVD syscall15Args_a9(R9), R10 + MOVD R10, 0(RSP) // push a9 onto stack + MOVD syscall15Args_a10(R9), R10 + MOVD R10, 8(RSP) // push a10 onto stack + MOVD syscall15Args_a11(R9), R10 + MOVD R10, 16(RSP) // push a11 onto stack + MOVD syscall15Args_a12(R9), R10 + MOVD R10, 24(RSP) // push a12 onto stack + MOVD syscall15Args_a13(R9), R10 + MOVD R10, 32(RSP) // push a13 onto stack + MOVD syscall15Args_a14(R9), R10 + MOVD R10, 40(RSP) // push a14 onto stack + MOVD syscall15Args_a15(R9), R10 + MOVD R10, 48(RSP) // push a15 onto stack + + MOVD syscall15Args_fn(R9), R10 // fn + BL (R10) + + MOVD PTR_ADDRESS(RSP), R2 // pop structure pointer + ADD $STACK_SIZE, RSP + + MOVD R0, syscall15Args_a1(R2) // save r1 + MOVD R1, syscall15Args_a2(R2) // save r3 + FMOVD F0, syscall15Args_f1(R2) // save f0 + FMOVD F1, syscall15Args_f2(R2) // save f1 + FMOVD F2, syscall15Args_f3(R2) // save f2 + FMOVD F3, syscall15Args_f4(R2) // save f3 + +#ifdef GOOS_darwin + BL purego_error(SB) + MOVD (R0), R0 + MOVD R0, syscall15Args_a3(R2) // save errno +#endif + RET diff --git a/vendor/github.com/ebitengine/purego/sys_loong64.s b/vendor/github.com/ebitengine/purego/sys_loong64.s new file mode 100644 index 00000000..420b855c --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_loong64.s @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +#define STACK_SIZE 64 +#define PTR_ADDRESS (STACK_SIZE - 8) + +// syscall15X calls a function in libc on behalf of the syscall package. +// syscall15X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// a11 uintptr +// a12 uintptr +// a13 uintptr +// a14 uintptr +// a15 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall15X must be called on the g0 stack with the +// C calling convention (use libcCall). +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $8 +DATA ·syscall15XABI0(SB)/8, $syscall15X(SB) +TEXT syscall15X(SB), NOSPLIT, $0 + // push structure pointer + SUBV $STACK_SIZE, R3 + MOVV R4, PTR_ADDRESS(R3) + MOVV R4, R13 + + MOVD syscall15Args_f1(R13), F0 // f1 + MOVD syscall15Args_f2(R13), F1 // f2 + MOVD syscall15Args_f3(R13), F2 // f3 + MOVD syscall15Args_f4(R13), F3 // f4 + MOVD syscall15Args_f5(R13), F4 // f5 + MOVD syscall15Args_f6(R13), F5 // f6 + MOVD syscall15Args_f7(R13), F6 // f7 + MOVD syscall15Args_f8(R13), F7 // f8 + + MOVV syscall15Args_a1(R13), R4 // a1 + MOVV syscall15Args_a2(R13), R5 // a2 + MOVV syscall15Args_a3(R13), R6 // a3 + MOVV syscall15Args_a4(R13), R7 // a4 + MOVV syscall15Args_a5(R13), R8 // a5 + MOVV syscall15Args_a6(R13), R9 // a6 + MOVV syscall15Args_a7(R13), R10 // a7 + MOVV syscall15Args_a8(R13), R11 // a8 + + // push a9-a15 onto stack + MOVV syscall15Args_a9(R13), R12 + MOVV R12, 0(R3) + MOVV syscall15Args_a10(R13), R12 + MOVV R12, 8(R3) + MOVV syscall15Args_a11(R13), R12 + MOVV R12, 16(R3) + MOVV syscall15Args_a12(R13), R12 + MOVV R12, 24(R3) + MOVV syscall15Args_a13(R13), R12 + MOVV R12, 32(R3) + MOVV syscall15Args_a14(R13), R12 + MOVV R12, 40(R3) + MOVV syscall15Args_a15(R13), R12 + MOVV R12, 48(R3) + + MOVV syscall15Args_fn(R13), R12 + JAL (R12) + + // pop structure pointer + MOVV PTR_ADDRESS(R3), R13 + ADDV $STACK_SIZE, R3 + + // save R4, R5 + MOVV R4, syscall15Args_a1(R13) + MOVV R5, syscall15Args_a2(R13) + + // save f0-f3 + MOVD F0, syscall15Args_f1(R13) + MOVD F1, syscall15Args_f2(R13) + MOVD F2, syscall15Args_f3(R13) + MOVD F3, syscall15Args_f4(R13) + RET diff --git a/vendor/github.com/ebitengine/purego/sys_ppc64le.s b/vendor/github.com/ebitengine/purego/sys_ppc64le.s new file mode 100644 index 00000000..391b30a9 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_ppc64le.s @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +// PPC64LE ELFv2 ABI: +// - Integer args: R3-R10 (8 registers) +// - Float args: F1-F8 (8 registers) +// - Return: R3 (integer), F1 (float) +// - Stack pointer: R1 +// - Link register: LR (special) +// - TOC pointer: R2 (must preserve) + +// Stack layout for ELFv2 ABI (aligned to 16 bytes): +// From callee's perspective when we call BL (CTR): +// 0(R1) - back chain (our old R1) +// 8(R1) - CR save word (optional) +// 16(R1) - LR save (optional, we save it) +// 24(R1) - Reserved (compilers) +// 32(R1) - Parameter save area start (8 * 8 = 64 bytes for R3-R10) +// 96(R1) - First stack arg (a9) - this is where callee looks +// 104(R1) - Second stack arg (a10) +// 112-152 - Stack args a11-a15 (5 * 8 = 40 bytes) +// 160(R1) - TOC save (we put it here, outside param save area) +// 168(R1) - saved args pointer +// 176(R1) - padding for 16-byte alignment +// Total: 176 bytes + +#define STACK_SIZE 176 +#define LR_SAVE 16 +#define TOC_SAVE 160 +#define ARGP_SAVE 168 + +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $8 +DATA ·syscall15XABI0(SB)/8, $syscall15X(SB) + +TEXT syscall15X(SB), NOSPLIT, $0 + // Prologue: create stack frame + // R3 contains the args pointer on entry + MOVD R1, R12 // save old SP + SUB $STACK_SIZE, R1 // allocate stack frame + MOVD R12, 0(R1) // save back chain + MOVD LR, R12 + MOVD R12, LR_SAVE(R1) // save LR + MOVD R2, TOC_SAVE(R1) // save TOC + + // Save args pointer (in R3) + MOVD R3, ARGP_SAVE(R1) + + // R11 := args pointer (syscall15Args*) + MOVD R3, R11 + + // Load float args into F1-F8 + FMOVD syscall15Args_f1(R11), F1 + FMOVD syscall15Args_f2(R11), F2 + FMOVD syscall15Args_f3(R11), F3 + FMOVD syscall15Args_f4(R11), F4 + FMOVD syscall15Args_f5(R11), F5 + FMOVD syscall15Args_f6(R11), F6 + FMOVD syscall15Args_f7(R11), F7 + FMOVD syscall15Args_f8(R11), F8 + + // Load integer args into R3-R10 + MOVD syscall15Args_a1(R11), R3 + MOVD syscall15Args_a2(R11), R4 + MOVD syscall15Args_a3(R11), R5 + MOVD syscall15Args_a4(R11), R6 + MOVD syscall15Args_a5(R11), R7 + MOVD syscall15Args_a6(R11), R8 + MOVD syscall15Args_a7(R11), R9 + MOVD syscall15Args_a8(R11), R10 + + // Spill a9-a15 onto the stack (stack parameters start at 96(R1)) + // Per ELFv2: parameter save area is 32-95, stack args start at 96 + MOVD ARGP_SAVE(R1), R11 // reload args pointer + MOVD syscall15Args_a9(R11), R12 + MOVD R12, 96(R1) // a9 at 96(R1) + MOVD syscall15Args_a10(R11), R12 + MOVD R12, 104(R1) // a10 at 104(R1) + MOVD syscall15Args_a11(R11), R12 + MOVD R12, 112(R1) // a11 at 112(R1) + MOVD syscall15Args_a12(R11), R12 + MOVD R12, 120(R1) // a12 at 120(R1) + MOVD syscall15Args_a13(R11), R12 + MOVD R12, 128(R1) // a13 at 128(R1) + MOVD syscall15Args_a14(R11), R12 + MOVD R12, 136(R1) // a14 at 136(R1) + MOVD syscall15Args_a15(R11), R12 + MOVD R12, 144(R1) // a15 at 144(R1) + + // Call function: load fn and call + MOVD syscall15Args_fn(R11), R12 + MOVD R12, CTR + BL (CTR) + + // Restore TOC after call + MOVD TOC_SAVE(R1), R2 + + // Restore args pointer for storing results + MOVD ARGP_SAVE(R1), R11 + + // Store integer results back (R3, R4) + MOVD R3, syscall15Args_a1(R11) + MOVD R4, syscall15Args_a2(R11) + + // Store float return values (F1-F4) + FMOVD F1, syscall15Args_f1(R11) + FMOVD F2, syscall15Args_f2(R11) + FMOVD F3, syscall15Args_f3(R11) + FMOVD F4, syscall15Args_f4(R11) + + // Epilogue: restore and return + MOVD LR_SAVE(R1), R12 + MOVD R12, LR + ADD $STACK_SIZE, R1 + RET diff --git a/vendor/github.com/ebitengine/purego/sys_riscv64.s b/vendor/github.com/ebitengine/purego/sys_riscv64.s new file mode 100644 index 00000000..e7e887e1 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_riscv64.s @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +// Stack usage: +// 0(SP) - 56(SP): stack args a9-a15 (7 * 8 bytes = 56) +// 56(SP) - 64(SP): saved RA (x1) +// 64(SP) - 72(SP): saved X9 (s1) +// 72(SP) - 80(SP): saved X18 (s2) +// 80(SP) - 88(SP): saved args pointer (original X10) +// 88(SP) - 96(SP): padding +#define STACK_SIZE 96 +#define SAVE_RA 56 +#define SAVE_X9 64 +#define SAVE_X18 72 +#define SAVE_ARGP 80 + +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $8 +DATA ·syscall15XABI0(SB)/8, $syscall15X(SB) + +TEXT syscall15X(SB), NOSPLIT, $0 + // Allocate stack frame (keeps 16-byte alignment) + SUB $STACK_SIZE, SP + + // Save callee-saved regs we clobber + return address + MOV X1, SAVE_RA(SP) + MOV X9, SAVE_X9(SP) + MOV X18, SAVE_X18(SP) + + // Save original args pointer (in a0/X10) + MOV X10, SAVE_ARGP(SP) + + // X9 := args pointer (syscall15Args*) + MOV X10, X9 + + // Load float args into fa0-fa7 (F10-F17) + MOVD syscall15Args_f1(X9), F10 + MOVD syscall15Args_f2(X9), F11 + MOVD syscall15Args_f3(X9), F12 + MOVD syscall15Args_f4(X9), F13 + MOVD syscall15Args_f5(X9), F14 + MOVD syscall15Args_f6(X9), F15 + MOVD syscall15Args_f7(X9), F16 + MOVD syscall15Args_f8(X9), F17 + + // Load integer args into a0-a7 (X10-X17) + MOV syscall15Args_a1(X9), X10 + MOV syscall15Args_a2(X9), X11 + MOV syscall15Args_a3(X9), X12 + MOV syscall15Args_a4(X9), X13 + MOV syscall15Args_a5(X9), X14 + MOV syscall15Args_a6(X9), X15 + MOV syscall15Args_a7(X9), X16 + MOV syscall15Args_a8(X9), X17 + + // Spill a9-a15 onto the stack (C ABI) + MOV syscall15Args_a9(X9), X18 + MOV X18, 0(SP) + MOV syscall15Args_a10(X9), X18 + MOV X18, 8(SP) + MOV syscall15Args_a11(X9), X18 + MOV X18, 16(SP) + MOV syscall15Args_a12(X9), X18 + MOV X18, 24(SP) + MOV syscall15Args_a13(X9), X18 + MOV X18, 32(SP) + MOV syscall15Args_a14(X9), X18 + MOV X18, 40(SP) + MOV syscall15Args_a15(X9), X18 + MOV X18, 48(SP) + + // Call fn + // IMPORTANT: preserve RA across this call (we saved it above) + MOV syscall15Args_fn(X9), X18 + CALL X18 + + // Restore args pointer (syscall15Args*) for storing results + MOV SAVE_ARGP(SP), X9 + + // Store results back + MOV X10, syscall15Args_a1(X9) + MOV X11, syscall15Args_a2(X9) + + // Store back float return regs if used by your ABI contract + MOVD F10, syscall15Args_f1(X9) + MOVD F11, syscall15Args_f2(X9) + MOVD F12, syscall15Args_f3(X9) + MOVD F13, syscall15Args_f4(X9) + + // Restore callee-saved regs and return address + MOV SAVE_X18(SP), X18 + MOV SAVE_X9(SP), X9 + MOV SAVE_RA(SP), X1 + + ADD $STACK_SIZE, SP + RET diff --git a/vendor/github.com/ebitengine/purego/sys_s390x.s b/vendor/github.com/ebitengine/purego/sys_s390x.s new file mode 100644 index 00000000..a044e34d --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_s390x.s @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +// S390X ELF ABI: +// - Integer args: R2-R6 (5 registers) +// - Float args: F0, F2, F4, F6 (4 registers, even-numbered) +// - Return: R2 (integer), F0 (float) +// - Stack pointer: R15 +// - Link register: R14 +// - Callee-saved: R6-R13, F8-F15 (but R6 is also used for 5th param) +// +// Stack frame layout (aligned to 8 bytes): +// 0(R15) - back chain +// 8(R15) - reserved +// 16(R15) - reserved +// ... - register save area (R6-R15 at 48(R15)) +// 160(R15) - parameter area start (args beyond registers) +// +// We need space for: +// - 160 bytes standard frame (with register save area) +// - Stack args a6-a15 (10 * 8 = 80 bytes) +// - Saved args pointer (8 bytes) +// - Padding for alignment +// Total: 264 bytes (rounded to 8-byte alignment) + +#define STACK_SIZE 264 +#define STACK_ARGS 160 +#define ARGP_SAVE 248 + +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $8 +DATA ·syscall15XABI0(SB)/8, $syscall15X(SB) + +TEXT syscall15X(SB), NOSPLIT, $0 + // On entry, R2 contains the args pointer + // Save callee-saved registers in caller's frame (per ABI) + STMG R6, R15, 48(R15) + + // Allocate our stack frame + MOVD R15, R1 + SUB $STACK_SIZE, R15 + MOVD R1, 0(R15) // back chain + + // Save args pointer + MOVD R2, ARGP_SAVE(R15) + + // R9 := args pointer (syscall15Args*) + MOVD R2, R9 + + // Load float args into F0, F2, F4, F6 (s390x uses even-numbered FPRs) + FMOVD syscall15Args_f1(R9), F0 + FMOVD syscall15Args_f2(R9), F2 + FMOVD syscall15Args_f3(R9), F4 + FMOVD syscall15Args_f4(R9), F6 + + // Load integer args into R2-R6 (5 registers) + MOVD syscall15Args_a1(R9), R2 + MOVD syscall15Args_a2(R9), R3 + MOVD syscall15Args_a3(R9), R4 + MOVD syscall15Args_a4(R9), R5 + MOVD syscall15Args_a5(R9), R6 + + // Spill remaining args (a6-a15) onto the stack at 160(R15) + MOVD ARGP_SAVE(R15), R9 // reload args pointer + MOVD syscall15Args_a6(R9), R1 + MOVD R1, (STACK_ARGS+0*8)(R15) + MOVD syscall15Args_a7(R9), R1 + MOVD R1, (STACK_ARGS+1*8)(R15) + MOVD syscall15Args_a8(R9), R1 + MOVD R1, (STACK_ARGS+2*8)(R15) + MOVD syscall15Args_a9(R9), R1 + MOVD R1, (STACK_ARGS+3*8)(R15) + MOVD syscall15Args_a10(R9), R1 + MOVD R1, (STACK_ARGS+4*8)(R15) + MOVD syscall15Args_a11(R9), R1 + MOVD R1, (STACK_ARGS+5*8)(R15) + MOVD syscall15Args_a12(R9), R1 + MOVD R1, (STACK_ARGS+6*8)(R15) + MOVD syscall15Args_a13(R9), R1 + MOVD R1, (STACK_ARGS+7*8)(R15) + MOVD syscall15Args_a14(R9), R1 + MOVD R1, (STACK_ARGS+8*8)(R15) + MOVD syscall15Args_a15(R9), R1 + MOVD R1, (STACK_ARGS+9*8)(R15) + + // Call function + MOVD syscall15Args_fn(R9), R1 + BL (R1) + + // Restore args pointer for storing results + MOVD ARGP_SAVE(R15), R9 + + // Store integer results back (R2, R3) + MOVD R2, syscall15Args_a1(R9) + MOVD R3, syscall15Args_a2(R9) + + // Store float return values (F0, F2, F4, F6) + FMOVD F0, syscall15Args_f1(R9) + FMOVD F2, syscall15Args_f2(R9) + FMOVD F4, syscall15Args_f3(R9) + FMOVD F6, syscall15Args_f4(R9) + + // Deallocate stack frame + ADD $STACK_SIZE, R15 + + // Restore callee-saved registers from caller's save area + LMG 48(R15), R6, R15 + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_386.s b/vendor/github.com/ebitengine/purego/sys_unix_386.s new file mode 100644 index 00000000..31aecbf3 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_386.s @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +// callbackasm1 is the second part of the callback trampoline. +// On entry: +// - CX contains the callback index (set by callbackasm) +// - 0(SP) contains the return address to C caller +// - 4(SP), 8(SP), ... contain C arguments (cdecl convention) +// +// i386 cdecl calling convention: +// - All arguments passed on stack +// - Return value in EAX (and EDX for 64-bit) +// - Caller cleans the stack +// - Callee must preserve: EBX, ESI, EDI, EBP +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + NO_LOCAL_POINTERS + + // Save the return address + MOVL 0(SP), AX + + // Allocate stack frame (must be done carefully to preserve args access) + // Layout: + // 0-15: saved callee-saved registers (BX, SI, DI, BP) + // 16-19: saved callback index + // 20-23: saved return address + // 24-35: callbackArgs struct (12 bytes) + // 36-291: copy of C arguments (256 bytes for 64 args, matching callbackMaxFrame) + // Total: 292 bytes, round up to 304 for alignment + SUBL $304, SP + + // Save callee-saved registers + MOVL BX, 0(SP) + MOVL SI, 4(SP) + MOVL DI, 8(SP) + MOVL BP, 12(SP) + + // Save callback index and return address + MOVL CX, 16(SP) + MOVL AX, 20(SP) + + // Copy C arguments from original stack location to our frame + // Original args start at 304+4(SP) = 308(SP) (past our frame + original return addr) + // Copy to our frame at 36(SP) + // Copy 64 arguments (256 bytes, matching callbackMaxFrame = 64 * ptrSize) + MOVL 308(SP), AX + MOVL AX, 36(SP) + MOVL 312(SP), AX + MOVL AX, 40(SP) + MOVL 316(SP), AX + MOVL AX, 44(SP) + MOVL 320(SP), AX + MOVL AX, 48(SP) + MOVL 324(SP), AX + MOVL AX, 52(SP) + MOVL 328(SP), AX + MOVL AX, 56(SP) + MOVL 332(SP), AX + MOVL AX, 60(SP) + MOVL 336(SP), AX + MOVL AX, 64(SP) + MOVL 340(SP), AX + MOVL AX, 68(SP) + MOVL 344(SP), AX + MOVL AX, 72(SP) + MOVL 348(SP), AX + MOVL AX, 76(SP) + MOVL 352(SP), AX + MOVL AX, 80(SP) + MOVL 356(SP), AX + MOVL AX, 84(SP) + MOVL 360(SP), AX + MOVL AX, 88(SP) + MOVL 364(SP), AX + MOVL AX, 92(SP) + MOVL 368(SP), AX + MOVL AX, 96(SP) + MOVL 372(SP), AX + MOVL AX, 100(SP) + MOVL 376(SP), AX + MOVL AX, 104(SP) + MOVL 380(SP), AX + MOVL AX, 108(SP) + MOVL 384(SP), AX + MOVL AX, 112(SP) + MOVL 388(SP), AX + MOVL AX, 116(SP) + MOVL 392(SP), AX + MOVL AX, 120(SP) + MOVL 396(SP), AX + MOVL AX, 124(SP) + MOVL 400(SP), AX + MOVL AX, 128(SP) + MOVL 404(SP), AX + MOVL AX, 132(SP) + MOVL 408(SP), AX + MOVL AX, 136(SP) + MOVL 412(SP), AX + MOVL AX, 140(SP) + MOVL 416(SP), AX + MOVL AX, 144(SP) + MOVL 420(SP), AX + MOVL AX, 148(SP) + MOVL 424(SP), AX + MOVL AX, 152(SP) + MOVL 428(SP), AX + MOVL AX, 156(SP) + MOVL 432(SP), AX + MOVL AX, 160(SP) + MOVL 436(SP), AX + MOVL AX, 164(SP) + MOVL 440(SP), AX + MOVL AX, 168(SP) + MOVL 444(SP), AX + MOVL AX, 172(SP) + MOVL 448(SP), AX + MOVL AX, 176(SP) + MOVL 452(SP), AX + MOVL AX, 180(SP) + MOVL 456(SP), AX + MOVL AX, 184(SP) + MOVL 460(SP), AX + MOVL AX, 188(SP) + MOVL 464(SP), AX + MOVL AX, 192(SP) + MOVL 468(SP), AX + MOVL AX, 196(SP) + MOVL 472(SP), AX + MOVL AX, 200(SP) + MOVL 476(SP), AX + MOVL AX, 204(SP) + MOVL 480(SP), AX + MOVL AX, 208(SP) + MOVL 484(SP), AX + MOVL AX, 212(SP) + MOVL 488(SP), AX + MOVL AX, 216(SP) + MOVL 492(SP), AX + MOVL AX, 220(SP) + MOVL 496(SP), AX + MOVL AX, 224(SP) + MOVL 500(SP), AX + MOVL AX, 228(SP) + MOVL 504(SP), AX + MOVL AX, 232(SP) + MOVL 508(SP), AX + MOVL AX, 236(SP) + MOVL 512(SP), AX + MOVL AX, 240(SP) + MOVL 516(SP), AX + MOVL AX, 244(SP) + MOVL 520(SP), AX + MOVL AX, 248(SP) + MOVL 524(SP), AX + MOVL AX, 252(SP) + MOVL 528(SP), AX + MOVL AX, 256(SP) + MOVL 532(SP), AX + MOVL AX, 260(SP) + MOVL 536(SP), AX + MOVL AX, 264(SP) + MOVL 540(SP), AX + MOVL AX, 268(SP) + MOVL 544(SP), AX + MOVL AX, 272(SP) + MOVL 548(SP), AX + MOVL AX, 276(SP) + MOVL 552(SP), AX + MOVL AX, 280(SP) + MOVL 556(SP), AX + MOVL AX, 284(SP) + MOVL 560(SP), AX + MOVL AX, 288(SP) + + // Set up callbackArgs struct at 24(SP) + // struct callbackArgs { + // index uintptr // offset 0 + // args *byte // offset 4 + // result uintptr // offset 8 + // } + MOVL 16(SP), AX // callback index + MOVL AX, 24(SP) // callbackArgs.index + LEAL 36(SP), AX // pointer to copied arguments + MOVL AX, 28(SP) // callbackArgs.args + MOVL $0, 32(SP) // callbackArgs.result = 0 + + // Call crosscall2(fn, frame, 0, ctxt) + // crosscall2 expects arguments on stack: + // 0(SP) = fn + // 4(SP) = frame (pointer to callbackArgs) + // 8(SP) = ignored (was n) + // 12(SP) = ctxt + SUBL $16, SP + + MOVL ·callbackWrap_call(SB), AX + MOVL (AX), AX // fn = *callbackWrap_call + MOVL AX, 0(SP) // fn + LEAL (24+16)(SP), AX // &callbackArgs (adjusted for SUB $16) + MOVL AX, 4(SP) // frame + MOVL $0, 8(SP) // 0 + MOVL $0, 12(SP) // ctxt + + CALL crosscall2(SB) + + ADDL $16, SP + + // Get result from callbackArgs.result + MOVL 32(SP), AX + + // Restore callee-saved registers + MOVL 0(SP), BX + MOVL 4(SP), SI + MOVL 8(SP), DI + MOVL 12(SP), BP + + // Restore return address and clean up + MOVL 20(SP), CX // get return address + ADDL $304, SP // remove our frame + MOVL CX, 0(SP) // put return address back + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_arm.s b/vendor/github.com/ebitengine/purego/sys_unix_arm.s new file mode 100644 index 00000000..a97e9437 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_arm.s @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + NO_LOCAL_POINTERS + + // Allocate stack frame: 48 + 16 + 64 + 16 = 144 bytes + SUB $144, R13 + + // Save callee-saved registers at SP+0 + MOVW R4, 0(R13) + MOVW R5, 4(R13) + MOVW R6, 8(R13) + MOVW R7, 12(R13) + MOVW R8, 16(R13) + MOVW R9, 20(R13) + MOVW g, 24(R13) + MOVW R11, 28(R13) + MOVW R14, 32(R13) + + // Save callback index (passed in R12) at SP+36 + MOVW R12, 36(R13) + + // Save integer arguments R0-R3 at SP+128 (frame[16..19]) + MOVW R0, 128(R13) + MOVW R1, 132(R13) + MOVW R2, 136(R13) + MOVW R3, 140(R13) + + // Save floating point registers F0-F7 at SP+64 (frame[0..15]) + // Note: We always save these since we target hard-float ABI. + MOVD F0, 64(R13) + MOVD F1, 72(R13) + MOVD F2, 80(R13) + MOVD F3, 88(R13) + MOVD F4, 96(R13) + MOVD F5, 104(R13) + MOVD F6, 112(R13) + MOVD F7, 120(R13) + + // Set up callbackArgs at SP+48 + MOVW 36(R13), R4 + MOVW R4, 48(R13) + ADD $64, R13, R4 + MOVW R4, 52(R13) + MOVW $0, R4 + MOVW R4, 56(R13) + + // Call crosscall2(fn, frame, 0, ctxt) + MOVW ·callbackWrap_call(SB), R0 + MOVW (R0), R0 + ADD $48, R13, R1 + MOVW $0, R2 + MOVW $0, R3 + + BL crosscall2(SB) + + // Get result + MOVW 56(R13), R0 + + // Restore float registers + MOVD 64(R13), F0 + MOVD 72(R13), F1 + MOVD 80(R13), F2 + MOVD 88(R13), F3 + MOVD 96(R13), F4 + MOVD 104(R13), F5 + MOVD 112(R13), F6 + MOVD 120(R13), F7 + + // Restore callee-saved registers + MOVW 0(R13), R4 + MOVW 4(R13), R5 + MOVW 8(R13), R6 + MOVW 12(R13), R7 + MOVW 16(R13), R8 + MOVW 20(R13), R9 + MOVW 24(R13), g + MOVW 28(R13), R11 + MOVW 32(R13), R14 + + ADD $144, R13 + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_arm64.s b/vendor/github.com/ebitengine/purego/sys_unix_arm64.s new file mode 100644 index 00000000..cea803ef --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_arm64.s @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2023 The Ebitengine Authors + +//go:build darwin || freebsd || linux || netbsd + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" +#include "abi_arm64.h" + +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + NO_LOCAL_POINTERS + + // On entry, the trampoline in zcallback_darwin_arm64.s left + // the callback index in R12 (which is volatile in the C ABI). + + // Save callback register arguments R0-R7 and F0-F7. + // We do this at the top of the frame so they're contiguous with stack arguments. + SUB $(16*8), RSP, R14 + FSTPD (F0, F1), (0*8)(R14) + FSTPD (F2, F3), (2*8)(R14) + FSTPD (F4, F5), (4*8)(R14) + FSTPD (F6, F7), (6*8)(R14) + STP (R0, R1), (8*8)(R14) + STP (R2, R3), (10*8)(R14) + STP (R4, R5), (12*8)(R14) + STP (R6, R7), (14*8)(R14) + + // Adjust SP by frame size. + SUB $(26*8), RSP + + // It is important to save R27 because the go assembler + // uses it for move instructions for a variable. + // This line: + // MOVD ·callbackWrap_call(SB), R0 + // Creates the instructions: + // ADRP 14335(PC), R27 + // MOVD 388(27), R0 + // R27 is a callee saved register so we are responsible + // for ensuring its value doesn't change. So save it and + // restore it at the end of this function. + // R30 is the link register. crosscall2 doesn't save it + // so it's saved here. + STP (R27, R30), 0(RSP) + + // Create a struct callbackArgs on our stack. + MOVD $(callbackArgs__size)(RSP), R13 + MOVD R12, callbackArgs_index(R13) // callback index + MOVD R14, callbackArgs_args(R13) // address of args vector + MOVD ZR, callbackArgs_result(R13) // result + + // Move parameters into registers + // Get the ABIInternal function pointer + // without by using a closure. + MOVD ·callbackWrap_call(SB), R0 + MOVD (R0), R0 // fn unsafe.Pointer + MOVD R13, R1 // frame (&callbackArgs{...}) + MOVD $0, R3 // ctxt uintptr + + BL crosscall2(SB) + + // Get callback result. + MOVD $(callbackArgs__size)(RSP), R13 + MOVD callbackArgs_result(R13), R0 + + // Restore LR and R27 + LDP 0(RSP), (R27, R30) + ADD $(26*8), RSP + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_loong64.s b/vendor/github.com/ebitengine/purego/sys_unix_loong64.s new file mode 100644 index 00000000..cd00f9c1 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_loong64.s @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" +#include "abi_loong64.h" + +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + NO_LOCAL_POINTERS + + SUBV $(16*8), R3, R14 + MOVD F0, 0(R14) + MOVD F1, 8(R14) + MOVD F2, 16(R14) + MOVD F3, 24(R14) + MOVD F4, 32(R14) + MOVD F5, 40(R14) + MOVD F6, 48(R14) + MOVD F7, 56(R14) + MOVV R4, 64(R14) + MOVV R5, 72(R14) + MOVV R6, 80(R14) + MOVV R7, 88(R14) + MOVV R8, 96(R14) + MOVV R9, 104(R14) + MOVV R10, 112(R14) + MOVV R11, 120(R14) + + // Adjust SP by frame size. + SUBV $(22*8), R3 + + // It is important to save R30 because the go assembler + // uses it for move instructions for a variable. + // This line: + // MOVV ·callbackWrap_call(SB), R4 + // Creates the instructions: + // PCALAU12I off1(PC), R30 + // MOVV off2(R30), R4 + // R30 is a callee saved register so we are responsible + // for ensuring its value doesn't change. So save it and + // restore it at the end of this function. + // R1 is the link register. crosscall2 doesn't save it + // so it's saved here. + MOVV R1, 0(R3) + MOVV R30, 8(R3) + + // Create a struct callbackArgs on our stack. + MOVV $(callbackArgs__size)(R3), R13 + MOVV R12, callbackArgs_index(R13) // callback index + MOVV R14, callbackArgs_args(R13) // address of args vector + MOVV $0, callbackArgs_result(R13) // result + + // Move parameters into registers + // Get the ABIInternal function pointer + // without by using a closure. + MOVV ·callbackWrap_call(SB), R4 + MOVV (R4), R4 // fn unsafe.Pointer + MOVV R13, R5 // frame (&callbackArgs{...}) + MOVV $0, R7 // ctxt uintptr + + JAL crosscall2(SB) + + // Get callback result. + MOVV $(callbackArgs__size)(R3), R13 + MOVV callbackArgs_result(R13), R4 + + // Restore LR and R30 + MOVV 0(R3), R1 + MOVV 8(R3), R30 + ADDV $(22*8), R3 + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_ppc64le.s b/vendor/github.com/ebitengine/purego/sys_unix_ppc64le.s new file mode 100644 index 00000000..37f0d8d6 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_ppc64le.s @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +// PPC64LE ELFv2 ABI callbackasm1 implementation +// On entry, R11 contains the callback index (set by callbackasm) +// +// ELFv2 stack frame layout requirements: +// 0(R1) - back chain (pointer to caller's frame) +// 8(R1) - CR save area (optional) +// 16(R1) - LR save area (for callee to save caller's LR) +// 24(R1) - TOC save area (if needed) +// 32(R1)+ - parameter save area / local variables +// +// Our frame (total 208 bytes, 16-byte aligned): +// 32(R1) - saved R31 (8 bytes) +// 40(R1) - callbackArgs struct (32 bytes: index, args, result, stackArgs) +// 72(R1) - args array: floats (64) + ints (64) = 128 bytes, ends at 200 +// Total with alignment: 208 bytes +// +// Stack args are NOT copied - we pass a pointer to their location in caller's frame. +// This keeps frame size small enough for NOSPLIT with CGO_ENABLED=1. +// Budget: 208 + 544 (crosscall2) + 56 (cgocallback) = 808 bytes +// This is 8 bytes over the 800 limit, but cgocallback's children (load_g, save_g) +// reuse the same stack space, so in practice it works. + +#define FRAME_SIZE 200 +#define SAVE_R31 32 +#define CB_ARGS 40 +#define ARGS_ARRAY 72 +#define FLOAT_OFF 0 +#define INT_OFF 64 + +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + NO_LOCAL_POINTERS + + // On entry, the trampoline in zcallback_ppc64le.s left + // the callback index in R11. + + // Per ELFv2 ABI, save LR to caller's frame BEFORE allocating our frame + MOVD LR, R0 + MOVD R0, 16(R1) + + // Allocate our stack frame (with back chain via MOVDU) + MOVDU R1, -FRAME_SIZE(R1) + + // Save R31 - Go assembler uses it for MOVD from SB (like arm64's R27) + MOVD R31, SAVE_R31(R1) + + // Save R11 (callback index) immediately - it's volatile and will be clobbered! + // Store it in the callbackArgs struct's index field now. + MOVD R11, (CB_ARGS+0)(R1) + + // Save callback arguments to args array. + // Layout: floats first (F1-F8), then ints (R3-R10), then stack args + FMOVD F1, (ARGS_ARRAY+FLOAT_OFF+0*8)(R1) + FMOVD F2, (ARGS_ARRAY+FLOAT_OFF+1*8)(R1) + FMOVD F3, (ARGS_ARRAY+FLOAT_OFF+2*8)(R1) + FMOVD F4, (ARGS_ARRAY+FLOAT_OFF+3*8)(R1) + FMOVD F5, (ARGS_ARRAY+FLOAT_OFF+4*8)(R1) + FMOVD F6, (ARGS_ARRAY+FLOAT_OFF+5*8)(R1) + FMOVD F7, (ARGS_ARRAY+FLOAT_OFF+6*8)(R1) + FMOVD F8, (ARGS_ARRAY+FLOAT_OFF+7*8)(R1) + + MOVD R3, (ARGS_ARRAY+INT_OFF+0*8)(R1) + MOVD R4, (ARGS_ARRAY+INT_OFF+1*8)(R1) + MOVD R5, (ARGS_ARRAY+INT_OFF+2*8)(R1) + MOVD R6, (ARGS_ARRAY+INT_OFF+3*8)(R1) + MOVD R7, (ARGS_ARRAY+INT_OFF+4*8)(R1) + MOVD R8, (ARGS_ARRAY+INT_OFF+5*8)(R1) + MOVD R9, (ARGS_ARRAY+INT_OFF+6*8)(R1) + MOVD R10, (ARGS_ARRAY+INT_OFF+7*8)(R1) + + // Finish setting up callbackArgs struct at CB_ARGS(R1) + // struct { index uintptr; args unsafe.Pointer; result uintptr; stackArgs unsafe.Pointer } + // Note: index was already saved earlier (R11 is volatile) + ADD $ARGS_ARRAY, R1, R12 + MOVD R12, (CB_ARGS+8)(R1) // args = address of register args + MOVD $0, (CB_ARGS+16)(R1) // result = 0 + + // stackArgs points to caller's stack arguments at old_R1+96 = R1+FRAME_SIZE+96 + ADD $(FRAME_SIZE+96), R1, R12 + MOVD R12, (CB_ARGS+24)(R1) // stackArgs = &caller_stack_args + + // Call crosscall2 with arguments in registers: + // R3 = fn (from callbackWrap_call closure) + // R4 = frame (address of callbackArgs) + // R6 = ctxt (0) + MOVD ·callbackWrap_call(SB), R3 + MOVD (R3), R3 // dereference closure to get fn + ADD $CB_ARGS, R1, R4 // frame = &callbackArgs + MOVD $0, R6 // ctxt = 0 + + BL crosscall2(SB) + + // Get callback result into R3 + MOVD (CB_ARGS+16)(R1), R3 + + // Restore R31 + MOVD SAVE_R31(R1), R31 + + // Deallocate frame + ADD $FRAME_SIZE, R1 + + // Restore LR from caller's frame (per ELFv2, it was saved at 16(old_R1)) + MOVD 16(R1), R0 + MOVD R0, LR + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_riscv64.s b/vendor/github.com/ebitengine/purego/sys_unix_riscv64.s new file mode 100644 index 00000000..8341d5b0 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_riscv64.s @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +TEXT callbackasm1(SB), NOFRAME, $0 + NO_LOCAL_POINTERS + + // On entry, the trampoline in zcallback_riscv64.s left + // the callback index in X7. + + // Save callback register arguments X10-X17 and F10-F17. + // Stack args (if any) are at 0(SP), 8(SP), etc. + // We save register args at SP-128, making them contiguous with stack args. + ADD $-(16*8), SP, X6 + + // Save float arg regs fa0-fa7 (F10-F17) + MOVD F10, 0(X6) + MOVD F11, 8(X6) + MOVD F12, 16(X6) + MOVD F13, 24(X6) + MOVD F14, 32(X6) + MOVD F15, 40(X6) + MOVD F16, 48(X6) + MOVD F17, 56(X6) + + // Save integer arg regs a0-a7 (X10-X17) + MOV X10, 64(X6) + MOV X11, 72(X6) + MOV X12, 80(X6) + MOV X13, 88(X6) + MOV X14, 96(X6) + MOV X15, 104(X6) + MOV X16, 112(X6) + MOV X17, 120(X6) + + // Allocate space on stack for RA, saved regs, and callbackArgs. + // We need: 8 (RA) + 8 (X9 callee-saved) + 24 (callbackArgs) = 40, round to 176 (22*8) + // to match loong64 and ensure we don't overlap with saved register args. + // The saved regs end at SP-8 (original), so we need new SP below SP-128. + ADD $-(22*8), SP + + // Save link register (RA/X1) and callee-saved register X9 + // (X9 is used by the assembler for some instructions) + MOV X1, 0(SP) + MOV X9, 8(SP) + + // Create a struct callbackArgs on our stack. + // callbackArgs struct: index(0), args(8), result(16) + // Place it at 16(SP) to avoid overlap + ADD $16, SP, X9 + MOV X7, 0(X9) // callback index + MOV X6, 8(X9) // address of args vector + MOV X0, 16(X9) // result = 0 + + // Call crosscall2 with arguments in registers + MOV ·callbackWrap_call(SB), X10 // Get the ABIInternal function pointer + MOV (X10), X10 // without by using a closure. X10 = fn + MOV X9, X11 // X11 = frame (address of callbackArgs) + MOV X0, X13 // X13 = ctxt = 0 + + CALL crosscall2(SB) + + // Get callback result. + ADD $16, SP, X9 + MOV 16(X9), X10 + + // Restore link register and callee-saved X9 + MOV 8(SP), X9 + MOV 0(SP), X1 + + // Restore stack pointer + ADD $(22*8), SP + + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_s390x.s b/vendor/github.com/ebitengine/purego/sys_unix_s390x.s new file mode 100644 index 00000000..9eed6d29 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_s390x.s @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +// S390X ELF ABI callbackasm1 implementation +// On entry, R0 contains the callback index (set by callbackasm) +// NOTE: We use R0 instead of R11 because R11 is callee-saved on S390X. +// +// S390X stack frame layout: +// 0(R15) - back chain +// 48(R15) - register save area (R6-R15) +// 160(R15) - parameter area +// +// S390X uses R2-R6 for integer arguments (5 registers) and F0,F2,F4,F6 for floats (4 registers). +// +// Our frame layout (total 264 bytes, 8-byte aligned): +// 0(R15) - back chain +// 48(R15) - saved R6-R15 (done by STMG) +// 160(R15) - callbackArgs struct (32 bytes: index, args, result, stackArgs) +// 192(R15) - args array start +// +// Args array layout: +// - floats F0,F2,F4,F6 (32 bytes) +// - ints R2-R6 (40 bytes) +// Total args array: 72 bytes, ends at 264 +// +// Stack args in caller's frame start at old_R15+160 + +#define FRAME_SIZE 264 +#define CB_ARGS 160 +#define ARGS_ARRAY 192 +#define FLOAT_OFF 0 +#define INT_OFF 32 + +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + NO_LOCAL_POINTERS + + // On entry, the trampoline in zcallback_s390x.s left + // the callback index in R0 (NOT R11, since R11 is callee-saved). + // R6 contains the 5th integer argument. + + // Save R6-R15 in caller's frame (per S390X ABI) BEFORE allocating our frame + // STMG stores R6's current value (the 5th arg) at 48(R15) + STMG R6, R15, 48(R15) + + // Save current stack pointer (will be back chain) + MOVD R15, R1 + + // Allocate our stack frame + SUB $FRAME_SIZE, R15 + MOVD R1, 0(R15) // back chain + + // Save R0 (callback index) immediately - it's volatile + MOVD R0, (CB_ARGS+0)(R15) + + // Save callback arguments to args array. + // Layout: floats first (F0,F2,F4,F6), then ints (R2-R6) + FMOVD F0, (ARGS_ARRAY+FLOAT_OFF+0*8)(R15) + FMOVD F2, (ARGS_ARRAY+FLOAT_OFF+1*8)(R15) + FMOVD F4, (ARGS_ARRAY+FLOAT_OFF+2*8)(R15) + FMOVD F6, (ARGS_ARRAY+FLOAT_OFF+3*8)(R15) + + MOVD R2, (ARGS_ARRAY+INT_OFF+0*8)(R15) + MOVD R3, (ARGS_ARRAY+INT_OFF+1*8)(R15) + MOVD R4, (ARGS_ARRAY+INT_OFF+2*8)(R15) + MOVD R5, (ARGS_ARRAY+INT_OFF+3*8)(R15) + + // R6 (5th int arg) was saved at 48(old_R15) by STMG + // old_R15 = current R15 + FRAME_SIZE, so R6 is at 48+FRAME_SIZE(R15) = 312(R15) + MOVD (48+FRAME_SIZE)(R15), R1 + MOVD R1, (ARGS_ARRAY+INT_OFF+4*8)(R15) + + // Finish setting up callbackArgs struct at CB_ARGS(R15) + // struct { index uintptr; args unsafe.Pointer; result uintptr; stackArgs unsafe.Pointer } + // Note: index was already saved earlier + ADD $ARGS_ARRAY, R15, R1 + MOVD R1, (CB_ARGS+8)(R15) // args = address of register args + MOVD $0, (CB_ARGS+16)(R15) // result = 0 + + // stackArgs points to caller's stack arguments at old_R15+160 = R15+FRAME_SIZE+160 + ADD $(FRAME_SIZE+160), R15, R1 + MOVD R1, (CB_ARGS+24)(R15) // stackArgs = &caller_stack_args + + // Call crosscall2 with arguments in registers: + // R2 = fn (from callbackWrap_call closure) + // R3 = frame (address of callbackArgs) + // R5 = ctxt (0) + MOVD ·callbackWrap_call(SB), R2 + MOVD (R2), R2 // dereference closure to get fn + ADD $CB_ARGS, R15, R3 // frame = &callbackArgs + MOVD $0, R5 // ctxt = 0 + + BL crosscall2(SB) + + // Get callback result into R2 + MOVD (CB_ARGS+16)(R15), R2 + + // Deallocate frame + ADD $FRAME_SIZE, R15 + + // Restore R6-R15 from caller's frame + LMG 48(R15), R6, R15 + + RET diff --git a/vendor/github.com/ebitengine/purego/syscall.go b/vendor/github.com/ebitengine/purego/syscall.go new file mode 100644 index 00000000..7b45383d --- /dev/null +++ b/vendor/github.com/ebitengine/purego/syscall.go @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !386 && !arm && (darwin || freebsd || linux || netbsd || windows) + +package purego + +// CDecl marks a function as being called using the __cdecl calling convention as defined in +// the [MSDocs] when passed to NewCallback. It must be the first argument to the function. +// This is only useful on 386 Windows, but it is safe to use on other platforms. +// +// [MSDocs]: https://learn.microsoft.com/en-us/cpp/cpp/cdecl?view=msvc-170 +type CDecl struct{} + +const ( + maxArgs = 15 +) + +type syscall15Args struct { + fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr + f1, f2, f3, f4, f5, f6, f7, f8 uintptr + arm64_r8 uintptr +} + +func (s *syscall15Args) Set(fn uintptr, ints []uintptr, floats []uintptr, r8 uintptr) { + s.fn = fn + s.a1 = ints[0] + s.a2 = ints[1] + s.a3 = ints[2] + s.a4 = ints[3] + s.a5 = ints[4] + s.a6 = ints[5] + s.a7 = ints[6] + s.a8 = ints[7] + s.a9 = ints[8] + s.a10 = ints[9] + s.a11 = ints[10] + s.a12 = ints[11] + s.a13 = ints[12] + s.a14 = ints[13] + s.a15 = ints[14] + s.f1 = floats[0] + s.f2 = floats[1] + s.f3 = floats[2] + s.f4 = floats[3] + s.f5 = floats[4] + s.f6 = floats[5] + s.f7 = floats[6] + s.f8 = floats[7] + s.arm64_r8 = r8 +} + +// SyscallN takes fn, a C function pointer and a list of arguments as uintptr. +// There is an internal maximum number of arguments that SyscallN can take. It panics +// when the maximum is exceeded. It returns the result and the libc error code if there is one. +// +// In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer] +// especially point 4. +// +// NOTE: SyscallN does not properly call functions that have both integer and float parameters. +// See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607 +// for an explanation of why that is. +// +// On amd64, if there are more than 8 floats the 9th and so on will be placed incorrectly on the +// stack. +// +// The pragma go:nosplit is not needed at this function declaration because it uses go:uintptrescapes +// which forces all the objects that the uintptrs point to onto the heap where a stack split won't affect +// their memory location. +// +//go:uintptrescapes +func SyscallN(fn uintptr, args ...uintptr) (r1, r2, err uintptr) { + if fn == 0 { + panic("purego: fn is nil") + } + if len(args) > maxArgs { + panic("purego: too many arguments to SyscallN") + } + // add padding so there is no out-of-bounds slicing + var tmp [maxArgs]uintptr + copy(tmp[:], args) + return syscall_syscall15X(fn, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5], tmp[6], tmp[7], tmp[8], tmp[9], tmp[10], tmp[11], tmp[12], tmp[13], tmp[14]) +} diff --git a/vendor/github.com/ebitengine/purego/syscall_32bit.go b/vendor/github.com/ebitengine/purego/syscall_32bit.go new file mode 100644 index 00000000..f9f37630 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/syscall_32bit.go @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build (386 || arm) && (freebsd || linux || netbsd || windows) + +package purego + +// CDecl marks a function as being called using the __cdecl calling convention as defined in +// the [MSDocs] when passed to NewCallback. It must be the first argument to the function. +// This is only useful on 386 Windows, but it is safe to use on other platforms. +// +// [MSDocs]: https://learn.microsoft.com/en-us/cpp/cpp/cdecl?view=msvc-170 +type CDecl struct{} + +const ( + maxArgs = 32 +) + +type syscall15Args struct { + fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr + a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32 uintptr + f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16 uintptr + arm64_r8 uintptr +} + +func (s *syscall15Args) Set(fn uintptr, ints []uintptr, floats []uintptr, r8 uintptr) { + s.fn = fn + s.a1 = ints[0] + s.a2 = ints[1] + s.a3 = ints[2] + s.a4 = ints[3] + s.a5 = ints[4] + s.a6 = ints[5] + s.a7 = ints[6] + s.a8 = ints[7] + s.a9 = ints[8] + s.a10 = ints[9] + s.a11 = ints[10] + s.a12 = ints[11] + s.a13 = ints[12] + s.a14 = ints[13] + s.a15 = ints[14] + s.a16 = ints[15] + s.a17 = ints[16] + s.a18 = ints[17] + s.a19 = ints[18] + s.a20 = ints[19] + s.a21 = ints[20] + s.a22 = ints[21] + s.a23 = ints[22] + s.a24 = ints[23] + s.a25 = ints[24] + s.a26 = ints[25] + s.a27 = ints[26] + s.a28 = ints[27] + s.a29 = ints[28] + s.a30 = ints[29] + s.a31 = ints[30] + s.a32 = ints[31] + s.f1 = floats[0] + s.f2 = floats[1] + s.f3 = floats[2] + s.f4 = floats[3] + s.f5 = floats[4] + s.f6 = floats[5] + s.f7 = floats[6] + s.f8 = floats[7] + s.f9 = floats[8] + s.f10 = floats[9] + s.f11 = floats[10] + s.f12 = floats[11] + s.f13 = floats[12] + s.f14 = floats[13] + s.f15 = floats[14] + s.f16 = floats[15] + s.arm64_r8 = r8 +} + +// SyscallN takes fn, a C function pointer and a list of arguments as uintptr. +// There is an internal maximum number of arguments that SyscallN can take. It panics +// when the maximum is exceeded. It returns the result and the libc error code if there is one. +// +// In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer] +// especially point 4. +// +// NOTE: SyscallN does not properly call functions that have both integer and float parameters. +// See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607 +// for an explanation of why that is. +// +// On amd64, if there are more than 8 floats the 9th and so on will be placed incorrectly on the +// stack. +// +// The pragma go:nosplit is not needed at this function declaration because it uses go:uintptrescapes +// which forces all the objects that the uintptrs point to onto the heap where a stack split won't affect +// their memory location. +// +//go:uintptrescapes +func SyscallN(fn uintptr, args ...uintptr) (r1, r2, err uintptr) { + if fn == 0 { + panic("purego: fn is nil") + } + if len(args) > maxArgs { + panic("purego: too many arguments to SyscallN") + } + // add padding so there is no out-of-bounds slicing + var tmp [maxArgs]uintptr + copy(tmp[:], args) + return syscall_syscall15X(fn, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5], tmp[6], tmp[7], tmp[8], tmp[9], tmp[10], tmp[11], tmp[12], tmp[13], tmp[14]) +} diff --git a/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go b/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go new file mode 100644 index 00000000..179167f4 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build cgo && !(386 || amd64 || arm || arm64 || loong64 || ppc64le || riscv64 || s390x) + +package purego + +import ( + "github.com/ebitengine/purego/internal/cgo" +) + +var syscall15XABI0 = uintptr(cgo.Syscall15XABI0) + +//go:nosplit +func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { + return cgo.Syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) +} + +func NewCallback(_ any) uintptr { + panic("purego: NewCallback on Linux is only supported on 386/amd64/arm64/arm/loong64/ppc64le/riscv64/s390x") +} diff --git a/vendor/github.com/ebitengine/purego/syscall_sysv.go b/vendor/github.com/ebitengine/purego/syscall_sysv.go new file mode 100644 index 00000000..e35b32e7 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/syscall_sysv.go @@ -0,0 +1,320 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +// TODO: remove s390x cgo dependency once golang/go#77449 is resolved +//go:build darwin || freebsd || (linux && (386 || amd64 || arm || arm64 || loong64 || ppc64le || riscv64 || (cgo && s390x))) || netbsd + +package purego + +import ( + "reflect" + "runtime" + "sync" + "unsafe" +) + +var syscall15XABI0 uintptr + +func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { + args := thePool.Get().(*syscall15Args) + defer thePool.Put(args) + + *args = syscall15Args{ + fn: fn, + a1: a1, a2: a2, a3: a3, a4: a4, a5: a5, a6: a6, a7: a7, a8: a8, + a9: a9, a10: a10, a11: a11, a12: a12, a13: a13, a14: a14, a15: a15, + f1: a1, f2: a2, f3: a3, f4: a4, f5: a5, f6: a6, f7: a7, f8: a8, + } + + runtime_cgocall(syscall15XABI0, unsafe.Pointer(args)) + return args.a1, args.a2, args.a3 +} + +// NewCallback converts a Go function to a function pointer conforming to the C calling convention. +// This is useful when interoperating with C code requiring callbacks. The argument is expected to be a +// function with zero or one uintptr-sized result. The function must not have arguments with size larger than the size +// of uintptr. Only a limited number of callbacks may be created in a single Go process, and any memory allocated +// for these callbacks is never released. At least 2000 callbacks can always be created. Although this function +// provides similar functionality to windows.NewCallback it is distinct. +func NewCallback(fn any) uintptr { + ty := reflect.TypeOf(fn) + for i := 0; i < ty.NumIn(); i++ { + in := ty.In(i) + if !in.AssignableTo(reflect.TypeOf(CDecl{})) { + continue + } + if i != 0 { + panic("purego: CDecl must be the first argument") + } + } + return compileCallback(fn) +} + +// maxCb is the maximum number of callbacks +// only increase this if you have added more to the callbackasm function +const maxCB = 2000 + +var cbs struct { + lock sync.Mutex + numFn int // the number of functions currently in cbs.funcs + funcs [maxCB]reflect.Value // the saved callbacks +} + +func compileCallback(fn any) uintptr { + val := reflect.ValueOf(fn) + if val.Kind() != reflect.Func { + panic("purego: the type must be a function but was not") + } + if val.IsNil() { + panic("purego: function must not be nil") + } + ty := val.Type() + for i := 0; i < ty.NumIn(); i++ { + in := ty.In(i) + switch in.Kind() { + case reflect.Struct: + if i == 0 && in.AssignableTo(reflect.TypeOf(CDecl{})) { + continue + } + fallthrough + case reflect.Interface, reflect.Func, reflect.Slice, + reflect.Chan, reflect.Complex64, reflect.Complex128, + reflect.String, reflect.Map, reflect.Invalid: + panic("purego: unsupported argument type: " + in.Kind().String()) + } + } +output: + switch { + case ty.NumOut() == 1: + switch ty.Out(0).Kind() { + case reflect.Pointer, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, + reflect.Bool, reflect.UnsafePointer: + break output + } + panic("purego: unsupported return type: " + ty.String()) + case ty.NumOut() > 1: + panic("purego: callbacks can only have one return") + } + cbs.lock.Lock() + defer cbs.lock.Unlock() + if cbs.numFn >= maxCB { + panic("purego: the maximum number of callbacks has been reached") + } + cbs.funcs[cbs.numFn] = val + cbs.numFn++ + return callbackasmAddr(cbs.numFn - 1) +} + +const ptrSize = unsafe.Sizeof((*int)(nil)) + +const callbackMaxFrame = 64 * ptrSize + +// callbackasm is implemented in zcallback_GOOS_GOARCH.s +// +//go:linkname __callbackasm callbackasm +var __callbackasm byte +var callbackasmABI0 = uintptr(unsafe.Pointer(&__callbackasm)) + +// callbackWrap_call allows the calling of the ABIInternal wrapper +// which is required for runtime.cgocallback without the +// tag which is only allowed in the runtime. +// This closure is used inside sys_darwin_GOARCH.s +var callbackWrap_call = callbackWrap + +// callbackWrap is called by assembly code which determines which Go function to call. +// This function takes the arguments and passes them to the Go function and returns the result. +func callbackWrap(a *callbackArgs) { + cbs.lock.Lock() + fn := cbs.funcs[a.index] + cbs.lock.Unlock() + fnType := fn.Type() + args := make([]reflect.Value, fnType.NumIn()) + frame := (*[callbackMaxFrame]uintptr)(a.args) + // stackFrame points to stack-passed arguments. On most architectures this is + // contiguous with frame (after register args), but on ppc64le it's separate. + var stackFrame *[callbackMaxFrame]uintptr + if sf := a.stackFrame(); sf != nil { + // Only ppc64le uses separate stackArgs pointer due to NOSPLIT constraints + stackFrame = (*[callbackMaxFrame]uintptr)(sf) + } + // floatsN and intsN track the number of register slots used, not argument count. + // This distinction matters on ARM32 where float64 uses 2 slots (32-bit registers). + var floatsN int + var intsN int + // stackSlot points to the index into frame (or stackFrame) of the current stack element. + // When stackFrame is nil, stack begins after float and integer registers in frame. + // When stackFrame is not nil (ppc64le), stackSlot indexes into stackFrame starting at 0. + stackSlot := numOfIntegerRegisters() + numOfFloatRegisters() + if stackFrame != nil { + // ppc64le: stackArgs is a separate pointer, indices start at 0 + stackSlot = 0 + } + // stackByteOffset tracks the byte offset within the stack area for Darwin ARM64 + // tight packing. On Darwin ARM64, C passes small types packed on the stack. + stackByteOffset := uintptr(0) + for i := range args { + // slots is the number of pointer-sized slots the argument takes + var slots int + inType := fnType.In(i) + switch inType.Kind() { + case reflect.Float32, reflect.Float64: + slots = int((fnType.In(i).Size() + ptrSize - 1) / ptrSize) + if floatsN+slots > numOfFloatRegisters() { + if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + // Darwin ARM64: read from packed stack with proper alignment + args[i] = callbackArgFromStack(a.args, stackSlot, &stackByteOffset, inType) + } else if stackFrame != nil { + // ppc64le/s390x: stack args are in separate stackFrame + if runtime.GOARCH == "s390x" { + // s390x big-endian: sub-8-byte values are right-justified + args[i] = callbackArgFromSlotBigEndian(unsafe.Pointer(&stackFrame[stackSlot]), inType) + } else { + args[i] = reflect.NewAt(inType, unsafe.Pointer(&stackFrame[stackSlot])).Elem() + } + stackSlot += slots + } else { + args[i] = reflect.NewAt(inType, unsafe.Pointer(&frame[stackSlot])).Elem() + stackSlot += slots + } + } else { + if runtime.GOARCH == "s390x" { + // s390x big-endian: float32 is right-justified in 8-byte FPR slot + args[i] = callbackArgFromSlotBigEndian(unsafe.Pointer(&frame[floatsN]), inType) + } else { + args[i] = reflect.NewAt(inType, unsafe.Pointer(&frame[floatsN])).Elem() + } + } + floatsN += slots + case reflect.Struct: + // This is the CDecl field + args[i] = reflect.Zero(inType) + default: + slots = int((inType.Size() + ptrSize - 1) / ptrSize) + if intsN+slots > numOfIntegerRegisters() { + if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + // Darwin ARM64: read from packed stack with proper alignment + args[i] = callbackArgFromStack(a.args, stackSlot, &stackByteOffset, inType) + } else if stackFrame != nil { + // ppc64le/s390x: stack args are in separate stackFrame + if runtime.GOARCH == "s390x" { + // s390x big-endian: sub-8-byte values are right-justified + args[i] = callbackArgFromSlotBigEndian(unsafe.Pointer(&stackFrame[stackSlot]), inType) + } else { + args[i] = reflect.NewAt(inType, unsafe.Pointer(&stackFrame[stackSlot])).Elem() + } + stackSlot += slots + } else { + args[i] = reflect.NewAt(inType, unsafe.Pointer(&frame[stackSlot])).Elem() + stackSlot += slots + } + } else { + // the integers begin after the floats in frame + pos := intsN + numOfFloatRegisters() + if runtime.GOARCH == "s390x" { + // s390x big-endian: sub-8-byte values are right-justified in GPR slot + args[i] = callbackArgFromSlotBigEndian(unsafe.Pointer(&frame[pos]), inType) + } else { + args[i] = reflect.NewAt(inType, unsafe.Pointer(&frame[pos])).Elem() + } + } + intsN += slots + } + } + ret := fn.Call(args) + if len(ret) > 0 { + switch k := ret[0].Kind(); k { + case reflect.Uint, reflect.Uint64, reflect.Uint32, reflect.Uint16, reflect.Uint8, reflect.Uintptr: + a.result = uintptr(ret[0].Uint()) + case reflect.Int, reflect.Int64, reflect.Int32, reflect.Int16, reflect.Int8: + a.result = uintptr(ret[0].Int()) + case reflect.Bool: + if ret[0].Bool() { + a.result = 1 + } else { + a.result = 0 + } + case reflect.Pointer: + a.result = ret[0].Pointer() + case reflect.UnsafePointer: + a.result = ret[0].Pointer() + default: + panic("purego: unsupported kind: " + k.String()) + } + } +} + +// callbackArgFromStack reads an argument from the tightly-packed stack area on Darwin ARM64. +// The C ABI on Darwin ARM64 packs small types on the stack without padding to 8 bytes. +// This function handles proper alignment and advances stackByteOffset accordingly. +func callbackArgFromStack(argsBase unsafe.Pointer, stackSlot int, stackByteOffset *uintptr, inType reflect.Type) reflect.Value { + // Calculate base address of stack area (after float and int registers) + stackBase := unsafe.Add(argsBase, stackSlot*int(ptrSize)) + + // Get type's natural alignment + align := uintptr(inType.Align()) + size := inType.Size() + + // Align the offset + if *stackByteOffset%align != 0 { + *stackByteOffset = (*stackByteOffset + align - 1) &^ (align - 1) + } + + // Read value at aligned offset + ptr := unsafe.Add(stackBase, *stackByteOffset) + *stackByteOffset += size + + return reflect.NewAt(inType, ptr).Elem() +} + +// callbackArgFromSlotBigEndian reads an argument from an 8-byte slot on big-endian architectures. +// On s390x: +// - Integer types are right-justified in GPRs: sub-8-byte values are at offset (8 - size) +// - Float32 in FPRs is left-justified: stored in upper 32 bits, so at offset 0 +// - Float64 occupies the full 8-byte slot +func callbackArgFromSlotBigEndian(slotPtr unsafe.Pointer, inType reflect.Type) reflect.Value { + size := inType.Size() + if size >= 8 { + // 8-byte values occupy the entire slot + return reflect.NewAt(inType, slotPtr).Elem() + } + // Float32 is left-justified in FPRs (upper 32 bits), so offset is 0 + if inType.Kind() == reflect.Float32 { + return reflect.NewAt(inType, slotPtr).Elem() + } + // Integer types are right-justified: offset = 8 - size + offset := 8 - size + ptr := unsafe.Add(slotPtr, offset) + return reflect.NewAt(inType, ptr).Elem() +} + +// callbackasmAddr returns address of runtime.callbackasm +// function adjusted by i. +// On x86 and amd64, runtime.callbackasm is a series of CALL instructions, +// and we want callback to arrive at +// correspondent call instruction instead of start of +// runtime.callbackasm. +// On ARM, runtime.callbackasm is a series of mov and branch instructions. +// R12 is loaded with the callback index. Each entry is two instructions, +// hence 8 bytes. +func callbackasmAddr(i int) uintptr { + var entrySize int + switch runtime.GOARCH { + default: + panic("purego: unsupported architecture") + case "amd64": + // On amd64, each callback entry is just a CALL instruction (5 bytes) + entrySize = 5 + case "386": + // On 386, each callback entry is MOVL $imm, CX (5 bytes) + JMP (5 bytes) + entrySize = 10 + case "arm", "arm64", "loong64", "ppc64le", "riscv64": + // On ARM, ARM64, Loong64, PPC64LE and RISCV64, each entry is a MOV instruction + // followed by a branch instruction + entrySize = 8 + case "s390x": + // On S390X, each entry is LGHI (4 bytes) + JG (6 bytes) + entrySize = 10 + } + return callbackasmABI0 + uintptr(i*entrySize) +} diff --git a/vendor/github.com/ebitengine/purego/syscall_sysv_others.go b/vendor/github.com/ebitengine/purego/syscall_sysv_others.go new file mode 100644 index 00000000..d4f6c7b7 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/syscall_sysv_others.go @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build darwin || freebsd || (linux && (386 || amd64 || arm || arm64 || loong64 || riscv64)) || netbsd + +package purego + +import "unsafe" + +type callbackArgs struct { + index uintptr + // args points to the argument block. + // + // The structure of the arguments goes + // float registers followed by the + // integer registers followed by the stack. + // + // This variable is treated as a continuous + // block of memory containing all of the arguments + // for this callback. + args unsafe.Pointer + // Below are out-args from callbackWrap + result uintptr +} + +func (c *callbackArgs) stackFrame() unsafe.Pointer { + return nil +} diff --git a/vendor/github.com/ebitengine/purego/syscall_sysv_stackargs.go b/vendor/github.com/ebitengine/purego/syscall_sysv_stackargs.go new file mode 100644 index 00000000..87ed9811 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/syscall_sysv_stackargs.go @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 The Ebitengine Authors + +//go:build linux && (ppc64le || s390x) + +package purego + +import "unsafe" + +type callbackArgs struct { + index uintptr + // args points to the argument block. + // + // The structure of the arguments goes + // float registers followed by the + // integer registers followed by the stack. + // + // This variable is treated as a continuous + // block of memory containing all of the arguments + // for this callback. + args unsafe.Pointer + // Below are out-args from callbackWrap + result uintptr + // stackArgs points to stack-passed arguments for architectures where + // they can't be made contiguous with register args (e.g., ppc64le). + // On other architectures, this is nil and stack args are read from + // the end of the args block. + stackArgs unsafe.Pointer +} + +func (c *callbackArgs) stackFrame() unsafe.Pointer { + return c.stackArgs +} diff --git a/vendor/github.com/ebitengine/purego/syscall_windows.go b/vendor/github.com/ebitengine/purego/syscall_windows.go new file mode 100644 index 00000000..5afd8d83 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/syscall_windows.go @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +package purego + +import ( + "reflect" + "syscall" +) + +var syscall15XABI0 uintptr + +func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { + r1, r2, errno := syscall.Syscall15(fn, 15, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) + return r1, r2, uintptr(errno) +} + +// NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention. +// This is useful when interoperating with Windows code requiring callbacks. The argument is expected to be a +// function with one uintptr-sized result. The function must not have arguments with size larger than the +// size of uintptr. Only a limited number of callbacks may be created in a single Go process, and any memory +// allocated for these callbacks is never released. Between NewCallback and NewCallbackCDecl, at least 1024 +// callbacks can always be created. Although this function is similiar to the darwin version it may act +// differently. +func NewCallback(fn any) uintptr { + isCDecl := false + ty := reflect.TypeOf(fn) + for i := 0; i < ty.NumIn(); i++ { + in := ty.In(i) + if !in.AssignableTo(reflect.TypeOf(CDecl{})) { + continue + } + if i != 0 { + panic("purego: CDecl must be the first argument") + } + isCDecl = true + } + if isCDecl { + return syscall.NewCallbackCDecl(fn) + } + return syscall.NewCallback(fn) +} + +func loadSymbol(handle uintptr, name string) (uintptr, error) { + return syscall.GetProcAddress(syscall.Handle(handle), name) +} diff --git a/vendor/github.com/ebitengine/purego/zcallback_386.s b/vendor/github.com/ebitengine/purego/zcallback_386.s new file mode 100644 index 00000000..bd2d9c85 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_386.s @@ -0,0 +1,4014 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build linux + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOVL and JMP instructions. +// The MOVL instruction loads CX with the callback index, and the +// JMP instruction branches to callbackasm1. +// callbackasm1 takes the callback index from CX and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + MOVL $0, CX + JMP callbackasm1(SB) + MOVL $1, CX + JMP callbackasm1(SB) + MOVL $2, CX + JMP callbackasm1(SB) + MOVL $3, CX + JMP callbackasm1(SB) + MOVL $4, CX + JMP callbackasm1(SB) + MOVL $5, CX + JMP callbackasm1(SB) + MOVL $6, CX + JMP callbackasm1(SB) + MOVL $7, CX + JMP callbackasm1(SB) + MOVL $8, CX + JMP callbackasm1(SB) + MOVL $9, CX + JMP callbackasm1(SB) + MOVL $10, CX + JMP callbackasm1(SB) + MOVL $11, CX + JMP callbackasm1(SB) + MOVL $12, CX + JMP callbackasm1(SB) + MOVL $13, CX + JMP callbackasm1(SB) + MOVL $14, CX + JMP callbackasm1(SB) + MOVL $15, CX + JMP callbackasm1(SB) + MOVL $16, CX + JMP callbackasm1(SB) + MOVL $17, CX + JMP callbackasm1(SB) + MOVL $18, CX + JMP callbackasm1(SB) + MOVL $19, CX + JMP callbackasm1(SB) + MOVL $20, CX + JMP callbackasm1(SB) + MOVL $21, CX + JMP callbackasm1(SB) + MOVL $22, CX + JMP callbackasm1(SB) + MOVL $23, CX + JMP callbackasm1(SB) + MOVL $24, CX + JMP callbackasm1(SB) + MOVL $25, CX + JMP callbackasm1(SB) + MOVL $26, CX + JMP callbackasm1(SB) + MOVL $27, CX + JMP callbackasm1(SB) + MOVL $28, CX + JMP callbackasm1(SB) + MOVL $29, CX + JMP callbackasm1(SB) + MOVL $30, CX + JMP callbackasm1(SB) + MOVL $31, CX + JMP callbackasm1(SB) + MOVL $32, CX + JMP callbackasm1(SB) + MOVL $33, CX + JMP callbackasm1(SB) + MOVL $34, CX + JMP callbackasm1(SB) + MOVL $35, CX + JMP callbackasm1(SB) + MOVL $36, CX + JMP callbackasm1(SB) + MOVL $37, CX + JMP callbackasm1(SB) + MOVL $38, CX + JMP callbackasm1(SB) + MOVL $39, CX + JMP callbackasm1(SB) + MOVL $40, CX + JMP callbackasm1(SB) + MOVL $41, CX + JMP callbackasm1(SB) + MOVL $42, CX + JMP callbackasm1(SB) + MOVL $43, CX + JMP callbackasm1(SB) + MOVL $44, CX + JMP callbackasm1(SB) + MOVL $45, CX + JMP callbackasm1(SB) + MOVL $46, CX + JMP callbackasm1(SB) + MOVL $47, CX + JMP callbackasm1(SB) + MOVL $48, CX + JMP callbackasm1(SB) + MOVL $49, CX + JMP callbackasm1(SB) + MOVL $50, CX + JMP callbackasm1(SB) + MOVL $51, CX + JMP callbackasm1(SB) + MOVL $52, CX + JMP callbackasm1(SB) + MOVL $53, CX + JMP callbackasm1(SB) + MOVL $54, CX + JMP callbackasm1(SB) + MOVL $55, CX + JMP callbackasm1(SB) + MOVL $56, CX + JMP callbackasm1(SB) + MOVL $57, CX + JMP callbackasm1(SB) + MOVL $58, CX + JMP callbackasm1(SB) + MOVL $59, CX + JMP callbackasm1(SB) + MOVL $60, CX + JMP callbackasm1(SB) + MOVL $61, CX + JMP callbackasm1(SB) + MOVL $62, CX + JMP callbackasm1(SB) + MOVL $63, CX + JMP callbackasm1(SB) + MOVL $64, CX + JMP callbackasm1(SB) + MOVL $65, CX + JMP callbackasm1(SB) + MOVL $66, CX + JMP callbackasm1(SB) + MOVL $67, CX + JMP callbackasm1(SB) + MOVL $68, CX + JMP callbackasm1(SB) + MOVL $69, CX + JMP callbackasm1(SB) + MOVL $70, CX + JMP callbackasm1(SB) + MOVL $71, CX + JMP callbackasm1(SB) + MOVL $72, CX + JMP callbackasm1(SB) + MOVL $73, CX + JMP callbackasm1(SB) + MOVL $74, CX + JMP callbackasm1(SB) + MOVL $75, CX + JMP callbackasm1(SB) + MOVL $76, CX + JMP callbackasm1(SB) + MOVL $77, CX + JMP callbackasm1(SB) + MOVL $78, CX + JMP callbackasm1(SB) + MOVL $79, CX + JMP callbackasm1(SB) + MOVL $80, CX + JMP callbackasm1(SB) + MOVL $81, CX + JMP callbackasm1(SB) + MOVL $82, CX + JMP callbackasm1(SB) + MOVL $83, CX + JMP callbackasm1(SB) + MOVL $84, CX + JMP callbackasm1(SB) + MOVL $85, CX + JMP callbackasm1(SB) + MOVL $86, CX + JMP callbackasm1(SB) + MOVL $87, CX + JMP callbackasm1(SB) + MOVL $88, CX + JMP callbackasm1(SB) + MOVL $89, CX + JMP callbackasm1(SB) + MOVL $90, CX + JMP callbackasm1(SB) + MOVL $91, CX + JMP callbackasm1(SB) + MOVL $92, CX + JMP callbackasm1(SB) + MOVL $93, CX + JMP callbackasm1(SB) + MOVL $94, CX + JMP callbackasm1(SB) + MOVL $95, CX + JMP callbackasm1(SB) + MOVL $96, CX + JMP callbackasm1(SB) + MOVL $97, CX + JMP callbackasm1(SB) + MOVL $98, CX + JMP callbackasm1(SB) + MOVL $99, CX + JMP callbackasm1(SB) + MOVL $100, CX + JMP callbackasm1(SB) + MOVL $101, CX + JMP callbackasm1(SB) + MOVL $102, CX + JMP callbackasm1(SB) + MOVL $103, CX + JMP callbackasm1(SB) + MOVL $104, CX + JMP callbackasm1(SB) + MOVL $105, CX + JMP callbackasm1(SB) + MOVL $106, CX + JMP callbackasm1(SB) + MOVL $107, CX + JMP callbackasm1(SB) + MOVL $108, CX + JMP callbackasm1(SB) + MOVL $109, CX + JMP callbackasm1(SB) + MOVL $110, CX + JMP callbackasm1(SB) + MOVL $111, CX + JMP callbackasm1(SB) + MOVL $112, CX + JMP callbackasm1(SB) + MOVL $113, CX + JMP callbackasm1(SB) + MOVL $114, CX + JMP callbackasm1(SB) + MOVL $115, CX + JMP callbackasm1(SB) + MOVL $116, CX + JMP callbackasm1(SB) + MOVL $117, CX + JMP callbackasm1(SB) + MOVL $118, CX + JMP callbackasm1(SB) + MOVL $119, CX + JMP callbackasm1(SB) + MOVL $120, CX + JMP callbackasm1(SB) + MOVL $121, CX + JMP callbackasm1(SB) + MOVL $122, CX + JMP callbackasm1(SB) + MOVL $123, CX + JMP callbackasm1(SB) + MOVL $124, CX + JMP callbackasm1(SB) + MOVL $125, CX + JMP callbackasm1(SB) + MOVL $126, CX + JMP callbackasm1(SB) + MOVL $127, CX + JMP callbackasm1(SB) + MOVL $128, CX + JMP callbackasm1(SB) + MOVL $129, CX + JMP callbackasm1(SB) + MOVL $130, CX + JMP callbackasm1(SB) + MOVL $131, CX + JMP callbackasm1(SB) + MOVL $132, CX + JMP callbackasm1(SB) + MOVL $133, CX + JMP callbackasm1(SB) + MOVL $134, CX + JMP callbackasm1(SB) + MOVL $135, CX + JMP callbackasm1(SB) + MOVL $136, CX + JMP callbackasm1(SB) + MOVL $137, CX + JMP callbackasm1(SB) + MOVL $138, CX + JMP callbackasm1(SB) + MOVL $139, CX + JMP callbackasm1(SB) + MOVL $140, CX + JMP callbackasm1(SB) + MOVL $141, CX + JMP callbackasm1(SB) + MOVL $142, CX + JMP callbackasm1(SB) + MOVL $143, CX + JMP callbackasm1(SB) + MOVL $144, CX + JMP callbackasm1(SB) + MOVL $145, CX + JMP callbackasm1(SB) + MOVL $146, CX + JMP callbackasm1(SB) + MOVL $147, CX + JMP callbackasm1(SB) + MOVL $148, CX + JMP callbackasm1(SB) + MOVL $149, CX + JMP callbackasm1(SB) + MOVL $150, CX + JMP callbackasm1(SB) + MOVL $151, CX + JMP callbackasm1(SB) + MOVL $152, CX + JMP callbackasm1(SB) + MOVL $153, CX + JMP callbackasm1(SB) + MOVL $154, CX + JMP callbackasm1(SB) + MOVL $155, CX + JMP callbackasm1(SB) + MOVL $156, CX + JMP callbackasm1(SB) + MOVL $157, CX + JMP callbackasm1(SB) + MOVL $158, CX + JMP callbackasm1(SB) + MOVL $159, CX + JMP callbackasm1(SB) + MOVL $160, CX + JMP callbackasm1(SB) + MOVL $161, CX + JMP callbackasm1(SB) + MOVL $162, CX + JMP callbackasm1(SB) + MOVL $163, CX + JMP callbackasm1(SB) + MOVL $164, CX + JMP callbackasm1(SB) + MOVL $165, CX + JMP callbackasm1(SB) + MOVL $166, CX + JMP callbackasm1(SB) + MOVL $167, CX + JMP callbackasm1(SB) + MOVL $168, CX + JMP callbackasm1(SB) + MOVL $169, CX + JMP callbackasm1(SB) + MOVL $170, CX + JMP callbackasm1(SB) + MOVL $171, CX + JMP callbackasm1(SB) + MOVL $172, CX + JMP callbackasm1(SB) + MOVL $173, CX + JMP callbackasm1(SB) + MOVL $174, CX + JMP callbackasm1(SB) + MOVL $175, CX + JMP callbackasm1(SB) + MOVL $176, CX + JMP callbackasm1(SB) + MOVL $177, CX + JMP callbackasm1(SB) + MOVL $178, CX + JMP callbackasm1(SB) + MOVL $179, CX + JMP callbackasm1(SB) + MOVL $180, CX + JMP callbackasm1(SB) + MOVL $181, CX + JMP callbackasm1(SB) + MOVL $182, CX + JMP callbackasm1(SB) + MOVL $183, CX + JMP callbackasm1(SB) + MOVL $184, CX + JMP callbackasm1(SB) + MOVL $185, CX + JMP callbackasm1(SB) + MOVL $186, CX + JMP callbackasm1(SB) + MOVL $187, CX + JMP callbackasm1(SB) + MOVL $188, CX + JMP callbackasm1(SB) + MOVL $189, CX + JMP callbackasm1(SB) + MOVL $190, CX + JMP callbackasm1(SB) + MOVL $191, CX + JMP callbackasm1(SB) + MOVL $192, CX + JMP callbackasm1(SB) + MOVL $193, CX + JMP callbackasm1(SB) + MOVL $194, CX + JMP callbackasm1(SB) + MOVL $195, CX + JMP callbackasm1(SB) + MOVL $196, CX + JMP callbackasm1(SB) + MOVL $197, CX + JMP callbackasm1(SB) + MOVL $198, CX + JMP callbackasm1(SB) + MOVL $199, CX + JMP callbackasm1(SB) + MOVL $200, CX + JMP callbackasm1(SB) + MOVL $201, CX + JMP callbackasm1(SB) + MOVL $202, CX + JMP callbackasm1(SB) + MOVL $203, CX + JMP callbackasm1(SB) + MOVL $204, CX + JMP callbackasm1(SB) + MOVL $205, CX + JMP callbackasm1(SB) + MOVL $206, CX + JMP callbackasm1(SB) + MOVL $207, CX + JMP callbackasm1(SB) + MOVL $208, CX + JMP callbackasm1(SB) + MOVL $209, CX + JMP callbackasm1(SB) + MOVL $210, CX + JMP callbackasm1(SB) + MOVL $211, CX + JMP callbackasm1(SB) + MOVL $212, CX + JMP callbackasm1(SB) + MOVL $213, CX + JMP callbackasm1(SB) + MOVL $214, CX + JMP callbackasm1(SB) + MOVL $215, CX + JMP callbackasm1(SB) + MOVL $216, CX + JMP callbackasm1(SB) + MOVL $217, CX + JMP callbackasm1(SB) + MOVL $218, CX + JMP callbackasm1(SB) + MOVL $219, CX + JMP callbackasm1(SB) + MOVL $220, CX + JMP callbackasm1(SB) + MOVL $221, CX + JMP callbackasm1(SB) + MOVL $222, CX + JMP callbackasm1(SB) + MOVL $223, CX + JMP callbackasm1(SB) + MOVL $224, CX + JMP callbackasm1(SB) + MOVL $225, CX + JMP callbackasm1(SB) + MOVL $226, CX + JMP callbackasm1(SB) + MOVL $227, CX + JMP callbackasm1(SB) + MOVL $228, CX + JMP callbackasm1(SB) + MOVL $229, CX + JMP callbackasm1(SB) + MOVL $230, CX + JMP callbackasm1(SB) + MOVL $231, CX + JMP callbackasm1(SB) + MOVL $232, CX + JMP callbackasm1(SB) + MOVL $233, CX + JMP callbackasm1(SB) + MOVL $234, CX + JMP callbackasm1(SB) + MOVL $235, CX + JMP callbackasm1(SB) + MOVL $236, CX + JMP callbackasm1(SB) + MOVL $237, CX + JMP callbackasm1(SB) + MOVL $238, CX + JMP callbackasm1(SB) + MOVL $239, CX + JMP callbackasm1(SB) + MOVL $240, CX + JMP callbackasm1(SB) + MOVL $241, CX + JMP callbackasm1(SB) + MOVL $242, CX + JMP callbackasm1(SB) + MOVL $243, CX + JMP callbackasm1(SB) + MOVL $244, CX + JMP callbackasm1(SB) + MOVL $245, CX + JMP callbackasm1(SB) + MOVL $246, CX + JMP callbackasm1(SB) + MOVL $247, CX + JMP callbackasm1(SB) + MOVL $248, CX + JMP callbackasm1(SB) + MOVL $249, CX + JMP callbackasm1(SB) + MOVL $250, CX + JMP callbackasm1(SB) + MOVL $251, CX + JMP callbackasm1(SB) + MOVL $252, CX + JMP callbackasm1(SB) + MOVL $253, CX + JMP callbackasm1(SB) + MOVL $254, CX + JMP callbackasm1(SB) + MOVL $255, CX + JMP callbackasm1(SB) + MOVL $256, CX + JMP callbackasm1(SB) + MOVL $257, CX + JMP callbackasm1(SB) + MOVL $258, CX + JMP callbackasm1(SB) + MOVL $259, CX + JMP callbackasm1(SB) + MOVL $260, CX + JMP callbackasm1(SB) + MOVL $261, CX + JMP callbackasm1(SB) + MOVL $262, CX + JMP callbackasm1(SB) + MOVL $263, CX + JMP callbackasm1(SB) + MOVL $264, CX + JMP callbackasm1(SB) + MOVL $265, CX + JMP callbackasm1(SB) + MOVL $266, CX + JMP callbackasm1(SB) + MOVL $267, CX + JMP callbackasm1(SB) + MOVL $268, CX + JMP callbackasm1(SB) + MOVL $269, CX + JMP callbackasm1(SB) + MOVL $270, CX + JMP callbackasm1(SB) + MOVL $271, CX + JMP callbackasm1(SB) + MOVL $272, CX + JMP callbackasm1(SB) + MOVL $273, CX + JMP callbackasm1(SB) + MOVL $274, CX + JMP callbackasm1(SB) + MOVL $275, CX + JMP callbackasm1(SB) + MOVL $276, CX + JMP callbackasm1(SB) + MOVL $277, CX + JMP callbackasm1(SB) + MOVL $278, CX + JMP callbackasm1(SB) + MOVL $279, CX + JMP callbackasm1(SB) + MOVL $280, CX + JMP callbackasm1(SB) + MOVL $281, CX + JMP callbackasm1(SB) + MOVL $282, CX + JMP callbackasm1(SB) + MOVL $283, CX + JMP callbackasm1(SB) + MOVL $284, CX + JMP callbackasm1(SB) + MOVL $285, CX + JMP callbackasm1(SB) + MOVL $286, CX + JMP callbackasm1(SB) + MOVL $287, CX + JMP callbackasm1(SB) + MOVL $288, CX + JMP callbackasm1(SB) + MOVL $289, CX + JMP callbackasm1(SB) + MOVL $290, CX + JMP callbackasm1(SB) + MOVL $291, CX + JMP callbackasm1(SB) + MOVL $292, CX + JMP callbackasm1(SB) + MOVL $293, CX + JMP callbackasm1(SB) + MOVL $294, CX + JMP callbackasm1(SB) + MOVL $295, CX + JMP callbackasm1(SB) + MOVL $296, CX + JMP callbackasm1(SB) + MOVL $297, CX + JMP callbackasm1(SB) + MOVL $298, CX + JMP callbackasm1(SB) + MOVL $299, CX + JMP callbackasm1(SB) + MOVL $300, CX + JMP callbackasm1(SB) + MOVL $301, CX + JMP callbackasm1(SB) + MOVL $302, CX + JMP callbackasm1(SB) + MOVL $303, CX + JMP callbackasm1(SB) + MOVL $304, CX + JMP callbackasm1(SB) + MOVL $305, CX + JMP callbackasm1(SB) + MOVL $306, CX + JMP callbackasm1(SB) + MOVL $307, CX + JMP callbackasm1(SB) + MOVL $308, CX + JMP callbackasm1(SB) + MOVL $309, CX + JMP callbackasm1(SB) + MOVL $310, CX + JMP callbackasm1(SB) + MOVL $311, CX + JMP callbackasm1(SB) + MOVL $312, CX + JMP callbackasm1(SB) + MOVL $313, CX + JMP callbackasm1(SB) + MOVL $314, CX + JMP callbackasm1(SB) + MOVL $315, CX + JMP callbackasm1(SB) + MOVL $316, CX + JMP callbackasm1(SB) + MOVL $317, CX + JMP callbackasm1(SB) + MOVL $318, CX + JMP callbackasm1(SB) + MOVL $319, CX + JMP callbackasm1(SB) + MOVL $320, CX + JMP callbackasm1(SB) + MOVL $321, CX + JMP callbackasm1(SB) + MOVL $322, CX + JMP callbackasm1(SB) + MOVL $323, CX + JMP callbackasm1(SB) + MOVL $324, CX + JMP callbackasm1(SB) + MOVL $325, CX + JMP callbackasm1(SB) + MOVL $326, CX + JMP callbackasm1(SB) + MOVL $327, CX + JMP callbackasm1(SB) + MOVL $328, CX + JMP callbackasm1(SB) + MOVL $329, CX + JMP callbackasm1(SB) + MOVL $330, CX + JMP callbackasm1(SB) + MOVL $331, CX + JMP callbackasm1(SB) + MOVL $332, CX + JMP callbackasm1(SB) + MOVL $333, CX + JMP callbackasm1(SB) + MOVL $334, CX + JMP callbackasm1(SB) + MOVL $335, CX + JMP callbackasm1(SB) + MOVL $336, CX + JMP callbackasm1(SB) + MOVL $337, CX + JMP callbackasm1(SB) + MOVL $338, CX + JMP callbackasm1(SB) + MOVL $339, CX + JMP callbackasm1(SB) + MOVL $340, CX + JMP callbackasm1(SB) + MOVL $341, CX + JMP callbackasm1(SB) + MOVL $342, CX + JMP callbackasm1(SB) + MOVL $343, CX + JMP callbackasm1(SB) + MOVL $344, CX + JMP callbackasm1(SB) + MOVL $345, CX + JMP callbackasm1(SB) + MOVL $346, CX + JMP callbackasm1(SB) + MOVL $347, CX + JMP callbackasm1(SB) + MOVL $348, CX + JMP callbackasm1(SB) + MOVL $349, CX + JMP callbackasm1(SB) + MOVL $350, CX + JMP callbackasm1(SB) + MOVL $351, CX + JMP callbackasm1(SB) + MOVL $352, CX + JMP callbackasm1(SB) + MOVL $353, CX + JMP callbackasm1(SB) + MOVL $354, CX + JMP callbackasm1(SB) + MOVL $355, CX + JMP callbackasm1(SB) + MOVL $356, CX + JMP callbackasm1(SB) + MOVL $357, CX + JMP callbackasm1(SB) + MOVL $358, CX + JMP callbackasm1(SB) + MOVL $359, CX + JMP callbackasm1(SB) + MOVL $360, CX + JMP callbackasm1(SB) + MOVL $361, CX + JMP callbackasm1(SB) + MOVL $362, CX + JMP callbackasm1(SB) + MOVL $363, CX + JMP callbackasm1(SB) + MOVL $364, CX + JMP callbackasm1(SB) + MOVL $365, CX + JMP callbackasm1(SB) + MOVL $366, CX + JMP callbackasm1(SB) + MOVL $367, CX + JMP callbackasm1(SB) + MOVL $368, CX + JMP callbackasm1(SB) + MOVL $369, CX + JMP callbackasm1(SB) + MOVL $370, CX + JMP callbackasm1(SB) + MOVL $371, CX + JMP callbackasm1(SB) + MOVL $372, CX + JMP callbackasm1(SB) + MOVL $373, CX + JMP callbackasm1(SB) + MOVL $374, CX + JMP callbackasm1(SB) + MOVL $375, CX + JMP callbackasm1(SB) + MOVL $376, CX + JMP callbackasm1(SB) + MOVL $377, CX + JMP callbackasm1(SB) + MOVL $378, CX + JMP callbackasm1(SB) + MOVL $379, CX + JMP callbackasm1(SB) + MOVL $380, CX + JMP callbackasm1(SB) + MOVL $381, CX + JMP callbackasm1(SB) + MOVL $382, CX + JMP callbackasm1(SB) + MOVL $383, CX + JMP callbackasm1(SB) + MOVL $384, CX + JMP callbackasm1(SB) + MOVL $385, CX + JMP callbackasm1(SB) + MOVL $386, CX + JMP callbackasm1(SB) + MOVL $387, CX + JMP callbackasm1(SB) + MOVL $388, CX + JMP callbackasm1(SB) + MOVL $389, CX + JMP callbackasm1(SB) + MOVL $390, CX + JMP callbackasm1(SB) + MOVL $391, CX + JMP callbackasm1(SB) + MOVL $392, CX + JMP callbackasm1(SB) + MOVL $393, CX + JMP callbackasm1(SB) + MOVL $394, CX + JMP callbackasm1(SB) + MOVL $395, CX + JMP callbackasm1(SB) + MOVL $396, CX + JMP callbackasm1(SB) + MOVL $397, CX + JMP callbackasm1(SB) + MOVL $398, CX + JMP callbackasm1(SB) + MOVL $399, CX + JMP callbackasm1(SB) + MOVL $400, CX + JMP callbackasm1(SB) + MOVL $401, CX + JMP callbackasm1(SB) + MOVL $402, CX + JMP callbackasm1(SB) + MOVL $403, CX + JMP callbackasm1(SB) + MOVL $404, CX + JMP callbackasm1(SB) + MOVL $405, CX + JMP callbackasm1(SB) + MOVL $406, CX + JMP callbackasm1(SB) + MOVL $407, CX + JMP callbackasm1(SB) + MOVL $408, CX + JMP callbackasm1(SB) + MOVL $409, CX + JMP callbackasm1(SB) + MOVL $410, CX + JMP callbackasm1(SB) + MOVL $411, CX + JMP callbackasm1(SB) + MOVL $412, CX + JMP callbackasm1(SB) + MOVL $413, CX + JMP callbackasm1(SB) + MOVL $414, CX + JMP callbackasm1(SB) + MOVL $415, CX + JMP callbackasm1(SB) + MOVL $416, CX + JMP callbackasm1(SB) + MOVL $417, CX + JMP callbackasm1(SB) + MOVL $418, CX + JMP callbackasm1(SB) + MOVL $419, CX + JMP callbackasm1(SB) + MOVL $420, CX + JMP callbackasm1(SB) + MOVL $421, CX + JMP callbackasm1(SB) + MOVL $422, CX + JMP callbackasm1(SB) + MOVL $423, CX + JMP callbackasm1(SB) + MOVL $424, CX + JMP callbackasm1(SB) + MOVL $425, CX + JMP callbackasm1(SB) + MOVL $426, CX + JMP callbackasm1(SB) + MOVL $427, CX + JMP callbackasm1(SB) + MOVL $428, CX + JMP callbackasm1(SB) + MOVL $429, CX + JMP callbackasm1(SB) + MOVL $430, CX + JMP callbackasm1(SB) + MOVL $431, CX + JMP callbackasm1(SB) + MOVL $432, CX + JMP callbackasm1(SB) + MOVL $433, CX + JMP callbackasm1(SB) + MOVL $434, CX + JMP callbackasm1(SB) + MOVL $435, CX + JMP callbackasm1(SB) + MOVL $436, CX + JMP callbackasm1(SB) + MOVL $437, CX + JMP callbackasm1(SB) + MOVL $438, CX + JMP callbackasm1(SB) + MOVL $439, CX + JMP callbackasm1(SB) + MOVL $440, CX + JMP callbackasm1(SB) + MOVL $441, CX + JMP callbackasm1(SB) + MOVL $442, CX + JMP callbackasm1(SB) + MOVL $443, CX + JMP callbackasm1(SB) + MOVL $444, CX + JMP callbackasm1(SB) + MOVL $445, CX + JMP callbackasm1(SB) + MOVL $446, CX + JMP callbackasm1(SB) + MOVL $447, CX + JMP callbackasm1(SB) + MOVL $448, CX + JMP callbackasm1(SB) + MOVL $449, CX + JMP callbackasm1(SB) + MOVL $450, CX + JMP callbackasm1(SB) + MOVL $451, CX + JMP callbackasm1(SB) + MOVL $452, CX + JMP callbackasm1(SB) + MOVL $453, CX + JMP callbackasm1(SB) + MOVL $454, CX + JMP callbackasm1(SB) + MOVL $455, CX + JMP callbackasm1(SB) + MOVL $456, CX + JMP callbackasm1(SB) + MOVL $457, CX + JMP callbackasm1(SB) + MOVL $458, CX + JMP callbackasm1(SB) + MOVL $459, CX + JMP callbackasm1(SB) + MOVL $460, CX + JMP callbackasm1(SB) + MOVL $461, CX + JMP callbackasm1(SB) + MOVL $462, CX + JMP callbackasm1(SB) + MOVL $463, CX + JMP callbackasm1(SB) + MOVL $464, CX + JMP callbackasm1(SB) + MOVL $465, CX + JMP callbackasm1(SB) + MOVL $466, CX + JMP callbackasm1(SB) + MOVL $467, CX + JMP callbackasm1(SB) + MOVL $468, CX + JMP callbackasm1(SB) + MOVL $469, CX + JMP callbackasm1(SB) + MOVL $470, CX + JMP callbackasm1(SB) + MOVL $471, CX + JMP callbackasm1(SB) + MOVL $472, CX + JMP callbackasm1(SB) + MOVL $473, CX + JMP callbackasm1(SB) + MOVL $474, CX + JMP callbackasm1(SB) + MOVL $475, CX + JMP callbackasm1(SB) + MOVL $476, CX + JMP callbackasm1(SB) + MOVL $477, CX + JMP callbackasm1(SB) + MOVL $478, CX + JMP callbackasm1(SB) + MOVL $479, CX + JMP callbackasm1(SB) + MOVL $480, CX + JMP callbackasm1(SB) + MOVL $481, CX + JMP callbackasm1(SB) + MOVL $482, CX + JMP callbackasm1(SB) + MOVL $483, CX + JMP callbackasm1(SB) + MOVL $484, CX + JMP callbackasm1(SB) + MOVL $485, CX + JMP callbackasm1(SB) + MOVL $486, CX + JMP callbackasm1(SB) + MOVL $487, CX + JMP callbackasm1(SB) + MOVL $488, CX + JMP callbackasm1(SB) + MOVL $489, CX + JMP callbackasm1(SB) + MOVL $490, CX + JMP callbackasm1(SB) + MOVL $491, CX + JMP callbackasm1(SB) + MOVL $492, CX + JMP callbackasm1(SB) + MOVL $493, CX + JMP callbackasm1(SB) + MOVL $494, CX + JMP callbackasm1(SB) + MOVL $495, CX + JMP callbackasm1(SB) + MOVL $496, CX + JMP callbackasm1(SB) + MOVL $497, CX + JMP callbackasm1(SB) + MOVL $498, CX + JMP callbackasm1(SB) + MOVL $499, CX + JMP callbackasm1(SB) + MOVL $500, CX + JMP callbackasm1(SB) + MOVL $501, CX + JMP callbackasm1(SB) + MOVL $502, CX + JMP callbackasm1(SB) + MOVL $503, CX + JMP callbackasm1(SB) + MOVL $504, CX + JMP callbackasm1(SB) + MOVL $505, CX + JMP callbackasm1(SB) + MOVL $506, CX + JMP callbackasm1(SB) + MOVL $507, CX + JMP callbackasm1(SB) + MOVL $508, CX + JMP callbackasm1(SB) + MOVL $509, CX + JMP callbackasm1(SB) + MOVL $510, CX + JMP callbackasm1(SB) + MOVL $511, CX + JMP callbackasm1(SB) + MOVL $512, CX + JMP callbackasm1(SB) + MOVL $513, CX + JMP callbackasm1(SB) + MOVL $514, CX + JMP callbackasm1(SB) + MOVL $515, CX + JMP callbackasm1(SB) + MOVL $516, CX + JMP callbackasm1(SB) + MOVL $517, CX + JMP callbackasm1(SB) + MOVL $518, CX + JMP callbackasm1(SB) + MOVL $519, CX + JMP callbackasm1(SB) + MOVL $520, CX + JMP callbackasm1(SB) + MOVL $521, CX + JMP callbackasm1(SB) + MOVL $522, CX + JMP callbackasm1(SB) + MOVL $523, CX + JMP callbackasm1(SB) + MOVL $524, CX + JMP callbackasm1(SB) + MOVL $525, CX + JMP callbackasm1(SB) + MOVL $526, CX + JMP callbackasm1(SB) + MOVL $527, CX + JMP callbackasm1(SB) + MOVL $528, CX + JMP callbackasm1(SB) + MOVL $529, CX + JMP callbackasm1(SB) + MOVL $530, CX + JMP callbackasm1(SB) + MOVL $531, CX + JMP callbackasm1(SB) + MOVL $532, CX + JMP callbackasm1(SB) + MOVL $533, CX + JMP callbackasm1(SB) + MOVL $534, CX + JMP callbackasm1(SB) + MOVL $535, CX + JMP callbackasm1(SB) + MOVL $536, CX + JMP callbackasm1(SB) + MOVL $537, CX + JMP callbackasm1(SB) + MOVL $538, CX + JMP callbackasm1(SB) + MOVL $539, CX + JMP callbackasm1(SB) + MOVL $540, CX + JMP callbackasm1(SB) + MOVL $541, CX + JMP callbackasm1(SB) + MOVL $542, CX + JMP callbackasm1(SB) + MOVL $543, CX + JMP callbackasm1(SB) + MOVL $544, CX + JMP callbackasm1(SB) + MOVL $545, CX + JMP callbackasm1(SB) + MOVL $546, CX + JMP callbackasm1(SB) + MOVL $547, CX + JMP callbackasm1(SB) + MOVL $548, CX + JMP callbackasm1(SB) + MOVL $549, CX + JMP callbackasm1(SB) + MOVL $550, CX + JMP callbackasm1(SB) + MOVL $551, CX + JMP callbackasm1(SB) + MOVL $552, CX + JMP callbackasm1(SB) + MOVL $553, CX + JMP callbackasm1(SB) + MOVL $554, CX + JMP callbackasm1(SB) + MOVL $555, CX + JMP callbackasm1(SB) + MOVL $556, CX + JMP callbackasm1(SB) + MOVL $557, CX + JMP callbackasm1(SB) + MOVL $558, CX + JMP callbackasm1(SB) + MOVL $559, CX + JMP callbackasm1(SB) + MOVL $560, CX + JMP callbackasm1(SB) + MOVL $561, CX + JMP callbackasm1(SB) + MOVL $562, CX + JMP callbackasm1(SB) + MOVL $563, CX + JMP callbackasm1(SB) + MOVL $564, CX + JMP callbackasm1(SB) + MOVL $565, CX + JMP callbackasm1(SB) + MOVL $566, CX + JMP callbackasm1(SB) + MOVL $567, CX + JMP callbackasm1(SB) + MOVL $568, CX + JMP callbackasm1(SB) + MOVL $569, CX + JMP callbackasm1(SB) + MOVL $570, CX + JMP callbackasm1(SB) + MOVL $571, CX + JMP callbackasm1(SB) + MOVL $572, CX + JMP callbackasm1(SB) + MOVL $573, CX + JMP callbackasm1(SB) + MOVL $574, CX + JMP callbackasm1(SB) + MOVL $575, CX + JMP callbackasm1(SB) + MOVL $576, CX + JMP callbackasm1(SB) + MOVL $577, CX + JMP callbackasm1(SB) + MOVL $578, CX + JMP callbackasm1(SB) + MOVL $579, CX + JMP callbackasm1(SB) + MOVL $580, CX + JMP callbackasm1(SB) + MOVL $581, CX + JMP callbackasm1(SB) + MOVL $582, CX + JMP callbackasm1(SB) + MOVL $583, CX + JMP callbackasm1(SB) + MOVL $584, CX + JMP callbackasm1(SB) + MOVL $585, CX + JMP callbackasm1(SB) + MOVL $586, CX + JMP callbackasm1(SB) + MOVL $587, CX + JMP callbackasm1(SB) + MOVL $588, CX + JMP callbackasm1(SB) + MOVL $589, CX + JMP callbackasm1(SB) + MOVL $590, CX + JMP callbackasm1(SB) + MOVL $591, CX + JMP callbackasm1(SB) + MOVL $592, CX + JMP callbackasm1(SB) + MOVL $593, CX + JMP callbackasm1(SB) + MOVL $594, CX + JMP callbackasm1(SB) + MOVL $595, CX + JMP callbackasm1(SB) + MOVL $596, CX + JMP callbackasm1(SB) + MOVL $597, CX + JMP callbackasm1(SB) + MOVL $598, CX + JMP callbackasm1(SB) + MOVL $599, CX + JMP callbackasm1(SB) + MOVL $600, CX + JMP callbackasm1(SB) + MOVL $601, CX + JMP callbackasm1(SB) + MOVL $602, CX + JMP callbackasm1(SB) + MOVL $603, CX + JMP callbackasm1(SB) + MOVL $604, CX + JMP callbackasm1(SB) + MOVL $605, CX + JMP callbackasm1(SB) + MOVL $606, CX + JMP callbackasm1(SB) + MOVL $607, CX + JMP callbackasm1(SB) + MOVL $608, CX + JMP callbackasm1(SB) + MOVL $609, CX + JMP callbackasm1(SB) + MOVL $610, CX + JMP callbackasm1(SB) + MOVL $611, CX + JMP callbackasm1(SB) + MOVL $612, CX + JMP callbackasm1(SB) + MOVL $613, CX + JMP callbackasm1(SB) + MOVL $614, CX + JMP callbackasm1(SB) + MOVL $615, CX + JMP callbackasm1(SB) + MOVL $616, CX + JMP callbackasm1(SB) + MOVL $617, CX + JMP callbackasm1(SB) + MOVL $618, CX + JMP callbackasm1(SB) + MOVL $619, CX + JMP callbackasm1(SB) + MOVL $620, CX + JMP callbackasm1(SB) + MOVL $621, CX + JMP callbackasm1(SB) + MOVL $622, CX + JMP callbackasm1(SB) + MOVL $623, CX + JMP callbackasm1(SB) + MOVL $624, CX + JMP callbackasm1(SB) + MOVL $625, CX + JMP callbackasm1(SB) + MOVL $626, CX + JMP callbackasm1(SB) + MOVL $627, CX + JMP callbackasm1(SB) + MOVL $628, CX + JMP callbackasm1(SB) + MOVL $629, CX + JMP callbackasm1(SB) + MOVL $630, CX + JMP callbackasm1(SB) + MOVL $631, CX + JMP callbackasm1(SB) + MOVL $632, CX + JMP callbackasm1(SB) + MOVL $633, CX + JMP callbackasm1(SB) + MOVL $634, CX + JMP callbackasm1(SB) + MOVL $635, CX + JMP callbackasm1(SB) + MOVL $636, CX + JMP callbackasm1(SB) + MOVL $637, CX + JMP callbackasm1(SB) + MOVL $638, CX + JMP callbackasm1(SB) + MOVL $639, CX + JMP callbackasm1(SB) + MOVL $640, CX + JMP callbackasm1(SB) + MOVL $641, CX + JMP callbackasm1(SB) + MOVL $642, CX + JMP callbackasm1(SB) + MOVL $643, CX + JMP callbackasm1(SB) + MOVL $644, CX + JMP callbackasm1(SB) + MOVL $645, CX + JMP callbackasm1(SB) + MOVL $646, CX + JMP callbackasm1(SB) + MOVL $647, CX + JMP callbackasm1(SB) + MOVL $648, CX + JMP callbackasm1(SB) + MOVL $649, CX + JMP callbackasm1(SB) + MOVL $650, CX + JMP callbackasm1(SB) + MOVL $651, CX + JMP callbackasm1(SB) + MOVL $652, CX + JMP callbackasm1(SB) + MOVL $653, CX + JMP callbackasm1(SB) + MOVL $654, CX + JMP callbackasm1(SB) + MOVL $655, CX + JMP callbackasm1(SB) + MOVL $656, CX + JMP callbackasm1(SB) + MOVL $657, CX + JMP callbackasm1(SB) + MOVL $658, CX + JMP callbackasm1(SB) + MOVL $659, CX + JMP callbackasm1(SB) + MOVL $660, CX + JMP callbackasm1(SB) + MOVL $661, CX + JMP callbackasm1(SB) + MOVL $662, CX + JMP callbackasm1(SB) + MOVL $663, CX + JMP callbackasm1(SB) + MOVL $664, CX + JMP callbackasm1(SB) + MOVL $665, CX + JMP callbackasm1(SB) + MOVL $666, CX + JMP callbackasm1(SB) + MOVL $667, CX + JMP callbackasm1(SB) + MOVL $668, CX + JMP callbackasm1(SB) + MOVL $669, CX + JMP callbackasm1(SB) + MOVL $670, CX + JMP callbackasm1(SB) + MOVL $671, CX + JMP callbackasm1(SB) + MOVL $672, CX + JMP callbackasm1(SB) + MOVL $673, CX + JMP callbackasm1(SB) + MOVL $674, CX + JMP callbackasm1(SB) + MOVL $675, CX + JMP callbackasm1(SB) + MOVL $676, CX + JMP callbackasm1(SB) + MOVL $677, CX + JMP callbackasm1(SB) + MOVL $678, CX + JMP callbackasm1(SB) + MOVL $679, CX + JMP callbackasm1(SB) + MOVL $680, CX + JMP callbackasm1(SB) + MOVL $681, CX + JMP callbackasm1(SB) + MOVL $682, CX + JMP callbackasm1(SB) + MOVL $683, CX + JMP callbackasm1(SB) + MOVL $684, CX + JMP callbackasm1(SB) + MOVL $685, CX + JMP callbackasm1(SB) + MOVL $686, CX + JMP callbackasm1(SB) + MOVL $687, CX + JMP callbackasm1(SB) + MOVL $688, CX + JMP callbackasm1(SB) + MOVL $689, CX + JMP callbackasm1(SB) + MOVL $690, CX + JMP callbackasm1(SB) + MOVL $691, CX + JMP callbackasm1(SB) + MOVL $692, CX + JMP callbackasm1(SB) + MOVL $693, CX + JMP callbackasm1(SB) + MOVL $694, CX + JMP callbackasm1(SB) + MOVL $695, CX + JMP callbackasm1(SB) + MOVL $696, CX + JMP callbackasm1(SB) + MOVL $697, CX + JMP callbackasm1(SB) + MOVL $698, CX + JMP callbackasm1(SB) + MOVL $699, CX + JMP callbackasm1(SB) + MOVL $700, CX + JMP callbackasm1(SB) + MOVL $701, CX + JMP callbackasm1(SB) + MOVL $702, CX + JMP callbackasm1(SB) + MOVL $703, CX + JMP callbackasm1(SB) + MOVL $704, CX + JMP callbackasm1(SB) + MOVL $705, CX + JMP callbackasm1(SB) + MOVL $706, CX + JMP callbackasm1(SB) + MOVL $707, CX + JMP callbackasm1(SB) + MOVL $708, CX + JMP callbackasm1(SB) + MOVL $709, CX + JMP callbackasm1(SB) + MOVL $710, CX + JMP callbackasm1(SB) + MOVL $711, CX + JMP callbackasm1(SB) + MOVL $712, CX + JMP callbackasm1(SB) + MOVL $713, CX + JMP callbackasm1(SB) + MOVL $714, CX + JMP callbackasm1(SB) + MOVL $715, CX + JMP callbackasm1(SB) + MOVL $716, CX + JMP callbackasm1(SB) + MOVL $717, CX + JMP callbackasm1(SB) + MOVL $718, CX + JMP callbackasm1(SB) + MOVL $719, CX + JMP callbackasm1(SB) + MOVL $720, CX + JMP callbackasm1(SB) + MOVL $721, CX + JMP callbackasm1(SB) + MOVL $722, CX + JMP callbackasm1(SB) + MOVL $723, CX + JMP callbackasm1(SB) + MOVL $724, CX + JMP callbackasm1(SB) + MOVL $725, CX + JMP callbackasm1(SB) + MOVL $726, CX + JMP callbackasm1(SB) + MOVL $727, CX + JMP callbackasm1(SB) + MOVL $728, CX + JMP callbackasm1(SB) + MOVL $729, CX + JMP callbackasm1(SB) + MOVL $730, CX + JMP callbackasm1(SB) + MOVL $731, CX + JMP callbackasm1(SB) + MOVL $732, CX + JMP callbackasm1(SB) + MOVL $733, CX + JMP callbackasm1(SB) + MOVL $734, CX + JMP callbackasm1(SB) + MOVL $735, CX + JMP callbackasm1(SB) + MOVL $736, CX + JMP callbackasm1(SB) + MOVL $737, CX + JMP callbackasm1(SB) + MOVL $738, CX + JMP callbackasm1(SB) + MOVL $739, CX + JMP callbackasm1(SB) + MOVL $740, CX + JMP callbackasm1(SB) + MOVL $741, CX + JMP callbackasm1(SB) + MOVL $742, CX + JMP callbackasm1(SB) + MOVL $743, CX + JMP callbackasm1(SB) + MOVL $744, CX + JMP callbackasm1(SB) + MOVL $745, CX + JMP callbackasm1(SB) + MOVL $746, CX + JMP callbackasm1(SB) + MOVL $747, CX + JMP callbackasm1(SB) + MOVL $748, CX + JMP callbackasm1(SB) + MOVL $749, CX + JMP callbackasm1(SB) + MOVL $750, CX + JMP callbackasm1(SB) + MOVL $751, CX + JMP callbackasm1(SB) + MOVL $752, CX + JMP callbackasm1(SB) + MOVL $753, CX + JMP callbackasm1(SB) + MOVL $754, CX + JMP callbackasm1(SB) + MOVL $755, CX + JMP callbackasm1(SB) + MOVL $756, CX + JMP callbackasm1(SB) + MOVL $757, CX + JMP callbackasm1(SB) + MOVL $758, CX + JMP callbackasm1(SB) + MOVL $759, CX + JMP callbackasm1(SB) + MOVL $760, CX + JMP callbackasm1(SB) + MOVL $761, CX + JMP callbackasm1(SB) + MOVL $762, CX + JMP callbackasm1(SB) + MOVL $763, CX + JMP callbackasm1(SB) + MOVL $764, CX + JMP callbackasm1(SB) + MOVL $765, CX + JMP callbackasm1(SB) + MOVL $766, CX + JMP callbackasm1(SB) + MOVL $767, CX + JMP callbackasm1(SB) + MOVL $768, CX + JMP callbackasm1(SB) + MOVL $769, CX + JMP callbackasm1(SB) + MOVL $770, CX + JMP callbackasm1(SB) + MOVL $771, CX + JMP callbackasm1(SB) + MOVL $772, CX + JMP callbackasm1(SB) + MOVL $773, CX + JMP callbackasm1(SB) + MOVL $774, CX + JMP callbackasm1(SB) + MOVL $775, CX + JMP callbackasm1(SB) + MOVL $776, CX + JMP callbackasm1(SB) + MOVL $777, CX + JMP callbackasm1(SB) + MOVL $778, CX + JMP callbackasm1(SB) + MOVL $779, CX + JMP callbackasm1(SB) + MOVL $780, CX + JMP callbackasm1(SB) + MOVL $781, CX + JMP callbackasm1(SB) + MOVL $782, CX + JMP callbackasm1(SB) + MOVL $783, CX + JMP callbackasm1(SB) + MOVL $784, CX + JMP callbackasm1(SB) + MOVL $785, CX + JMP callbackasm1(SB) + MOVL $786, CX + JMP callbackasm1(SB) + MOVL $787, CX + JMP callbackasm1(SB) + MOVL $788, CX + JMP callbackasm1(SB) + MOVL $789, CX + JMP callbackasm1(SB) + MOVL $790, CX + JMP callbackasm1(SB) + MOVL $791, CX + JMP callbackasm1(SB) + MOVL $792, CX + JMP callbackasm1(SB) + MOVL $793, CX + JMP callbackasm1(SB) + MOVL $794, CX + JMP callbackasm1(SB) + MOVL $795, CX + JMP callbackasm1(SB) + MOVL $796, CX + JMP callbackasm1(SB) + MOVL $797, CX + JMP callbackasm1(SB) + MOVL $798, CX + JMP callbackasm1(SB) + MOVL $799, CX + JMP callbackasm1(SB) + MOVL $800, CX + JMP callbackasm1(SB) + MOVL $801, CX + JMP callbackasm1(SB) + MOVL $802, CX + JMP callbackasm1(SB) + MOVL $803, CX + JMP callbackasm1(SB) + MOVL $804, CX + JMP callbackasm1(SB) + MOVL $805, CX + JMP callbackasm1(SB) + MOVL $806, CX + JMP callbackasm1(SB) + MOVL $807, CX + JMP callbackasm1(SB) + MOVL $808, CX + JMP callbackasm1(SB) + MOVL $809, CX + JMP callbackasm1(SB) + MOVL $810, CX + JMP callbackasm1(SB) + MOVL $811, CX + JMP callbackasm1(SB) + MOVL $812, CX + JMP callbackasm1(SB) + MOVL $813, CX + JMP callbackasm1(SB) + MOVL $814, CX + JMP callbackasm1(SB) + MOVL $815, CX + JMP callbackasm1(SB) + MOVL $816, CX + JMP callbackasm1(SB) + MOVL $817, CX + JMP callbackasm1(SB) + MOVL $818, CX + JMP callbackasm1(SB) + MOVL $819, CX + JMP callbackasm1(SB) + MOVL $820, CX + JMP callbackasm1(SB) + MOVL $821, CX + JMP callbackasm1(SB) + MOVL $822, CX + JMP callbackasm1(SB) + MOVL $823, CX + JMP callbackasm1(SB) + MOVL $824, CX + JMP callbackasm1(SB) + MOVL $825, CX + JMP callbackasm1(SB) + MOVL $826, CX + JMP callbackasm1(SB) + MOVL $827, CX + JMP callbackasm1(SB) + MOVL $828, CX + JMP callbackasm1(SB) + MOVL $829, CX + JMP callbackasm1(SB) + MOVL $830, CX + JMP callbackasm1(SB) + MOVL $831, CX + JMP callbackasm1(SB) + MOVL $832, CX + JMP callbackasm1(SB) + MOVL $833, CX + JMP callbackasm1(SB) + MOVL $834, CX + JMP callbackasm1(SB) + MOVL $835, CX + JMP callbackasm1(SB) + MOVL $836, CX + JMP callbackasm1(SB) + MOVL $837, CX + JMP callbackasm1(SB) + MOVL $838, CX + JMP callbackasm1(SB) + MOVL $839, CX + JMP callbackasm1(SB) + MOVL $840, CX + JMP callbackasm1(SB) + MOVL $841, CX + JMP callbackasm1(SB) + MOVL $842, CX + JMP callbackasm1(SB) + MOVL $843, CX + JMP callbackasm1(SB) + MOVL $844, CX + JMP callbackasm1(SB) + MOVL $845, CX + JMP callbackasm1(SB) + MOVL $846, CX + JMP callbackasm1(SB) + MOVL $847, CX + JMP callbackasm1(SB) + MOVL $848, CX + JMP callbackasm1(SB) + MOVL $849, CX + JMP callbackasm1(SB) + MOVL $850, CX + JMP callbackasm1(SB) + MOVL $851, CX + JMP callbackasm1(SB) + MOVL $852, CX + JMP callbackasm1(SB) + MOVL $853, CX + JMP callbackasm1(SB) + MOVL $854, CX + JMP callbackasm1(SB) + MOVL $855, CX + JMP callbackasm1(SB) + MOVL $856, CX + JMP callbackasm1(SB) + MOVL $857, CX + JMP callbackasm1(SB) + MOVL $858, CX + JMP callbackasm1(SB) + MOVL $859, CX + JMP callbackasm1(SB) + MOVL $860, CX + JMP callbackasm1(SB) + MOVL $861, CX + JMP callbackasm1(SB) + MOVL $862, CX + JMP callbackasm1(SB) + MOVL $863, CX + JMP callbackasm1(SB) + MOVL $864, CX + JMP callbackasm1(SB) + MOVL $865, CX + JMP callbackasm1(SB) + MOVL $866, CX + JMP callbackasm1(SB) + MOVL $867, CX + JMP callbackasm1(SB) + MOVL $868, CX + JMP callbackasm1(SB) + MOVL $869, CX + JMP callbackasm1(SB) + MOVL $870, CX + JMP callbackasm1(SB) + MOVL $871, CX + JMP callbackasm1(SB) + MOVL $872, CX + JMP callbackasm1(SB) + MOVL $873, CX + JMP callbackasm1(SB) + MOVL $874, CX + JMP callbackasm1(SB) + MOVL $875, CX + JMP callbackasm1(SB) + MOVL $876, CX + JMP callbackasm1(SB) + MOVL $877, CX + JMP callbackasm1(SB) + MOVL $878, CX + JMP callbackasm1(SB) + MOVL $879, CX + JMP callbackasm1(SB) + MOVL $880, CX + JMP callbackasm1(SB) + MOVL $881, CX + JMP callbackasm1(SB) + MOVL $882, CX + JMP callbackasm1(SB) + MOVL $883, CX + JMP callbackasm1(SB) + MOVL $884, CX + JMP callbackasm1(SB) + MOVL $885, CX + JMP callbackasm1(SB) + MOVL $886, CX + JMP callbackasm1(SB) + MOVL $887, CX + JMP callbackasm1(SB) + MOVL $888, CX + JMP callbackasm1(SB) + MOVL $889, CX + JMP callbackasm1(SB) + MOVL $890, CX + JMP callbackasm1(SB) + MOVL $891, CX + JMP callbackasm1(SB) + MOVL $892, CX + JMP callbackasm1(SB) + MOVL $893, CX + JMP callbackasm1(SB) + MOVL $894, CX + JMP callbackasm1(SB) + MOVL $895, CX + JMP callbackasm1(SB) + MOVL $896, CX + JMP callbackasm1(SB) + MOVL $897, CX + JMP callbackasm1(SB) + MOVL $898, CX + JMP callbackasm1(SB) + MOVL $899, CX + JMP callbackasm1(SB) + MOVL $900, CX + JMP callbackasm1(SB) + MOVL $901, CX + JMP callbackasm1(SB) + MOVL $902, CX + JMP callbackasm1(SB) + MOVL $903, CX + JMP callbackasm1(SB) + MOVL $904, CX + JMP callbackasm1(SB) + MOVL $905, CX + JMP callbackasm1(SB) + MOVL $906, CX + JMP callbackasm1(SB) + MOVL $907, CX + JMP callbackasm1(SB) + MOVL $908, CX + JMP callbackasm1(SB) + MOVL $909, CX + JMP callbackasm1(SB) + MOVL $910, CX + JMP callbackasm1(SB) + MOVL $911, CX + JMP callbackasm1(SB) + MOVL $912, CX + JMP callbackasm1(SB) + MOVL $913, CX + JMP callbackasm1(SB) + MOVL $914, CX + JMP callbackasm1(SB) + MOVL $915, CX + JMP callbackasm1(SB) + MOVL $916, CX + JMP callbackasm1(SB) + MOVL $917, CX + JMP callbackasm1(SB) + MOVL $918, CX + JMP callbackasm1(SB) + MOVL $919, CX + JMP callbackasm1(SB) + MOVL $920, CX + JMP callbackasm1(SB) + MOVL $921, CX + JMP callbackasm1(SB) + MOVL $922, CX + JMP callbackasm1(SB) + MOVL $923, CX + JMP callbackasm1(SB) + MOVL $924, CX + JMP callbackasm1(SB) + MOVL $925, CX + JMP callbackasm1(SB) + MOVL $926, CX + JMP callbackasm1(SB) + MOVL $927, CX + JMP callbackasm1(SB) + MOVL $928, CX + JMP callbackasm1(SB) + MOVL $929, CX + JMP callbackasm1(SB) + MOVL $930, CX + JMP callbackasm1(SB) + MOVL $931, CX + JMP callbackasm1(SB) + MOVL $932, CX + JMP callbackasm1(SB) + MOVL $933, CX + JMP callbackasm1(SB) + MOVL $934, CX + JMP callbackasm1(SB) + MOVL $935, CX + JMP callbackasm1(SB) + MOVL $936, CX + JMP callbackasm1(SB) + MOVL $937, CX + JMP callbackasm1(SB) + MOVL $938, CX + JMP callbackasm1(SB) + MOVL $939, CX + JMP callbackasm1(SB) + MOVL $940, CX + JMP callbackasm1(SB) + MOVL $941, CX + JMP callbackasm1(SB) + MOVL $942, CX + JMP callbackasm1(SB) + MOVL $943, CX + JMP callbackasm1(SB) + MOVL $944, CX + JMP callbackasm1(SB) + MOVL $945, CX + JMP callbackasm1(SB) + MOVL $946, CX + JMP callbackasm1(SB) + MOVL $947, CX + JMP callbackasm1(SB) + MOVL $948, CX + JMP callbackasm1(SB) + MOVL $949, CX + JMP callbackasm1(SB) + MOVL $950, CX + JMP callbackasm1(SB) + MOVL $951, CX + JMP callbackasm1(SB) + MOVL $952, CX + JMP callbackasm1(SB) + MOVL $953, CX + JMP callbackasm1(SB) + MOVL $954, CX + JMP callbackasm1(SB) + MOVL $955, CX + JMP callbackasm1(SB) + MOVL $956, CX + JMP callbackasm1(SB) + MOVL $957, CX + JMP callbackasm1(SB) + MOVL $958, CX + JMP callbackasm1(SB) + MOVL $959, CX + JMP callbackasm1(SB) + MOVL $960, CX + JMP callbackasm1(SB) + MOVL $961, CX + JMP callbackasm1(SB) + MOVL $962, CX + JMP callbackasm1(SB) + MOVL $963, CX + JMP callbackasm1(SB) + MOVL $964, CX + JMP callbackasm1(SB) + MOVL $965, CX + JMP callbackasm1(SB) + MOVL $966, CX + JMP callbackasm1(SB) + MOVL $967, CX + JMP callbackasm1(SB) + MOVL $968, CX + JMP callbackasm1(SB) + MOVL $969, CX + JMP callbackasm1(SB) + MOVL $970, CX + JMP callbackasm1(SB) + MOVL $971, CX + JMP callbackasm1(SB) + MOVL $972, CX + JMP callbackasm1(SB) + MOVL $973, CX + JMP callbackasm1(SB) + MOVL $974, CX + JMP callbackasm1(SB) + MOVL $975, CX + JMP callbackasm1(SB) + MOVL $976, CX + JMP callbackasm1(SB) + MOVL $977, CX + JMP callbackasm1(SB) + MOVL $978, CX + JMP callbackasm1(SB) + MOVL $979, CX + JMP callbackasm1(SB) + MOVL $980, CX + JMP callbackasm1(SB) + MOVL $981, CX + JMP callbackasm1(SB) + MOVL $982, CX + JMP callbackasm1(SB) + MOVL $983, CX + JMP callbackasm1(SB) + MOVL $984, CX + JMP callbackasm1(SB) + MOVL $985, CX + JMP callbackasm1(SB) + MOVL $986, CX + JMP callbackasm1(SB) + MOVL $987, CX + JMP callbackasm1(SB) + MOVL $988, CX + JMP callbackasm1(SB) + MOVL $989, CX + JMP callbackasm1(SB) + MOVL $990, CX + JMP callbackasm1(SB) + MOVL $991, CX + JMP callbackasm1(SB) + MOVL $992, CX + JMP callbackasm1(SB) + MOVL $993, CX + JMP callbackasm1(SB) + MOVL $994, CX + JMP callbackasm1(SB) + MOVL $995, CX + JMP callbackasm1(SB) + MOVL $996, CX + JMP callbackasm1(SB) + MOVL $997, CX + JMP callbackasm1(SB) + MOVL $998, CX + JMP callbackasm1(SB) + MOVL $999, CX + JMP callbackasm1(SB) + MOVL $1000, CX + JMP callbackasm1(SB) + MOVL $1001, CX + JMP callbackasm1(SB) + MOVL $1002, CX + JMP callbackasm1(SB) + MOVL $1003, CX + JMP callbackasm1(SB) + MOVL $1004, CX + JMP callbackasm1(SB) + MOVL $1005, CX + JMP callbackasm1(SB) + MOVL $1006, CX + JMP callbackasm1(SB) + MOVL $1007, CX + JMP callbackasm1(SB) + MOVL $1008, CX + JMP callbackasm1(SB) + MOVL $1009, CX + JMP callbackasm1(SB) + MOVL $1010, CX + JMP callbackasm1(SB) + MOVL $1011, CX + JMP callbackasm1(SB) + MOVL $1012, CX + JMP callbackasm1(SB) + MOVL $1013, CX + JMP callbackasm1(SB) + MOVL $1014, CX + JMP callbackasm1(SB) + MOVL $1015, CX + JMP callbackasm1(SB) + MOVL $1016, CX + JMP callbackasm1(SB) + MOVL $1017, CX + JMP callbackasm1(SB) + MOVL $1018, CX + JMP callbackasm1(SB) + MOVL $1019, CX + JMP callbackasm1(SB) + MOVL $1020, CX + JMP callbackasm1(SB) + MOVL $1021, CX + JMP callbackasm1(SB) + MOVL $1022, CX + JMP callbackasm1(SB) + MOVL $1023, CX + JMP callbackasm1(SB) + MOVL $1024, CX + JMP callbackasm1(SB) + MOVL $1025, CX + JMP callbackasm1(SB) + MOVL $1026, CX + JMP callbackasm1(SB) + MOVL $1027, CX + JMP callbackasm1(SB) + MOVL $1028, CX + JMP callbackasm1(SB) + MOVL $1029, CX + JMP callbackasm1(SB) + MOVL $1030, CX + JMP callbackasm1(SB) + MOVL $1031, CX + JMP callbackasm1(SB) + MOVL $1032, CX + JMP callbackasm1(SB) + MOVL $1033, CX + JMP callbackasm1(SB) + MOVL $1034, CX + JMP callbackasm1(SB) + MOVL $1035, CX + JMP callbackasm1(SB) + MOVL $1036, CX + JMP callbackasm1(SB) + MOVL $1037, CX + JMP callbackasm1(SB) + MOVL $1038, CX + JMP callbackasm1(SB) + MOVL $1039, CX + JMP callbackasm1(SB) + MOVL $1040, CX + JMP callbackasm1(SB) + MOVL $1041, CX + JMP callbackasm1(SB) + MOVL $1042, CX + JMP callbackasm1(SB) + MOVL $1043, CX + JMP callbackasm1(SB) + MOVL $1044, CX + JMP callbackasm1(SB) + MOVL $1045, CX + JMP callbackasm1(SB) + MOVL $1046, CX + JMP callbackasm1(SB) + MOVL $1047, CX + JMP callbackasm1(SB) + MOVL $1048, CX + JMP callbackasm1(SB) + MOVL $1049, CX + JMP callbackasm1(SB) + MOVL $1050, CX + JMP callbackasm1(SB) + MOVL $1051, CX + JMP callbackasm1(SB) + MOVL $1052, CX + JMP callbackasm1(SB) + MOVL $1053, CX + JMP callbackasm1(SB) + MOVL $1054, CX + JMP callbackasm1(SB) + MOVL $1055, CX + JMP callbackasm1(SB) + MOVL $1056, CX + JMP callbackasm1(SB) + MOVL $1057, CX + JMP callbackasm1(SB) + MOVL $1058, CX + JMP callbackasm1(SB) + MOVL $1059, CX + JMP callbackasm1(SB) + MOVL $1060, CX + JMP callbackasm1(SB) + MOVL $1061, CX + JMP callbackasm1(SB) + MOVL $1062, CX + JMP callbackasm1(SB) + MOVL $1063, CX + JMP callbackasm1(SB) + MOVL $1064, CX + JMP callbackasm1(SB) + MOVL $1065, CX + JMP callbackasm1(SB) + MOVL $1066, CX + JMP callbackasm1(SB) + MOVL $1067, CX + JMP callbackasm1(SB) + MOVL $1068, CX + JMP callbackasm1(SB) + MOVL $1069, CX + JMP callbackasm1(SB) + MOVL $1070, CX + JMP callbackasm1(SB) + MOVL $1071, CX + JMP callbackasm1(SB) + MOVL $1072, CX + JMP callbackasm1(SB) + MOVL $1073, CX + JMP callbackasm1(SB) + MOVL $1074, CX + JMP callbackasm1(SB) + MOVL $1075, CX + JMP callbackasm1(SB) + MOVL $1076, CX + JMP callbackasm1(SB) + MOVL $1077, CX + JMP callbackasm1(SB) + MOVL $1078, CX + JMP callbackasm1(SB) + MOVL $1079, CX + JMP callbackasm1(SB) + MOVL $1080, CX + JMP callbackasm1(SB) + MOVL $1081, CX + JMP callbackasm1(SB) + MOVL $1082, CX + JMP callbackasm1(SB) + MOVL $1083, CX + JMP callbackasm1(SB) + MOVL $1084, CX + JMP callbackasm1(SB) + MOVL $1085, CX + JMP callbackasm1(SB) + MOVL $1086, CX + JMP callbackasm1(SB) + MOVL $1087, CX + JMP callbackasm1(SB) + MOVL $1088, CX + JMP callbackasm1(SB) + MOVL $1089, CX + JMP callbackasm1(SB) + MOVL $1090, CX + JMP callbackasm1(SB) + MOVL $1091, CX + JMP callbackasm1(SB) + MOVL $1092, CX + JMP callbackasm1(SB) + MOVL $1093, CX + JMP callbackasm1(SB) + MOVL $1094, CX + JMP callbackasm1(SB) + MOVL $1095, CX + JMP callbackasm1(SB) + MOVL $1096, CX + JMP callbackasm1(SB) + MOVL $1097, CX + JMP callbackasm1(SB) + MOVL $1098, CX + JMP callbackasm1(SB) + MOVL $1099, CX + JMP callbackasm1(SB) + MOVL $1100, CX + JMP callbackasm1(SB) + MOVL $1101, CX + JMP callbackasm1(SB) + MOVL $1102, CX + JMP callbackasm1(SB) + MOVL $1103, CX + JMP callbackasm1(SB) + MOVL $1104, CX + JMP callbackasm1(SB) + MOVL $1105, CX + JMP callbackasm1(SB) + MOVL $1106, CX + JMP callbackasm1(SB) + MOVL $1107, CX + JMP callbackasm1(SB) + MOVL $1108, CX + JMP callbackasm1(SB) + MOVL $1109, CX + JMP callbackasm1(SB) + MOVL $1110, CX + JMP callbackasm1(SB) + MOVL $1111, CX + JMP callbackasm1(SB) + MOVL $1112, CX + JMP callbackasm1(SB) + MOVL $1113, CX + JMP callbackasm1(SB) + MOVL $1114, CX + JMP callbackasm1(SB) + MOVL $1115, CX + JMP callbackasm1(SB) + MOVL $1116, CX + JMP callbackasm1(SB) + MOVL $1117, CX + JMP callbackasm1(SB) + MOVL $1118, CX + JMP callbackasm1(SB) + MOVL $1119, CX + JMP callbackasm1(SB) + MOVL $1120, CX + JMP callbackasm1(SB) + MOVL $1121, CX + JMP callbackasm1(SB) + MOVL $1122, CX + JMP callbackasm1(SB) + MOVL $1123, CX + JMP callbackasm1(SB) + MOVL $1124, CX + JMP callbackasm1(SB) + MOVL $1125, CX + JMP callbackasm1(SB) + MOVL $1126, CX + JMP callbackasm1(SB) + MOVL $1127, CX + JMP callbackasm1(SB) + MOVL $1128, CX + JMP callbackasm1(SB) + MOVL $1129, CX + JMP callbackasm1(SB) + MOVL $1130, CX + JMP callbackasm1(SB) + MOVL $1131, CX + JMP callbackasm1(SB) + MOVL $1132, CX + JMP callbackasm1(SB) + MOVL $1133, CX + JMP callbackasm1(SB) + MOVL $1134, CX + JMP callbackasm1(SB) + MOVL $1135, CX + JMP callbackasm1(SB) + MOVL $1136, CX + JMP callbackasm1(SB) + MOVL $1137, CX + JMP callbackasm1(SB) + MOVL $1138, CX + JMP callbackasm1(SB) + MOVL $1139, CX + JMP callbackasm1(SB) + MOVL $1140, CX + JMP callbackasm1(SB) + MOVL $1141, CX + JMP callbackasm1(SB) + MOVL $1142, CX + JMP callbackasm1(SB) + MOVL $1143, CX + JMP callbackasm1(SB) + MOVL $1144, CX + JMP callbackasm1(SB) + MOVL $1145, CX + JMP callbackasm1(SB) + MOVL $1146, CX + JMP callbackasm1(SB) + MOVL $1147, CX + JMP callbackasm1(SB) + MOVL $1148, CX + JMP callbackasm1(SB) + MOVL $1149, CX + JMP callbackasm1(SB) + MOVL $1150, CX + JMP callbackasm1(SB) + MOVL $1151, CX + JMP callbackasm1(SB) + MOVL $1152, CX + JMP callbackasm1(SB) + MOVL $1153, CX + JMP callbackasm1(SB) + MOVL $1154, CX + JMP callbackasm1(SB) + MOVL $1155, CX + JMP callbackasm1(SB) + MOVL $1156, CX + JMP callbackasm1(SB) + MOVL $1157, CX + JMP callbackasm1(SB) + MOVL $1158, CX + JMP callbackasm1(SB) + MOVL $1159, CX + JMP callbackasm1(SB) + MOVL $1160, CX + JMP callbackasm1(SB) + MOVL $1161, CX + JMP callbackasm1(SB) + MOVL $1162, CX + JMP callbackasm1(SB) + MOVL $1163, CX + JMP callbackasm1(SB) + MOVL $1164, CX + JMP callbackasm1(SB) + MOVL $1165, CX + JMP callbackasm1(SB) + MOVL $1166, CX + JMP callbackasm1(SB) + MOVL $1167, CX + JMP callbackasm1(SB) + MOVL $1168, CX + JMP callbackasm1(SB) + MOVL $1169, CX + JMP callbackasm1(SB) + MOVL $1170, CX + JMP callbackasm1(SB) + MOVL $1171, CX + JMP callbackasm1(SB) + MOVL $1172, CX + JMP callbackasm1(SB) + MOVL $1173, CX + JMP callbackasm1(SB) + MOVL $1174, CX + JMP callbackasm1(SB) + MOVL $1175, CX + JMP callbackasm1(SB) + MOVL $1176, CX + JMP callbackasm1(SB) + MOVL $1177, CX + JMP callbackasm1(SB) + MOVL $1178, CX + JMP callbackasm1(SB) + MOVL $1179, CX + JMP callbackasm1(SB) + MOVL $1180, CX + JMP callbackasm1(SB) + MOVL $1181, CX + JMP callbackasm1(SB) + MOVL $1182, CX + JMP callbackasm1(SB) + MOVL $1183, CX + JMP callbackasm1(SB) + MOVL $1184, CX + JMP callbackasm1(SB) + MOVL $1185, CX + JMP callbackasm1(SB) + MOVL $1186, CX + JMP callbackasm1(SB) + MOVL $1187, CX + JMP callbackasm1(SB) + MOVL $1188, CX + JMP callbackasm1(SB) + MOVL $1189, CX + JMP callbackasm1(SB) + MOVL $1190, CX + JMP callbackasm1(SB) + MOVL $1191, CX + JMP callbackasm1(SB) + MOVL $1192, CX + JMP callbackasm1(SB) + MOVL $1193, CX + JMP callbackasm1(SB) + MOVL $1194, CX + JMP callbackasm1(SB) + MOVL $1195, CX + JMP callbackasm1(SB) + MOVL $1196, CX + JMP callbackasm1(SB) + MOVL $1197, CX + JMP callbackasm1(SB) + MOVL $1198, CX + JMP callbackasm1(SB) + MOVL $1199, CX + JMP callbackasm1(SB) + MOVL $1200, CX + JMP callbackasm1(SB) + MOVL $1201, CX + JMP callbackasm1(SB) + MOVL $1202, CX + JMP callbackasm1(SB) + MOVL $1203, CX + JMP callbackasm1(SB) + MOVL $1204, CX + JMP callbackasm1(SB) + MOVL $1205, CX + JMP callbackasm1(SB) + MOVL $1206, CX + JMP callbackasm1(SB) + MOVL $1207, CX + JMP callbackasm1(SB) + MOVL $1208, CX + JMP callbackasm1(SB) + MOVL $1209, CX + JMP callbackasm1(SB) + MOVL $1210, CX + JMP callbackasm1(SB) + MOVL $1211, CX + JMP callbackasm1(SB) + MOVL $1212, CX + JMP callbackasm1(SB) + MOVL $1213, CX + JMP callbackasm1(SB) + MOVL $1214, CX + JMP callbackasm1(SB) + MOVL $1215, CX + JMP callbackasm1(SB) + MOVL $1216, CX + JMP callbackasm1(SB) + MOVL $1217, CX + JMP callbackasm1(SB) + MOVL $1218, CX + JMP callbackasm1(SB) + MOVL $1219, CX + JMP callbackasm1(SB) + MOVL $1220, CX + JMP callbackasm1(SB) + MOVL $1221, CX + JMP callbackasm1(SB) + MOVL $1222, CX + JMP callbackasm1(SB) + MOVL $1223, CX + JMP callbackasm1(SB) + MOVL $1224, CX + JMP callbackasm1(SB) + MOVL $1225, CX + JMP callbackasm1(SB) + MOVL $1226, CX + JMP callbackasm1(SB) + MOVL $1227, CX + JMP callbackasm1(SB) + MOVL $1228, CX + JMP callbackasm1(SB) + MOVL $1229, CX + JMP callbackasm1(SB) + MOVL $1230, CX + JMP callbackasm1(SB) + MOVL $1231, CX + JMP callbackasm1(SB) + MOVL $1232, CX + JMP callbackasm1(SB) + MOVL $1233, CX + JMP callbackasm1(SB) + MOVL $1234, CX + JMP callbackasm1(SB) + MOVL $1235, CX + JMP callbackasm1(SB) + MOVL $1236, CX + JMP callbackasm1(SB) + MOVL $1237, CX + JMP callbackasm1(SB) + MOVL $1238, CX + JMP callbackasm1(SB) + MOVL $1239, CX + JMP callbackasm1(SB) + MOVL $1240, CX + JMP callbackasm1(SB) + MOVL $1241, CX + JMP callbackasm1(SB) + MOVL $1242, CX + JMP callbackasm1(SB) + MOVL $1243, CX + JMP callbackasm1(SB) + MOVL $1244, CX + JMP callbackasm1(SB) + MOVL $1245, CX + JMP callbackasm1(SB) + MOVL $1246, CX + JMP callbackasm1(SB) + MOVL $1247, CX + JMP callbackasm1(SB) + MOVL $1248, CX + JMP callbackasm1(SB) + MOVL $1249, CX + JMP callbackasm1(SB) + MOVL $1250, CX + JMP callbackasm1(SB) + MOVL $1251, CX + JMP callbackasm1(SB) + MOVL $1252, CX + JMP callbackasm1(SB) + MOVL $1253, CX + JMP callbackasm1(SB) + MOVL $1254, CX + JMP callbackasm1(SB) + MOVL $1255, CX + JMP callbackasm1(SB) + MOVL $1256, CX + JMP callbackasm1(SB) + MOVL $1257, CX + JMP callbackasm1(SB) + MOVL $1258, CX + JMP callbackasm1(SB) + MOVL $1259, CX + JMP callbackasm1(SB) + MOVL $1260, CX + JMP callbackasm1(SB) + MOVL $1261, CX + JMP callbackasm1(SB) + MOVL $1262, CX + JMP callbackasm1(SB) + MOVL $1263, CX + JMP callbackasm1(SB) + MOVL $1264, CX + JMP callbackasm1(SB) + MOVL $1265, CX + JMP callbackasm1(SB) + MOVL $1266, CX + JMP callbackasm1(SB) + MOVL $1267, CX + JMP callbackasm1(SB) + MOVL $1268, CX + JMP callbackasm1(SB) + MOVL $1269, CX + JMP callbackasm1(SB) + MOVL $1270, CX + JMP callbackasm1(SB) + MOVL $1271, CX + JMP callbackasm1(SB) + MOVL $1272, CX + JMP callbackasm1(SB) + MOVL $1273, CX + JMP callbackasm1(SB) + MOVL $1274, CX + JMP callbackasm1(SB) + MOVL $1275, CX + JMP callbackasm1(SB) + MOVL $1276, CX + JMP callbackasm1(SB) + MOVL $1277, CX + JMP callbackasm1(SB) + MOVL $1278, CX + JMP callbackasm1(SB) + MOVL $1279, CX + JMP callbackasm1(SB) + MOVL $1280, CX + JMP callbackasm1(SB) + MOVL $1281, CX + JMP callbackasm1(SB) + MOVL $1282, CX + JMP callbackasm1(SB) + MOVL $1283, CX + JMP callbackasm1(SB) + MOVL $1284, CX + JMP callbackasm1(SB) + MOVL $1285, CX + JMP callbackasm1(SB) + MOVL $1286, CX + JMP callbackasm1(SB) + MOVL $1287, CX + JMP callbackasm1(SB) + MOVL $1288, CX + JMP callbackasm1(SB) + MOVL $1289, CX + JMP callbackasm1(SB) + MOVL $1290, CX + JMP callbackasm1(SB) + MOVL $1291, CX + JMP callbackasm1(SB) + MOVL $1292, CX + JMP callbackasm1(SB) + MOVL $1293, CX + JMP callbackasm1(SB) + MOVL $1294, CX + JMP callbackasm1(SB) + MOVL $1295, CX + JMP callbackasm1(SB) + MOVL $1296, CX + JMP callbackasm1(SB) + MOVL $1297, CX + JMP callbackasm1(SB) + MOVL $1298, CX + JMP callbackasm1(SB) + MOVL $1299, CX + JMP callbackasm1(SB) + MOVL $1300, CX + JMP callbackasm1(SB) + MOVL $1301, CX + JMP callbackasm1(SB) + MOVL $1302, CX + JMP callbackasm1(SB) + MOVL $1303, CX + JMP callbackasm1(SB) + MOVL $1304, CX + JMP callbackasm1(SB) + MOVL $1305, CX + JMP callbackasm1(SB) + MOVL $1306, CX + JMP callbackasm1(SB) + MOVL $1307, CX + JMP callbackasm1(SB) + MOVL $1308, CX + JMP callbackasm1(SB) + MOVL $1309, CX + JMP callbackasm1(SB) + MOVL $1310, CX + JMP callbackasm1(SB) + MOVL $1311, CX + JMP callbackasm1(SB) + MOVL $1312, CX + JMP callbackasm1(SB) + MOVL $1313, CX + JMP callbackasm1(SB) + MOVL $1314, CX + JMP callbackasm1(SB) + MOVL $1315, CX + JMP callbackasm1(SB) + MOVL $1316, CX + JMP callbackasm1(SB) + MOVL $1317, CX + JMP callbackasm1(SB) + MOVL $1318, CX + JMP callbackasm1(SB) + MOVL $1319, CX + JMP callbackasm1(SB) + MOVL $1320, CX + JMP callbackasm1(SB) + MOVL $1321, CX + JMP callbackasm1(SB) + MOVL $1322, CX + JMP callbackasm1(SB) + MOVL $1323, CX + JMP callbackasm1(SB) + MOVL $1324, CX + JMP callbackasm1(SB) + MOVL $1325, CX + JMP callbackasm1(SB) + MOVL $1326, CX + JMP callbackasm1(SB) + MOVL $1327, CX + JMP callbackasm1(SB) + MOVL $1328, CX + JMP callbackasm1(SB) + MOVL $1329, CX + JMP callbackasm1(SB) + MOVL $1330, CX + JMP callbackasm1(SB) + MOVL $1331, CX + JMP callbackasm1(SB) + MOVL $1332, CX + JMP callbackasm1(SB) + MOVL $1333, CX + JMP callbackasm1(SB) + MOVL $1334, CX + JMP callbackasm1(SB) + MOVL $1335, CX + JMP callbackasm1(SB) + MOVL $1336, CX + JMP callbackasm1(SB) + MOVL $1337, CX + JMP callbackasm1(SB) + MOVL $1338, CX + JMP callbackasm1(SB) + MOVL $1339, CX + JMP callbackasm1(SB) + MOVL $1340, CX + JMP callbackasm1(SB) + MOVL $1341, CX + JMP callbackasm1(SB) + MOVL $1342, CX + JMP callbackasm1(SB) + MOVL $1343, CX + JMP callbackasm1(SB) + MOVL $1344, CX + JMP callbackasm1(SB) + MOVL $1345, CX + JMP callbackasm1(SB) + MOVL $1346, CX + JMP callbackasm1(SB) + MOVL $1347, CX + JMP callbackasm1(SB) + MOVL $1348, CX + JMP callbackasm1(SB) + MOVL $1349, CX + JMP callbackasm1(SB) + MOVL $1350, CX + JMP callbackasm1(SB) + MOVL $1351, CX + JMP callbackasm1(SB) + MOVL $1352, CX + JMP callbackasm1(SB) + MOVL $1353, CX + JMP callbackasm1(SB) + MOVL $1354, CX + JMP callbackasm1(SB) + MOVL $1355, CX + JMP callbackasm1(SB) + MOVL $1356, CX + JMP callbackasm1(SB) + MOVL $1357, CX + JMP callbackasm1(SB) + MOVL $1358, CX + JMP callbackasm1(SB) + MOVL $1359, CX + JMP callbackasm1(SB) + MOVL $1360, CX + JMP callbackasm1(SB) + MOVL $1361, CX + JMP callbackasm1(SB) + MOVL $1362, CX + JMP callbackasm1(SB) + MOVL $1363, CX + JMP callbackasm1(SB) + MOVL $1364, CX + JMP callbackasm1(SB) + MOVL $1365, CX + JMP callbackasm1(SB) + MOVL $1366, CX + JMP callbackasm1(SB) + MOVL $1367, CX + JMP callbackasm1(SB) + MOVL $1368, CX + JMP callbackasm1(SB) + MOVL $1369, CX + JMP callbackasm1(SB) + MOVL $1370, CX + JMP callbackasm1(SB) + MOVL $1371, CX + JMP callbackasm1(SB) + MOVL $1372, CX + JMP callbackasm1(SB) + MOVL $1373, CX + JMP callbackasm1(SB) + MOVL $1374, CX + JMP callbackasm1(SB) + MOVL $1375, CX + JMP callbackasm1(SB) + MOVL $1376, CX + JMP callbackasm1(SB) + MOVL $1377, CX + JMP callbackasm1(SB) + MOVL $1378, CX + JMP callbackasm1(SB) + MOVL $1379, CX + JMP callbackasm1(SB) + MOVL $1380, CX + JMP callbackasm1(SB) + MOVL $1381, CX + JMP callbackasm1(SB) + MOVL $1382, CX + JMP callbackasm1(SB) + MOVL $1383, CX + JMP callbackasm1(SB) + MOVL $1384, CX + JMP callbackasm1(SB) + MOVL $1385, CX + JMP callbackasm1(SB) + MOVL $1386, CX + JMP callbackasm1(SB) + MOVL $1387, CX + JMP callbackasm1(SB) + MOVL $1388, CX + JMP callbackasm1(SB) + MOVL $1389, CX + JMP callbackasm1(SB) + MOVL $1390, CX + JMP callbackasm1(SB) + MOVL $1391, CX + JMP callbackasm1(SB) + MOVL $1392, CX + JMP callbackasm1(SB) + MOVL $1393, CX + JMP callbackasm1(SB) + MOVL $1394, CX + JMP callbackasm1(SB) + MOVL $1395, CX + JMP callbackasm1(SB) + MOVL $1396, CX + JMP callbackasm1(SB) + MOVL $1397, CX + JMP callbackasm1(SB) + MOVL $1398, CX + JMP callbackasm1(SB) + MOVL $1399, CX + JMP callbackasm1(SB) + MOVL $1400, CX + JMP callbackasm1(SB) + MOVL $1401, CX + JMP callbackasm1(SB) + MOVL $1402, CX + JMP callbackasm1(SB) + MOVL $1403, CX + JMP callbackasm1(SB) + MOVL $1404, CX + JMP callbackasm1(SB) + MOVL $1405, CX + JMP callbackasm1(SB) + MOVL $1406, CX + JMP callbackasm1(SB) + MOVL $1407, CX + JMP callbackasm1(SB) + MOVL $1408, CX + JMP callbackasm1(SB) + MOVL $1409, CX + JMP callbackasm1(SB) + MOVL $1410, CX + JMP callbackasm1(SB) + MOVL $1411, CX + JMP callbackasm1(SB) + MOVL $1412, CX + JMP callbackasm1(SB) + MOVL $1413, CX + JMP callbackasm1(SB) + MOVL $1414, CX + JMP callbackasm1(SB) + MOVL $1415, CX + JMP callbackasm1(SB) + MOVL $1416, CX + JMP callbackasm1(SB) + MOVL $1417, CX + JMP callbackasm1(SB) + MOVL $1418, CX + JMP callbackasm1(SB) + MOVL $1419, CX + JMP callbackasm1(SB) + MOVL $1420, CX + JMP callbackasm1(SB) + MOVL $1421, CX + JMP callbackasm1(SB) + MOVL $1422, CX + JMP callbackasm1(SB) + MOVL $1423, CX + JMP callbackasm1(SB) + MOVL $1424, CX + JMP callbackasm1(SB) + MOVL $1425, CX + JMP callbackasm1(SB) + MOVL $1426, CX + JMP callbackasm1(SB) + MOVL $1427, CX + JMP callbackasm1(SB) + MOVL $1428, CX + JMP callbackasm1(SB) + MOVL $1429, CX + JMP callbackasm1(SB) + MOVL $1430, CX + JMP callbackasm1(SB) + MOVL $1431, CX + JMP callbackasm1(SB) + MOVL $1432, CX + JMP callbackasm1(SB) + MOVL $1433, CX + JMP callbackasm1(SB) + MOVL $1434, CX + JMP callbackasm1(SB) + MOVL $1435, CX + JMP callbackasm1(SB) + MOVL $1436, CX + JMP callbackasm1(SB) + MOVL $1437, CX + JMP callbackasm1(SB) + MOVL $1438, CX + JMP callbackasm1(SB) + MOVL $1439, CX + JMP callbackasm1(SB) + MOVL $1440, CX + JMP callbackasm1(SB) + MOVL $1441, CX + JMP callbackasm1(SB) + MOVL $1442, CX + JMP callbackasm1(SB) + MOVL $1443, CX + JMP callbackasm1(SB) + MOVL $1444, CX + JMP callbackasm1(SB) + MOVL $1445, CX + JMP callbackasm1(SB) + MOVL $1446, CX + JMP callbackasm1(SB) + MOVL $1447, CX + JMP callbackasm1(SB) + MOVL $1448, CX + JMP callbackasm1(SB) + MOVL $1449, CX + JMP callbackasm1(SB) + MOVL $1450, CX + JMP callbackasm1(SB) + MOVL $1451, CX + JMP callbackasm1(SB) + MOVL $1452, CX + JMP callbackasm1(SB) + MOVL $1453, CX + JMP callbackasm1(SB) + MOVL $1454, CX + JMP callbackasm1(SB) + MOVL $1455, CX + JMP callbackasm1(SB) + MOVL $1456, CX + JMP callbackasm1(SB) + MOVL $1457, CX + JMP callbackasm1(SB) + MOVL $1458, CX + JMP callbackasm1(SB) + MOVL $1459, CX + JMP callbackasm1(SB) + MOVL $1460, CX + JMP callbackasm1(SB) + MOVL $1461, CX + JMP callbackasm1(SB) + MOVL $1462, CX + JMP callbackasm1(SB) + MOVL $1463, CX + JMP callbackasm1(SB) + MOVL $1464, CX + JMP callbackasm1(SB) + MOVL $1465, CX + JMP callbackasm1(SB) + MOVL $1466, CX + JMP callbackasm1(SB) + MOVL $1467, CX + JMP callbackasm1(SB) + MOVL $1468, CX + JMP callbackasm1(SB) + MOVL $1469, CX + JMP callbackasm1(SB) + MOVL $1470, CX + JMP callbackasm1(SB) + MOVL $1471, CX + JMP callbackasm1(SB) + MOVL $1472, CX + JMP callbackasm1(SB) + MOVL $1473, CX + JMP callbackasm1(SB) + MOVL $1474, CX + JMP callbackasm1(SB) + MOVL $1475, CX + JMP callbackasm1(SB) + MOVL $1476, CX + JMP callbackasm1(SB) + MOVL $1477, CX + JMP callbackasm1(SB) + MOVL $1478, CX + JMP callbackasm1(SB) + MOVL $1479, CX + JMP callbackasm1(SB) + MOVL $1480, CX + JMP callbackasm1(SB) + MOVL $1481, CX + JMP callbackasm1(SB) + MOVL $1482, CX + JMP callbackasm1(SB) + MOVL $1483, CX + JMP callbackasm1(SB) + MOVL $1484, CX + JMP callbackasm1(SB) + MOVL $1485, CX + JMP callbackasm1(SB) + MOVL $1486, CX + JMP callbackasm1(SB) + MOVL $1487, CX + JMP callbackasm1(SB) + MOVL $1488, CX + JMP callbackasm1(SB) + MOVL $1489, CX + JMP callbackasm1(SB) + MOVL $1490, CX + JMP callbackasm1(SB) + MOVL $1491, CX + JMP callbackasm1(SB) + MOVL $1492, CX + JMP callbackasm1(SB) + MOVL $1493, CX + JMP callbackasm1(SB) + MOVL $1494, CX + JMP callbackasm1(SB) + MOVL $1495, CX + JMP callbackasm1(SB) + MOVL $1496, CX + JMP callbackasm1(SB) + MOVL $1497, CX + JMP callbackasm1(SB) + MOVL $1498, CX + JMP callbackasm1(SB) + MOVL $1499, CX + JMP callbackasm1(SB) + MOVL $1500, CX + JMP callbackasm1(SB) + MOVL $1501, CX + JMP callbackasm1(SB) + MOVL $1502, CX + JMP callbackasm1(SB) + MOVL $1503, CX + JMP callbackasm1(SB) + MOVL $1504, CX + JMP callbackasm1(SB) + MOVL $1505, CX + JMP callbackasm1(SB) + MOVL $1506, CX + JMP callbackasm1(SB) + MOVL $1507, CX + JMP callbackasm1(SB) + MOVL $1508, CX + JMP callbackasm1(SB) + MOVL $1509, CX + JMP callbackasm1(SB) + MOVL $1510, CX + JMP callbackasm1(SB) + MOVL $1511, CX + JMP callbackasm1(SB) + MOVL $1512, CX + JMP callbackasm1(SB) + MOVL $1513, CX + JMP callbackasm1(SB) + MOVL $1514, CX + JMP callbackasm1(SB) + MOVL $1515, CX + JMP callbackasm1(SB) + MOVL $1516, CX + JMP callbackasm1(SB) + MOVL $1517, CX + JMP callbackasm1(SB) + MOVL $1518, CX + JMP callbackasm1(SB) + MOVL $1519, CX + JMP callbackasm1(SB) + MOVL $1520, CX + JMP callbackasm1(SB) + MOVL $1521, CX + JMP callbackasm1(SB) + MOVL $1522, CX + JMP callbackasm1(SB) + MOVL $1523, CX + JMP callbackasm1(SB) + MOVL $1524, CX + JMP callbackasm1(SB) + MOVL $1525, CX + JMP callbackasm1(SB) + MOVL $1526, CX + JMP callbackasm1(SB) + MOVL $1527, CX + JMP callbackasm1(SB) + MOVL $1528, CX + JMP callbackasm1(SB) + MOVL $1529, CX + JMP callbackasm1(SB) + MOVL $1530, CX + JMP callbackasm1(SB) + MOVL $1531, CX + JMP callbackasm1(SB) + MOVL $1532, CX + JMP callbackasm1(SB) + MOVL $1533, CX + JMP callbackasm1(SB) + MOVL $1534, CX + JMP callbackasm1(SB) + MOVL $1535, CX + JMP callbackasm1(SB) + MOVL $1536, CX + JMP callbackasm1(SB) + MOVL $1537, CX + JMP callbackasm1(SB) + MOVL $1538, CX + JMP callbackasm1(SB) + MOVL $1539, CX + JMP callbackasm1(SB) + MOVL $1540, CX + JMP callbackasm1(SB) + MOVL $1541, CX + JMP callbackasm1(SB) + MOVL $1542, CX + JMP callbackasm1(SB) + MOVL $1543, CX + JMP callbackasm1(SB) + MOVL $1544, CX + JMP callbackasm1(SB) + MOVL $1545, CX + JMP callbackasm1(SB) + MOVL $1546, CX + JMP callbackasm1(SB) + MOVL $1547, CX + JMP callbackasm1(SB) + MOVL $1548, CX + JMP callbackasm1(SB) + MOVL $1549, CX + JMP callbackasm1(SB) + MOVL $1550, CX + JMP callbackasm1(SB) + MOVL $1551, CX + JMP callbackasm1(SB) + MOVL $1552, CX + JMP callbackasm1(SB) + MOVL $1553, CX + JMP callbackasm1(SB) + MOVL $1554, CX + JMP callbackasm1(SB) + MOVL $1555, CX + JMP callbackasm1(SB) + MOVL $1556, CX + JMP callbackasm1(SB) + MOVL $1557, CX + JMP callbackasm1(SB) + MOVL $1558, CX + JMP callbackasm1(SB) + MOVL $1559, CX + JMP callbackasm1(SB) + MOVL $1560, CX + JMP callbackasm1(SB) + MOVL $1561, CX + JMP callbackasm1(SB) + MOVL $1562, CX + JMP callbackasm1(SB) + MOVL $1563, CX + JMP callbackasm1(SB) + MOVL $1564, CX + JMP callbackasm1(SB) + MOVL $1565, CX + JMP callbackasm1(SB) + MOVL $1566, CX + JMP callbackasm1(SB) + MOVL $1567, CX + JMP callbackasm1(SB) + MOVL $1568, CX + JMP callbackasm1(SB) + MOVL $1569, CX + JMP callbackasm1(SB) + MOVL $1570, CX + JMP callbackasm1(SB) + MOVL $1571, CX + JMP callbackasm1(SB) + MOVL $1572, CX + JMP callbackasm1(SB) + MOVL $1573, CX + JMP callbackasm1(SB) + MOVL $1574, CX + JMP callbackasm1(SB) + MOVL $1575, CX + JMP callbackasm1(SB) + MOVL $1576, CX + JMP callbackasm1(SB) + MOVL $1577, CX + JMP callbackasm1(SB) + MOVL $1578, CX + JMP callbackasm1(SB) + MOVL $1579, CX + JMP callbackasm1(SB) + MOVL $1580, CX + JMP callbackasm1(SB) + MOVL $1581, CX + JMP callbackasm1(SB) + MOVL $1582, CX + JMP callbackasm1(SB) + MOVL $1583, CX + JMP callbackasm1(SB) + MOVL $1584, CX + JMP callbackasm1(SB) + MOVL $1585, CX + JMP callbackasm1(SB) + MOVL $1586, CX + JMP callbackasm1(SB) + MOVL $1587, CX + JMP callbackasm1(SB) + MOVL $1588, CX + JMP callbackasm1(SB) + MOVL $1589, CX + JMP callbackasm1(SB) + MOVL $1590, CX + JMP callbackasm1(SB) + MOVL $1591, CX + JMP callbackasm1(SB) + MOVL $1592, CX + JMP callbackasm1(SB) + MOVL $1593, CX + JMP callbackasm1(SB) + MOVL $1594, CX + JMP callbackasm1(SB) + MOVL $1595, CX + JMP callbackasm1(SB) + MOVL $1596, CX + JMP callbackasm1(SB) + MOVL $1597, CX + JMP callbackasm1(SB) + MOVL $1598, CX + JMP callbackasm1(SB) + MOVL $1599, CX + JMP callbackasm1(SB) + MOVL $1600, CX + JMP callbackasm1(SB) + MOVL $1601, CX + JMP callbackasm1(SB) + MOVL $1602, CX + JMP callbackasm1(SB) + MOVL $1603, CX + JMP callbackasm1(SB) + MOVL $1604, CX + JMP callbackasm1(SB) + MOVL $1605, CX + JMP callbackasm1(SB) + MOVL $1606, CX + JMP callbackasm1(SB) + MOVL $1607, CX + JMP callbackasm1(SB) + MOVL $1608, CX + JMP callbackasm1(SB) + MOVL $1609, CX + JMP callbackasm1(SB) + MOVL $1610, CX + JMP callbackasm1(SB) + MOVL $1611, CX + JMP callbackasm1(SB) + MOVL $1612, CX + JMP callbackasm1(SB) + MOVL $1613, CX + JMP callbackasm1(SB) + MOVL $1614, CX + JMP callbackasm1(SB) + MOVL $1615, CX + JMP callbackasm1(SB) + MOVL $1616, CX + JMP callbackasm1(SB) + MOVL $1617, CX + JMP callbackasm1(SB) + MOVL $1618, CX + JMP callbackasm1(SB) + MOVL $1619, CX + JMP callbackasm1(SB) + MOVL $1620, CX + JMP callbackasm1(SB) + MOVL $1621, CX + JMP callbackasm1(SB) + MOVL $1622, CX + JMP callbackasm1(SB) + MOVL $1623, CX + JMP callbackasm1(SB) + MOVL $1624, CX + JMP callbackasm1(SB) + MOVL $1625, CX + JMP callbackasm1(SB) + MOVL $1626, CX + JMP callbackasm1(SB) + MOVL $1627, CX + JMP callbackasm1(SB) + MOVL $1628, CX + JMP callbackasm1(SB) + MOVL $1629, CX + JMP callbackasm1(SB) + MOVL $1630, CX + JMP callbackasm1(SB) + MOVL $1631, CX + JMP callbackasm1(SB) + MOVL $1632, CX + JMP callbackasm1(SB) + MOVL $1633, CX + JMP callbackasm1(SB) + MOVL $1634, CX + JMP callbackasm1(SB) + MOVL $1635, CX + JMP callbackasm1(SB) + MOVL $1636, CX + JMP callbackasm1(SB) + MOVL $1637, CX + JMP callbackasm1(SB) + MOVL $1638, CX + JMP callbackasm1(SB) + MOVL $1639, CX + JMP callbackasm1(SB) + MOVL $1640, CX + JMP callbackasm1(SB) + MOVL $1641, CX + JMP callbackasm1(SB) + MOVL $1642, CX + JMP callbackasm1(SB) + MOVL $1643, CX + JMP callbackasm1(SB) + MOVL $1644, CX + JMP callbackasm1(SB) + MOVL $1645, CX + JMP callbackasm1(SB) + MOVL $1646, CX + JMP callbackasm1(SB) + MOVL $1647, CX + JMP callbackasm1(SB) + MOVL $1648, CX + JMP callbackasm1(SB) + MOVL $1649, CX + JMP callbackasm1(SB) + MOVL $1650, CX + JMP callbackasm1(SB) + MOVL $1651, CX + JMP callbackasm1(SB) + MOVL $1652, CX + JMP callbackasm1(SB) + MOVL $1653, CX + JMP callbackasm1(SB) + MOVL $1654, CX + JMP callbackasm1(SB) + MOVL $1655, CX + JMP callbackasm1(SB) + MOVL $1656, CX + JMP callbackasm1(SB) + MOVL $1657, CX + JMP callbackasm1(SB) + MOVL $1658, CX + JMP callbackasm1(SB) + MOVL $1659, CX + JMP callbackasm1(SB) + MOVL $1660, CX + JMP callbackasm1(SB) + MOVL $1661, CX + JMP callbackasm1(SB) + MOVL $1662, CX + JMP callbackasm1(SB) + MOVL $1663, CX + JMP callbackasm1(SB) + MOVL $1664, CX + JMP callbackasm1(SB) + MOVL $1665, CX + JMP callbackasm1(SB) + MOVL $1666, CX + JMP callbackasm1(SB) + MOVL $1667, CX + JMP callbackasm1(SB) + MOVL $1668, CX + JMP callbackasm1(SB) + MOVL $1669, CX + JMP callbackasm1(SB) + MOVL $1670, CX + JMP callbackasm1(SB) + MOVL $1671, CX + JMP callbackasm1(SB) + MOVL $1672, CX + JMP callbackasm1(SB) + MOVL $1673, CX + JMP callbackasm1(SB) + MOVL $1674, CX + JMP callbackasm1(SB) + MOVL $1675, CX + JMP callbackasm1(SB) + MOVL $1676, CX + JMP callbackasm1(SB) + MOVL $1677, CX + JMP callbackasm1(SB) + MOVL $1678, CX + JMP callbackasm1(SB) + MOVL $1679, CX + JMP callbackasm1(SB) + MOVL $1680, CX + JMP callbackasm1(SB) + MOVL $1681, CX + JMP callbackasm1(SB) + MOVL $1682, CX + JMP callbackasm1(SB) + MOVL $1683, CX + JMP callbackasm1(SB) + MOVL $1684, CX + JMP callbackasm1(SB) + MOVL $1685, CX + JMP callbackasm1(SB) + MOVL $1686, CX + JMP callbackasm1(SB) + MOVL $1687, CX + JMP callbackasm1(SB) + MOVL $1688, CX + JMP callbackasm1(SB) + MOVL $1689, CX + JMP callbackasm1(SB) + MOVL $1690, CX + JMP callbackasm1(SB) + MOVL $1691, CX + JMP callbackasm1(SB) + MOVL $1692, CX + JMP callbackasm1(SB) + MOVL $1693, CX + JMP callbackasm1(SB) + MOVL $1694, CX + JMP callbackasm1(SB) + MOVL $1695, CX + JMP callbackasm1(SB) + MOVL $1696, CX + JMP callbackasm1(SB) + MOVL $1697, CX + JMP callbackasm1(SB) + MOVL $1698, CX + JMP callbackasm1(SB) + MOVL $1699, CX + JMP callbackasm1(SB) + MOVL $1700, CX + JMP callbackasm1(SB) + MOVL $1701, CX + JMP callbackasm1(SB) + MOVL $1702, CX + JMP callbackasm1(SB) + MOVL $1703, CX + JMP callbackasm1(SB) + MOVL $1704, CX + JMP callbackasm1(SB) + MOVL $1705, CX + JMP callbackasm1(SB) + MOVL $1706, CX + JMP callbackasm1(SB) + MOVL $1707, CX + JMP callbackasm1(SB) + MOVL $1708, CX + JMP callbackasm1(SB) + MOVL $1709, CX + JMP callbackasm1(SB) + MOVL $1710, CX + JMP callbackasm1(SB) + MOVL $1711, CX + JMP callbackasm1(SB) + MOVL $1712, CX + JMP callbackasm1(SB) + MOVL $1713, CX + JMP callbackasm1(SB) + MOVL $1714, CX + JMP callbackasm1(SB) + MOVL $1715, CX + JMP callbackasm1(SB) + MOVL $1716, CX + JMP callbackasm1(SB) + MOVL $1717, CX + JMP callbackasm1(SB) + MOVL $1718, CX + JMP callbackasm1(SB) + MOVL $1719, CX + JMP callbackasm1(SB) + MOVL $1720, CX + JMP callbackasm1(SB) + MOVL $1721, CX + JMP callbackasm1(SB) + MOVL $1722, CX + JMP callbackasm1(SB) + MOVL $1723, CX + JMP callbackasm1(SB) + MOVL $1724, CX + JMP callbackasm1(SB) + MOVL $1725, CX + JMP callbackasm1(SB) + MOVL $1726, CX + JMP callbackasm1(SB) + MOVL $1727, CX + JMP callbackasm1(SB) + MOVL $1728, CX + JMP callbackasm1(SB) + MOVL $1729, CX + JMP callbackasm1(SB) + MOVL $1730, CX + JMP callbackasm1(SB) + MOVL $1731, CX + JMP callbackasm1(SB) + MOVL $1732, CX + JMP callbackasm1(SB) + MOVL $1733, CX + JMP callbackasm1(SB) + MOVL $1734, CX + JMP callbackasm1(SB) + MOVL $1735, CX + JMP callbackasm1(SB) + MOVL $1736, CX + JMP callbackasm1(SB) + MOVL $1737, CX + JMP callbackasm1(SB) + MOVL $1738, CX + JMP callbackasm1(SB) + MOVL $1739, CX + JMP callbackasm1(SB) + MOVL $1740, CX + JMP callbackasm1(SB) + MOVL $1741, CX + JMP callbackasm1(SB) + MOVL $1742, CX + JMP callbackasm1(SB) + MOVL $1743, CX + JMP callbackasm1(SB) + MOVL $1744, CX + JMP callbackasm1(SB) + MOVL $1745, CX + JMP callbackasm1(SB) + MOVL $1746, CX + JMP callbackasm1(SB) + MOVL $1747, CX + JMP callbackasm1(SB) + MOVL $1748, CX + JMP callbackasm1(SB) + MOVL $1749, CX + JMP callbackasm1(SB) + MOVL $1750, CX + JMP callbackasm1(SB) + MOVL $1751, CX + JMP callbackasm1(SB) + MOVL $1752, CX + JMP callbackasm1(SB) + MOVL $1753, CX + JMP callbackasm1(SB) + MOVL $1754, CX + JMP callbackasm1(SB) + MOVL $1755, CX + JMP callbackasm1(SB) + MOVL $1756, CX + JMP callbackasm1(SB) + MOVL $1757, CX + JMP callbackasm1(SB) + MOVL $1758, CX + JMP callbackasm1(SB) + MOVL $1759, CX + JMP callbackasm1(SB) + MOVL $1760, CX + JMP callbackasm1(SB) + MOVL $1761, CX + JMP callbackasm1(SB) + MOVL $1762, CX + JMP callbackasm1(SB) + MOVL $1763, CX + JMP callbackasm1(SB) + MOVL $1764, CX + JMP callbackasm1(SB) + MOVL $1765, CX + JMP callbackasm1(SB) + MOVL $1766, CX + JMP callbackasm1(SB) + MOVL $1767, CX + JMP callbackasm1(SB) + MOVL $1768, CX + JMP callbackasm1(SB) + MOVL $1769, CX + JMP callbackasm1(SB) + MOVL $1770, CX + JMP callbackasm1(SB) + MOVL $1771, CX + JMP callbackasm1(SB) + MOVL $1772, CX + JMP callbackasm1(SB) + MOVL $1773, CX + JMP callbackasm1(SB) + MOVL $1774, CX + JMP callbackasm1(SB) + MOVL $1775, CX + JMP callbackasm1(SB) + MOVL $1776, CX + JMP callbackasm1(SB) + MOVL $1777, CX + JMP callbackasm1(SB) + MOVL $1778, CX + JMP callbackasm1(SB) + MOVL $1779, CX + JMP callbackasm1(SB) + MOVL $1780, CX + JMP callbackasm1(SB) + MOVL $1781, CX + JMP callbackasm1(SB) + MOVL $1782, CX + JMP callbackasm1(SB) + MOVL $1783, CX + JMP callbackasm1(SB) + MOVL $1784, CX + JMP callbackasm1(SB) + MOVL $1785, CX + JMP callbackasm1(SB) + MOVL $1786, CX + JMP callbackasm1(SB) + MOVL $1787, CX + JMP callbackasm1(SB) + MOVL $1788, CX + JMP callbackasm1(SB) + MOVL $1789, CX + JMP callbackasm1(SB) + MOVL $1790, CX + JMP callbackasm1(SB) + MOVL $1791, CX + JMP callbackasm1(SB) + MOVL $1792, CX + JMP callbackasm1(SB) + MOVL $1793, CX + JMP callbackasm1(SB) + MOVL $1794, CX + JMP callbackasm1(SB) + MOVL $1795, CX + JMP callbackasm1(SB) + MOVL $1796, CX + JMP callbackasm1(SB) + MOVL $1797, CX + JMP callbackasm1(SB) + MOVL $1798, CX + JMP callbackasm1(SB) + MOVL $1799, CX + JMP callbackasm1(SB) + MOVL $1800, CX + JMP callbackasm1(SB) + MOVL $1801, CX + JMP callbackasm1(SB) + MOVL $1802, CX + JMP callbackasm1(SB) + MOVL $1803, CX + JMP callbackasm1(SB) + MOVL $1804, CX + JMP callbackasm1(SB) + MOVL $1805, CX + JMP callbackasm1(SB) + MOVL $1806, CX + JMP callbackasm1(SB) + MOVL $1807, CX + JMP callbackasm1(SB) + MOVL $1808, CX + JMP callbackasm1(SB) + MOVL $1809, CX + JMP callbackasm1(SB) + MOVL $1810, CX + JMP callbackasm1(SB) + MOVL $1811, CX + JMP callbackasm1(SB) + MOVL $1812, CX + JMP callbackasm1(SB) + MOVL $1813, CX + JMP callbackasm1(SB) + MOVL $1814, CX + JMP callbackasm1(SB) + MOVL $1815, CX + JMP callbackasm1(SB) + MOVL $1816, CX + JMP callbackasm1(SB) + MOVL $1817, CX + JMP callbackasm1(SB) + MOVL $1818, CX + JMP callbackasm1(SB) + MOVL $1819, CX + JMP callbackasm1(SB) + MOVL $1820, CX + JMP callbackasm1(SB) + MOVL $1821, CX + JMP callbackasm1(SB) + MOVL $1822, CX + JMP callbackasm1(SB) + MOVL $1823, CX + JMP callbackasm1(SB) + MOVL $1824, CX + JMP callbackasm1(SB) + MOVL $1825, CX + JMP callbackasm1(SB) + MOVL $1826, CX + JMP callbackasm1(SB) + MOVL $1827, CX + JMP callbackasm1(SB) + MOVL $1828, CX + JMP callbackasm1(SB) + MOVL $1829, CX + JMP callbackasm1(SB) + MOVL $1830, CX + JMP callbackasm1(SB) + MOVL $1831, CX + JMP callbackasm1(SB) + MOVL $1832, CX + JMP callbackasm1(SB) + MOVL $1833, CX + JMP callbackasm1(SB) + MOVL $1834, CX + JMP callbackasm1(SB) + MOVL $1835, CX + JMP callbackasm1(SB) + MOVL $1836, CX + JMP callbackasm1(SB) + MOVL $1837, CX + JMP callbackasm1(SB) + MOVL $1838, CX + JMP callbackasm1(SB) + MOVL $1839, CX + JMP callbackasm1(SB) + MOVL $1840, CX + JMP callbackasm1(SB) + MOVL $1841, CX + JMP callbackasm1(SB) + MOVL $1842, CX + JMP callbackasm1(SB) + MOVL $1843, CX + JMP callbackasm1(SB) + MOVL $1844, CX + JMP callbackasm1(SB) + MOVL $1845, CX + JMP callbackasm1(SB) + MOVL $1846, CX + JMP callbackasm1(SB) + MOVL $1847, CX + JMP callbackasm1(SB) + MOVL $1848, CX + JMP callbackasm1(SB) + MOVL $1849, CX + JMP callbackasm1(SB) + MOVL $1850, CX + JMP callbackasm1(SB) + MOVL $1851, CX + JMP callbackasm1(SB) + MOVL $1852, CX + JMP callbackasm1(SB) + MOVL $1853, CX + JMP callbackasm1(SB) + MOVL $1854, CX + JMP callbackasm1(SB) + MOVL $1855, CX + JMP callbackasm1(SB) + MOVL $1856, CX + JMP callbackasm1(SB) + MOVL $1857, CX + JMP callbackasm1(SB) + MOVL $1858, CX + JMP callbackasm1(SB) + MOVL $1859, CX + JMP callbackasm1(SB) + MOVL $1860, CX + JMP callbackasm1(SB) + MOVL $1861, CX + JMP callbackasm1(SB) + MOVL $1862, CX + JMP callbackasm1(SB) + MOVL $1863, CX + JMP callbackasm1(SB) + MOVL $1864, CX + JMP callbackasm1(SB) + MOVL $1865, CX + JMP callbackasm1(SB) + MOVL $1866, CX + JMP callbackasm1(SB) + MOVL $1867, CX + JMP callbackasm1(SB) + MOVL $1868, CX + JMP callbackasm1(SB) + MOVL $1869, CX + JMP callbackasm1(SB) + MOVL $1870, CX + JMP callbackasm1(SB) + MOVL $1871, CX + JMP callbackasm1(SB) + MOVL $1872, CX + JMP callbackasm1(SB) + MOVL $1873, CX + JMP callbackasm1(SB) + MOVL $1874, CX + JMP callbackasm1(SB) + MOVL $1875, CX + JMP callbackasm1(SB) + MOVL $1876, CX + JMP callbackasm1(SB) + MOVL $1877, CX + JMP callbackasm1(SB) + MOVL $1878, CX + JMP callbackasm1(SB) + MOVL $1879, CX + JMP callbackasm1(SB) + MOVL $1880, CX + JMP callbackasm1(SB) + MOVL $1881, CX + JMP callbackasm1(SB) + MOVL $1882, CX + JMP callbackasm1(SB) + MOVL $1883, CX + JMP callbackasm1(SB) + MOVL $1884, CX + JMP callbackasm1(SB) + MOVL $1885, CX + JMP callbackasm1(SB) + MOVL $1886, CX + JMP callbackasm1(SB) + MOVL $1887, CX + JMP callbackasm1(SB) + MOVL $1888, CX + JMP callbackasm1(SB) + MOVL $1889, CX + JMP callbackasm1(SB) + MOVL $1890, CX + JMP callbackasm1(SB) + MOVL $1891, CX + JMP callbackasm1(SB) + MOVL $1892, CX + JMP callbackasm1(SB) + MOVL $1893, CX + JMP callbackasm1(SB) + MOVL $1894, CX + JMP callbackasm1(SB) + MOVL $1895, CX + JMP callbackasm1(SB) + MOVL $1896, CX + JMP callbackasm1(SB) + MOVL $1897, CX + JMP callbackasm1(SB) + MOVL $1898, CX + JMP callbackasm1(SB) + MOVL $1899, CX + JMP callbackasm1(SB) + MOVL $1900, CX + JMP callbackasm1(SB) + MOVL $1901, CX + JMP callbackasm1(SB) + MOVL $1902, CX + JMP callbackasm1(SB) + MOVL $1903, CX + JMP callbackasm1(SB) + MOVL $1904, CX + JMP callbackasm1(SB) + MOVL $1905, CX + JMP callbackasm1(SB) + MOVL $1906, CX + JMP callbackasm1(SB) + MOVL $1907, CX + JMP callbackasm1(SB) + MOVL $1908, CX + JMP callbackasm1(SB) + MOVL $1909, CX + JMP callbackasm1(SB) + MOVL $1910, CX + JMP callbackasm1(SB) + MOVL $1911, CX + JMP callbackasm1(SB) + MOVL $1912, CX + JMP callbackasm1(SB) + MOVL $1913, CX + JMP callbackasm1(SB) + MOVL $1914, CX + JMP callbackasm1(SB) + MOVL $1915, CX + JMP callbackasm1(SB) + MOVL $1916, CX + JMP callbackasm1(SB) + MOVL $1917, CX + JMP callbackasm1(SB) + MOVL $1918, CX + JMP callbackasm1(SB) + MOVL $1919, CX + JMP callbackasm1(SB) + MOVL $1920, CX + JMP callbackasm1(SB) + MOVL $1921, CX + JMP callbackasm1(SB) + MOVL $1922, CX + JMP callbackasm1(SB) + MOVL $1923, CX + JMP callbackasm1(SB) + MOVL $1924, CX + JMP callbackasm1(SB) + MOVL $1925, CX + JMP callbackasm1(SB) + MOVL $1926, CX + JMP callbackasm1(SB) + MOVL $1927, CX + JMP callbackasm1(SB) + MOVL $1928, CX + JMP callbackasm1(SB) + MOVL $1929, CX + JMP callbackasm1(SB) + MOVL $1930, CX + JMP callbackasm1(SB) + MOVL $1931, CX + JMP callbackasm1(SB) + MOVL $1932, CX + JMP callbackasm1(SB) + MOVL $1933, CX + JMP callbackasm1(SB) + MOVL $1934, CX + JMP callbackasm1(SB) + MOVL $1935, CX + JMP callbackasm1(SB) + MOVL $1936, CX + JMP callbackasm1(SB) + MOVL $1937, CX + JMP callbackasm1(SB) + MOVL $1938, CX + JMP callbackasm1(SB) + MOVL $1939, CX + JMP callbackasm1(SB) + MOVL $1940, CX + JMP callbackasm1(SB) + MOVL $1941, CX + JMP callbackasm1(SB) + MOVL $1942, CX + JMP callbackasm1(SB) + MOVL $1943, CX + JMP callbackasm1(SB) + MOVL $1944, CX + JMP callbackasm1(SB) + MOVL $1945, CX + JMP callbackasm1(SB) + MOVL $1946, CX + JMP callbackasm1(SB) + MOVL $1947, CX + JMP callbackasm1(SB) + MOVL $1948, CX + JMP callbackasm1(SB) + MOVL $1949, CX + JMP callbackasm1(SB) + MOVL $1950, CX + JMP callbackasm1(SB) + MOVL $1951, CX + JMP callbackasm1(SB) + MOVL $1952, CX + JMP callbackasm1(SB) + MOVL $1953, CX + JMP callbackasm1(SB) + MOVL $1954, CX + JMP callbackasm1(SB) + MOVL $1955, CX + JMP callbackasm1(SB) + MOVL $1956, CX + JMP callbackasm1(SB) + MOVL $1957, CX + JMP callbackasm1(SB) + MOVL $1958, CX + JMP callbackasm1(SB) + MOVL $1959, CX + JMP callbackasm1(SB) + MOVL $1960, CX + JMP callbackasm1(SB) + MOVL $1961, CX + JMP callbackasm1(SB) + MOVL $1962, CX + JMP callbackasm1(SB) + MOVL $1963, CX + JMP callbackasm1(SB) + MOVL $1964, CX + JMP callbackasm1(SB) + MOVL $1965, CX + JMP callbackasm1(SB) + MOVL $1966, CX + JMP callbackasm1(SB) + MOVL $1967, CX + JMP callbackasm1(SB) + MOVL $1968, CX + JMP callbackasm1(SB) + MOVL $1969, CX + JMP callbackasm1(SB) + MOVL $1970, CX + JMP callbackasm1(SB) + MOVL $1971, CX + JMP callbackasm1(SB) + MOVL $1972, CX + JMP callbackasm1(SB) + MOVL $1973, CX + JMP callbackasm1(SB) + MOVL $1974, CX + JMP callbackasm1(SB) + MOVL $1975, CX + JMP callbackasm1(SB) + MOVL $1976, CX + JMP callbackasm1(SB) + MOVL $1977, CX + JMP callbackasm1(SB) + MOVL $1978, CX + JMP callbackasm1(SB) + MOVL $1979, CX + JMP callbackasm1(SB) + MOVL $1980, CX + JMP callbackasm1(SB) + MOVL $1981, CX + JMP callbackasm1(SB) + MOVL $1982, CX + JMP callbackasm1(SB) + MOVL $1983, CX + JMP callbackasm1(SB) + MOVL $1984, CX + JMP callbackasm1(SB) + MOVL $1985, CX + JMP callbackasm1(SB) + MOVL $1986, CX + JMP callbackasm1(SB) + MOVL $1987, CX + JMP callbackasm1(SB) + MOVL $1988, CX + JMP callbackasm1(SB) + MOVL $1989, CX + JMP callbackasm1(SB) + MOVL $1990, CX + JMP callbackasm1(SB) + MOVL $1991, CX + JMP callbackasm1(SB) + MOVL $1992, CX + JMP callbackasm1(SB) + MOVL $1993, CX + JMP callbackasm1(SB) + MOVL $1994, CX + JMP callbackasm1(SB) + MOVL $1995, CX + JMP callbackasm1(SB) + MOVL $1996, CX + JMP callbackasm1(SB) + MOVL $1997, CX + JMP callbackasm1(SB) + MOVL $1998, CX + JMP callbackasm1(SB) + MOVL $1999, CX + JMP callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_amd64.s b/vendor/github.com/ebitengine/purego/zcallback_amd64.s new file mode 100644 index 00000000..b2da0225 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_amd64.s @@ -0,0 +1,2014 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build darwin || freebsd || linux || netbsd + +// runtime·callbackasm is called by external code to +// execute Go implemented callback function. It is not +// called from the start, instead runtime·compilecallback +// always returns address into runtime·callbackasm offset +// appropriately so different callbacks start with different +// CALL instruction in runtime·callbackasm. This determines +// which Go callback function is executed later on. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_arm.s b/vendor/github.com/ebitengine/purego/zcallback_arm.s new file mode 100644 index 00000000..d969d81d --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_arm.s @@ -0,0 +1,4014 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build linux + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOVW and B instructions. +// The MOVW instruction loads R12 with the callback index, and the +// B instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R12 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + MOVW $0, R12 + B callbackasm1(SB) + MOVW $1, R12 + B callbackasm1(SB) + MOVW $2, R12 + B callbackasm1(SB) + MOVW $3, R12 + B callbackasm1(SB) + MOVW $4, R12 + B callbackasm1(SB) + MOVW $5, R12 + B callbackasm1(SB) + MOVW $6, R12 + B callbackasm1(SB) + MOVW $7, R12 + B callbackasm1(SB) + MOVW $8, R12 + B callbackasm1(SB) + MOVW $9, R12 + B callbackasm1(SB) + MOVW $10, R12 + B callbackasm1(SB) + MOVW $11, R12 + B callbackasm1(SB) + MOVW $12, R12 + B callbackasm1(SB) + MOVW $13, R12 + B callbackasm1(SB) + MOVW $14, R12 + B callbackasm1(SB) + MOVW $15, R12 + B callbackasm1(SB) + MOVW $16, R12 + B callbackasm1(SB) + MOVW $17, R12 + B callbackasm1(SB) + MOVW $18, R12 + B callbackasm1(SB) + MOVW $19, R12 + B callbackasm1(SB) + MOVW $20, R12 + B callbackasm1(SB) + MOVW $21, R12 + B callbackasm1(SB) + MOVW $22, R12 + B callbackasm1(SB) + MOVW $23, R12 + B callbackasm1(SB) + MOVW $24, R12 + B callbackasm1(SB) + MOVW $25, R12 + B callbackasm1(SB) + MOVW $26, R12 + B callbackasm1(SB) + MOVW $27, R12 + B callbackasm1(SB) + MOVW $28, R12 + B callbackasm1(SB) + MOVW $29, R12 + B callbackasm1(SB) + MOVW $30, R12 + B callbackasm1(SB) + MOVW $31, R12 + B callbackasm1(SB) + MOVW $32, R12 + B callbackasm1(SB) + MOVW $33, R12 + B callbackasm1(SB) + MOVW $34, R12 + B callbackasm1(SB) + MOVW $35, R12 + B callbackasm1(SB) + MOVW $36, R12 + B callbackasm1(SB) + MOVW $37, R12 + B callbackasm1(SB) + MOVW $38, R12 + B callbackasm1(SB) + MOVW $39, R12 + B callbackasm1(SB) + MOVW $40, R12 + B callbackasm1(SB) + MOVW $41, R12 + B callbackasm1(SB) + MOVW $42, R12 + B callbackasm1(SB) + MOVW $43, R12 + B callbackasm1(SB) + MOVW $44, R12 + B callbackasm1(SB) + MOVW $45, R12 + B callbackasm1(SB) + MOVW $46, R12 + B callbackasm1(SB) + MOVW $47, R12 + B callbackasm1(SB) + MOVW $48, R12 + B callbackasm1(SB) + MOVW $49, R12 + B callbackasm1(SB) + MOVW $50, R12 + B callbackasm1(SB) + MOVW $51, R12 + B callbackasm1(SB) + MOVW $52, R12 + B callbackasm1(SB) + MOVW $53, R12 + B callbackasm1(SB) + MOVW $54, R12 + B callbackasm1(SB) + MOVW $55, R12 + B callbackasm1(SB) + MOVW $56, R12 + B callbackasm1(SB) + MOVW $57, R12 + B callbackasm1(SB) + MOVW $58, R12 + B callbackasm1(SB) + MOVW $59, R12 + B callbackasm1(SB) + MOVW $60, R12 + B callbackasm1(SB) + MOVW $61, R12 + B callbackasm1(SB) + MOVW $62, R12 + B callbackasm1(SB) + MOVW $63, R12 + B callbackasm1(SB) + MOVW $64, R12 + B callbackasm1(SB) + MOVW $65, R12 + B callbackasm1(SB) + MOVW $66, R12 + B callbackasm1(SB) + MOVW $67, R12 + B callbackasm1(SB) + MOVW $68, R12 + B callbackasm1(SB) + MOVW $69, R12 + B callbackasm1(SB) + MOVW $70, R12 + B callbackasm1(SB) + MOVW $71, R12 + B callbackasm1(SB) + MOVW $72, R12 + B callbackasm1(SB) + MOVW $73, R12 + B callbackasm1(SB) + MOVW $74, R12 + B callbackasm1(SB) + MOVW $75, R12 + B callbackasm1(SB) + MOVW $76, R12 + B callbackasm1(SB) + MOVW $77, R12 + B callbackasm1(SB) + MOVW $78, R12 + B callbackasm1(SB) + MOVW $79, R12 + B callbackasm1(SB) + MOVW $80, R12 + B callbackasm1(SB) + MOVW $81, R12 + B callbackasm1(SB) + MOVW $82, R12 + B callbackasm1(SB) + MOVW $83, R12 + B callbackasm1(SB) + MOVW $84, R12 + B callbackasm1(SB) + MOVW $85, R12 + B callbackasm1(SB) + MOVW $86, R12 + B callbackasm1(SB) + MOVW $87, R12 + B callbackasm1(SB) + MOVW $88, R12 + B callbackasm1(SB) + MOVW $89, R12 + B callbackasm1(SB) + MOVW $90, R12 + B callbackasm1(SB) + MOVW $91, R12 + B callbackasm1(SB) + MOVW $92, R12 + B callbackasm1(SB) + MOVW $93, R12 + B callbackasm1(SB) + MOVW $94, R12 + B callbackasm1(SB) + MOVW $95, R12 + B callbackasm1(SB) + MOVW $96, R12 + B callbackasm1(SB) + MOVW $97, R12 + B callbackasm1(SB) + MOVW $98, R12 + B callbackasm1(SB) + MOVW $99, R12 + B callbackasm1(SB) + MOVW $100, R12 + B callbackasm1(SB) + MOVW $101, R12 + B callbackasm1(SB) + MOVW $102, R12 + B callbackasm1(SB) + MOVW $103, R12 + B callbackasm1(SB) + MOVW $104, R12 + B callbackasm1(SB) + MOVW $105, R12 + B callbackasm1(SB) + MOVW $106, R12 + B callbackasm1(SB) + MOVW $107, R12 + B callbackasm1(SB) + MOVW $108, R12 + B callbackasm1(SB) + MOVW $109, R12 + B callbackasm1(SB) + MOVW $110, R12 + B callbackasm1(SB) + MOVW $111, R12 + B callbackasm1(SB) + MOVW $112, R12 + B callbackasm1(SB) + MOVW $113, R12 + B callbackasm1(SB) + MOVW $114, R12 + B callbackasm1(SB) + MOVW $115, R12 + B callbackasm1(SB) + MOVW $116, R12 + B callbackasm1(SB) + MOVW $117, R12 + B callbackasm1(SB) + MOVW $118, R12 + B callbackasm1(SB) + MOVW $119, R12 + B callbackasm1(SB) + MOVW $120, R12 + B callbackasm1(SB) + MOVW $121, R12 + B callbackasm1(SB) + MOVW $122, R12 + B callbackasm1(SB) + MOVW $123, R12 + B callbackasm1(SB) + MOVW $124, R12 + B callbackasm1(SB) + MOVW $125, R12 + B callbackasm1(SB) + MOVW $126, R12 + B callbackasm1(SB) + MOVW $127, R12 + B callbackasm1(SB) + MOVW $128, R12 + B callbackasm1(SB) + MOVW $129, R12 + B callbackasm1(SB) + MOVW $130, R12 + B callbackasm1(SB) + MOVW $131, R12 + B callbackasm1(SB) + MOVW $132, R12 + B callbackasm1(SB) + MOVW $133, R12 + B callbackasm1(SB) + MOVW $134, R12 + B callbackasm1(SB) + MOVW $135, R12 + B callbackasm1(SB) + MOVW $136, R12 + B callbackasm1(SB) + MOVW $137, R12 + B callbackasm1(SB) + MOVW $138, R12 + B callbackasm1(SB) + MOVW $139, R12 + B callbackasm1(SB) + MOVW $140, R12 + B callbackasm1(SB) + MOVW $141, R12 + B callbackasm1(SB) + MOVW $142, R12 + B callbackasm1(SB) + MOVW $143, R12 + B callbackasm1(SB) + MOVW $144, R12 + B callbackasm1(SB) + MOVW $145, R12 + B callbackasm1(SB) + MOVW $146, R12 + B callbackasm1(SB) + MOVW $147, R12 + B callbackasm1(SB) + MOVW $148, R12 + B callbackasm1(SB) + MOVW $149, R12 + B callbackasm1(SB) + MOVW $150, R12 + B callbackasm1(SB) + MOVW $151, R12 + B callbackasm1(SB) + MOVW $152, R12 + B callbackasm1(SB) + MOVW $153, R12 + B callbackasm1(SB) + MOVW $154, R12 + B callbackasm1(SB) + MOVW $155, R12 + B callbackasm1(SB) + MOVW $156, R12 + B callbackasm1(SB) + MOVW $157, R12 + B callbackasm1(SB) + MOVW $158, R12 + B callbackasm1(SB) + MOVW $159, R12 + B callbackasm1(SB) + MOVW $160, R12 + B callbackasm1(SB) + MOVW $161, R12 + B callbackasm1(SB) + MOVW $162, R12 + B callbackasm1(SB) + MOVW $163, R12 + B callbackasm1(SB) + MOVW $164, R12 + B callbackasm1(SB) + MOVW $165, R12 + B callbackasm1(SB) + MOVW $166, R12 + B callbackasm1(SB) + MOVW $167, R12 + B callbackasm1(SB) + MOVW $168, R12 + B callbackasm1(SB) + MOVW $169, R12 + B callbackasm1(SB) + MOVW $170, R12 + B callbackasm1(SB) + MOVW $171, R12 + B callbackasm1(SB) + MOVW $172, R12 + B callbackasm1(SB) + MOVW $173, R12 + B callbackasm1(SB) + MOVW $174, R12 + B callbackasm1(SB) + MOVW $175, R12 + B callbackasm1(SB) + MOVW $176, R12 + B callbackasm1(SB) + MOVW $177, R12 + B callbackasm1(SB) + MOVW $178, R12 + B callbackasm1(SB) + MOVW $179, R12 + B callbackasm1(SB) + MOVW $180, R12 + B callbackasm1(SB) + MOVW $181, R12 + B callbackasm1(SB) + MOVW $182, R12 + B callbackasm1(SB) + MOVW $183, R12 + B callbackasm1(SB) + MOVW $184, R12 + B callbackasm1(SB) + MOVW $185, R12 + B callbackasm1(SB) + MOVW $186, R12 + B callbackasm1(SB) + MOVW $187, R12 + B callbackasm1(SB) + MOVW $188, R12 + B callbackasm1(SB) + MOVW $189, R12 + B callbackasm1(SB) + MOVW $190, R12 + B callbackasm1(SB) + MOVW $191, R12 + B callbackasm1(SB) + MOVW $192, R12 + B callbackasm1(SB) + MOVW $193, R12 + B callbackasm1(SB) + MOVW $194, R12 + B callbackasm1(SB) + MOVW $195, R12 + B callbackasm1(SB) + MOVW $196, R12 + B callbackasm1(SB) + MOVW $197, R12 + B callbackasm1(SB) + MOVW $198, R12 + B callbackasm1(SB) + MOVW $199, R12 + B callbackasm1(SB) + MOVW $200, R12 + B callbackasm1(SB) + MOVW $201, R12 + B callbackasm1(SB) + MOVW $202, R12 + B callbackasm1(SB) + MOVW $203, R12 + B callbackasm1(SB) + MOVW $204, R12 + B callbackasm1(SB) + MOVW $205, R12 + B callbackasm1(SB) + MOVW $206, R12 + B callbackasm1(SB) + MOVW $207, R12 + B callbackasm1(SB) + MOVW $208, R12 + B callbackasm1(SB) + MOVW $209, R12 + B callbackasm1(SB) + MOVW $210, R12 + B callbackasm1(SB) + MOVW $211, R12 + B callbackasm1(SB) + MOVW $212, R12 + B callbackasm1(SB) + MOVW $213, R12 + B callbackasm1(SB) + MOVW $214, R12 + B callbackasm1(SB) + MOVW $215, R12 + B callbackasm1(SB) + MOVW $216, R12 + B callbackasm1(SB) + MOVW $217, R12 + B callbackasm1(SB) + MOVW $218, R12 + B callbackasm1(SB) + MOVW $219, R12 + B callbackasm1(SB) + MOVW $220, R12 + B callbackasm1(SB) + MOVW $221, R12 + B callbackasm1(SB) + MOVW $222, R12 + B callbackasm1(SB) + MOVW $223, R12 + B callbackasm1(SB) + MOVW $224, R12 + B callbackasm1(SB) + MOVW $225, R12 + B callbackasm1(SB) + MOVW $226, R12 + B callbackasm1(SB) + MOVW $227, R12 + B callbackasm1(SB) + MOVW $228, R12 + B callbackasm1(SB) + MOVW $229, R12 + B callbackasm1(SB) + MOVW $230, R12 + B callbackasm1(SB) + MOVW $231, R12 + B callbackasm1(SB) + MOVW $232, R12 + B callbackasm1(SB) + MOVW $233, R12 + B callbackasm1(SB) + MOVW $234, R12 + B callbackasm1(SB) + MOVW $235, R12 + B callbackasm1(SB) + MOVW $236, R12 + B callbackasm1(SB) + MOVW $237, R12 + B callbackasm1(SB) + MOVW $238, R12 + B callbackasm1(SB) + MOVW $239, R12 + B callbackasm1(SB) + MOVW $240, R12 + B callbackasm1(SB) + MOVW $241, R12 + B callbackasm1(SB) + MOVW $242, R12 + B callbackasm1(SB) + MOVW $243, R12 + B callbackasm1(SB) + MOVW $244, R12 + B callbackasm1(SB) + MOVW $245, R12 + B callbackasm1(SB) + MOVW $246, R12 + B callbackasm1(SB) + MOVW $247, R12 + B callbackasm1(SB) + MOVW $248, R12 + B callbackasm1(SB) + MOVW $249, R12 + B callbackasm1(SB) + MOVW $250, R12 + B callbackasm1(SB) + MOVW $251, R12 + B callbackasm1(SB) + MOVW $252, R12 + B callbackasm1(SB) + MOVW $253, R12 + B callbackasm1(SB) + MOVW $254, R12 + B callbackasm1(SB) + MOVW $255, R12 + B callbackasm1(SB) + MOVW $256, R12 + B callbackasm1(SB) + MOVW $257, R12 + B callbackasm1(SB) + MOVW $258, R12 + B callbackasm1(SB) + MOVW $259, R12 + B callbackasm1(SB) + MOVW $260, R12 + B callbackasm1(SB) + MOVW $261, R12 + B callbackasm1(SB) + MOVW $262, R12 + B callbackasm1(SB) + MOVW $263, R12 + B callbackasm1(SB) + MOVW $264, R12 + B callbackasm1(SB) + MOVW $265, R12 + B callbackasm1(SB) + MOVW $266, R12 + B callbackasm1(SB) + MOVW $267, R12 + B callbackasm1(SB) + MOVW $268, R12 + B callbackasm1(SB) + MOVW $269, R12 + B callbackasm1(SB) + MOVW $270, R12 + B callbackasm1(SB) + MOVW $271, R12 + B callbackasm1(SB) + MOVW $272, R12 + B callbackasm1(SB) + MOVW $273, R12 + B callbackasm1(SB) + MOVW $274, R12 + B callbackasm1(SB) + MOVW $275, R12 + B callbackasm1(SB) + MOVW $276, R12 + B callbackasm1(SB) + MOVW $277, R12 + B callbackasm1(SB) + MOVW $278, R12 + B callbackasm1(SB) + MOVW $279, R12 + B callbackasm1(SB) + MOVW $280, R12 + B callbackasm1(SB) + MOVW $281, R12 + B callbackasm1(SB) + MOVW $282, R12 + B callbackasm1(SB) + MOVW $283, R12 + B callbackasm1(SB) + MOVW $284, R12 + B callbackasm1(SB) + MOVW $285, R12 + B callbackasm1(SB) + MOVW $286, R12 + B callbackasm1(SB) + MOVW $287, R12 + B callbackasm1(SB) + MOVW $288, R12 + B callbackasm1(SB) + MOVW $289, R12 + B callbackasm1(SB) + MOVW $290, R12 + B callbackasm1(SB) + MOVW $291, R12 + B callbackasm1(SB) + MOVW $292, R12 + B callbackasm1(SB) + MOVW $293, R12 + B callbackasm1(SB) + MOVW $294, R12 + B callbackasm1(SB) + MOVW $295, R12 + B callbackasm1(SB) + MOVW $296, R12 + B callbackasm1(SB) + MOVW $297, R12 + B callbackasm1(SB) + MOVW $298, R12 + B callbackasm1(SB) + MOVW $299, R12 + B callbackasm1(SB) + MOVW $300, R12 + B callbackasm1(SB) + MOVW $301, R12 + B callbackasm1(SB) + MOVW $302, R12 + B callbackasm1(SB) + MOVW $303, R12 + B callbackasm1(SB) + MOVW $304, R12 + B callbackasm1(SB) + MOVW $305, R12 + B callbackasm1(SB) + MOVW $306, R12 + B callbackasm1(SB) + MOVW $307, R12 + B callbackasm1(SB) + MOVW $308, R12 + B callbackasm1(SB) + MOVW $309, R12 + B callbackasm1(SB) + MOVW $310, R12 + B callbackasm1(SB) + MOVW $311, R12 + B callbackasm1(SB) + MOVW $312, R12 + B callbackasm1(SB) + MOVW $313, R12 + B callbackasm1(SB) + MOVW $314, R12 + B callbackasm1(SB) + MOVW $315, R12 + B callbackasm1(SB) + MOVW $316, R12 + B callbackasm1(SB) + MOVW $317, R12 + B callbackasm1(SB) + MOVW $318, R12 + B callbackasm1(SB) + MOVW $319, R12 + B callbackasm1(SB) + MOVW $320, R12 + B callbackasm1(SB) + MOVW $321, R12 + B callbackasm1(SB) + MOVW $322, R12 + B callbackasm1(SB) + MOVW $323, R12 + B callbackasm1(SB) + MOVW $324, R12 + B callbackasm1(SB) + MOVW $325, R12 + B callbackasm1(SB) + MOVW $326, R12 + B callbackasm1(SB) + MOVW $327, R12 + B callbackasm1(SB) + MOVW $328, R12 + B callbackasm1(SB) + MOVW $329, R12 + B callbackasm1(SB) + MOVW $330, R12 + B callbackasm1(SB) + MOVW $331, R12 + B callbackasm1(SB) + MOVW $332, R12 + B callbackasm1(SB) + MOVW $333, R12 + B callbackasm1(SB) + MOVW $334, R12 + B callbackasm1(SB) + MOVW $335, R12 + B callbackasm1(SB) + MOVW $336, R12 + B callbackasm1(SB) + MOVW $337, R12 + B callbackasm1(SB) + MOVW $338, R12 + B callbackasm1(SB) + MOVW $339, R12 + B callbackasm1(SB) + MOVW $340, R12 + B callbackasm1(SB) + MOVW $341, R12 + B callbackasm1(SB) + MOVW $342, R12 + B callbackasm1(SB) + MOVW $343, R12 + B callbackasm1(SB) + MOVW $344, R12 + B callbackasm1(SB) + MOVW $345, R12 + B callbackasm1(SB) + MOVW $346, R12 + B callbackasm1(SB) + MOVW $347, R12 + B callbackasm1(SB) + MOVW $348, R12 + B callbackasm1(SB) + MOVW $349, R12 + B callbackasm1(SB) + MOVW $350, R12 + B callbackasm1(SB) + MOVW $351, R12 + B callbackasm1(SB) + MOVW $352, R12 + B callbackasm1(SB) + MOVW $353, R12 + B callbackasm1(SB) + MOVW $354, R12 + B callbackasm1(SB) + MOVW $355, R12 + B callbackasm1(SB) + MOVW $356, R12 + B callbackasm1(SB) + MOVW $357, R12 + B callbackasm1(SB) + MOVW $358, R12 + B callbackasm1(SB) + MOVW $359, R12 + B callbackasm1(SB) + MOVW $360, R12 + B callbackasm1(SB) + MOVW $361, R12 + B callbackasm1(SB) + MOVW $362, R12 + B callbackasm1(SB) + MOVW $363, R12 + B callbackasm1(SB) + MOVW $364, R12 + B callbackasm1(SB) + MOVW $365, R12 + B callbackasm1(SB) + MOVW $366, R12 + B callbackasm1(SB) + MOVW $367, R12 + B callbackasm1(SB) + MOVW $368, R12 + B callbackasm1(SB) + MOVW $369, R12 + B callbackasm1(SB) + MOVW $370, R12 + B callbackasm1(SB) + MOVW $371, R12 + B callbackasm1(SB) + MOVW $372, R12 + B callbackasm1(SB) + MOVW $373, R12 + B callbackasm1(SB) + MOVW $374, R12 + B callbackasm1(SB) + MOVW $375, R12 + B callbackasm1(SB) + MOVW $376, R12 + B callbackasm1(SB) + MOVW $377, R12 + B callbackasm1(SB) + MOVW $378, R12 + B callbackasm1(SB) + MOVW $379, R12 + B callbackasm1(SB) + MOVW $380, R12 + B callbackasm1(SB) + MOVW $381, R12 + B callbackasm1(SB) + MOVW $382, R12 + B callbackasm1(SB) + MOVW $383, R12 + B callbackasm1(SB) + MOVW $384, R12 + B callbackasm1(SB) + MOVW $385, R12 + B callbackasm1(SB) + MOVW $386, R12 + B callbackasm1(SB) + MOVW $387, R12 + B callbackasm1(SB) + MOVW $388, R12 + B callbackasm1(SB) + MOVW $389, R12 + B callbackasm1(SB) + MOVW $390, R12 + B callbackasm1(SB) + MOVW $391, R12 + B callbackasm1(SB) + MOVW $392, R12 + B callbackasm1(SB) + MOVW $393, R12 + B callbackasm1(SB) + MOVW $394, R12 + B callbackasm1(SB) + MOVW $395, R12 + B callbackasm1(SB) + MOVW $396, R12 + B callbackasm1(SB) + MOVW $397, R12 + B callbackasm1(SB) + MOVW $398, R12 + B callbackasm1(SB) + MOVW $399, R12 + B callbackasm1(SB) + MOVW $400, R12 + B callbackasm1(SB) + MOVW $401, R12 + B callbackasm1(SB) + MOVW $402, R12 + B callbackasm1(SB) + MOVW $403, R12 + B callbackasm1(SB) + MOVW $404, R12 + B callbackasm1(SB) + MOVW $405, R12 + B callbackasm1(SB) + MOVW $406, R12 + B callbackasm1(SB) + MOVW $407, R12 + B callbackasm1(SB) + MOVW $408, R12 + B callbackasm1(SB) + MOVW $409, R12 + B callbackasm1(SB) + MOVW $410, R12 + B callbackasm1(SB) + MOVW $411, R12 + B callbackasm1(SB) + MOVW $412, R12 + B callbackasm1(SB) + MOVW $413, R12 + B callbackasm1(SB) + MOVW $414, R12 + B callbackasm1(SB) + MOVW $415, R12 + B callbackasm1(SB) + MOVW $416, R12 + B callbackasm1(SB) + MOVW $417, R12 + B callbackasm1(SB) + MOVW $418, R12 + B callbackasm1(SB) + MOVW $419, R12 + B callbackasm1(SB) + MOVW $420, R12 + B callbackasm1(SB) + MOVW $421, R12 + B callbackasm1(SB) + MOVW $422, R12 + B callbackasm1(SB) + MOVW $423, R12 + B callbackasm1(SB) + MOVW $424, R12 + B callbackasm1(SB) + MOVW $425, R12 + B callbackasm1(SB) + MOVW $426, R12 + B callbackasm1(SB) + MOVW $427, R12 + B callbackasm1(SB) + MOVW $428, R12 + B callbackasm1(SB) + MOVW $429, R12 + B callbackasm1(SB) + MOVW $430, R12 + B callbackasm1(SB) + MOVW $431, R12 + B callbackasm1(SB) + MOVW $432, R12 + B callbackasm1(SB) + MOVW $433, R12 + B callbackasm1(SB) + MOVW $434, R12 + B callbackasm1(SB) + MOVW $435, R12 + B callbackasm1(SB) + MOVW $436, R12 + B callbackasm1(SB) + MOVW $437, R12 + B callbackasm1(SB) + MOVW $438, R12 + B callbackasm1(SB) + MOVW $439, R12 + B callbackasm1(SB) + MOVW $440, R12 + B callbackasm1(SB) + MOVW $441, R12 + B callbackasm1(SB) + MOVW $442, R12 + B callbackasm1(SB) + MOVW $443, R12 + B callbackasm1(SB) + MOVW $444, R12 + B callbackasm1(SB) + MOVW $445, R12 + B callbackasm1(SB) + MOVW $446, R12 + B callbackasm1(SB) + MOVW $447, R12 + B callbackasm1(SB) + MOVW $448, R12 + B callbackasm1(SB) + MOVW $449, R12 + B callbackasm1(SB) + MOVW $450, R12 + B callbackasm1(SB) + MOVW $451, R12 + B callbackasm1(SB) + MOVW $452, R12 + B callbackasm1(SB) + MOVW $453, R12 + B callbackasm1(SB) + MOVW $454, R12 + B callbackasm1(SB) + MOVW $455, R12 + B callbackasm1(SB) + MOVW $456, R12 + B callbackasm1(SB) + MOVW $457, R12 + B callbackasm1(SB) + MOVW $458, R12 + B callbackasm1(SB) + MOVW $459, R12 + B callbackasm1(SB) + MOVW $460, R12 + B callbackasm1(SB) + MOVW $461, R12 + B callbackasm1(SB) + MOVW $462, R12 + B callbackasm1(SB) + MOVW $463, R12 + B callbackasm1(SB) + MOVW $464, R12 + B callbackasm1(SB) + MOVW $465, R12 + B callbackasm1(SB) + MOVW $466, R12 + B callbackasm1(SB) + MOVW $467, R12 + B callbackasm1(SB) + MOVW $468, R12 + B callbackasm1(SB) + MOVW $469, R12 + B callbackasm1(SB) + MOVW $470, R12 + B callbackasm1(SB) + MOVW $471, R12 + B callbackasm1(SB) + MOVW $472, R12 + B callbackasm1(SB) + MOVW $473, R12 + B callbackasm1(SB) + MOVW $474, R12 + B callbackasm1(SB) + MOVW $475, R12 + B callbackasm1(SB) + MOVW $476, R12 + B callbackasm1(SB) + MOVW $477, R12 + B callbackasm1(SB) + MOVW $478, R12 + B callbackasm1(SB) + MOVW $479, R12 + B callbackasm1(SB) + MOVW $480, R12 + B callbackasm1(SB) + MOVW $481, R12 + B callbackasm1(SB) + MOVW $482, R12 + B callbackasm1(SB) + MOVW $483, R12 + B callbackasm1(SB) + MOVW $484, R12 + B callbackasm1(SB) + MOVW $485, R12 + B callbackasm1(SB) + MOVW $486, R12 + B callbackasm1(SB) + MOVW $487, R12 + B callbackasm1(SB) + MOVW $488, R12 + B callbackasm1(SB) + MOVW $489, R12 + B callbackasm1(SB) + MOVW $490, R12 + B callbackasm1(SB) + MOVW $491, R12 + B callbackasm1(SB) + MOVW $492, R12 + B callbackasm1(SB) + MOVW $493, R12 + B callbackasm1(SB) + MOVW $494, R12 + B callbackasm1(SB) + MOVW $495, R12 + B callbackasm1(SB) + MOVW $496, R12 + B callbackasm1(SB) + MOVW $497, R12 + B callbackasm1(SB) + MOVW $498, R12 + B callbackasm1(SB) + MOVW $499, R12 + B callbackasm1(SB) + MOVW $500, R12 + B callbackasm1(SB) + MOVW $501, R12 + B callbackasm1(SB) + MOVW $502, R12 + B callbackasm1(SB) + MOVW $503, R12 + B callbackasm1(SB) + MOVW $504, R12 + B callbackasm1(SB) + MOVW $505, R12 + B callbackasm1(SB) + MOVW $506, R12 + B callbackasm1(SB) + MOVW $507, R12 + B callbackasm1(SB) + MOVW $508, R12 + B callbackasm1(SB) + MOVW $509, R12 + B callbackasm1(SB) + MOVW $510, R12 + B callbackasm1(SB) + MOVW $511, R12 + B callbackasm1(SB) + MOVW $512, R12 + B callbackasm1(SB) + MOVW $513, R12 + B callbackasm1(SB) + MOVW $514, R12 + B callbackasm1(SB) + MOVW $515, R12 + B callbackasm1(SB) + MOVW $516, R12 + B callbackasm1(SB) + MOVW $517, R12 + B callbackasm1(SB) + MOVW $518, R12 + B callbackasm1(SB) + MOVW $519, R12 + B callbackasm1(SB) + MOVW $520, R12 + B callbackasm1(SB) + MOVW $521, R12 + B callbackasm1(SB) + MOVW $522, R12 + B callbackasm1(SB) + MOVW $523, R12 + B callbackasm1(SB) + MOVW $524, R12 + B callbackasm1(SB) + MOVW $525, R12 + B callbackasm1(SB) + MOVW $526, R12 + B callbackasm1(SB) + MOVW $527, R12 + B callbackasm1(SB) + MOVW $528, R12 + B callbackasm1(SB) + MOVW $529, R12 + B callbackasm1(SB) + MOVW $530, R12 + B callbackasm1(SB) + MOVW $531, R12 + B callbackasm1(SB) + MOVW $532, R12 + B callbackasm1(SB) + MOVW $533, R12 + B callbackasm1(SB) + MOVW $534, R12 + B callbackasm1(SB) + MOVW $535, R12 + B callbackasm1(SB) + MOVW $536, R12 + B callbackasm1(SB) + MOVW $537, R12 + B callbackasm1(SB) + MOVW $538, R12 + B callbackasm1(SB) + MOVW $539, R12 + B callbackasm1(SB) + MOVW $540, R12 + B callbackasm1(SB) + MOVW $541, R12 + B callbackasm1(SB) + MOVW $542, R12 + B callbackasm1(SB) + MOVW $543, R12 + B callbackasm1(SB) + MOVW $544, R12 + B callbackasm1(SB) + MOVW $545, R12 + B callbackasm1(SB) + MOVW $546, R12 + B callbackasm1(SB) + MOVW $547, R12 + B callbackasm1(SB) + MOVW $548, R12 + B callbackasm1(SB) + MOVW $549, R12 + B callbackasm1(SB) + MOVW $550, R12 + B callbackasm1(SB) + MOVW $551, R12 + B callbackasm1(SB) + MOVW $552, R12 + B callbackasm1(SB) + MOVW $553, R12 + B callbackasm1(SB) + MOVW $554, R12 + B callbackasm1(SB) + MOVW $555, R12 + B callbackasm1(SB) + MOVW $556, R12 + B callbackasm1(SB) + MOVW $557, R12 + B callbackasm1(SB) + MOVW $558, R12 + B callbackasm1(SB) + MOVW $559, R12 + B callbackasm1(SB) + MOVW $560, R12 + B callbackasm1(SB) + MOVW $561, R12 + B callbackasm1(SB) + MOVW $562, R12 + B callbackasm1(SB) + MOVW $563, R12 + B callbackasm1(SB) + MOVW $564, R12 + B callbackasm1(SB) + MOVW $565, R12 + B callbackasm1(SB) + MOVW $566, R12 + B callbackasm1(SB) + MOVW $567, R12 + B callbackasm1(SB) + MOVW $568, R12 + B callbackasm1(SB) + MOVW $569, R12 + B callbackasm1(SB) + MOVW $570, R12 + B callbackasm1(SB) + MOVW $571, R12 + B callbackasm1(SB) + MOVW $572, R12 + B callbackasm1(SB) + MOVW $573, R12 + B callbackasm1(SB) + MOVW $574, R12 + B callbackasm1(SB) + MOVW $575, R12 + B callbackasm1(SB) + MOVW $576, R12 + B callbackasm1(SB) + MOVW $577, R12 + B callbackasm1(SB) + MOVW $578, R12 + B callbackasm1(SB) + MOVW $579, R12 + B callbackasm1(SB) + MOVW $580, R12 + B callbackasm1(SB) + MOVW $581, R12 + B callbackasm1(SB) + MOVW $582, R12 + B callbackasm1(SB) + MOVW $583, R12 + B callbackasm1(SB) + MOVW $584, R12 + B callbackasm1(SB) + MOVW $585, R12 + B callbackasm1(SB) + MOVW $586, R12 + B callbackasm1(SB) + MOVW $587, R12 + B callbackasm1(SB) + MOVW $588, R12 + B callbackasm1(SB) + MOVW $589, R12 + B callbackasm1(SB) + MOVW $590, R12 + B callbackasm1(SB) + MOVW $591, R12 + B callbackasm1(SB) + MOVW $592, R12 + B callbackasm1(SB) + MOVW $593, R12 + B callbackasm1(SB) + MOVW $594, R12 + B callbackasm1(SB) + MOVW $595, R12 + B callbackasm1(SB) + MOVW $596, R12 + B callbackasm1(SB) + MOVW $597, R12 + B callbackasm1(SB) + MOVW $598, R12 + B callbackasm1(SB) + MOVW $599, R12 + B callbackasm1(SB) + MOVW $600, R12 + B callbackasm1(SB) + MOVW $601, R12 + B callbackasm1(SB) + MOVW $602, R12 + B callbackasm1(SB) + MOVW $603, R12 + B callbackasm1(SB) + MOVW $604, R12 + B callbackasm1(SB) + MOVW $605, R12 + B callbackasm1(SB) + MOVW $606, R12 + B callbackasm1(SB) + MOVW $607, R12 + B callbackasm1(SB) + MOVW $608, R12 + B callbackasm1(SB) + MOVW $609, R12 + B callbackasm1(SB) + MOVW $610, R12 + B callbackasm1(SB) + MOVW $611, R12 + B callbackasm1(SB) + MOVW $612, R12 + B callbackasm1(SB) + MOVW $613, R12 + B callbackasm1(SB) + MOVW $614, R12 + B callbackasm1(SB) + MOVW $615, R12 + B callbackasm1(SB) + MOVW $616, R12 + B callbackasm1(SB) + MOVW $617, R12 + B callbackasm1(SB) + MOVW $618, R12 + B callbackasm1(SB) + MOVW $619, R12 + B callbackasm1(SB) + MOVW $620, R12 + B callbackasm1(SB) + MOVW $621, R12 + B callbackasm1(SB) + MOVW $622, R12 + B callbackasm1(SB) + MOVW $623, R12 + B callbackasm1(SB) + MOVW $624, R12 + B callbackasm1(SB) + MOVW $625, R12 + B callbackasm1(SB) + MOVW $626, R12 + B callbackasm1(SB) + MOVW $627, R12 + B callbackasm1(SB) + MOVW $628, R12 + B callbackasm1(SB) + MOVW $629, R12 + B callbackasm1(SB) + MOVW $630, R12 + B callbackasm1(SB) + MOVW $631, R12 + B callbackasm1(SB) + MOVW $632, R12 + B callbackasm1(SB) + MOVW $633, R12 + B callbackasm1(SB) + MOVW $634, R12 + B callbackasm1(SB) + MOVW $635, R12 + B callbackasm1(SB) + MOVW $636, R12 + B callbackasm1(SB) + MOVW $637, R12 + B callbackasm1(SB) + MOVW $638, R12 + B callbackasm1(SB) + MOVW $639, R12 + B callbackasm1(SB) + MOVW $640, R12 + B callbackasm1(SB) + MOVW $641, R12 + B callbackasm1(SB) + MOVW $642, R12 + B callbackasm1(SB) + MOVW $643, R12 + B callbackasm1(SB) + MOVW $644, R12 + B callbackasm1(SB) + MOVW $645, R12 + B callbackasm1(SB) + MOVW $646, R12 + B callbackasm1(SB) + MOVW $647, R12 + B callbackasm1(SB) + MOVW $648, R12 + B callbackasm1(SB) + MOVW $649, R12 + B callbackasm1(SB) + MOVW $650, R12 + B callbackasm1(SB) + MOVW $651, R12 + B callbackasm1(SB) + MOVW $652, R12 + B callbackasm1(SB) + MOVW $653, R12 + B callbackasm1(SB) + MOVW $654, R12 + B callbackasm1(SB) + MOVW $655, R12 + B callbackasm1(SB) + MOVW $656, R12 + B callbackasm1(SB) + MOVW $657, R12 + B callbackasm1(SB) + MOVW $658, R12 + B callbackasm1(SB) + MOVW $659, R12 + B callbackasm1(SB) + MOVW $660, R12 + B callbackasm1(SB) + MOVW $661, R12 + B callbackasm1(SB) + MOVW $662, R12 + B callbackasm1(SB) + MOVW $663, R12 + B callbackasm1(SB) + MOVW $664, R12 + B callbackasm1(SB) + MOVW $665, R12 + B callbackasm1(SB) + MOVW $666, R12 + B callbackasm1(SB) + MOVW $667, R12 + B callbackasm1(SB) + MOVW $668, R12 + B callbackasm1(SB) + MOVW $669, R12 + B callbackasm1(SB) + MOVW $670, R12 + B callbackasm1(SB) + MOVW $671, R12 + B callbackasm1(SB) + MOVW $672, R12 + B callbackasm1(SB) + MOVW $673, R12 + B callbackasm1(SB) + MOVW $674, R12 + B callbackasm1(SB) + MOVW $675, R12 + B callbackasm1(SB) + MOVW $676, R12 + B callbackasm1(SB) + MOVW $677, R12 + B callbackasm1(SB) + MOVW $678, R12 + B callbackasm1(SB) + MOVW $679, R12 + B callbackasm1(SB) + MOVW $680, R12 + B callbackasm1(SB) + MOVW $681, R12 + B callbackasm1(SB) + MOVW $682, R12 + B callbackasm1(SB) + MOVW $683, R12 + B callbackasm1(SB) + MOVW $684, R12 + B callbackasm1(SB) + MOVW $685, R12 + B callbackasm1(SB) + MOVW $686, R12 + B callbackasm1(SB) + MOVW $687, R12 + B callbackasm1(SB) + MOVW $688, R12 + B callbackasm1(SB) + MOVW $689, R12 + B callbackasm1(SB) + MOVW $690, R12 + B callbackasm1(SB) + MOVW $691, R12 + B callbackasm1(SB) + MOVW $692, R12 + B callbackasm1(SB) + MOVW $693, R12 + B callbackasm1(SB) + MOVW $694, R12 + B callbackasm1(SB) + MOVW $695, R12 + B callbackasm1(SB) + MOVW $696, R12 + B callbackasm1(SB) + MOVW $697, R12 + B callbackasm1(SB) + MOVW $698, R12 + B callbackasm1(SB) + MOVW $699, R12 + B callbackasm1(SB) + MOVW $700, R12 + B callbackasm1(SB) + MOVW $701, R12 + B callbackasm1(SB) + MOVW $702, R12 + B callbackasm1(SB) + MOVW $703, R12 + B callbackasm1(SB) + MOVW $704, R12 + B callbackasm1(SB) + MOVW $705, R12 + B callbackasm1(SB) + MOVW $706, R12 + B callbackasm1(SB) + MOVW $707, R12 + B callbackasm1(SB) + MOVW $708, R12 + B callbackasm1(SB) + MOVW $709, R12 + B callbackasm1(SB) + MOVW $710, R12 + B callbackasm1(SB) + MOVW $711, R12 + B callbackasm1(SB) + MOVW $712, R12 + B callbackasm1(SB) + MOVW $713, R12 + B callbackasm1(SB) + MOVW $714, R12 + B callbackasm1(SB) + MOVW $715, R12 + B callbackasm1(SB) + MOVW $716, R12 + B callbackasm1(SB) + MOVW $717, R12 + B callbackasm1(SB) + MOVW $718, R12 + B callbackasm1(SB) + MOVW $719, R12 + B callbackasm1(SB) + MOVW $720, R12 + B callbackasm1(SB) + MOVW $721, R12 + B callbackasm1(SB) + MOVW $722, R12 + B callbackasm1(SB) + MOVW $723, R12 + B callbackasm1(SB) + MOVW $724, R12 + B callbackasm1(SB) + MOVW $725, R12 + B callbackasm1(SB) + MOVW $726, R12 + B callbackasm1(SB) + MOVW $727, R12 + B callbackasm1(SB) + MOVW $728, R12 + B callbackasm1(SB) + MOVW $729, R12 + B callbackasm1(SB) + MOVW $730, R12 + B callbackasm1(SB) + MOVW $731, R12 + B callbackasm1(SB) + MOVW $732, R12 + B callbackasm1(SB) + MOVW $733, R12 + B callbackasm1(SB) + MOVW $734, R12 + B callbackasm1(SB) + MOVW $735, R12 + B callbackasm1(SB) + MOVW $736, R12 + B callbackasm1(SB) + MOVW $737, R12 + B callbackasm1(SB) + MOVW $738, R12 + B callbackasm1(SB) + MOVW $739, R12 + B callbackasm1(SB) + MOVW $740, R12 + B callbackasm1(SB) + MOVW $741, R12 + B callbackasm1(SB) + MOVW $742, R12 + B callbackasm1(SB) + MOVW $743, R12 + B callbackasm1(SB) + MOVW $744, R12 + B callbackasm1(SB) + MOVW $745, R12 + B callbackasm1(SB) + MOVW $746, R12 + B callbackasm1(SB) + MOVW $747, R12 + B callbackasm1(SB) + MOVW $748, R12 + B callbackasm1(SB) + MOVW $749, R12 + B callbackasm1(SB) + MOVW $750, R12 + B callbackasm1(SB) + MOVW $751, R12 + B callbackasm1(SB) + MOVW $752, R12 + B callbackasm1(SB) + MOVW $753, R12 + B callbackasm1(SB) + MOVW $754, R12 + B callbackasm1(SB) + MOVW $755, R12 + B callbackasm1(SB) + MOVW $756, R12 + B callbackasm1(SB) + MOVW $757, R12 + B callbackasm1(SB) + MOVW $758, R12 + B callbackasm1(SB) + MOVW $759, R12 + B callbackasm1(SB) + MOVW $760, R12 + B callbackasm1(SB) + MOVW $761, R12 + B callbackasm1(SB) + MOVW $762, R12 + B callbackasm1(SB) + MOVW $763, R12 + B callbackasm1(SB) + MOVW $764, R12 + B callbackasm1(SB) + MOVW $765, R12 + B callbackasm1(SB) + MOVW $766, R12 + B callbackasm1(SB) + MOVW $767, R12 + B callbackasm1(SB) + MOVW $768, R12 + B callbackasm1(SB) + MOVW $769, R12 + B callbackasm1(SB) + MOVW $770, R12 + B callbackasm1(SB) + MOVW $771, R12 + B callbackasm1(SB) + MOVW $772, R12 + B callbackasm1(SB) + MOVW $773, R12 + B callbackasm1(SB) + MOVW $774, R12 + B callbackasm1(SB) + MOVW $775, R12 + B callbackasm1(SB) + MOVW $776, R12 + B callbackasm1(SB) + MOVW $777, R12 + B callbackasm1(SB) + MOVW $778, R12 + B callbackasm1(SB) + MOVW $779, R12 + B callbackasm1(SB) + MOVW $780, R12 + B callbackasm1(SB) + MOVW $781, R12 + B callbackasm1(SB) + MOVW $782, R12 + B callbackasm1(SB) + MOVW $783, R12 + B callbackasm1(SB) + MOVW $784, R12 + B callbackasm1(SB) + MOVW $785, R12 + B callbackasm1(SB) + MOVW $786, R12 + B callbackasm1(SB) + MOVW $787, R12 + B callbackasm1(SB) + MOVW $788, R12 + B callbackasm1(SB) + MOVW $789, R12 + B callbackasm1(SB) + MOVW $790, R12 + B callbackasm1(SB) + MOVW $791, R12 + B callbackasm1(SB) + MOVW $792, R12 + B callbackasm1(SB) + MOVW $793, R12 + B callbackasm1(SB) + MOVW $794, R12 + B callbackasm1(SB) + MOVW $795, R12 + B callbackasm1(SB) + MOVW $796, R12 + B callbackasm1(SB) + MOVW $797, R12 + B callbackasm1(SB) + MOVW $798, R12 + B callbackasm1(SB) + MOVW $799, R12 + B callbackasm1(SB) + MOVW $800, R12 + B callbackasm1(SB) + MOVW $801, R12 + B callbackasm1(SB) + MOVW $802, R12 + B callbackasm1(SB) + MOVW $803, R12 + B callbackasm1(SB) + MOVW $804, R12 + B callbackasm1(SB) + MOVW $805, R12 + B callbackasm1(SB) + MOVW $806, R12 + B callbackasm1(SB) + MOVW $807, R12 + B callbackasm1(SB) + MOVW $808, R12 + B callbackasm1(SB) + MOVW $809, R12 + B callbackasm1(SB) + MOVW $810, R12 + B callbackasm1(SB) + MOVW $811, R12 + B callbackasm1(SB) + MOVW $812, R12 + B callbackasm1(SB) + MOVW $813, R12 + B callbackasm1(SB) + MOVW $814, R12 + B callbackasm1(SB) + MOVW $815, R12 + B callbackasm1(SB) + MOVW $816, R12 + B callbackasm1(SB) + MOVW $817, R12 + B callbackasm1(SB) + MOVW $818, R12 + B callbackasm1(SB) + MOVW $819, R12 + B callbackasm1(SB) + MOVW $820, R12 + B callbackasm1(SB) + MOVW $821, R12 + B callbackasm1(SB) + MOVW $822, R12 + B callbackasm1(SB) + MOVW $823, R12 + B callbackasm1(SB) + MOVW $824, R12 + B callbackasm1(SB) + MOVW $825, R12 + B callbackasm1(SB) + MOVW $826, R12 + B callbackasm1(SB) + MOVW $827, R12 + B callbackasm1(SB) + MOVW $828, R12 + B callbackasm1(SB) + MOVW $829, R12 + B callbackasm1(SB) + MOVW $830, R12 + B callbackasm1(SB) + MOVW $831, R12 + B callbackasm1(SB) + MOVW $832, R12 + B callbackasm1(SB) + MOVW $833, R12 + B callbackasm1(SB) + MOVW $834, R12 + B callbackasm1(SB) + MOVW $835, R12 + B callbackasm1(SB) + MOVW $836, R12 + B callbackasm1(SB) + MOVW $837, R12 + B callbackasm1(SB) + MOVW $838, R12 + B callbackasm1(SB) + MOVW $839, R12 + B callbackasm1(SB) + MOVW $840, R12 + B callbackasm1(SB) + MOVW $841, R12 + B callbackasm1(SB) + MOVW $842, R12 + B callbackasm1(SB) + MOVW $843, R12 + B callbackasm1(SB) + MOVW $844, R12 + B callbackasm1(SB) + MOVW $845, R12 + B callbackasm1(SB) + MOVW $846, R12 + B callbackasm1(SB) + MOVW $847, R12 + B callbackasm1(SB) + MOVW $848, R12 + B callbackasm1(SB) + MOVW $849, R12 + B callbackasm1(SB) + MOVW $850, R12 + B callbackasm1(SB) + MOVW $851, R12 + B callbackasm1(SB) + MOVW $852, R12 + B callbackasm1(SB) + MOVW $853, R12 + B callbackasm1(SB) + MOVW $854, R12 + B callbackasm1(SB) + MOVW $855, R12 + B callbackasm1(SB) + MOVW $856, R12 + B callbackasm1(SB) + MOVW $857, R12 + B callbackasm1(SB) + MOVW $858, R12 + B callbackasm1(SB) + MOVW $859, R12 + B callbackasm1(SB) + MOVW $860, R12 + B callbackasm1(SB) + MOVW $861, R12 + B callbackasm1(SB) + MOVW $862, R12 + B callbackasm1(SB) + MOVW $863, R12 + B callbackasm1(SB) + MOVW $864, R12 + B callbackasm1(SB) + MOVW $865, R12 + B callbackasm1(SB) + MOVW $866, R12 + B callbackasm1(SB) + MOVW $867, R12 + B callbackasm1(SB) + MOVW $868, R12 + B callbackasm1(SB) + MOVW $869, R12 + B callbackasm1(SB) + MOVW $870, R12 + B callbackasm1(SB) + MOVW $871, R12 + B callbackasm1(SB) + MOVW $872, R12 + B callbackasm1(SB) + MOVW $873, R12 + B callbackasm1(SB) + MOVW $874, R12 + B callbackasm1(SB) + MOVW $875, R12 + B callbackasm1(SB) + MOVW $876, R12 + B callbackasm1(SB) + MOVW $877, R12 + B callbackasm1(SB) + MOVW $878, R12 + B callbackasm1(SB) + MOVW $879, R12 + B callbackasm1(SB) + MOVW $880, R12 + B callbackasm1(SB) + MOVW $881, R12 + B callbackasm1(SB) + MOVW $882, R12 + B callbackasm1(SB) + MOVW $883, R12 + B callbackasm1(SB) + MOVW $884, R12 + B callbackasm1(SB) + MOVW $885, R12 + B callbackasm1(SB) + MOVW $886, R12 + B callbackasm1(SB) + MOVW $887, R12 + B callbackasm1(SB) + MOVW $888, R12 + B callbackasm1(SB) + MOVW $889, R12 + B callbackasm1(SB) + MOVW $890, R12 + B callbackasm1(SB) + MOVW $891, R12 + B callbackasm1(SB) + MOVW $892, R12 + B callbackasm1(SB) + MOVW $893, R12 + B callbackasm1(SB) + MOVW $894, R12 + B callbackasm1(SB) + MOVW $895, R12 + B callbackasm1(SB) + MOVW $896, R12 + B callbackasm1(SB) + MOVW $897, R12 + B callbackasm1(SB) + MOVW $898, R12 + B callbackasm1(SB) + MOVW $899, R12 + B callbackasm1(SB) + MOVW $900, R12 + B callbackasm1(SB) + MOVW $901, R12 + B callbackasm1(SB) + MOVW $902, R12 + B callbackasm1(SB) + MOVW $903, R12 + B callbackasm1(SB) + MOVW $904, R12 + B callbackasm1(SB) + MOVW $905, R12 + B callbackasm1(SB) + MOVW $906, R12 + B callbackasm1(SB) + MOVW $907, R12 + B callbackasm1(SB) + MOVW $908, R12 + B callbackasm1(SB) + MOVW $909, R12 + B callbackasm1(SB) + MOVW $910, R12 + B callbackasm1(SB) + MOVW $911, R12 + B callbackasm1(SB) + MOVW $912, R12 + B callbackasm1(SB) + MOVW $913, R12 + B callbackasm1(SB) + MOVW $914, R12 + B callbackasm1(SB) + MOVW $915, R12 + B callbackasm1(SB) + MOVW $916, R12 + B callbackasm1(SB) + MOVW $917, R12 + B callbackasm1(SB) + MOVW $918, R12 + B callbackasm1(SB) + MOVW $919, R12 + B callbackasm1(SB) + MOVW $920, R12 + B callbackasm1(SB) + MOVW $921, R12 + B callbackasm1(SB) + MOVW $922, R12 + B callbackasm1(SB) + MOVW $923, R12 + B callbackasm1(SB) + MOVW $924, R12 + B callbackasm1(SB) + MOVW $925, R12 + B callbackasm1(SB) + MOVW $926, R12 + B callbackasm1(SB) + MOVW $927, R12 + B callbackasm1(SB) + MOVW $928, R12 + B callbackasm1(SB) + MOVW $929, R12 + B callbackasm1(SB) + MOVW $930, R12 + B callbackasm1(SB) + MOVW $931, R12 + B callbackasm1(SB) + MOVW $932, R12 + B callbackasm1(SB) + MOVW $933, R12 + B callbackasm1(SB) + MOVW $934, R12 + B callbackasm1(SB) + MOVW $935, R12 + B callbackasm1(SB) + MOVW $936, R12 + B callbackasm1(SB) + MOVW $937, R12 + B callbackasm1(SB) + MOVW $938, R12 + B callbackasm1(SB) + MOVW $939, R12 + B callbackasm1(SB) + MOVW $940, R12 + B callbackasm1(SB) + MOVW $941, R12 + B callbackasm1(SB) + MOVW $942, R12 + B callbackasm1(SB) + MOVW $943, R12 + B callbackasm1(SB) + MOVW $944, R12 + B callbackasm1(SB) + MOVW $945, R12 + B callbackasm1(SB) + MOVW $946, R12 + B callbackasm1(SB) + MOVW $947, R12 + B callbackasm1(SB) + MOVW $948, R12 + B callbackasm1(SB) + MOVW $949, R12 + B callbackasm1(SB) + MOVW $950, R12 + B callbackasm1(SB) + MOVW $951, R12 + B callbackasm1(SB) + MOVW $952, R12 + B callbackasm1(SB) + MOVW $953, R12 + B callbackasm1(SB) + MOVW $954, R12 + B callbackasm1(SB) + MOVW $955, R12 + B callbackasm1(SB) + MOVW $956, R12 + B callbackasm1(SB) + MOVW $957, R12 + B callbackasm1(SB) + MOVW $958, R12 + B callbackasm1(SB) + MOVW $959, R12 + B callbackasm1(SB) + MOVW $960, R12 + B callbackasm1(SB) + MOVW $961, R12 + B callbackasm1(SB) + MOVW $962, R12 + B callbackasm1(SB) + MOVW $963, R12 + B callbackasm1(SB) + MOVW $964, R12 + B callbackasm1(SB) + MOVW $965, R12 + B callbackasm1(SB) + MOVW $966, R12 + B callbackasm1(SB) + MOVW $967, R12 + B callbackasm1(SB) + MOVW $968, R12 + B callbackasm1(SB) + MOVW $969, R12 + B callbackasm1(SB) + MOVW $970, R12 + B callbackasm1(SB) + MOVW $971, R12 + B callbackasm1(SB) + MOVW $972, R12 + B callbackasm1(SB) + MOVW $973, R12 + B callbackasm1(SB) + MOVW $974, R12 + B callbackasm1(SB) + MOVW $975, R12 + B callbackasm1(SB) + MOVW $976, R12 + B callbackasm1(SB) + MOVW $977, R12 + B callbackasm1(SB) + MOVW $978, R12 + B callbackasm1(SB) + MOVW $979, R12 + B callbackasm1(SB) + MOVW $980, R12 + B callbackasm1(SB) + MOVW $981, R12 + B callbackasm1(SB) + MOVW $982, R12 + B callbackasm1(SB) + MOVW $983, R12 + B callbackasm1(SB) + MOVW $984, R12 + B callbackasm1(SB) + MOVW $985, R12 + B callbackasm1(SB) + MOVW $986, R12 + B callbackasm1(SB) + MOVW $987, R12 + B callbackasm1(SB) + MOVW $988, R12 + B callbackasm1(SB) + MOVW $989, R12 + B callbackasm1(SB) + MOVW $990, R12 + B callbackasm1(SB) + MOVW $991, R12 + B callbackasm1(SB) + MOVW $992, R12 + B callbackasm1(SB) + MOVW $993, R12 + B callbackasm1(SB) + MOVW $994, R12 + B callbackasm1(SB) + MOVW $995, R12 + B callbackasm1(SB) + MOVW $996, R12 + B callbackasm1(SB) + MOVW $997, R12 + B callbackasm1(SB) + MOVW $998, R12 + B callbackasm1(SB) + MOVW $999, R12 + B callbackasm1(SB) + MOVW $1000, R12 + B callbackasm1(SB) + MOVW $1001, R12 + B callbackasm1(SB) + MOVW $1002, R12 + B callbackasm1(SB) + MOVW $1003, R12 + B callbackasm1(SB) + MOVW $1004, R12 + B callbackasm1(SB) + MOVW $1005, R12 + B callbackasm1(SB) + MOVW $1006, R12 + B callbackasm1(SB) + MOVW $1007, R12 + B callbackasm1(SB) + MOVW $1008, R12 + B callbackasm1(SB) + MOVW $1009, R12 + B callbackasm1(SB) + MOVW $1010, R12 + B callbackasm1(SB) + MOVW $1011, R12 + B callbackasm1(SB) + MOVW $1012, R12 + B callbackasm1(SB) + MOVW $1013, R12 + B callbackasm1(SB) + MOVW $1014, R12 + B callbackasm1(SB) + MOVW $1015, R12 + B callbackasm1(SB) + MOVW $1016, R12 + B callbackasm1(SB) + MOVW $1017, R12 + B callbackasm1(SB) + MOVW $1018, R12 + B callbackasm1(SB) + MOVW $1019, R12 + B callbackasm1(SB) + MOVW $1020, R12 + B callbackasm1(SB) + MOVW $1021, R12 + B callbackasm1(SB) + MOVW $1022, R12 + B callbackasm1(SB) + MOVW $1023, R12 + B callbackasm1(SB) + MOVW $1024, R12 + B callbackasm1(SB) + MOVW $1025, R12 + B callbackasm1(SB) + MOVW $1026, R12 + B callbackasm1(SB) + MOVW $1027, R12 + B callbackasm1(SB) + MOVW $1028, R12 + B callbackasm1(SB) + MOVW $1029, R12 + B callbackasm1(SB) + MOVW $1030, R12 + B callbackasm1(SB) + MOVW $1031, R12 + B callbackasm1(SB) + MOVW $1032, R12 + B callbackasm1(SB) + MOVW $1033, R12 + B callbackasm1(SB) + MOVW $1034, R12 + B callbackasm1(SB) + MOVW $1035, R12 + B callbackasm1(SB) + MOVW $1036, R12 + B callbackasm1(SB) + MOVW $1037, R12 + B callbackasm1(SB) + MOVW $1038, R12 + B callbackasm1(SB) + MOVW $1039, R12 + B callbackasm1(SB) + MOVW $1040, R12 + B callbackasm1(SB) + MOVW $1041, R12 + B callbackasm1(SB) + MOVW $1042, R12 + B callbackasm1(SB) + MOVW $1043, R12 + B callbackasm1(SB) + MOVW $1044, R12 + B callbackasm1(SB) + MOVW $1045, R12 + B callbackasm1(SB) + MOVW $1046, R12 + B callbackasm1(SB) + MOVW $1047, R12 + B callbackasm1(SB) + MOVW $1048, R12 + B callbackasm1(SB) + MOVW $1049, R12 + B callbackasm1(SB) + MOVW $1050, R12 + B callbackasm1(SB) + MOVW $1051, R12 + B callbackasm1(SB) + MOVW $1052, R12 + B callbackasm1(SB) + MOVW $1053, R12 + B callbackasm1(SB) + MOVW $1054, R12 + B callbackasm1(SB) + MOVW $1055, R12 + B callbackasm1(SB) + MOVW $1056, R12 + B callbackasm1(SB) + MOVW $1057, R12 + B callbackasm1(SB) + MOVW $1058, R12 + B callbackasm1(SB) + MOVW $1059, R12 + B callbackasm1(SB) + MOVW $1060, R12 + B callbackasm1(SB) + MOVW $1061, R12 + B callbackasm1(SB) + MOVW $1062, R12 + B callbackasm1(SB) + MOVW $1063, R12 + B callbackasm1(SB) + MOVW $1064, R12 + B callbackasm1(SB) + MOVW $1065, R12 + B callbackasm1(SB) + MOVW $1066, R12 + B callbackasm1(SB) + MOVW $1067, R12 + B callbackasm1(SB) + MOVW $1068, R12 + B callbackasm1(SB) + MOVW $1069, R12 + B callbackasm1(SB) + MOVW $1070, R12 + B callbackasm1(SB) + MOVW $1071, R12 + B callbackasm1(SB) + MOVW $1072, R12 + B callbackasm1(SB) + MOVW $1073, R12 + B callbackasm1(SB) + MOVW $1074, R12 + B callbackasm1(SB) + MOVW $1075, R12 + B callbackasm1(SB) + MOVW $1076, R12 + B callbackasm1(SB) + MOVW $1077, R12 + B callbackasm1(SB) + MOVW $1078, R12 + B callbackasm1(SB) + MOVW $1079, R12 + B callbackasm1(SB) + MOVW $1080, R12 + B callbackasm1(SB) + MOVW $1081, R12 + B callbackasm1(SB) + MOVW $1082, R12 + B callbackasm1(SB) + MOVW $1083, R12 + B callbackasm1(SB) + MOVW $1084, R12 + B callbackasm1(SB) + MOVW $1085, R12 + B callbackasm1(SB) + MOVW $1086, R12 + B callbackasm1(SB) + MOVW $1087, R12 + B callbackasm1(SB) + MOVW $1088, R12 + B callbackasm1(SB) + MOVW $1089, R12 + B callbackasm1(SB) + MOVW $1090, R12 + B callbackasm1(SB) + MOVW $1091, R12 + B callbackasm1(SB) + MOVW $1092, R12 + B callbackasm1(SB) + MOVW $1093, R12 + B callbackasm1(SB) + MOVW $1094, R12 + B callbackasm1(SB) + MOVW $1095, R12 + B callbackasm1(SB) + MOVW $1096, R12 + B callbackasm1(SB) + MOVW $1097, R12 + B callbackasm1(SB) + MOVW $1098, R12 + B callbackasm1(SB) + MOVW $1099, R12 + B callbackasm1(SB) + MOVW $1100, R12 + B callbackasm1(SB) + MOVW $1101, R12 + B callbackasm1(SB) + MOVW $1102, R12 + B callbackasm1(SB) + MOVW $1103, R12 + B callbackasm1(SB) + MOVW $1104, R12 + B callbackasm1(SB) + MOVW $1105, R12 + B callbackasm1(SB) + MOVW $1106, R12 + B callbackasm1(SB) + MOVW $1107, R12 + B callbackasm1(SB) + MOVW $1108, R12 + B callbackasm1(SB) + MOVW $1109, R12 + B callbackasm1(SB) + MOVW $1110, R12 + B callbackasm1(SB) + MOVW $1111, R12 + B callbackasm1(SB) + MOVW $1112, R12 + B callbackasm1(SB) + MOVW $1113, R12 + B callbackasm1(SB) + MOVW $1114, R12 + B callbackasm1(SB) + MOVW $1115, R12 + B callbackasm1(SB) + MOVW $1116, R12 + B callbackasm1(SB) + MOVW $1117, R12 + B callbackasm1(SB) + MOVW $1118, R12 + B callbackasm1(SB) + MOVW $1119, R12 + B callbackasm1(SB) + MOVW $1120, R12 + B callbackasm1(SB) + MOVW $1121, R12 + B callbackasm1(SB) + MOVW $1122, R12 + B callbackasm1(SB) + MOVW $1123, R12 + B callbackasm1(SB) + MOVW $1124, R12 + B callbackasm1(SB) + MOVW $1125, R12 + B callbackasm1(SB) + MOVW $1126, R12 + B callbackasm1(SB) + MOVW $1127, R12 + B callbackasm1(SB) + MOVW $1128, R12 + B callbackasm1(SB) + MOVW $1129, R12 + B callbackasm1(SB) + MOVW $1130, R12 + B callbackasm1(SB) + MOVW $1131, R12 + B callbackasm1(SB) + MOVW $1132, R12 + B callbackasm1(SB) + MOVW $1133, R12 + B callbackasm1(SB) + MOVW $1134, R12 + B callbackasm1(SB) + MOVW $1135, R12 + B callbackasm1(SB) + MOVW $1136, R12 + B callbackasm1(SB) + MOVW $1137, R12 + B callbackasm1(SB) + MOVW $1138, R12 + B callbackasm1(SB) + MOVW $1139, R12 + B callbackasm1(SB) + MOVW $1140, R12 + B callbackasm1(SB) + MOVW $1141, R12 + B callbackasm1(SB) + MOVW $1142, R12 + B callbackasm1(SB) + MOVW $1143, R12 + B callbackasm1(SB) + MOVW $1144, R12 + B callbackasm1(SB) + MOVW $1145, R12 + B callbackasm1(SB) + MOVW $1146, R12 + B callbackasm1(SB) + MOVW $1147, R12 + B callbackasm1(SB) + MOVW $1148, R12 + B callbackasm1(SB) + MOVW $1149, R12 + B callbackasm1(SB) + MOVW $1150, R12 + B callbackasm1(SB) + MOVW $1151, R12 + B callbackasm1(SB) + MOVW $1152, R12 + B callbackasm1(SB) + MOVW $1153, R12 + B callbackasm1(SB) + MOVW $1154, R12 + B callbackasm1(SB) + MOVW $1155, R12 + B callbackasm1(SB) + MOVW $1156, R12 + B callbackasm1(SB) + MOVW $1157, R12 + B callbackasm1(SB) + MOVW $1158, R12 + B callbackasm1(SB) + MOVW $1159, R12 + B callbackasm1(SB) + MOVW $1160, R12 + B callbackasm1(SB) + MOVW $1161, R12 + B callbackasm1(SB) + MOVW $1162, R12 + B callbackasm1(SB) + MOVW $1163, R12 + B callbackasm1(SB) + MOVW $1164, R12 + B callbackasm1(SB) + MOVW $1165, R12 + B callbackasm1(SB) + MOVW $1166, R12 + B callbackasm1(SB) + MOVW $1167, R12 + B callbackasm1(SB) + MOVW $1168, R12 + B callbackasm1(SB) + MOVW $1169, R12 + B callbackasm1(SB) + MOVW $1170, R12 + B callbackasm1(SB) + MOVW $1171, R12 + B callbackasm1(SB) + MOVW $1172, R12 + B callbackasm1(SB) + MOVW $1173, R12 + B callbackasm1(SB) + MOVW $1174, R12 + B callbackasm1(SB) + MOVW $1175, R12 + B callbackasm1(SB) + MOVW $1176, R12 + B callbackasm1(SB) + MOVW $1177, R12 + B callbackasm1(SB) + MOVW $1178, R12 + B callbackasm1(SB) + MOVW $1179, R12 + B callbackasm1(SB) + MOVW $1180, R12 + B callbackasm1(SB) + MOVW $1181, R12 + B callbackasm1(SB) + MOVW $1182, R12 + B callbackasm1(SB) + MOVW $1183, R12 + B callbackasm1(SB) + MOVW $1184, R12 + B callbackasm1(SB) + MOVW $1185, R12 + B callbackasm1(SB) + MOVW $1186, R12 + B callbackasm1(SB) + MOVW $1187, R12 + B callbackasm1(SB) + MOVW $1188, R12 + B callbackasm1(SB) + MOVW $1189, R12 + B callbackasm1(SB) + MOVW $1190, R12 + B callbackasm1(SB) + MOVW $1191, R12 + B callbackasm1(SB) + MOVW $1192, R12 + B callbackasm1(SB) + MOVW $1193, R12 + B callbackasm1(SB) + MOVW $1194, R12 + B callbackasm1(SB) + MOVW $1195, R12 + B callbackasm1(SB) + MOVW $1196, R12 + B callbackasm1(SB) + MOVW $1197, R12 + B callbackasm1(SB) + MOVW $1198, R12 + B callbackasm1(SB) + MOVW $1199, R12 + B callbackasm1(SB) + MOVW $1200, R12 + B callbackasm1(SB) + MOVW $1201, R12 + B callbackasm1(SB) + MOVW $1202, R12 + B callbackasm1(SB) + MOVW $1203, R12 + B callbackasm1(SB) + MOVW $1204, R12 + B callbackasm1(SB) + MOVW $1205, R12 + B callbackasm1(SB) + MOVW $1206, R12 + B callbackasm1(SB) + MOVW $1207, R12 + B callbackasm1(SB) + MOVW $1208, R12 + B callbackasm1(SB) + MOVW $1209, R12 + B callbackasm1(SB) + MOVW $1210, R12 + B callbackasm1(SB) + MOVW $1211, R12 + B callbackasm1(SB) + MOVW $1212, R12 + B callbackasm1(SB) + MOVW $1213, R12 + B callbackasm1(SB) + MOVW $1214, R12 + B callbackasm1(SB) + MOVW $1215, R12 + B callbackasm1(SB) + MOVW $1216, R12 + B callbackasm1(SB) + MOVW $1217, R12 + B callbackasm1(SB) + MOVW $1218, R12 + B callbackasm1(SB) + MOVW $1219, R12 + B callbackasm1(SB) + MOVW $1220, R12 + B callbackasm1(SB) + MOVW $1221, R12 + B callbackasm1(SB) + MOVW $1222, R12 + B callbackasm1(SB) + MOVW $1223, R12 + B callbackasm1(SB) + MOVW $1224, R12 + B callbackasm1(SB) + MOVW $1225, R12 + B callbackasm1(SB) + MOVW $1226, R12 + B callbackasm1(SB) + MOVW $1227, R12 + B callbackasm1(SB) + MOVW $1228, R12 + B callbackasm1(SB) + MOVW $1229, R12 + B callbackasm1(SB) + MOVW $1230, R12 + B callbackasm1(SB) + MOVW $1231, R12 + B callbackasm1(SB) + MOVW $1232, R12 + B callbackasm1(SB) + MOVW $1233, R12 + B callbackasm1(SB) + MOVW $1234, R12 + B callbackasm1(SB) + MOVW $1235, R12 + B callbackasm1(SB) + MOVW $1236, R12 + B callbackasm1(SB) + MOVW $1237, R12 + B callbackasm1(SB) + MOVW $1238, R12 + B callbackasm1(SB) + MOVW $1239, R12 + B callbackasm1(SB) + MOVW $1240, R12 + B callbackasm1(SB) + MOVW $1241, R12 + B callbackasm1(SB) + MOVW $1242, R12 + B callbackasm1(SB) + MOVW $1243, R12 + B callbackasm1(SB) + MOVW $1244, R12 + B callbackasm1(SB) + MOVW $1245, R12 + B callbackasm1(SB) + MOVW $1246, R12 + B callbackasm1(SB) + MOVW $1247, R12 + B callbackasm1(SB) + MOVW $1248, R12 + B callbackasm1(SB) + MOVW $1249, R12 + B callbackasm1(SB) + MOVW $1250, R12 + B callbackasm1(SB) + MOVW $1251, R12 + B callbackasm1(SB) + MOVW $1252, R12 + B callbackasm1(SB) + MOVW $1253, R12 + B callbackasm1(SB) + MOVW $1254, R12 + B callbackasm1(SB) + MOVW $1255, R12 + B callbackasm1(SB) + MOVW $1256, R12 + B callbackasm1(SB) + MOVW $1257, R12 + B callbackasm1(SB) + MOVW $1258, R12 + B callbackasm1(SB) + MOVW $1259, R12 + B callbackasm1(SB) + MOVW $1260, R12 + B callbackasm1(SB) + MOVW $1261, R12 + B callbackasm1(SB) + MOVW $1262, R12 + B callbackasm1(SB) + MOVW $1263, R12 + B callbackasm1(SB) + MOVW $1264, R12 + B callbackasm1(SB) + MOVW $1265, R12 + B callbackasm1(SB) + MOVW $1266, R12 + B callbackasm1(SB) + MOVW $1267, R12 + B callbackasm1(SB) + MOVW $1268, R12 + B callbackasm1(SB) + MOVW $1269, R12 + B callbackasm1(SB) + MOVW $1270, R12 + B callbackasm1(SB) + MOVW $1271, R12 + B callbackasm1(SB) + MOVW $1272, R12 + B callbackasm1(SB) + MOVW $1273, R12 + B callbackasm1(SB) + MOVW $1274, R12 + B callbackasm1(SB) + MOVW $1275, R12 + B callbackasm1(SB) + MOVW $1276, R12 + B callbackasm1(SB) + MOVW $1277, R12 + B callbackasm1(SB) + MOVW $1278, R12 + B callbackasm1(SB) + MOVW $1279, R12 + B callbackasm1(SB) + MOVW $1280, R12 + B callbackasm1(SB) + MOVW $1281, R12 + B callbackasm1(SB) + MOVW $1282, R12 + B callbackasm1(SB) + MOVW $1283, R12 + B callbackasm1(SB) + MOVW $1284, R12 + B callbackasm1(SB) + MOVW $1285, R12 + B callbackasm1(SB) + MOVW $1286, R12 + B callbackasm1(SB) + MOVW $1287, R12 + B callbackasm1(SB) + MOVW $1288, R12 + B callbackasm1(SB) + MOVW $1289, R12 + B callbackasm1(SB) + MOVW $1290, R12 + B callbackasm1(SB) + MOVW $1291, R12 + B callbackasm1(SB) + MOVW $1292, R12 + B callbackasm1(SB) + MOVW $1293, R12 + B callbackasm1(SB) + MOVW $1294, R12 + B callbackasm1(SB) + MOVW $1295, R12 + B callbackasm1(SB) + MOVW $1296, R12 + B callbackasm1(SB) + MOVW $1297, R12 + B callbackasm1(SB) + MOVW $1298, R12 + B callbackasm1(SB) + MOVW $1299, R12 + B callbackasm1(SB) + MOVW $1300, R12 + B callbackasm1(SB) + MOVW $1301, R12 + B callbackasm1(SB) + MOVW $1302, R12 + B callbackasm1(SB) + MOVW $1303, R12 + B callbackasm1(SB) + MOVW $1304, R12 + B callbackasm1(SB) + MOVW $1305, R12 + B callbackasm1(SB) + MOVW $1306, R12 + B callbackasm1(SB) + MOVW $1307, R12 + B callbackasm1(SB) + MOVW $1308, R12 + B callbackasm1(SB) + MOVW $1309, R12 + B callbackasm1(SB) + MOVW $1310, R12 + B callbackasm1(SB) + MOVW $1311, R12 + B callbackasm1(SB) + MOVW $1312, R12 + B callbackasm1(SB) + MOVW $1313, R12 + B callbackasm1(SB) + MOVW $1314, R12 + B callbackasm1(SB) + MOVW $1315, R12 + B callbackasm1(SB) + MOVW $1316, R12 + B callbackasm1(SB) + MOVW $1317, R12 + B callbackasm1(SB) + MOVW $1318, R12 + B callbackasm1(SB) + MOVW $1319, R12 + B callbackasm1(SB) + MOVW $1320, R12 + B callbackasm1(SB) + MOVW $1321, R12 + B callbackasm1(SB) + MOVW $1322, R12 + B callbackasm1(SB) + MOVW $1323, R12 + B callbackasm1(SB) + MOVW $1324, R12 + B callbackasm1(SB) + MOVW $1325, R12 + B callbackasm1(SB) + MOVW $1326, R12 + B callbackasm1(SB) + MOVW $1327, R12 + B callbackasm1(SB) + MOVW $1328, R12 + B callbackasm1(SB) + MOVW $1329, R12 + B callbackasm1(SB) + MOVW $1330, R12 + B callbackasm1(SB) + MOVW $1331, R12 + B callbackasm1(SB) + MOVW $1332, R12 + B callbackasm1(SB) + MOVW $1333, R12 + B callbackasm1(SB) + MOVW $1334, R12 + B callbackasm1(SB) + MOVW $1335, R12 + B callbackasm1(SB) + MOVW $1336, R12 + B callbackasm1(SB) + MOVW $1337, R12 + B callbackasm1(SB) + MOVW $1338, R12 + B callbackasm1(SB) + MOVW $1339, R12 + B callbackasm1(SB) + MOVW $1340, R12 + B callbackasm1(SB) + MOVW $1341, R12 + B callbackasm1(SB) + MOVW $1342, R12 + B callbackasm1(SB) + MOVW $1343, R12 + B callbackasm1(SB) + MOVW $1344, R12 + B callbackasm1(SB) + MOVW $1345, R12 + B callbackasm1(SB) + MOVW $1346, R12 + B callbackasm1(SB) + MOVW $1347, R12 + B callbackasm1(SB) + MOVW $1348, R12 + B callbackasm1(SB) + MOVW $1349, R12 + B callbackasm1(SB) + MOVW $1350, R12 + B callbackasm1(SB) + MOVW $1351, R12 + B callbackasm1(SB) + MOVW $1352, R12 + B callbackasm1(SB) + MOVW $1353, R12 + B callbackasm1(SB) + MOVW $1354, R12 + B callbackasm1(SB) + MOVW $1355, R12 + B callbackasm1(SB) + MOVW $1356, R12 + B callbackasm1(SB) + MOVW $1357, R12 + B callbackasm1(SB) + MOVW $1358, R12 + B callbackasm1(SB) + MOVW $1359, R12 + B callbackasm1(SB) + MOVW $1360, R12 + B callbackasm1(SB) + MOVW $1361, R12 + B callbackasm1(SB) + MOVW $1362, R12 + B callbackasm1(SB) + MOVW $1363, R12 + B callbackasm1(SB) + MOVW $1364, R12 + B callbackasm1(SB) + MOVW $1365, R12 + B callbackasm1(SB) + MOVW $1366, R12 + B callbackasm1(SB) + MOVW $1367, R12 + B callbackasm1(SB) + MOVW $1368, R12 + B callbackasm1(SB) + MOVW $1369, R12 + B callbackasm1(SB) + MOVW $1370, R12 + B callbackasm1(SB) + MOVW $1371, R12 + B callbackasm1(SB) + MOVW $1372, R12 + B callbackasm1(SB) + MOVW $1373, R12 + B callbackasm1(SB) + MOVW $1374, R12 + B callbackasm1(SB) + MOVW $1375, R12 + B callbackasm1(SB) + MOVW $1376, R12 + B callbackasm1(SB) + MOVW $1377, R12 + B callbackasm1(SB) + MOVW $1378, R12 + B callbackasm1(SB) + MOVW $1379, R12 + B callbackasm1(SB) + MOVW $1380, R12 + B callbackasm1(SB) + MOVW $1381, R12 + B callbackasm1(SB) + MOVW $1382, R12 + B callbackasm1(SB) + MOVW $1383, R12 + B callbackasm1(SB) + MOVW $1384, R12 + B callbackasm1(SB) + MOVW $1385, R12 + B callbackasm1(SB) + MOVW $1386, R12 + B callbackasm1(SB) + MOVW $1387, R12 + B callbackasm1(SB) + MOVW $1388, R12 + B callbackasm1(SB) + MOVW $1389, R12 + B callbackasm1(SB) + MOVW $1390, R12 + B callbackasm1(SB) + MOVW $1391, R12 + B callbackasm1(SB) + MOVW $1392, R12 + B callbackasm1(SB) + MOVW $1393, R12 + B callbackasm1(SB) + MOVW $1394, R12 + B callbackasm1(SB) + MOVW $1395, R12 + B callbackasm1(SB) + MOVW $1396, R12 + B callbackasm1(SB) + MOVW $1397, R12 + B callbackasm1(SB) + MOVW $1398, R12 + B callbackasm1(SB) + MOVW $1399, R12 + B callbackasm1(SB) + MOVW $1400, R12 + B callbackasm1(SB) + MOVW $1401, R12 + B callbackasm1(SB) + MOVW $1402, R12 + B callbackasm1(SB) + MOVW $1403, R12 + B callbackasm1(SB) + MOVW $1404, R12 + B callbackasm1(SB) + MOVW $1405, R12 + B callbackasm1(SB) + MOVW $1406, R12 + B callbackasm1(SB) + MOVW $1407, R12 + B callbackasm1(SB) + MOVW $1408, R12 + B callbackasm1(SB) + MOVW $1409, R12 + B callbackasm1(SB) + MOVW $1410, R12 + B callbackasm1(SB) + MOVW $1411, R12 + B callbackasm1(SB) + MOVW $1412, R12 + B callbackasm1(SB) + MOVW $1413, R12 + B callbackasm1(SB) + MOVW $1414, R12 + B callbackasm1(SB) + MOVW $1415, R12 + B callbackasm1(SB) + MOVW $1416, R12 + B callbackasm1(SB) + MOVW $1417, R12 + B callbackasm1(SB) + MOVW $1418, R12 + B callbackasm1(SB) + MOVW $1419, R12 + B callbackasm1(SB) + MOVW $1420, R12 + B callbackasm1(SB) + MOVW $1421, R12 + B callbackasm1(SB) + MOVW $1422, R12 + B callbackasm1(SB) + MOVW $1423, R12 + B callbackasm1(SB) + MOVW $1424, R12 + B callbackasm1(SB) + MOVW $1425, R12 + B callbackasm1(SB) + MOVW $1426, R12 + B callbackasm1(SB) + MOVW $1427, R12 + B callbackasm1(SB) + MOVW $1428, R12 + B callbackasm1(SB) + MOVW $1429, R12 + B callbackasm1(SB) + MOVW $1430, R12 + B callbackasm1(SB) + MOVW $1431, R12 + B callbackasm1(SB) + MOVW $1432, R12 + B callbackasm1(SB) + MOVW $1433, R12 + B callbackasm1(SB) + MOVW $1434, R12 + B callbackasm1(SB) + MOVW $1435, R12 + B callbackasm1(SB) + MOVW $1436, R12 + B callbackasm1(SB) + MOVW $1437, R12 + B callbackasm1(SB) + MOVW $1438, R12 + B callbackasm1(SB) + MOVW $1439, R12 + B callbackasm1(SB) + MOVW $1440, R12 + B callbackasm1(SB) + MOVW $1441, R12 + B callbackasm1(SB) + MOVW $1442, R12 + B callbackasm1(SB) + MOVW $1443, R12 + B callbackasm1(SB) + MOVW $1444, R12 + B callbackasm1(SB) + MOVW $1445, R12 + B callbackasm1(SB) + MOVW $1446, R12 + B callbackasm1(SB) + MOVW $1447, R12 + B callbackasm1(SB) + MOVW $1448, R12 + B callbackasm1(SB) + MOVW $1449, R12 + B callbackasm1(SB) + MOVW $1450, R12 + B callbackasm1(SB) + MOVW $1451, R12 + B callbackasm1(SB) + MOVW $1452, R12 + B callbackasm1(SB) + MOVW $1453, R12 + B callbackasm1(SB) + MOVW $1454, R12 + B callbackasm1(SB) + MOVW $1455, R12 + B callbackasm1(SB) + MOVW $1456, R12 + B callbackasm1(SB) + MOVW $1457, R12 + B callbackasm1(SB) + MOVW $1458, R12 + B callbackasm1(SB) + MOVW $1459, R12 + B callbackasm1(SB) + MOVW $1460, R12 + B callbackasm1(SB) + MOVW $1461, R12 + B callbackasm1(SB) + MOVW $1462, R12 + B callbackasm1(SB) + MOVW $1463, R12 + B callbackasm1(SB) + MOVW $1464, R12 + B callbackasm1(SB) + MOVW $1465, R12 + B callbackasm1(SB) + MOVW $1466, R12 + B callbackasm1(SB) + MOVW $1467, R12 + B callbackasm1(SB) + MOVW $1468, R12 + B callbackasm1(SB) + MOVW $1469, R12 + B callbackasm1(SB) + MOVW $1470, R12 + B callbackasm1(SB) + MOVW $1471, R12 + B callbackasm1(SB) + MOVW $1472, R12 + B callbackasm1(SB) + MOVW $1473, R12 + B callbackasm1(SB) + MOVW $1474, R12 + B callbackasm1(SB) + MOVW $1475, R12 + B callbackasm1(SB) + MOVW $1476, R12 + B callbackasm1(SB) + MOVW $1477, R12 + B callbackasm1(SB) + MOVW $1478, R12 + B callbackasm1(SB) + MOVW $1479, R12 + B callbackasm1(SB) + MOVW $1480, R12 + B callbackasm1(SB) + MOVW $1481, R12 + B callbackasm1(SB) + MOVW $1482, R12 + B callbackasm1(SB) + MOVW $1483, R12 + B callbackasm1(SB) + MOVW $1484, R12 + B callbackasm1(SB) + MOVW $1485, R12 + B callbackasm1(SB) + MOVW $1486, R12 + B callbackasm1(SB) + MOVW $1487, R12 + B callbackasm1(SB) + MOVW $1488, R12 + B callbackasm1(SB) + MOVW $1489, R12 + B callbackasm1(SB) + MOVW $1490, R12 + B callbackasm1(SB) + MOVW $1491, R12 + B callbackasm1(SB) + MOVW $1492, R12 + B callbackasm1(SB) + MOVW $1493, R12 + B callbackasm1(SB) + MOVW $1494, R12 + B callbackasm1(SB) + MOVW $1495, R12 + B callbackasm1(SB) + MOVW $1496, R12 + B callbackasm1(SB) + MOVW $1497, R12 + B callbackasm1(SB) + MOVW $1498, R12 + B callbackasm1(SB) + MOVW $1499, R12 + B callbackasm1(SB) + MOVW $1500, R12 + B callbackasm1(SB) + MOVW $1501, R12 + B callbackasm1(SB) + MOVW $1502, R12 + B callbackasm1(SB) + MOVW $1503, R12 + B callbackasm1(SB) + MOVW $1504, R12 + B callbackasm1(SB) + MOVW $1505, R12 + B callbackasm1(SB) + MOVW $1506, R12 + B callbackasm1(SB) + MOVW $1507, R12 + B callbackasm1(SB) + MOVW $1508, R12 + B callbackasm1(SB) + MOVW $1509, R12 + B callbackasm1(SB) + MOVW $1510, R12 + B callbackasm1(SB) + MOVW $1511, R12 + B callbackasm1(SB) + MOVW $1512, R12 + B callbackasm1(SB) + MOVW $1513, R12 + B callbackasm1(SB) + MOVW $1514, R12 + B callbackasm1(SB) + MOVW $1515, R12 + B callbackasm1(SB) + MOVW $1516, R12 + B callbackasm1(SB) + MOVW $1517, R12 + B callbackasm1(SB) + MOVW $1518, R12 + B callbackasm1(SB) + MOVW $1519, R12 + B callbackasm1(SB) + MOVW $1520, R12 + B callbackasm1(SB) + MOVW $1521, R12 + B callbackasm1(SB) + MOVW $1522, R12 + B callbackasm1(SB) + MOVW $1523, R12 + B callbackasm1(SB) + MOVW $1524, R12 + B callbackasm1(SB) + MOVW $1525, R12 + B callbackasm1(SB) + MOVW $1526, R12 + B callbackasm1(SB) + MOVW $1527, R12 + B callbackasm1(SB) + MOVW $1528, R12 + B callbackasm1(SB) + MOVW $1529, R12 + B callbackasm1(SB) + MOVW $1530, R12 + B callbackasm1(SB) + MOVW $1531, R12 + B callbackasm1(SB) + MOVW $1532, R12 + B callbackasm1(SB) + MOVW $1533, R12 + B callbackasm1(SB) + MOVW $1534, R12 + B callbackasm1(SB) + MOVW $1535, R12 + B callbackasm1(SB) + MOVW $1536, R12 + B callbackasm1(SB) + MOVW $1537, R12 + B callbackasm1(SB) + MOVW $1538, R12 + B callbackasm1(SB) + MOVW $1539, R12 + B callbackasm1(SB) + MOVW $1540, R12 + B callbackasm1(SB) + MOVW $1541, R12 + B callbackasm1(SB) + MOVW $1542, R12 + B callbackasm1(SB) + MOVW $1543, R12 + B callbackasm1(SB) + MOVW $1544, R12 + B callbackasm1(SB) + MOVW $1545, R12 + B callbackasm1(SB) + MOVW $1546, R12 + B callbackasm1(SB) + MOVW $1547, R12 + B callbackasm1(SB) + MOVW $1548, R12 + B callbackasm1(SB) + MOVW $1549, R12 + B callbackasm1(SB) + MOVW $1550, R12 + B callbackasm1(SB) + MOVW $1551, R12 + B callbackasm1(SB) + MOVW $1552, R12 + B callbackasm1(SB) + MOVW $1553, R12 + B callbackasm1(SB) + MOVW $1554, R12 + B callbackasm1(SB) + MOVW $1555, R12 + B callbackasm1(SB) + MOVW $1556, R12 + B callbackasm1(SB) + MOVW $1557, R12 + B callbackasm1(SB) + MOVW $1558, R12 + B callbackasm1(SB) + MOVW $1559, R12 + B callbackasm1(SB) + MOVW $1560, R12 + B callbackasm1(SB) + MOVW $1561, R12 + B callbackasm1(SB) + MOVW $1562, R12 + B callbackasm1(SB) + MOVW $1563, R12 + B callbackasm1(SB) + MOVW $1564, R12 + B callbackasm1(SB) + MOVW $1565, R12 + B callbackasm1(SB) + MOVW $1566, R12 + B callbackasm1(SB) + MOVW $1567, R12 + B callbackasm1(SB) + MOVW $1568, R12 + B callbackasm1(SB) + MOVW $1569, R12 + B callbackasm1(SB) + MOVW $1570, R12 + B callbackasm1(SB) + MOVW $1571, R12 + B callbackasm1(SB) + MOVW $1572, R12 + B callbackasm1(SB) + MOVW $1573, R12 + B callbackasm1(SB) + MOVW $1574, R12 + B callbackasm1(SB) + MOVW $1575, R12 + B callbackasm1(SB) + MOVW $1576, R12 + B callbackasm1(SB) + MOVW $1577, R12 + B callbackasm1(SB) + MOVW $1578, R12 + B callbackasm1(SB) + MOVW $1579, R12 + B callbackasm1(SB) + MOVW $1580, R12 + B callbackasm1(SB) + MOVW $1581, R12 + B callbackasm1(SB) + MOVW $1582, R12 + B callbackasm1(SB) + MOVW $1583, R12 + B callbackasm1(SB) + MOVW $1584, R12 + B callbackasm1(SB) + MOVW $1585, R12 + B callbackasm1(SB) + MOVW $1586, R12 + B callbackasm1(SB) + MOVW $1587, R12 + B callbackasm1(SB) + MOVW $1588, R12 + B callbackasm1(SB) + MOVW $1589, R12 + B callbackasm1(SB) + MOVW $1590, R12 + B callbackasm1(SB) + MOVW $1591, R12 + B callbackasm1(SB) + MOVW $1592, R12 + B callbackasm1(SB) + MOVW $1593, R12 + B callbackasm1(SB) + MOVW $1594, R12 + B callbackasm1(SB) + MOVW $1595, R12 + B callbackasm1(SB) + MOVW $1596, R12 + B callbackasm1(SB) + MOVW $1597, R12 + B callbackasm1(SB) + MOVW $1598, R12 + B callbackasm1(SB) + MOVW $1599, R12 + B callbackasm1(SB) + MOVW $1600, R12 + B callbackasm1(SB) + MOVW $1601, R12 + B callbackasm1(SB) + MOVW $1602, R12 + B callbackasm1(SB) + MOVW $1603, R12 + B callbackasm1(SB) + MOVW $1604, R12 + B callbackasm1(SB) + MOVW $1605, R12 + B callbackasm1(SB) + MOVW $1606, R12 + B callbackasm1(SB) + MOVW $1607, R12 + B callbackasm1(SB) + MOVW $1608, R12 + B callbackasm1(SB) + MOVW $1609, R12 + B callbackasm1(SB) + MOVW $1610, R12 + B callbackasm1(SB) + MOVW $1611, R12 + B callbackasm1(SB) + MOVW $1612, R12 + B callbackasm1(SB) + MOVW $1613, R12 + B callbackasm1(SB) + MOVW $1614, R12 + B callbackasm1(SB) + MOVW $1615, R12 + B callbackasm1(SB) + MOVW $1616, R12 + B callbackasm1(SB) + MOVW $1617, R12 + B callbackasm1(SB) + MOVW $1618, R12 + B callbackasm1(SB) + MOVW $1619, R12 + B callbackasm1(SB) + MOVW $1620, R12 + B callbackasm1(SB) + MOVW $1621, R12 + B callbackasm1(SB) + MOVW $1622, R12 + B callbackasm1(SB) + MOVW $1623, R12 + B callbackasm1(SB) + MOVW $1624, R12 + B callbackasm1(SB) + MOVW $1625, R12 + B callbackasm1(SB) + MOVW $1626, R12 + B callbackasm1(SB) + MOVW $1627, R12 + B callbackasm1(SB) + MOVW $1628, R12 + B callbackasm1(SB) + MOVW $1629, R12 + B callbackasm1(SB) + MOVW $1630, R12 + B callbackasm1(SB) + MOVW $1631, R12 + B callbackasm1(SB) + MOVW $1632, R12 + B callbackasm1(SB) + MOVW $1633, R12 + B callbackasm1(SB) + MOVW $1634, R12 + B callbackasm1(SB) + MOVW $1635, R12 + B callbackasm1(SB) + MOVW $1636, R12 + B callbackasm1(SB) + MOVW $1637, R12 + B callbackasm1(SB) + MOVW $1638, R12 + B callbackasm1(SB) + MOVW $1639, R12 + B callbackasm1(SB) + MOVW $1640, R12 + B callbackasm1(SB) + MOVW $1641, R12 + B callbackasm1(SB) + MOVW $1642, R12 + B callbackasm1(SB) + MOVW $1643, R12 + B callbackasm1(SB) + MOVW $1644, R12 + B callbackasm1(SB) + MOVW $1645, R12 + B callbackasm1(SB) + MOVW $1646, R12 + B callbackasm1(SB) + MOVW $1647, R12 + B callbackasm1(SB) + MOVW $1648, R12 + B callbackasm1(SB) + MOVW $1649, R12 + B callbackasm1(SB) + MOVW $1650, R12 + B callbackasm1(SB) + MOVW $1651, R12 + B callbackasm1(SB) + MOVW $1652, R12 + B callbackasm1(SB) + MOVW $1653, R12 + B callbackasm1(SB) + MOVW $1654, R12 + B callbackasm1(SB) + MOVW $1655, R12 + B callbackasm1(SB) + MOVW $1656, R12 + B callbackasm1(SB) + MOVW $1657, R12 + B callbackasm1(SB) + MOVW $1658, R12 + B callbackasm1(SB) + MOVW $1659, R12 + B callbackasm1(SB) + MOVW $1660, R12 + B callbackasm1(SB) + MOVW $1661, R12 + B callbackasm1(SB) + MOVW $1662, R12 + B callbackasm1(SB) + MOVW $1663, R12 + B callbackasm1(SB) + MOVW $1664, R12 + B callbackasm1(SB) + MOVW $1665, R12 + B callbackasm1(SB) + MOVW $1666, R12 + B callbackasm1(SB) + MOVW $1667, R12 + B callbackasm1(SB) + MOVW $1668, R12 + B callbackasm1(SB) + MOVW $1669, R12 + B callbackasm1(SB) + MOVW $1670, R12 + B callbackasm1(SB) + MOVW $1671, R12 + B callbackasm1(SB) + MOVW $1672, R12 + B callbackasm1(SB) + MOVW $1673, R12 + B callbackasm1(SB) + MOVW $1674, R12 + B callbackasm1(SB) + MOVW $1675, R12 + B callbackasm1(SB) + MOVW $1676, R12 + B callbackasm1(SB) + MOVW $1677, R12 + B callbackasm1(SB) + MOVW $1678, R12 + B callbackasm1(SB) + MOVW $1679, R12 + B callbackasm1(SB) + MOVW $1680, R12 + B callbackasm1(SB) + MOVW $1681, R12 + B callbackasm1(SB) + MOVW $1682, R12 + B callbackasm1(SB) + MOVW $1683, R12 + B callbackasm1(SB) + MOVW $1684, R12 + B callbackasm1(SB) + MOVW $1685, R12 + B callbackasm1(SB) + MOVW $1686, R12 + B callbackasm1(SB) + MOVW $1687, R12 + B callbackasm1(SB) + MOVW $1688, R12 + B callbackasm1(SB) + MOVW $1689, R12 + B callbackasm1(SB) + MOVW $1690, R12 + B callbackasm1(SB) + MOVW $1691, R12 + B callbackasm1(SB) + MOVW $1692, R12 + B callbackasm1(SB) + MOVW $1693, R12 + B callbackasm1(SB) + MOVW $1694, R12 + B callbackasm1(SB) + MOVW $1695, R12 + B callbackasm1(SB) + MOVW $1696, R12 + B callbackasm1(SB) + MOVW $1697, R12 + B callbackasm1(SB) + MOVW $1698, R12 + B callbackasm1(SB) + MOVW $1699, R12 + B callbackasm1(SB) + MOVW $1700, R12 + B callbackasm1(SB) + MOVW $1701, R12 + B callbackasm1(SB) + MOVW $1702, R12 + B callbackasm1(SB) + MOVW $1703, R12 + B callbackasm1(SB) + MOVW $1704, R12 + B callbackasm1(SB) + MOVW $1705, R12 + B callbackasm1(SB) + MOVW $1706, R12 + B callbackasm1(SB) + MOVW $1707, R12 + B callbackasm1(SB) + MOVW $1708, R12 + B callbackasm1(SB) + MOVW $1709, R12 + B callbackasm1(SB) + MOVW $1710, R12 + B callbackasm1(SB) + MOVW $1711, R12 + B callbackasm1(SB) + MOVW $1712, R12 + B callbackasm1(SB) + MOVW $1713, R12 + B callbackasm1(SB) + MOVW $1714, R12 + B callbackasm1(SB) + MOVW $1715, R12 + B callbackasm1(SB) + MOVW $1716, R12 + B callbackasm1(SB) + MOVW $1717, R12 + B callbackasm1(SB) + MOVW $1718, R12 + B callbackasm1(SB) + MOVW $1719, R12 + B callbackasm1(SB) + MOVW $1720, R12 + B callbackasm1(SB) + MOVW $1721, R12 + B callbackasm1(SB) + MOVW $1722, R12 + B callbackasm1(SB) + MOVW $1723, R12 + B callbackasm1(SB) + MOVW $1724, R12 + B callbackasm1(SB) + MOVW $1725, R12 + B callbackasm1(SB) + MOVW $1726, R12 + B callbackasm1(SB) + MOVW $1727, R12 + B callbackasm1(SB) + MOVW $1728, R12 + B callbackasm1(SB) + MOVW $1729, R12 + B callbackasm1(SB) + MOVW $1730, R12 + B callbackasm1(SB) + MOVW $1731, R12 + B callbackasm1(SB) + MOVW $1732, R12 + B callbackasm1(SB) + MOVW $1733, R12 + B callbackasm1(SB) + MOVW $1734, R12 + B callbackasm1(SB) + MOVW $1735, R12 + B callbackasm1(SB) + MOVW $1736, R12 + B callbackasm1(SB) + MOVW $1737, R12 + B callbackasm1(SB) + MOVW $1738, R12 + B callbackasm1(SB) + MOVW $1739, R12 + B callbackasm1(SB) + MOVW $1740, R12 + B callbackasm1(SB) + MOVW $1741, R12 + B callbackasm1(SB) + MOVW $1742, R12 + B callbackasm1(SB) + MOVW $1743, R12 + B callbackasm1(SB) + MOVW $1744, R12 + B callbackasm1(SB) + MOVW $1745, R12 + B callbackasm1(SB) + MOVW $1746, R12 + B callbackasm1(SB) + MOVW $1747, R12 + B callbackasm1(SB) + MOVW $1748, R12 + B callbackasm1(SB) + MOVW $1749, R12 + B callbackasm1(SB) + MOVW $1750, R12 + B callbackasm1(SB) + MOVW $1751, R12 + B callbackasm1(SB) + MOVW $1752, R12 + B callbackasm1(SB) + MOVW $1753, R12 + B callbackasm1(SB) + MOVW $1754, R12 + B callbackasm1(SB) + MOVW $1755, R12 + B callbackasm1(SB) + MOVW $1756, R12 + B callbackasm1(SB) + MOVW $1757, R12 + B callbackasm1(SB) + MOVW $1758, R12 + B callbackasm1(SB) + MOVW $1759, R12 + B callbackasm1(SB) + MOVW $1760, R12 + B callbackasm1(SB) + MOVW $1761, R12 + B callbackasm1(SB) + MOVW $1762, R12 + B callbackasm1(SB) + MOVW $1763, R12 + B callbackasm1(SB) + MOVW $1764, R12 + B callbackasm1(SB) + MOVW $1765, R12 + B callbackasm1(SB) + MOVW $1766, R12 + B callbackasm1(SB) + MOVW $1767, R12 + B callbackasm1(SB) + MOVW $1768, R12 + B callbackasm1(SB) + MOVW $1769, R12 + B callbackasm1(SB) + MOVW $1770, R12 + B callbackasm1(SB) + MOVW $1771, R12 + B callbackasm1(SB) + MOVW $1772, R12 + B callbackasm1(SB) + MOVW $1773, R12 + B callbackasm1(SB) + MOVW $1774, R12 + B callbackasm1(SB) + MOVW $1775, R12 + B callbackasm1(SB) + MOVW $1776, R12 + B callbackasm1(SB) + MOVW $1777, R12 + B callbackasm1(SB) + MOVW $1778, R12 + B callbackasm1(SB) + MOVW $1779, R12 + B callbackasm1(SB) + MOVW $1780, R12 + B callbackasm1(SB) + MOVW $1781, R12 + B callbackasm1(SB) + MOVW $1782, R12 + B callbackasm1(SB) + MOVW $1783, R12 + B callbackasm1(SB) + MOVW $1784, R12 + B callbackasm1(SB) + MOVW $1785, R12 + B callbackasm1(SB) + MOVW $1786, R12 + B callbackasm1(SB) + MOVW $1787, R12 + B callbackasm1(SB) + MOVW $1788, R12 + B callbackasm1(SB) + MOVW $1789, R12 + B callbackasm1(SB) + MOVW $1790, R12 + B callbackasm1(SB) + MOVW $1791, R12 + B callbackasm1(SB) + MOVW $1792, R12 + B callbackasm1(SB) + MOVW $1793, R12 + B callbackasm1(SB) + MOVW $1794, R12 + B callbackasm1(SB) + MOVW $1795, R12 + B callbackasm1(SB) + MOVW $1796, R12 + B callbackasm1(SB) + MOVW $1797, R12 + B callbackasm1(SB) + MOVW $1798, R12 + B callbackasm1(SB) + MOVW $1799, R12 + B callbackasm1(SB) + MOVW $1800, R12 + B callbackasm1(SB) + MOVW $1801, R12 + B callbackasm1(SB) + MOVW $1802, R12 + B callbackasm1(SB) + MOVW $1803, R12 + B callbackasm1(SB) + MOVW $1804, R12 + B callbackasm1(SB) + MOVW $1805, R12 + B callbackasm1(SB) + MOVW $1806, R12 + B callbackasm1(SB) + MOVW $1807, R12 + B callbackasm1(SB) + MOVW $1808, R12 + B callbackasm1(SB) + MOVW $1809, R12 + B callbackasm1(SB) + MOVW $1810, R12 + B callbackasm1(SB) + MOVW $1811, R12 + B callbackasm1(SB) + MOVW $1812, R12 + B callbackasm1(SB) + MOVW $1813, R12 + B callbackasm1(SB) + MOVW $1814, R12 + B callbackasm1(SB) + MOVW $1815, R12 + B callbackasm1(SB) + MOVW $1816, R12 + B callbackasm1(SB) + MOVW $1817, R12 + B callbackasm1(SB) + MOVW $1818, R12 + B callbackasm1(SB) + MOVW $1819, R12 + B callbackasm1(SB) + MOVW $1820, R12 + B callbackasm1(SB) + MOVW $1821, R12 + B callbackasm1(SB) + MOVW $1822, R12 + B callbackasm1(SB) + MOVW $1823, R12 + B callbackasm1(SB) + MOVW $1824, R12 + B callbackasm1(SB) + MOVW $1825, R12 + B callbackasm1(SB) + MOVW $1826, R12 + B callbackasm1(SB) + MOVW $1827, R12 + B callbackasm1(SB) + MOVW $1828, R12 + B callbackasm1(SB) + MOVW $1829, R12 + B callbackasm1(SB) + MOVW $1830, R12 + B callbackasm1(SB) + MOVW $1831, R12 + B callbackasm1(SB) + MOVW $1832, R12 + B callbackasm1(SB) + MOVW $1833, R12 + B callbackasm1(SB) + MOVW $1834, R12 + B callbackasm1(SB) + MOVW $1835, R12 + B callbackasm1(SB) + MOVW $1836, R12 + B callbackasm1(SB) + MOVW $1837, R12 + B callbackasm1(SB) + MOVW $1838, R12 + B callbackasm1(SB) + MOVW $1839, R12 + B callbackasm1(SB) + MOVW $1840, R12 + B callbackasm1(SB) + MOVW $1841, R12 + B callbackasm1(SB) + MOVW $1842, R12 + B callbackasm1(SB) + MOVW $1843, R12 + B callbackasm1(SB) + MOVW $1844, R12 + B callbackasm1(SB) + MOVW $1845, R12 + B callbackasm1(SB) + MOVW $1846, R12 + B callbackasm1(SB) + MOVW $1847, R12 + B callbackasm1(SB) + MOVW $1848, R12 + B callbackasm1(SB) + MOVW $1849, R12 + B callbackasm1(SB) + MOVW $1850, R12 + B callbackasm1(SB) + MOVW $1851, R12 + B callbackasm1(SB) + MOVW $1852, R12 + B callbackasm1(SB) + MOVW $1853, R12 + B callbackasm1(SB) + MOVW $1854, R12 + B callbackasm1(SB) + MOVW $1855, R12 + B callbackasm1(SB) + MOVW $1856, R12 + B callbackasm1(SB) + MOVW $1857, R12 + B callbackasm1(SB) + MOVW $1858, R12 + B callbackasm1(SB) + MOVW $1859, R12 + B callbackasm1(SB) + MOVW $1860, R12 + B callbackasm1(SB) + MOVW $1861, R12 + B callbackasm1(SB) + MOVW $1862, R12 + B callbackasm1(SB) + MOVW $1863, R12 + B callbackasm1(SB) + MOVW $1864, R12 + B callbackasm1(SB) + MOVW $1865, R12 + B callbackasm1(SB) + MOVW $1866, R12 + B callbackasm1(SB) + MOVW $1867, R12 + B callbackasm1(SB) + MOVW $1868, R12 + B callbackasm1(SB) + MOVW $1869, R12 + B callbackasm1(SB) + MOVW $1870, R12 + B callbackasm1(SB) + MOVW $1871, R12 + B callbackasm1(SB) + MOVW $1872, R12 + B callbackasm1(SB) + MOVW $1873, R12 + B callbackasm1(SB) + MOVW $1874, R12 + B callbackasm1(SB) + MOVW $1875, R12 + B callbackasm1(SB) + MOVW $1876, R12 + B callbackasm1(SB) + MOVW $1877, R12 + B callbackasm1(SB) + MOVW $1878, R12 + B callbackasm1(SB) + MOVW $1879, R12 + B callbackasm1(SB) + MOVW $1880, R12 + B callbackasm1(SB) + MOVW $1881, R12 + B callbackasm1(SB) + MOVW $1882, R12 + B callbackasm1(SB) + MOVW $1883, R12 + B callbackasm1(SB) + MOVW $1884, R12 + B callbackasm1(SB) + MOVW $1885, R12 + B callbackasm1(SB) + MOVW $1886, R12 + B callbackasm1(SB) + MOVW $1887, R12 + B callbackasm1(SB) + MOVW $1888, R12 + B callbackasm1(SB) + MOVW $1889, R12 + B callbackasm1(SB) + MOVW $1890, R12 + B callbackasm1(SB) + MOVW $1891, R12 + B callbackasm1(SB) + MOVW $1892, R12 + B callbackasm1(SB) + MOVW $1893, R12 + B callbackasm1(SB) + MOVW $1894, R12 + B callbackasm1(SB) + MOVW $1895, R12 + B callbackasm1(SB) + MOVW $1896, R12 + B callbackasm1(SB) + MOVW $1897, R12 + B callbackasm1(SB) + MOVW $1898, R12 + B callbackasm1(SB) + MOVW $1899, R12 + B callbackasm1(SB) + MOVW $1900, R12 + B callbackasm1(SB) + MOVW $1901, R12 + B callbackasm1(SB) + MOVW $1902, R12 + B callbackasm1(SB) + MOVW $1903, R12 + B callbackasm1(SB) + MOVW $1904, R12 + B callbackasm1(SB) + MOVW $1905, R12 + B callbackasm1(SB) + MOVW $1906, R12 + B callbackasm1(SB) + MOVW $1907, R12 + B callbackasm1(SB) + MOVW $1908, R12 + B callbackasm1(SB) + MOVW $1909, R12 + B callbackasm1(SB) + MOVW $1910, R12 + B callbackasm1(SB) + MOVW $1911, R12 + B callbackasm1(SB) + MOVW $1912, R12 + B callbackasm1(SB) + MOVW $1913, R12 + B callbackasm1(SB) + MOVW $1914, R12 + B callbackasm1(SB) + MOVW $1915, R12 + B callbackasm1(SB) + MOVW $1916, R12 + B callbackasm1(SB) + MOVW $1917, R12 + B callbackasm1(SB) + MOVW $1918, R12 + B callbackasm1(SB) + MOVW $1919, R12 + B callbackasm1(SB) + MOVW $1920, R12 + B callbackasm1(SB) + MOVW $1921, R12 + B callbackasm1(SB) + MOVW $1922, R12 + B callbackasm1(SB) + MOVW $1923, R12 + B callbackasm1(SB) + MOVW $1924, R12 + B callbackasm1(SB) + MOVW $1925, R12 + B callbackasm1(SB) + MOVW $1926, R12 + B callbackasm1(SB) + MOVW $1927, R12 + B callbackasm1(SB) + MOVW $1928, R12 + B callbackasm1(SB) + MOVW $1929, R12 + B callbackasm1(SB) + MOVW $1930, R12 + B callbackasm1(SB) + MOVW $1931, R12 + B callbackasm1(SB) + MOVW $1932, R12 + B callbackasm1(SB) + MOVW $1933, R12 + B callbackasm1(SB) + MOVW $1934, R12 + B callbackasm1(SB) + MOVW $1935, R12 + B callbackasm1(SB) + MOVW $1936, R12 + B callbackasm1(SB) + MOVW $1937, R12 + B callbackasm1(SB) + MOVW $1938, R12 + B callbackasm1(SB) + MOVW $1939, R12 + B callbackasm1(SB) + MOVW $1940, R12 + B callbackasm1(SB) + MOVW $1941, R12 + B callbackasm1(SB) + MOVW $1942, R12 + B callbackasm1(SB) + MOVW $1943, R12 + B callbackasm1(SB) + MOVW $1944, R12 + B callbackasm1(SB) + MOVW $1945, R12 + B callbackasm1(SB) + MOVW $1946, R12 + B callbackasm1(SB) + MOVW $1947, R12 + B callbackasm1(SB) + MOVW $1948, R12 + B callbackasm1(SB) + MOVW $1949, R12 + B callbackasm1(SB) + MOVW $1950, R12 + B callbackasm1(SB) + MOVW $1951, R12 + B callbackasm1(SB) + MOVW $1952, R12 + B callbackasm1(SB) + MOVW $1953, R12 + B callbackasm1(SB) + MOVW $1954, R12 + B callbackasm1(SB) + MOVW $1955, R12 + B callbackasm1(SB) + MOVW $1956, R12 + B callbackasm1(SB) + MOVW $1957, R12 + B callbackasm1(SB) + MOVW $1958, R12 + B callbackasm1(SB) + MOVW $1959, R12 + B callbackasm1(SB) + MOVW $1960, R12 + B callbackasm1(SB) + MOVW $1961, R12 + B callbackasm1(SB) + MOVW $1962, R12 + B callbackasm1(SB) + MOVW $1963, R12 + B callbackasm1(SB) + MOVW $1964, R12 + B callbackasm1(SB) + MOVW $1965, R12 + B callbackasm1(SB) + MOVW $1966, R12 + B callbackasm1(SB) + MOVW $1967, R12 + B callbackasm1(SB) + MOVW $1968, R12 + B callbackasm1(SB) + MOVW $1969, R12 + B callbackasm1(SB) + MOVW $1970, R12 + B callbackasm1(SB) + MOVW $1971, R12 + B callbackasm1(SB) + MOVW $1972, R12 + B callbackasm1(SB) + MOVW $1973, R12 + B callbackasm1(SB) + MOVW $1974, R12 + B callbackasm1(SB) + MOVW $1975, R12 + B callbackasm1(SB) + MOVW $1976, R12 + B callbackasm1(SB) + MOVW $1977, R12 + B callbackasm1(SB) + MOVW $1978, R12 + B callbackasm1(SB) + MOVW $1979, R12 + B callbackasm1(SB) + MOVW $1980, R12 + B callbackasm1(SB) + MOVW $1981, R12 + B callbackasm1(SB) + MOVW $1982, R12 + B callbackasm1(SB) + MOVW $1983, R12 + B callbackasm1(SB) + MOVW $1984, R12 + B callbackasm1(SB) + MOVW $1985, R12 + B callbackasm1(SB) + MOVW $1986, R12 + B callbackasm1(SB) + MOVW $1987, R12 + B callbackasm1(SB) + MOVW $1988, R12 + B callbackasm1(SB) + MOVW $1989, R12 + B callbackasm1(SB) + MOVW $1990, R12 + B callbackasm1(SB) + MOVW $1991, R12 + B callbackasm1(SB) + MOVW $1992, R12 + B callbackasm1(SB) + MOVW $1993, R12 + B callbackasm1(SB) + MOVW $1994, R12 + B callbackasm1(SB) + MOVW $1995, R12 + B callbackasm1(SB) + MOVW $1996, R12 + B callbackasm1(SB) + MOVW $1997, R12 + B callbackasm1(SB) + MOVW $1998, R12 + B callbackasm1(SB) + MOVW $1999, R12 + B callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_arm64.s b/vendor/github.com/ebitengine/purego/zcallback_arm64.s new file mode 100644 index 00000000..3fea4af8 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_arm64.s @@ -0,0 +1,4014 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build darwin || freebsd || linux || netbsd + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOV and B instructions. +// The MOV instruction loads R12 with the callback index, and the +// B instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R12 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + MOVD $0, R12 + B callbackasm1(SB) + MOVD $1, R12 + B callbackasm1(SB) + MOVD $2, R12 + B callbackasm1(SB) + MOVD $3, R12 + B callbackasm1(SB) + MOVD $4, R12 + B callbackasm1(SB) + MOVD $5, R12 + B callbackasm1(SB) + MOVD $6, R12 + B callbackasm1(SB) + MOVD $7, R12 + B callbackasm1(SB) + MOVD $8, R12 + B callbackasm1(SB) + MOVD $9, R12 + B callbackasm1(SB) + MOVD $10, R12 + B callbackasm1(SB) + MOVD $11, R12 + B callbackasm1(SB) + MOVD $12, R12 + B callbackasm1(SB) + MOVD $13, R12 + B callbackasm1(SB) + MOVD $14, R12 + B callbackasm1(SB) + MOVD $15, R12 + B callbackasm1(SB) + MOVD $16, R12 + B callbackasm1(SB) + MOVD $17, R12 + B callbackasm1(SB) + MOVD $18, R12 + B callbackasm1(SB) + MOVD $19, R12 + B callbackasm1(SB) + MOVD $20, R12 + B callbackasm1(SB) + MOVD $21, R12 + B callbackasm1(SB) + MOVD $22, R12 + B callbackasm1(SB) + MOVD $23, R12 + B callbackasm1(SB) + MOVD $24, R12 + B callbackasm1(SB) + MOVD $25, R12 + B callbackasm1(SB) + MOVD $26, R12 + B callbackasm1(SB) + MOVD $27, R12 + B callbackasm1(SB) + MOVD $28, R12 + B callbackasm1(SB) + MOVD $29, R12 + B callbackasm1(SB) + MOVD $30, R12 + B callbackasm1(SB) + MOVD $31, R12 + B callbackasm1(SB) + MOVD $32, R12 + B callbackasm1(SB) + MOVD $33, R12 + B callbackasm1(SB) + MOVD $34, R12 + B callbackasm1(SB) + MOVD $35, R12 + B callbackasm1(SB) + MOVD $36, R12 + B callbackasm1(SB) + MOVD $37, R12 + B callbackasm1(SB) + MOVD $38, R12 + B callbackasm1(SB) + MOVD $39, R12 + B callbackasm1(SB) + MOVD $40, R12 + B callbackasm1(SB) + MOVD $41, R12 + B callbackasm1(SB) + MOVD $42, R12 + B callbackasm1(SB) + MOVD $43, R12 + B callbackasm1(SB) + MOVD $44, R12 + B callbackasm1(SB) + MOVD $45, R12 + B callbackasm1(SB) + MOVD $46, R12 + B callbackasm1(SB) + MOVD $47, R12 + B callbackasm1(SB) + MOVD $48, R12 + B callbackasm1(SB) + MOVD $49, R12 + B callbackasm1(SB) + MOVD $50, R12 + B callbackasm1(SB) + MOVD $51, R12 + B callbackasm1(SB) + MOVD $52, R12 + B callbackasm1(SB) + MOVD $53, R12 + B callbackasm1(SB) + MOVD $54, R12 + B callbackasm1(SB) + MOVD $55, R12 + B callbackasm1(SB) + MOVD $56, R12 + B callbackasm1(SB) + MOVD $57, R12 + B callbackasm1(SB) + MOVD $58, R12 + B callbackasm1(SB) + MOVD $59, R12 + B callbackasm1(SB) + MOVD $60, R12 + B callbackasm1(SB) + MOVD $61, R12 + B callbackasm1(SB) + MOVD $62, R12 + B callbackasm1(SB) + MOVD $63, R12 + B callbackasm1(SB) + MOVD $64, R12 + B callbackasm1(SB) + MOVD $65, R12 + B callbackasm1(SB) + MOVD $66, R12 + B callbackasm1(SB) + MOVD $67, R12 + B callbackasm1(SB) + MOVD $68, R12 + B callbackasm1(SB) + MOVD $69, R12 + B callbackasm1(SB) + MOVD $70, R12 + B callbackasm1(SB) + MOVD $71, R12 + B callbackasm1(SB) + MOVD $72, R12 + B callbackasm1(SB) + MOVD $73, R12 + B callbackasm1(SB) + MOVD $74, R12 + B callbackasm1(SB) + MOVD $75, R12 + B callbackasm1(SB) + MOVD $76, R12 + B callbackasm1(SB) + MOVD $77, R12 + B callbackasm1(SB) + MOVD $78, R12 + B callbackasm1(SB) + MOVD $79, R12 + B callbackasm1(SB) + MOVD $80, R12 + B callbackasm1(SB) + MOVD $81, R12 + B callbackasm1(SB) + MOVD $82, R12 + B callbackasm1(SB) + MOVD $83, R12 + B callbackasm1(SB) + MOVD $84, R12 + B callbackasm1(SB) + MOVD $85, R12 + B callbackasm1(SB) + MOVD $86, R12 + B callbackasm1(SB) + MOVD $87, R12 + B callbackasm1(SB) + MOVD $88, R12 + B callbackasm1(SB) + MOVD $89, R12 + B callbackasm1(SB) + MOVD $90, R12 + B callbackasm1(SB) + MOVD $91, R12 + B callbackasm1(SB) + MOVD $92, R12 + B callbackasm1(SB) + MOVD $93, R12 + B callbackasm1(SB) + MOVD $94, R12 + B callbackasm1(SB) + MOVD $95, R12 + B callbackasm1(SB) + MOVD $96, R12 + B callbackasm1(SB) + MOVD $97, R12 + B callbackasm1(SB) + MOVD $98, R12 + B callbackasm1(SB) + MOVD $99, R12 + B callbackasm1(SB) + MOVD $100, R12 + B callbackasm1(SB) + MOVD $101, R12 + B callbackasm1(SB) + MOVD $102, R12 + B callbackasm1(SB) + MOVD $103, R12 + B callbackasm1(SB) + MOVD $104, R12 + B callbackasm1(SB) + MOVD $105, R12 + B callbackasm1(SB) + MOVD $106, R12 + B callbackasm1(SB) + MOVD $107, R12 + B callbackasm1(SB) + MOVD $108, R12 + B callbackasm1(SB) + MOVD $109, R12 + B callbackasm1(SB) + MOVD $110, R12 + B callbackasm1(SB) + MOVD $111, R12 + B callbackasm1(SB) + MOVD $112, R12 + B callbackasm1(SB) + MOVD $113, R12 + B callbackasm1(SB) + MOVD $114, R12 + B callbackasm1(SB) + MOVD $115, R12 + B callbackasm1(SB) + MOVD $116, R12 + B callbackasm1(SB) + MOVD $117, R12 + B callbackasm1(SB) + MOVD $118, R12 + B callbackasm1(SB) + MOVD $119, R12 + B callbackasm1(SB) + MOVD $120, R12 + B callbackasm1(SB) + MOVD $121, R12 + B callbackasm1(SB) + MOVD $122, R12 + B callbackasm1(SB) + MOVD $123, R12 + B callbackasm1(SB) + MOVD $124, R12 + B callbackasm1(SB) + MOVD $125, R12 + B callbackasm1(SB) + MOVD $126, R12 + B callbackasm1(SB) + MOVD $127, R12 + B callbackasm1(SB) + MOVD $128, R12 + B callbackasm1(SB) + MOVD $129, R12 + B callbackasm1(SB) + MOVD $130, R12 + B callbackasm1(SB) + MOVD $131, R12 + B callbackasm1(SB) + MOVD $132, R12 + B callbackasm1(SB) + MOVD $133, R12 + B callbackasm1(SB) + MOVD $134, R12 + B callbackasm1(SB) + MOVD $135, R12 + B callbackasm1(SB) + MOVD $136, R12 + B callbackasm1(SB) + MOVD $137, R12 + B callbackasm1(SB) + MOVD $138, R12 + B callbackasm1(SB) + MOVD $139, R12 + B callbackasm1(SB) + MOVD $140, R12 + B callbackasm1(SB) + MOVD $141, R12 + B callbackasm1(SB) + MOVD $142, R12 + B callbackasm1(SB) + MOVD $143, R12 + B callbackasm1(SB) + MOVD $144, R12 + B callbackasm1(SB) + MOVD $145, R12 + B callbackasm1(SB) + MOVD $146, R12 + B callbackasm1(SB) + MOVD $147, R12 + B callbackasm1(SB) + MOVD $148, R12 + B callbackasm1(SB) + MOVD $149, R12 + B callbackasm1(SB) + MOVD $150, R12 + B callbackasm1(SB) + MOVD $151, R12 + B callbackasm1(SB) + MOVD $152, R12 + B callbackasm1(SB) + MOVD $153, R12 + B callbackasm1(SB) + MOVD $154, R12 + B callbackasm1(SB) + MOVD $155, R12 + B callbackasm1(SB) + MOVD $156, R12 + B callbackasm1(SB) + MOVD $157, R12 + B callbackasm1(SB) + MOVD $158, R12 + B callbackasm1(SB) + MOVD $159, R12 + B callbackasm1(SB) + MOVD $160, R12 + B callbackasm1(SB) + MOVD $161, R12 + B callbackasm1(SB) + MOVD $162, R12 + B callbackasm1(SB) + MOVD $163, R12 + B callbackasm1(SB) + MOVD $164, R12 + B callbackasm1(SB) + MOVD $165, R12 + B callbackasm1(SB) + MOVD $166, R12 + B callbackasm1(SB) + MOVD $167, R12 + B callbackasm1(SB) + MOVD $168, R12 + B callbackasm1(SB) + MOVD $169, R12 + B callbackasm1(SB) + MOVD $170, R12 + B callbackasm1(SB) + MOVD $171, R12 + B callbackasm1(SB) + MOVD $172, R12 + B callbackasm1(SB) + MOVD $173, R12 + B callbackasm1(SB) + MOVD $174, R12 + B callbackasm1(SB) + MOVD $175, R12 + B callbackasm1(SB) + MOVD $176, R12 + B callbackasm1(SB) + MOVD $177, R12 + B callbackasm1(SB) + MOVD $178, R12 + B callbackasm1(SB) + MOVD $179, R12 + B callbackasm1(SB) + MOVD $180, R12 + B callbackasm1(SB) + MOVD $181, R12 + B callbackasm1(SB) + MOVD $182, R12 + B callbackasm1(SB) + MOVD $183, R12 + B callbackasm1(SB) + MOVD $184, R12 + B callbackasm1(SB) + MOVD $185, R12 + B callbackasm1(SB) + MOVD $186, R12 + B callbackasm1(SB) + MOVD $187, R12 + B callbackasm1(SB) + MOVD $188, R12 + B callbackasm1(SB) + MOVD $189, R12 + B callbackasm1(SB) + MOVD $190, R12 + B callbackasm1(SB) + MOVD $191, R12 + B callbackasm1(SB) + MOVD $192, R12 + B callbackasm1(SB) + MOVD $193, R12 + B callbackasm1(SB) + MOVD $194, R12 + B callbackasm1(SB) + MOVD $195, R12 + B callbackasm1(SB) + MOVD $196, R12 + B callbackasm1(SB) + MOVD $197, R12 + B callbackasm1(SB) + MOVD $198, R12 + B callbackasm1(SB) + MOVD $199, R12 + B callbackasm1(SB) + MOVD $200, R12 + B callbackasm1(SB) + MOVD $201, R12 + B callbackasm1(SB) + MOVD $202, R12 + B callbackasm1(SB) + MOVD $203, R12 + B callbackasm1(SB) + MOVD $204, R12 + B callbackasm1(SB) + MOVD $205, R12 + B callbackasm1(SB) + MOVD $206, R12 + B callbackasm1(SB) + MOVD $207, R12 + B callbackasm1(SB) + MOVD $208, R12 + B callbackasm1(SB) + MOVD $209, R12 + B callbackasm1(SB) + MOVD $210, R12 + B callbackasm1(SB) + MOVD $211, R12 + B callbackasm1(SB) + MOVD $212, R12 + B callbackasm1(SB) + MOVD $213, R12 + B callbackasm1(SB) + MOVD $214, R12 + B callbackasm1(SB) + MOVD $215, R12 + B callbackasm1(SB) + MOVD $216, R12 + B callbackasm1(SB) + MOVD $217, R12 + B callbackasm1(SB) + MOVD $218, R12 + B callbackasm1(SB) + MOVD $219, R12 + B callbackasm1(SB) + MOVD $220, R12 + B callbackasm1(SB) + MOVD $221, R12 + B callbackasm1(SB) + MOVD $222, R12 + B callbackasm1(SB) + MOVD $223, R12 + B callbackasm1(SB) + MOVD $224, R12 + B callbackasm1(SB) + MOVD $225, R12 + B callbackasm1(SB) + MOVD $226, R12 + B callbackasm1(SB) + MOVD $227, R12 + B callbackasm1(SB) + MOVD $228, R12 + B callbackasm1(SB) + MOVD $229, R12 + B callbackasm1(SB) + MOVD $230, R12 + B callbackasm1(SB) + MOVD $231, R12 + B callbackasm1(SB) + MOVD $232, R12 + B callbackasm1(SB) + MOVD $233, R12 + B callbackasm1(SB) + MOVD $234, R12 + B callbackasm1(SB) + MOVD $235, R12 + B callbackasm1(SB) + MOVD $236, R12 + B callbackasm1(SB) + MOVD $237, R12 + B callbackasm1(SB) + MOVD $238, R12 + B callbackasm1(SB) + MOVD $239, R12 + B callbackasm1(SB) + MOVD $240, R12 + B callbackasm1(SB) + MOVD $241, R12 + B callbackasm1(SB) + MOVD $242, R12 + B callbackasm1(SB) + MOVD $243, R12 + B callbackasm1(SB) + MOVD $244, R12 + B callbackasm1(SB) + MOVD $245, R12 + B callbackasm1(SB) + MOVD $246, R12 + B callbackasm1(SB) + MOVD $247, R12 + B callbackasm1(SB) + MOVD $248, R12 + B callbackasm1(SB) + MOVD $249, R12 + B callbackasm1(SB) + MOVD $250, R12 + B callbackasm1(SB) + MOVD $251, R12 + B callbackasm1(SB) + MOVD $252, R12 + B callbackasm1(SB) + MOVD $253, R12 + B callbackasm1(SB) + MOVD $254, R12 + B callbackasm1(SB) + MOVD $255, R12 + B callbackasm1(SB) + MOVD $256, R12 + B callbackasm1(SB) + MOVD $257, R12 + B callbackasm1(SB) + MOVD $258, R12 + B callbackasm1(SB) + MOVD $259, R12 + B callbackasm1(SB) + MOVD $260, R12 + B callbackasm1(SB) + MOVD $261, R12 + B callbackasm1(SB) + MOVD $262, R12 + B callbackasm1(SB) + MOVD $263, R12 + B callbackasm1(SB) + MOVD $264, R12 + B callbackasm1(SB) + MOVD $265, R12 + B callbackasm1(SB) + MOVD $266, R12 + B callbackasm1(SB) + MOVD $267, R12 + B callbackasm1(SB) + MOVD $268, R12 + B callbackasm1(SB) + MOVD $269, R12 + B callbackasm1(SB) + MOVD $270, R12 + B callbackasm1(SB) + MOVD $271, R12 + B callbackasm1(SB) + MOVD $272, R12 + B callbackasm1(SB) + MOVD $273, R12 + B callbackasm1(SB) + MOVD $274, R12 + B callbackasm1(SB) + MOVD $275, R12 + B callbackasm1(SB) + MOVD $276, R12 + B callbackasm1(SB) + MOVD $277, R12 + B callbackasm1(SB) + MOVD $278, R12 + B callbackasm1(SB) + MOVD $279, R12 + B callbackasm1(SB) + MOVD $280, R12 + B callbackasm1(SB) + MOVD $281, R12 + B callbackasm1(SB) + MOVD $282, R12 + B callbackasm1(SB) + MOVD $283, R12 + B callbackasm1(SB) + MOVD $284, R12 + B callbackasm1(SB) + MOVD $285, R12 + B callbackasm1(SB) + MOVD $286, R12 + B callbackasm1(SB) + MOVD $287, R12 + B callbackasm1(SB) + MOVD $288, R12 + B callbackasm1(SB) + MOVD $289, R12 + B callbackasm1(SB) + MOVD $290, R12 + B callbackasm1(SB) + MOVD $291, R12 + B callbackasm1(SB) + MOVD $292, R12 + B callbackasm1(SB) + MOVD $293, R12 + B callbackasm1(SB) + MOVD $294, R12 + B callbackasm1(SB) + MOVD $295, R12 + B callbackasm1(SB) + MOVD $296, R12 + B callbackasm1(SB) + MOVD $297, R12 + B callbackasm1(SB) + MOVD $298, R12 + B callbackasm1(SB) + MOVD $299, R12 + B callbackasm1(SB) + MOVD $300, R12 + B callbackasm1(SB) + MOVD $301, R12 + B callbackasm1(SB) + MOVD $302, R12 + B callbackasm1(SB) + MOVD $303, R12 + B callbackasm1(SB) + MOVD $304, R12 + B callbackasm1(SB) + MOVD $305, R12 + B callbackasm1(SB) + MOVD $306, R12 + B callbackasm1(SB) + MOVD $307, R12 + B callbackasm1(SB) + MOVD $308, R12 + B callbackasm1(SB) + MOVD $309, R12 + B callbackasm1(SB) + MOVD $310, R12 + B callbackasm1(SB) + MOVD $311, R12 + B callbackasm1(SB) + MOVD $312, R12 + B callbackasm1(SB) + MOVD $313, R12 + B callbackasm1(SB) + MOVD $314, R12 + B callbackasm1(SB) + MOVD $315, R12 + B callbackasm1(SB) + MOVD $316, R12 + B callbackasm1(SB) + MOVD $317, R12 + B callbackasm1(SB) + MOVD $318, R12 + B callbackasm1(SB) + MOVD $319, R12 + B callbackasm1(SB) + MOVD $320, R12 + B callbackasm1(SB) + MOVD $321, R12 + B callbackasm1(SB) + MOVD $322, R12 + B callbackasm1(SB) + MOVD $323, R12 + B callbackasm1(SB) + MOVD $324, R12 + B callbackasm1(SB) + MOVD $325, R12 + B callbackasm1(SB) + MOVD $326, R12 + B callbackasm1(SB) + MOVD $327, R12 + B callbackasm1(SB) + MOVD $328, R12 + B callbackasm1(SB) + MOVD $329, R12 + B callbackasm1(SB) + MOVD $330, R12 + B callbackasm1(SB) + MOVD $331, R12 + B callbackasm1(SB) + MOVD $332, R12 + B callbackasm1(SB) + MOVD $333, R12 + B callbackasm1(SB) + MOVD $334, R12 + B callbackasm1(SB) + MOVD $335, R12 + B callbackasm1(SB) + MOVD $336, R12 + B callbackasm1(SB) + MOVD $337, R12 + B callbackasm1(SB) + MOVD $338, R12 + B callbackasm1(SB) + MOVD $339, R12 + B callbackasm1(SB) + MOVD $340, R12 + B callbackasm1(SB) + MOVD $341, R12 + B callbackasm1(SB) + MOVD $342, R12 + B callbackasm1(SB) + MOVD $343, R12 + B callbackasm1(SB) + MOVD $344, R12 + B callbackasm1(SB) + MOVD $345, R12 + B callbackasm1(SB) + MOVD $346, R12 + B callbackasm1(SB) + MOVD $347, R12 + B callbackasm1(SB) + MOVD $348, R12 + B callbackasm1(SB) + MOVD $349, R12 + B callbackasm1(SB) + MOVD $350, R12 + B callbackasm1(SB) + MOVD $351, R12 + B callbackasm1(SB) + MOVD $352, R12 + B callbackasm1(SB) + MOVD $353, R12 + B callbackasm1(SB) + MOVD $354, R12 + B callbackasm1(SB) + MOVD $355, R12 + B callbackasm1(SB) + MOVD $356, R12 + B callbackasm1(SB) + MOVD $357, R12 + B callbackasm1(SB) + MOVD $358, R12 + B callbackasm1(SB) + MOVD $359, R12 + B callbackasm1(SB) + MOVD $360, R12 + B callbackasm1(SB) + MOVD $361, R12 + B callbackasm1(SB) + MOVD $362, R12 + B callbackasm1(SB) + MOVD $363, R12 + B callbackasm1(SB) + MOVD $364, R12 + B callbackasm1(SB) + MOVD $365, R12 + B callbackasm1(SB) + MOVD $366, R12 + B callbackasm1(SB) + MOVD $367, R12 + B callbackasm1(SB) + MOVD $368, R12 + B callbackasm1(SB) + MOVD $369, R12 + B callbackasm1(SB) + MOVD $370, R12 + B callbackasm1(SB) + MOVD $371, R12 + B callbackasm1(SB) + MOVD $372, R12 + B callbackasm1(SB) + MOVD $373, R12 + B callbackasm1(SB) + MOVD $374, R12 + B callbackasm1(SB) + MOVD $375, R12 + B callbackasm1(SB) + MOVD $376, R12 + B callbackasm1(SB) + MOVD $377, R12 + B callbackasm1(SB) + MOVD $378, R12 + B callbackasm1(SB) + MOVD $379, R12 + B callbackasm1(SB) + MOVD $380, R12 + B callbackasm1(SB) + MOVD $381, R12 + B callbackasm1(SB) + MOVD $382, R12 + B callbackasm1(SB) + MOVD $383, R12 + B callbackasm1(SB) + MOVD $384, R12 + B callbackasm1(SB) + MOVD $385, R12 + B callbackasm1(SB) + MOVD $386, R12 + B callbackasm1(SB) + MOVD $387, R12 + B callbackasm1(SB) + MOVD $388, R12 + B callbackasm1(SB) + MOVD $389, R12 + B callbackasm1(SB) + MOVD $390, R12 + B callbackasm1(SB) + MOVD $391, R12 + B callbackasm1(SB) + MOVD $392, R12 + B callbackasm1(SB) + MOVD $393, R12 + B callbackasm1(SB) + MOVD $394, R12 + B callbackasm1(SB) + MOVD $395, R12 + B callbackasm1(SB) + MOVD $396, R12 + B callbackasm1(SB) + MOVD $397, R12 + B callbackasm1(SB) + MOVD $398, R12 + B callbackasm1(SB) + MOVD $399, R12 + B callbackasm1(SB) + MOVD $400, R12 + B callbackasm1(SB) + MOVD $401, R12 + B callbackasm1(SB) + MOVD $402, R12 + B callbackasm1(SB) + MOVD $403, R12 + B callbackasm1(SB) + MOVD $404, R12 + B callbackasm1(SB) + MOVD $405, R12 + B callbackasm1(SB) + MOVD $406, R12 + B callbackasm1(SB) + MOVD $407, R12 + B callbackasm1(SB) + MOVD $408, R12 + B callbackasm1(SB) + MOVD $409, R12 + B callbackasm1(SB) + MOVD $410, R12 + B callbackasm1(SB) + MOVD $411, R12 + B callbackasm1(SB) + MOVD $412, R12 + B callbackasm1(SB) + MOVD $413, R12 + B callbackasm1(SB) + MOVD $414, R12 + B callbackasm1(SB) + MOVD $415, R12 + B callbackasm1(SB) + MOVD $416, R12 + B callbackasm1(SB) + MOVD $417, R12 + B callbackasm1(SB) + MOVD $418, R12 + B callbackasm1(SB) + MOVD $419, R12 + B callbackasm1(SB) + MOVD $420, R12 + B callbackasm1(SB) + MOVD $421, R12 + B callbackasm1(SB) + MOVD $422, R12 + B callbackasm1(SB) + MOVD $423, R12 + B callbackasm1(SB) + MOVD $424, R12 + B callbackasm1(SB) + MOVD $425, R12 + B callbackasm1(SB) + MOVD $426, R12 + B callbackasm1(SB) + MOVD $427, R12 + B callbackasm1(SB) + MOVD $428, R12 + B callbackasm1(SB) + MOVD $429, R12 + B callbackasm1(SB) + MOVD $430, R12 + B callbackasm1(SB) + MOVD $431, R12 + B callbackasm1(SB) + MOVD $432, R12 + B callbackasm1(SB) + MOVD $433, R12 + B callbackasm1(SB) + MOVD $434, R12 + B callbackasm1(SB) + MOVD $435, R12 + B callbackasm1(SB) + MOVD $436, R12 + B callbackasm1(SB) + MOVD $437, R12 + B callbackasm1(SB) + MOVD $438, R12 + B callbackasm1(SB) + MOVD $439, R12 + B callbackasm1(SB) + MOVD $440, R12 + B callbackasm1(SB) + MOVD $441, R12 + B callbackasm1(SB) + MOVD $442, R12 + B callbackasm1(SB) + MOVD $443, R12 + B callbackasm1(SB) + MOVD $444, R12 + B callbackasm1(SB) + MOVD $445, R12 + B callbackasm1(SB) + MOVD $446, R12 + B callbackasm1(SB) + MOVD $447, R12 + B callbackasm1(SB) + MOVD $448, R12 + B callbackasm1(SB) + MOVD $449, R12 + B callbackasm1(SB) + MOVD $450, R12 + B callbackasm1(SB) + MOVD $451, R12 + B callbackasm1(SB) + MOVD $452, R12 + B callbackasm1(SB) + MOVD $453, R12 + B callbackasm1(SB) + MOVD $454, R12 + B callbackasm1(SB) + MOVD $455, R12 + B callbackasm1(SB) + MOVD $456, R12 + B callbackasm1(SB) + MOVD $457, R12 + B callbackasm1(SB) + MOVD $458, R12 + B callbackasm1(SB) + MOVD $459, R12 + B callbackasm1(SB) + MOVD $460, R12 + B callbackasm1(SB) + MOVD $461, R12 + B callbackasm1(SB) + MOVD $462, R12 + B callbackasm1(SB) + MOVD $463, R12 + B callbackasm1(SB) + MOVD $464, R12 + B callbackasm1(SB) + MOVD $465, R12 + B callbackasm1(SB) + MOVD $466, R12 + B callbackasm1(SB) + MOVD $467, R12 + B callbackasm1(SB) + MOVD $468, R12 + B callbackasm1(SB) + MOVD $469, R12 + B callbackasm1(SB) + MOVD $470, R12 + B callbackasm1(SB) + MOVD $471, R12 + B callbackasm1(SB) + MOVD $472, R12 + B callbackasm1(SB) + MOVD $473, R12 + B callbackasm1(SB) + MOVD $474, R12 + B callbackasm1(SB) + MOVD $475, R12 + B callbackasm1(SB) + MOVD $476, R12 + B callbackasm1(SB) + MOVD $477, R12 + B callbackasm1(SB) + MOVD $478, R12 + B callbackasm1(SB) + MOVD $479, R12 + B callbackasm1(SB) + MOVD $480, R12 + B callbackasm1(SB) + MOVD $481, R12 + B callbackasm1(SB) + MOVD $482, R12 + B callbackasm1(SB) + MOVD $483, R12 + B callbackasm1(SB) + MOVD $484, R12 + B callbackasm1(SB) + MOVD $485, R12 + B callbackasm1(SB) + MOVD $486, R12 + B callbackasm1(SB) + MOVD $487, R12 + B callbackasm1(SB) + MOVD $488, R12 + B callbackasm1(SB) + MOVD $489, R12 + B callbackasm1(SB) + MOVD $490, R12 + B callbackasm1(SB) + MOVD $491, R12 + B callbackasm1(SB) + MOVD $492, R12 + B callbackasm1(SB) + MOVD $493, R12 + B callbackasm1(SB) + MOVD $494, R12 + B callbackasm1(SB) + MOVD $495, R12 + B callbackasm1(SB) + MOVD $496, R12 + B callbackasm1(SB) + MOVD $497, R12 + B callbackasm1(SB) + MOVD $498, R12 + B callbackasm1(SB) + MOVD $499, R12 + B callbackasm1(SB) + MOVD $500, R12 + B callbackasm1(SB) + MOVD $501, R12 + B callbackasm1(SB) + MOVD $502, R12 + B callbackasm1(SB) + MOVD $503, R12 + B callbackasm1(SB) + MOVD $504, R12 + B callbackasm1(SB) + MOVD $505, R12 + B callbackasm1(SB) + MOVD $506, R12 + B callbackasm1(SB) + MOVD $507, R12 + B callbackasm1(SB) + MOVD $508, R12 + B callbackasm1(SB) + MOVD $509, R12 + B callbackasm1(SB) + MOVD $510, R12 + B callbackasm1(SB) + MOVD $511, R12 + B callbackasm1(SB) + MOVD $512, R12 + B callbackasm1(SB) + MOVD $513, R12 + B callbackasm1(SB) + MOVD $514, R12 + B callbackasm1(SB) + MOVD $515, R12 + B callbackasm1(SB) + MOVD $516, R12 + B callbackasm1(SB) + MOVD $517, R12 + B callbackasm1(SB) + MOVD $518, R12 + B callbackasm1(SB) + MOVD $519, R12 + B callbackasm1(SB) + MOVD $520, R12 + B callbackasm1(SB) + MOVD $521, R12 + B callbackasm1(SB) + MOVD $522, R12 + B callbackasm1(SB) + MOVD $523, R12 + B callbackasm1(SB) + MOVD $524, R12 + B callbackasm1(SB) + MOVD $525, R12 + B callbackasm1(SB) + MOVD $526, R12 + B callbackasm1(SB) + MOVD $527, R12 + B callbackasm1(SB) + MOVD $528, R12 + B callbackasm1(SB) + MOVD $529, R12 + B callbackasm1(SB) + MOVD $530, R12 + B callbackasm1(SB) + MOVD $531, R12 + B callbackasm1(SB) + MOVD $532, R12 + B callbackasm1(SB) + MOVD $533, R12 + B callbackasm1(SB) + MOVD $534, R12 + B callbackasm1(SB) + MOVD $535, R12 + B callbackasm1(SB) + MOVD $536, R12 + B callbackasm1(SB) + MOVD $537, R12 + B callbackasm1(SB) + MOVD $538, R12 + B callbackasm1(SB) + MOVD $539, R12 + B callbackasm1(SB) + MOVD $540, R12 + B callbackasm1(SB) + MOVD $541, R12 + B callbackasm1(SB) + MOVD $542, R12 + B callbackasm1(SB) + MOVD $543, R12 + B callbackasm1(SB) + MOVD $544, R12 + B callbackasm1(SB) + MOVD $545, R12 + B callbackasm1(SB) + MOVD $546, R12 + B callbackasm1(SB) + MOVD $547, R12 + B callbackasm1(SB) + MOVD $548, R12 + B callbackasm1(SB) + MOVD $549, R12 + B callbackasm1(SB) + MOVD $550, R12 + B callbackasm1(SB) + MOVD $551, R12 + B callbackasm1(SB) + MOVD $552, R12 + B callbackasm1(SB) + MOVD $553, R12 + B callbackasm1(SB) + MOVD $554, R12 + B callbackasm1(SB) + MOVD $555, R12 + B callbackasm1(SB) + MOVD $556, R12 + B callbackasm1(SB) + MOVD $557, R12 + B callbackasm1(SB) + MOVD $558, R12 + B callbackasm1(SB) + MOVD $559, R12 + B callbackasm1(SB) + MOVD $560, R12 + B callbackasm1(SB) + MOVD $561, R12 + B callbackasm1(SB) + MOVD $562, R12 + B callbackasm1(SB) + MOVD $563, R12 + B callbackasm1(SB) + MOVD $564, R12 + B callbackasm1(SB) + MOVD $565, R12 + B callbackasm1(SB) + MOVD $566, R12 + B callbackasm1(SB) + MOVD $567, R12 + B callbackasm1(SB) + MOVD $568, R12 + B callbackasm1(SB) + MOVD $569, R12 + B callbackasm1(SB) + MOVD $570, R12 + B callbackasm1(SB) + MOVD $571, R12 + B callbackasm1(SB) + MOVD $572, R12 + B callbackasm1(SB) + MOVD $573, R12 + B callbackasm1(SB) + MOVD $574, R12 + B callbackasm1(SB) + MOVD $575, R12 + B callbackasm1(SB) + MOVD $576, R12 + B callbackasm1(SB) + MOVD $577, R12 + B callbackasm1(SB) + MOVD $578, R12 + B callbackasm1(SB) + MOVD $579, R12 + B callbackasm1(SB) + MOVD $580, R12 + B callbackasm1(SB) + MOVD $581, R12 + B callbackasm1(SB) + MOVD $582, R12 + B callbackasm1(SB) + MOVD $583, R12 + B callbackasm1(SB) + MOVD $584, R12 + B callbackasm1(SB) + MOVD $585, R12 + B callbackasm1(SB) + MOVD $586, R12 + B callbackasm1(SB) + MOVD $587, R12 + B callbackasm1(SB) + MOVD $588, R12 + B callbackasm1(SB) + MOVD $589, R12 + B callbackasm1(SB) + MOVD $590, R12 + B callbackasm1(SB) + MOVD $591, R12 + B callbackasm1(SB) + MOVD $592, R12 + B callbackasm1(SB) + MOVD $593, R12 + B callbackasm1(SB) + MOVD $594, R12 + B callbackasm1(SB) + MOVD $595, R12 + B callbackasm1(SB) + MOVD $596, R12 + B callbackasm1(SB) + MOVD $597, R12 + B callbackasm1(SB) + MOVD $598, R12 + B callbackasm1(SB) + MOVD $599, R12 + B callbackasm1(SB) + MOVD $600, R12 + B callbackasm1(SB) + MOVD $601, R12 + B callbackasm1(SB) + MOVD $602, R12 + B callbackasm1(SB) + MOVD $603, R12 + B callbackasm1(SB) + MOVD $604, R12 + B callbackasm1(SB) + MOVD $605, R12 + B callbackasm1(SB) + MOVD $606, R12 + B callbackasm1(SB) + MOVD $607, R12 + B callbackasm1(SB) + MOVD $608, R12 + B callbackasm1(SB) + MOVD $609, R12 + B callbackasm1(SB) + MOVD $610, R12 + B callbackasm1(SB) + MOVD $611, R12 + B callbackasm1(SB) + MOVD $612, R12 + B callbackasm1(SB) + MOVD $613, R12 + B callbackasm1(SB) + MOVD $614, R12 + B callbackasm1(SB) + MOVD $615, R12 + B callbackasm1(SB) + MOVD $616, R12 + B callbackasm1(SB) + MOVD $617, R12 + B callbackasm1(SB) + MOVD $618, R12 + B callbackasm1(SB) + MOVD $619, R12 + B callbackasm1(SB) + MOVD $620, R12 + B callbackasm1(SB) + MOVD $621, R12 + B callbackasm1(SB) + MOVD $622, R12 + B callbackasm1(SB) + MOVD $623, R12 + B callbackasm1(SB) + MOVD $624, R12 + B callbackasm1(SB) + MOVD $625, R12 + B callbackasm1(SB) + MOVD $626, R12 + B callbackasm1(SB) + MOVD $627, R12 + B callbackasm1(SB) + MOVD $628, R12 + B callbackasm1(SB) + MOVD $629, R12 + B callbackasm1(SB) + MOVD $630, R12 + B callbackasm1(SB) + MOVD $631, R12 + B callbackasm1(SB) + MOVD $632, R12 + B callbackasm1(SB) + MOVD $633, R12 + B callbackasm1(SB) + MOVD $634, R12 + B callbackasm1(SB) + MOVD $635, R12 + B callbackasm1(SB) + MOVD $636, R12 + B callbackasm1(SB) + MOVD $637, R12 + B callbackasm1(SB) + MOVD $638, R12 + B callbackasm1(SB) + MOVD $639, R12 + B callbackasm1(SB) + MOVD $640, R12 + B callbackasm1(SB) + MOVD $641, R12 + B callbackasm1(SB) + MOVD $642, R12 + B callbackasm1(SB) + MOVD $643, R12 + B callbackasm1(SB) + MOVD $644, R12 + B callbackasm1(SB) + MOVD $645, R12 + B callbackasm1(SB) + MOVD $646, R12 + B callbackasm1(SB) + MOVD $647, R12 + B callbackasm1(SB) + MOVD $648, R12 + B callbackasm1(SB) + MOVD $649, R12 + B callbackasm1(SB) + MOVD $650, R12 + B callbackasm1(SB) + MOVD $651, R12 + B callbackasm1(SB) + MOVD $652, R12 + B callbackasm1(SB) + MOVD $653, R12 + B callbackasm1(SB) + MOVD $654, R12 + B callbackasm1(SB) + MOVD $655, R12 + B callbackasm1(SB) + MOVD $656, R12 + B callbackasm1(SB) + MOVD $657, R12 + B callbackasm1(SB) + MOVD $658, R12 + B callbackasm1(SB) + MOVD $659, R12 + B callbackasm1(SB) + MOVD $660, R12 + B callbackasm1(SB) + MOVD $661, R12 + B callbackasm1(SB) + MOVD $662, R12 + B callbackasm1(SB) + MOVD $663, R12 + B callbackasm1(SB) + MOVD $664, R12 + B callbackasm1(SB) + MOVD $665, R12 + B callbackasm1(SB) + MOVD $666, R12 + B callbackasm1(SB) + MOVD $667, R12 + B callbackasm1(SB) + MOVD $668, R12 + B callbackasm1(SB) + MOVD $669, R12 + B callbackasm1(SB) + MOVD $670, R12 + B callbackasm1(SB) + MOVD $671, R12 + B callbackasm1(SB) + MOVD $672, R12 + B callbackasm1(SB) + MOVD $673, R12 + B callbackasm1(SB) + MOVD $674, R12 + B callbackasm1(SB) + MOVD $675, R12 + B callbackasm1(SB) + MOVD $676, R12 + B callbackasm1(SB) + MOVD $677, R12 + B callbackasm1(SB) + MOVD $678, R12 + B callbackasm1(SB) + MOVD $679, R12 + B callbackasm1(SB) + MOVD $680, R12 + B callbackasm1(SB) + MOVD $681, R12 + B callbackasm1(SB) + MOVD $682, R12 + B callbackasm1(SB) + MOVD $683, R12 + B callbackasm1(SB) + MOVD $684, R12 + B callbackasm1(SB) + MOVD $685, R12 + B callbackasm1(SB) + MOVD $686, R12 + B callbackasm1(SB) + MOVD $687, R12 + B callbackasm1(SB) + MOVD $688, R12 + B callbackasm1(SB) + MOVD $689, R12 + B callbackasm1(SB) + MOVD $690, R12 + B callbackasm1(SB) + MOVD $691, R12 + B callbackasm1(SB) + MOVD $692, R12 + B callbackasm1(SB) + MOVD $693, R12 + B callbackasm1(SB) + MOVD $694, R12 + B callbackasm1(SB) + MOVD $695, R12 + B callbackasm1(SB) + MOVD $696, R12 + B callbackasm1(SB) + MOVD $697, R12 + B callbackasm1(SB) + MOVD $698, R12 + B callbackasm1(SB) + MOVD $699, R12 + B callbackasm1(SB) + MOVD $700, R12 + B callbackasm1(SB) + MOVD $701, R12 + B callbackasm1(SB) + MOVD $702, R12 + B callbackasm1(SB) + MOVD $703, R12 + B callbackasm1(SB) + MOVD $704, R12 + B callbackasm1(SB) + MOVD $705, R12 + B callbackasm1(SB) + MOVD $706, R12 + B callbackasm1(SB) + MOVD $707, R12 + B callbackasm1(SB) + MOVD $708, R12 + B callbackasm1(SB) + MOVD $709, R12 + B callbackasm1(SB) + MOVD $710, R12 + B callbackasm1(SB) + MOVD $711, R12 + B callbackasm1(SB) + MOVD $712, R12 + B callbackasm1(SB) + MOVD $713, R12 + B callbackasm1(SB) + MOVD $714, R12 + B callbackasm1(SB) + MOVD $715, R12 + B callbackasm1(SB) + MOVD $716, R12 + B callbackasm1(SB) + MOVD $717, R12 + B callbackasm1(SB) + MOVD $718, R12 + B callbackasm1(SB) + MOVD $719, R12 + B callbackasm1(SB) + MOVD $720, R12 + B callbackasm1(SB) + MOVD $721, R12 + B callbackasm1(SB) + MOVD $722, R12 + B callbackasm1(SB) + MOVD $723, R12 + B callbackasm1(SB) + MOVD $724, R12 + B callbackasm1(SB) + MOVD $725, R12 + B callbackasm1(SB) + MOVD $726, R12 + B callbackasm1(SB) + MOVD $727, R12 + B callbackasm1(SB) + MOVD $728, R12 + B callbackasm1(SB) + MOVD $729, R12 + B callbackasm1(SB) + MOVD $730, R12 + B callbackasm1(SB) + MOVD $731, R12 + B callbackasm1(SB) + MOVD $732, R12 + B callbackasm1(SB) + MOVD $733, R12 + B callbackasm1(SB) + MOVD $734, R12 + B callbackasm1(SB) + MOVD $735, R12 + B callbackasm1(SB) + MOVD $736, R12 + B callbackasm1(SB) + MOVD $737, R12 + B callbackasm1(SB) + MOVD $738, R12 + B callbackasm1(SB) + MOVD $739, R12 + B callbackasm1(SB) + MOVD $740, R12 + B callbackasm1(SB) + MOVD $741, R12 + B callbackasm1(SB) + MOVD $742, R12 + B callbackasm1(SB) + MOVD $743, R12 + B callbackasm1(SB) + MOVD $744, R12 + B callbackasm1(SB) + MOVD $745, R12 + B callbackasm1(SB) + MOVD $746, R12 + B callbackasm1(SB) + MOVD $747, R12 + B callbackasm1(SB) + MOVD $748, R12 + B callbackasm1(SB) + MOVD $749, R12 + B callbackasm1(SB) + MOVD $750, R12 + B callbackasm1(SB) + MOVD $751, R12 + B callbackasm1(SB) + MOVD $752, R12 + B callbackasm1(SB) + MOVD $753, R12 + B callbackasm1(SB) + MOVD $754, R12 + B callbackasm1(SB) + MOVD $755, R12 + B callbackasm1(SB) + MOVD $756, R12 + B callbackasm1(SB) + MOVD $757, R12 + B callbackasm1(SB) + MOVD $758, R12 + B callbackasm1(SB) + MOVD $759, R12 + B callbackasm1(SB) + MOVD $760, R12 + B callbackasm1(SB) + MOVD $761, R12 + B callbackasm1(SB) + MOVD $762, R12 + B callbackasm1(SB) + MOVD $763, R12 + B callbackasm1(SB) + MOVD $764, R12 + B callbackasm1(SB) + MOVD $765, R12 + B callbackasm1(SB) + MOVD $766, R12 + B callbackasm1(SB) + MOVD $767, R12 + B callbackasm1(SB) + MOVD $768, R12 + B callbackasm1(SB) + MOVD $769, R12 + B callbackasm1(SB) + MOVD $770, R12 + B callbackasm1(SB) + MOVD $771, R12 + B callbackasm1(SB) + MOVD $772, R12 + B callbackasm1(SB) + MOVD $773, R12 + B callbackasm1(SB) + MOVD $774, R12 + B callbackasm1(SB) + MOVD $775, R12 + B callbackasm1(SB) + MOVD $776, R12 + B callbackasm1(SB) + MOVD $777, R12 + B callbackasm1(SB) + MOVD $778, R12 + B callbackasm1(SB) + MOVD $779, R12 + B callbackasm1(SB) + MOVD $780, R12 + B callbackasm1(SB) + MOVD $781, R12 + B callbackasm1(SB) + MOVD $782, R12 + B callbackasm1(SB) + MOVD $783, R12 + B callbackasm1(SB) + MOVD $784, R12 + B callbackasm1(SB) + MOVD $785, R12 + B callbackasm1(SB) + MOVD $786, R12 + B callbackasm1(SB) + MOVD $787, R12 + B callbackasm1(SB) + MOVD $788, R12 + B callbackasm1(SB) + MOVD $789, R12 + B callbackasm1(SB) + MOVD $790, R12 + B callbackasm1(SB) + MOVD $791, R12 + B callbackasm1(SB) + MOVD $792, R12 + B callbackasm1(SB) + MOVD $793, R12 + B callbackasm1(SB) + MOVD $794, R12 + B callbackasm1(SB) + MOVD $795, R12 + B callbackasm1(SB) + MOVD $796, R12 + B callbackasm1(SB) + MOVD $797, R12 + B callbackasm1(SB) + MOVD $798, R12 + B callbackasm1(SB) + MOVD $799, R12 + B callbackasm1(SB) + MOVD $800, R12 + B callbackasm1(SB) + MOVD $801, R12 + B callbackasm1(SB) + MOVD $802, R12 + B callbackasm1(SB) + MOVD $803, R12 + B callbackasm1(SB) + MOVD $804, R12 + B callbackasm1(SB) + MOVD $805, R12 + B callbackasm1(SB) + MOVD $806, R12 + B callbackasm1(SB) + MOVD $807, R12 + B callbackasm1(SB) + MOVD $808, R12 + B callbackasm1(SB) + MOVD $809, R12 + B callbackasm1(SB) + MOVD $810, R12 + B callbackasm1(SB) + MOVD $811, R12 + B callbackasm1(SB) + MOVD $812, R12 + B callbackasm1(SB) + MOVD $813, R12 + B callbackasm1(SB) + MOVD $814, R12 + B callbackasm1(SB) + MOVD $815, R12 + B callbackasm1(SB) + MOVD $816, R12 + B callbackasm1(SB) + MOVD $817, R12 + B callbackasm1(SB) + MOVD $818, R12 + B callbackasm1(SB) + MOVD $819, R12 + B callbackasm1(SB) + MOVD $820, R12 + B callbackasm1(SB) + MOVD $821, R12 + B callbackasm1(SB) + MOVD $822, R12 + B callbackasm1(SB) + MOVD $823, R12 + B callbackasm1(SB) + MOVD $824, R12 + B callbackasm1(SB) + MOVD $825, R12 + B callbackasm1(SB) + MOVD $826, R12 + B callbackasm1(SB) + MOVD $827, R12 + B callbackasm1(SB) + MOVD $828, R12 + B callbackasm1(SB) + MOVD $829, R12 + B callbackasm1(SB) + MOVD $830, R12 + B callbackasm1(SB) + MOVD $831, R12 + B callbackasm1(SB) + MOVD $832, R12 + B callbackasm1(SB) + MOVD $833, R12 + B callbackasm1(SB) + MOVD $834, R12 + B callbackasm1(SB) + MOVD $835, R12 + B callbackasm1(SB) + MOVD $836, R12 + B callbackasm1(SB) + MOVD $837, R12 + B callbackasm1(SB) + MOVD $838, R12 + B callbackasm1(SB) + MOVD $839, R12 + B callbackasm1(SB) + MOVD $840, R12 + B callbackasm1(SB) + MOVD $841, R12 + B callbackasm1(SB) + MOVD $842, R12 + B callbackasm1(SB) + MOVD $843, R12 + B callbackasm1(SB) + MOVD $844, R12 + B callbackasm1(SB) + MOVD $845, R12 + B callbackasm1(SB) + MOVD $846, R12 + B callbackasm1(SB) + MOVD $847, R12 + B callbackasm1(SB) + MOVD $848, R12 + B callbackasm1(SB) + MOVD $849, R12 + B callbackasm1(SB) + MOVD $850, R12 + B callbackasm1(SB) + MOVD $851, R12 + B callbackasm1(SB) + MOVD $852, R12 + B callbackasm1(SB) + MOVD $853, R12 + B callbackasm1(SB) + MOVD $854, R12 + B callbackasm1(SB) + MOVD $855, R12 + B callbackasm1(SB) + MOVD $856, R12 + B callbackasm1(SB) + MOVD $857, R12 + B callbackasm1(SB) + MOVD $858, R12 + B callbackasm1(SB) + MOVD $859, R12 + B callbackasm1(SB) + MOVD $860, R12 + B callbackasm1(SB) + MOVD $861, R12 + B callbackasm1(SB) + MOVD $862, R12 + B callbackasm1(SB) + MOVD $863, R12 + B callbackasm1(SB) + MOVD $864, R12 + B callbackasm1(SB) + MOVD $865, R12 + B callbackasm1(SB) + MOVD $866, R12 + B callbackasm1(SB) + MOVD $867, R12 + B callbackasm1(SB) + MOVD $868, R12 + B callbackasm1(SB) + MOVD $869, R12 + B callbackasm1(SB) + MOVD $870, R12 + B callbackasm1(SB) + MOVD $871, R12 + B callbackasm1(SB) + MOVD $872, R12 + B callbackasm1(SB) + MOVD $873, R12 + B callbackasm1(SB) + MOVD $874, R12 + B callbackasm1(SB) + MOVD $875, R12 + B callbackasm1(SB) + MOVD $876, R12 + B callbackasm1(SB) + MOVD $877, R12 + B callbackasm1(SB) + MOVD $878, R12 + B callbackasm1(SB) + MOVD $879, R12 + B callbackasm1(SB) + MOVD $880, R12 + B callbackasm1(SB) + MOVD $881, R12 + B callbackasm1(SB) + MOVD $882, R12 + B callbackasm1(SB) + MOVD $883, R12 + B callbackasm1(SB) + MOVD $884, R12 + B callbackasm1(SB) + MOVD $885, R12 + B callbackasm1(SB) + MOVD $886, R12 + B callbackasm1(SB) + MOVD $887, R12 + B callbackasm1(SB) + MOVD $888, R12 + B callbackasm1(SB) + MOVD $889, R12 + B callbackasm1(SB) + MOVD $890, R12 + B callbackasm1(SB) + MOVD $891, R12 + B callbackasm1(SB) + MOVD $892, R12 + B callbackasm1(SB) + MOVD $893, R12 + B callbackasm1(SB) + MOVD $894, R12 + B callbackasm1(SB) + MOVD $895, R12 + B callbackasm1(SB) + MOVD $896, R12 + B callbackasm1(SB) + MOVD $897, R12 + B callbackasm1(SB) + MOVD $898, R12 + B callbackasm1(SB) + MOVD $899, R12 + B callbackasm1(SB) + MOVD $900, R12 + B callbackasm1(SB) + MOVD $901, R12 + B callbackasm1(SB) + MOVD $902, R12 + B callbackasm1(SB) + MOVD $903, R12 + B callbackasm1(SB) + MOVD $904, R12 + B callbackasm1(SB) + MOVD $905, R12 + B callbackasm1(SB) + MOVD $906, R12 + B callbackasm1(SB) + MOVD $907, R12 + B callbackasm1(SB) + MOVD $908, R12 + B callbackasm1(SB) + MOVD $909, R12 + B callbackasm1(SB) + MOVD $910, R12 + B callbackasm1(SB) + MOVD $911, R12 + B callbackasm1(SB) + MOVD $912, R12 + B callbackasm1(SB) + MOVD $913, R12 + B callbackasm1(SB) + MOVD $914, R12 + B callbackasm1(SB) + MOVD $915, R12 + B callbackasm1(SB) + MOVD $916, R12 + B callbackasm1(SB) + MOVD $917, R12 + B callbackasm1(SB) + MOVD $918, R12 + B callbackasm1(SB) + MOVD $919, R12 + B callbackasm1(SB) + MOVD $920, R12 + B callbackasm1(SB) + MOVD $921, R12 + B callbackasm1(SB) + MOVD $922, R12 + B callbackasm1(SB) + MOVD $923, R12 + B callbackasm1(SB) + MOVD $924, R12 + B callbackasm1(SB) + MOVD $925, R12 + B callbackasm1(SB) + MOVD $926, R12 + B callbackasm1(SB) + MOVD $927, R12 + B callbackasm1(SB) + MOVD $928, R12 + B callbackasm1(SB) + MOVD $929, R12 + B callbackasm1(SB) + MOVD $930, R12 + B callbackasm1(SB) + MOVD $931, R12 + B callbackasm1(SB) + MOVD $932, R12 + B callbackasm1(SB) + MOVD $933, R12 + B callbackasm1(SB) + MOVD $934, R12 + B callbackasm1(SB) + MOVD $935, R12 + B callbackasm1(SB) + MOVD $936, R12 + B callbackasm1(SB) + MOVD $937, R12 + B callbackasm1(SB) + MOVD $938, R12 + B callbackasm1(SB) + MOVD $939, R12 + B callbackasm1(SB) + MOVD $940, R12 + B callbackasm1(SB) + MOVD $941, R12 + B callbackasm1(SB) + MOVD $942, R12 + B callbackasm1(SB) + MOVD $943, R12 + B callbackasm1(SB) + MOVD $944, R12 + B callbackasm1(SB) + MOVD $945, R12 + B callbackasm1(SB) + MOVD $946, R12 + B callbackasm1(SB) + MOVD $947, R12 + B callbackasm1(SB) + MOVD $948, R12 + B callbackasm1(SB) + MOVD $949, R12 + B callbackasm1(SB) + MOVD $950, R12 + B callbackasm1(SB) + MOVD $951, R12 + B callbackasm1(SB) + MOVD $952, R12 + B callbackasm1(SB) + MOVD $953, R12 + B callbackasm1(SB) + MOVD $954, R12 + B callbackasm1(SB) + MOVD $955, R12 + B callbackasm1(SB) + MOVD $956, R12 + B callbackasm1(SB) + MOVD $957, R12 + B callbackasm1(SB) + MOVD $958, R12 + B callbackasm1(SB) + MOVD $959, R12 + B callbackasm1(SB) + MOVD $960, R12 + B callbackasm1(SB) + MOVD $961, R12 + B callbackasm1(SB) + MOVD $962, R12 + B callbackasm1(SB) + MOVD $963, R12 + B callbackasm1(SB) + MOVD $964, R12 + B callbackasm1(SB) + MOVD $965, R12 + B callbackasm1(SB) + MOVD $966, R12 + B callbackasm1(SB) + MOVD $967, R12 + B callbackasm1(SB) + MOVD $968, R12 + B callbackasm1(SB) + MOVD $969, R12 + B callbackasm1(SB) + MOVD $970, R12 + B callbackasm1(SB) + MOVD $971, R12 + B callbackasm1(SB) + MOVD $972, R12 + B callbackasm1(SB) + MOVD $973, R12 + B callbackasm1(SB) + MOVD $974, R12 + B callbackasm1(SB) + MOVD $975, R12 + B callbackasm1(SB) + MOVD $976, R12 + B callbackasm1(SB) + MOVD $977, R12 + B callbackasm1(SB) + MOVD $978, R12 + B callbackasm1(SB) + MOVD $979, R12 + B callbackasm1(SB) + MOVD $980, R12 + B callbackasm1(SB) + MOVD $981, R12 + B callbackasm1(SB) + MOVD $982, R12 + B callbackasm1(SB) + MOVD $983, R12 + B callbackasm1(SB) + MOVD $984, R12 + B callbackasm1(SB) + MOVD $985, R12 + B callbackasm1(SB) + MOVD $986, R12 + B callbackasm1(SB) + MOVD $987, R12 + B callbackasm1(SB) + MOVD $988, R12 + B callbackasm1(SB) + MOVD $989, R12 + B callbackasm1(SB) + MOVD $990, R12 + B callbackasm1(SB) + MOVD $991, R12 + B callbackasm1(SB) + MOVD $992, R12 + B callbackasm1(SB) + MOVD $993, R12 + B callbackasm1(SB) + MOVD $994, R12 + B callbackasm1(SB) + MOVD $995, R12 + B callbackasm1(SB) + MOVD $996, R12 + B callbackasm1(SB) + MOVD $997, R12 + B callbackasm1(SB) + MOVD $998, R12 + B callbackasm1(SB) + MOVD $999, R12 + B callbackasm1(SB) + MOVD $1000, R12 + B callbackasm1(SB) + MOVD $1001, R12 + B callbackasm1(SB) + MOVD $1002, R12 + B callbackasm1(SB) + MOVD $1003, R12 + B callbackasm1(SB) + MOVD $1004, R12 + B callbackasm1(SB) + MOVD $1005, R12 + B callbackasm1(SB) + MOVD $1006, R12 + B callbackasm1(SB) + MOVD $1007, R12 + B callbackasm1(SB) + MOVD $1008, R12 + B callbackasm1(SB) + MOVD $1009, R12 + B callbackasm1(SB) + MOVD $1010, R12 + B callbackasm1(SB) + MOVD $1011, R12 + B callbackasm1(SB) + MOVD $1012, R12 + B callbackasm1(SB) + MOVD $1013, R12 + B callbackasm1(SB) + MOVD $1014, R12 + B callbackasm1(SB) + MOVD $1015, R12 + B callbackasm1(SB) + MOVD $1016, R12 + B callbackasm1(SB) + MOVD $1017, R12 + B callbackasm1(SB) + MOVD $1018, R12 + B callbackasm1(SB) + MOVD $1019, R12 + B callbackasm1(SB) + MOVD $1020, R12 + B callbackasm1(SB) + MOVD $1021, R12 + B callbackasm1(SB) + MOVD $1022, R12 + B callbackasm1(SB) + MOVD $1023, R12 + B callbackasm1(SB) + MOVD $1024, R12 + B callbackasm1(SB) + MOVD $1025, R12 + B callbackasm1(SB) + MOVD $1026, R12 + B callbackasm1(SB) + MOVD $1027, R12 + B callbackasm1(SB) + MOVD $1028, R12 + B callbackasm1(SB) + MOVD $1029, R12 + B callbackasm1(SB) + MOVD $1030, R12 + B callbackasm1(SB) + MOVD $1031, R12 + B callbackasm1(SB) + MOVD $1032, R12 + B callbackasm1(SB) + MOVD $1033, R12 + B callbackasm1(SB) + MOVD $1034, R12 + B callbackasm1(SB) + MOVD $1035, R12 + B callbackasm1(SB) + MOVD $1036, R12 + B callbackasm1(SB) + MOVD $1037, R12 + B callbackasm1(SB) + MOVD $1038, R12 + B callbackasm1(SB) + MOVD $1039, R12 + B callbackasm1(SB) + MOVD $1040, R12 + B callbackasm1(SB) + MOVD $1041, R12 + B callbackasm1(SB) + MOVD $1042, R12 + B callbackasm1(SB) + MOVD $1043, R12 + B callbackasm1(SB) + MOVD $1044, R12 + B callbackasm1(SB) + MOVD $1045, R12 + B callbackasm1(SB) + MOVD $1046, R12 + B callbackasm1(SB) + MOVD $1047, R12 + B callbackasm1(SB) + MOVD $1048, R12 + B callbackasm1(SB) + MOVD $1049, R12 + B callbackasm1(SB) + MOVD $1050, R12 + B callbackasm1(SB) + MOVD $1051, R12 + B callbackasm1(SB) + MOVD $1052, R12 + B callbackasm1(SB) + MOVD $1053, R12 + B callbackasm1(SB) + MOVD $1054, R12 + B callbackasm1(SB) + MOVD $1055, R12 + B callbackasm1(SB) + MOVD $1056, R12 + B callbackasm1(SB) + MOVD $1057, R12 + B callbackasm1(SB) + MOVD $1058, R12 + B callbackasm1(SB) + MOVD $1059, R12 + B callbackasm1(SB) + MOVD $1060, R12 + B callbackasm1(SB) + MOVD $1061, R12 + B callbackasm1(SB) + MOVD $1062, R12 + B callbackasm1(SB) + MOVD $1063, R12 + B callbackasm1(SB) + MOVD $1064, R12 + B callbackasm1(SB) + MOVD $1065, R12 + B callbackasm1(SB) + MOVD $1066, R12 + B callbackasm1(SB) + MOVD $1067, R12 + B callbackasm1(SB) + MOVD $1068, R12 + B callbackasm1(SB) + MOVD $1069, R12 + B callbackasm1(SB) + MOVD $1070, R12 + B callbackasm1(SB) + MOVD $1071, R12 + B callbackasm1(SB) + MOVD $1072, R12 + B callbackasm1(SB) + MOVD $1073, R12 + B callbackasm1(SB) + MOVD $1074, R12 + B callbackasm1(SB) + MOVD $1075, R12 + B callbackasm1(SB) + MOVD $1076, R12 + B callbackasm1(SB) + MOVD $1077, R12 + B callbackasm1(SB) + MOVD $1078, R12 + B callbackasm1(SB) + MOVD $1079, R12 + B callbackasm1(SB) + MOVD $1080, R12 + B callbackasm1(SB) + MOVD $1081, R12 + B callbackasm1(SB) + MOVD $1082, R12 + B callbackasm1(SB) + MOVD $1083, R12 + B callbackasm1(SB) + MOVD $1084, R12 + B callbackasm1(SB) + MOVD $1085, R12 + B callbackasm1(SB) + MOVD $1086, R12 + B callbackasm1(SB) + MOVD $1087, R12 + B callbackasm1(SB) + MOVD $1088, R12 + B callbackasm1(SB) + MOVD $1089, R12 + B callbackasm1(SB) + MOVD $1090, R12 + B callbackasm1(SB) + MOVD $1091, R12 + B callbackasm1(SB) + MOVD $1092, R12 + B callbackasm1(SB) + MOVD $1093, R12 + B callbackasm1(SB) + MOVD $1094, R12 + B callbackasm1(SB) + MOVD $1095, R12 + B callbackasm1(SB) + MOVD $1096, R12 + B callbackasm1(SB) + MOVD $1097, R12 + B callbackasm1(SB) + MOVD $1098, R12 + B callbackasm1(SB) + MOVD $1099, R12 + B callbackasm1(SB) + MOVD $1100, R12 + B callbackasm1(SB) + MOVD $1101, R12 + B callbackasm1(SB) + MOVD $1102, R12 + B callbackasm1(SB) + MOVD $1103, R12 + B callbackasm1(SB) + MOVD $1104, R12 + B callbackasm1(SB) + MOVD $1105, R12 + B callbackasm1(SB) + MOVD $1106, R12 + B callbackasm1(SB) + MOVD $1107, R12 + B callbackasm1(SB) + MOVD $1108, R12 + B callbackasm1(SB) + MOVD $1109, R12 + B callbackasm1(SB) + MOVD $1110, R12 + B callbackasm1(SB) + MOVD $1111, R12 + B callbackasm1(SB) + MOVD $1112, R12 + B callbackasm1(SB) + MOVD $1113, R12 + B callbackasm1(SB) + MOVD $1114, R12 + B callbackasm1(SB) + MOVD $1115, R12 + B callbackasm1(SB) + MOVD $1116, R12 + B callbackasm1(SB) + MOVD $1117, R12 + B callbackasm1(SB) + MOVD $1118, R12 + B callbackasm1(SB) + MOVD $1119, R12 + B callbackasm1(SB) + MOVD $1120, R12 + B callbackasm1(SB) + MOVD $1121, R12 + B callbackasm1(SB) + MOVD $1122, R12 + B callbackasm1(SB) + MOVD $1123, R12 + B callbackasm1(SB) + MOVD $1124, R12 + B callbackasm1(SB) + MOVD $1125, R12 + B callbackasm1(SB) + MOVD $1126, R12 + B callbackasm1(SB) + MOVD $1127, R12 + B callbackasm1(SB) + MOVD $1128, R12 + B callbackasm1(SB) + MOVD $1129, R12 + B callbackasm1(SB) + MOVD $1130, R12 + B callbackasm1(SB) + MOVD $1131, R12 + B callbackasm1(SB) + MOVD $1132, R12 + B callbackasm1(SB) + MOVD $1133, R12 + B callbackasm1(SB) + MOVD $1134, R12 + B callbackasm1(SB) + MOVD $1135, R12 + B callbackasm1(SB) + MOVD $1136, R12 + B callbackasm1(SB) + MOVD $1137, R12 + B callbackasm1(SB) + MOVD $1138, R12 + B callbackasm1(SB) + MOVD $1139, R12 + B callbackasm1(SB) + MOVD $1140, R12 + B callbackasm1(SB) + MOVD $1141, R12 + B callbackasm1(SB) + MOVD $1142, R12 + B callbackasm1(SB) + MOVD $1143, R12 + B callbackasm1(SB) + MOVD $1144, R12 + B callbackasm1(SB) + MOVD $1145, R12 + B callbackasm1(SB) + MOVD $1146, R12 + B callbackasm1(SB) + MOVD $1147, R12 + B callbackasm1(SB) + MOVD $1148, R12 + B callbackasm1(SB) + MOVD $1149, R12 + B callbackasm1(SB) + MOVD $1150, R12 + B callbackasm1(SB) + MOVD $1151, R12 + B callbackasm1(SB) + MOVD $1152, R12 + B callbackasm1(SB) + MOVD $1153, R12 + B callbackasm1(SB) + MOVD $1154, R12 + B callbackasm1(SB) + MOVD $1155, R12 + B callbackasm1(SB) + MOVD $1156, R12 + B callbackasm1(SB) + MOVD $1157, R12 + B callbackasm1(SB) + MOVD $1158, R12 + B callbackasm1(SB) + MOVD $1159, R12 + B callbackasm1(SB) + MOVD $1160, R12 + B callbackasm1(SB) + MOVD $1161, R12 + B callbackasm1(SB) + MOVD $1162, R12 + B callbackasm1(SB) + MOVD $1163, R12 + B callbackasm1(SB) + MOVD $1164, R12 + B callbackasm1(SB) + MOVD $1165, R12 + B callbackasm1(SB) + MOVD $1166, R12 + B callbackasm1(SB) + MOVD $1167, R12 + B callbackasm1(SB) + MOVD $1168, R12 + B callbackasm1(SB) + MOVD $1169, R12 + B callbackasm1(SB) + MOVD $1170, R12 + B callbackasm1(SB) + MOVD $1171, R12 + B callbackasm1(SB) + MOVD $1172, R12 + B callbackasm1(SB) + MOVD $1173, R12 + B callbackasm1(SB) + MOVD $1174, R12 + B callbackasm1(SB) + MOVD $1175, R12 + B callbackasm1(SB) + MOVD $1176, R12 + B callbackasm1(SB) + MOVD $1177, R12 + B callbackasm1(SB) + MOVD $1178, R12 + B callbackasm1(SB) + MOVD $1179, R12 + B callbackasm1(SB) + MOVD $1180, R12 + B callbackasm1(SB) + MOVD $1181, R12 + B callbackasm1(SB) + MOVD $1182, R12 + B callbackasm1(SB) + MOVD $1183, R12 + B callbackasm1(SB) + MOVD $1184, R12 + B callbackasm1(SB) + MOVD $1185, R12 + B callbackasm1(SB) + MOVD $1186, R12 + B callbackasm1(SB) + MOVD $1187, R12 + B callbackasm1(SB) + MOVD $1188, R12 + B callbackasm1(SB) + MOVD $1189, R12 + B callbackasm1(SB) + MOVD $1190, R12 + B callbackasm1(SB) + MOVD $1191, R12 + B callbackasm1(SB) + MOVD $1192, R12 + B callbackasm1(SB) + MOVD $1193, R12 + B callbackasm1(SB) + MOVD $1194, R12 + B callbackasm1(SB) + MOVD $1195, R12 + B callbackasm1(SB) + MOVD $1196, R12 + B callbackasm1(SB) + MOVD $1197, R12 + B callbackasm1(SB) + MOVD $1198, R12 + B callbackasm1(SB) + MOVD $1199, R12 + B callbackasm1(SB) + MOVD $1200, R12 + B callbackasm1(SB) + MOVD $1201, R12 + B callbackasm1(SB) + MOVD $1202, R12 + B callbackasm1(SB) + MOVD $1203, R12 + B callbackasm1(SB) + MOVD $1204, R12 + B callbackasm1(SB) + MOVD $1205, R12 + B callbackasm1(SB) + MOVD $1206, R12 + B callbackasm1(SB) + MOVD $1207, R12 + B callbackasm1(SB) + MOVD $1208, R12 + B callbackasm1(SB) + MOVD $1209, R12 + B callbackasm1(SB) + MOVD $1210, R12 + B callbackasm1(SB) + MOVD $1211, R12 + B callbackasm1(SB) + MOVD $1212, R12 + B callbackasm1(SB) + MOVD $1213, R12 + B callbackasm1(SB) + MOVD $1214, R12 + B callbackasm1(SB) + MOVD $1215, R12 + B callbackasm1(SB) + MOVD $1216, R12 + B callbackasm1(SB) + MOVD $1217, R12 + B callbackasm1(SB) + MOVD $1218, R12 + B callbackasm1(SB) + MOVD $1219, R12 + B callbackasm1(SB) + MOVD $1220, R12 + B callbackasm1(SB) + MOVD $1221, R12 + B callbackasm1(SB) + MOVD $1222, R12 + B callbackasm1(SB) + MOVD $1223, R12 + B callbackasm1(SB) + MOVD $1224, R12 + B callbackasm1(SB) + MOVD $1225, R12 + B callbackasm1(SB) + MOVD $1226, R12 + B callbackasm1(SB) + MOVD $1227, R12 + B callbackasm1(SB) + MOVD $1228, R12 + B callbackasm1(SB) + MOVD $1229, R12 + B callbackasm1(SB) + MOVD $1230, R12 + B callbackasm1(SB) + MOVD $1231, R12 + B callbackasm1(SB) + MOVD $1232, R12 + B callbackasm1(SB) + MOVD $1233, R12 + B callbackasm1(SB) + MOVD $1234, R12 + B callbackasm1(SB) + MOVD $1235, R12 + B callbackasm1(SB) + MOVD $1236, R12 + B callbackasm1(SB) + MOVD $1237, R12 + B callbackasm1(SB) + MOVD $1238, R12 + B callbackasm1(SB) + MOVD $1239, R12 + B callbackasm1(SB) + MOVD $1240, R12 + B callbackasm1(SB) + MOVD $1241, R12 + B callbackasm1(SB) + MOVD $1242, R12 + B callbackasm1(SB) + MOVD $1243, R12 + B callbackasm1(SB) + MOVD $1244, R12 + B callbackasm1(SB) + MOVD $1245, R12 + B callbackasm1(SB) + MOVD $1246, R12 + B callbackasm1(SB) + MOVD $1247, R12 + B callbackasm1(SB) + MOVD $1248, R12 + B callbackasm1(SB) + MOVD $1249, R12 + B callbackasm1(SB) + MOVD $1250, R12 + B callbackasm1(SB) + MOVD $1251, R12 + B callbackasm1(SB) + MOVD $1252, R12 + B callbackasm1(SB) + MOVD $1253, R12 + B callbackasm1(SB) + MOVD $1254, R12 + B callbackasm1(SB) + MOVD $1255, R12 + B callbackasm1(SB) + MOVD $1256, R12 + B callbackasm1(SB) + MOVD $1257, R12 + B callbackasm1(SB) + MOVD $1258, R12 + B callbackasm1(SB) + MOVD $1259, R12 + B callbackasm1(SB) + MOVD $1260, R12 + B callbackasm1(SB) + MOVD $1261, R12 + B callbackasm1(SB) + MOVD $1262, R12 + B callbackasm1(SB) + MOVD $1263, R12 + B callbackasm1(SB) + MOVD $1264, R12 + B callbackasm1(SB) + MOVD $1265, R12 + B callbackasm1(SB) + MOVD $1266, R12 + B callbackasm1(SB) + MOVD $1267, R12 + B callbackasm1(SB) + MOVD $1268, R12 + B callbackasm1(SB) + MOVD $1269, R12 + B callbackasm1(SB) + MOVD $1270, R12 + B callbackasm1(SB) + MOVD $1271, R12 + B callbackasm1(SB) + MOVD $1272, R12 + B callbackasm1(SB) + MOVD $1273, R12 + B callbackasm1(SB) + MOVD $1274, R12 + B callbackasm1(SB) + MOVD $1275, R12 + B callbackasm1(SB) + MOVD $1276, R12 + B callbackasm1(SB) + MOVD $1277, R12 + B callbackasm1(SB) + MOVD $1278, R12 + B callbackasm1(SB) + MOVD $1279, R12 + B callbackasm1(SB) + MOVD $1280, R12 + B callbackasm1(SB) + MOVD $1281, R12 + B callbackasm1(SB) + MOVD $1282, R12 + B callbackasm1(SB) + MOVD $1283, R12 + B callbackasm1(SB) + MOVD $1284, R12 + B callbackasm1(SB) + MOVD $1285, R12 + B callbackasm1(SB) + MOVD $1286, R12 + B callbackasm1(SB) + MOVD $1287, R12 + B callbackasm1(SB) + MOVD $1288, R12 + B callbackasm1(SB) + MOVD $1289, R12 + B callbackasm1(SB) + MOVD $1290, R12 + B callbackasm1(SB) + MOVD $1291, R12 + B callbackasm1(SB) + MOVD $1292, R12 + B callbackasm1(SB) + MOVD $1293, R12 + B callbackasm1(SB) + MOVD $1294, R12 + B callbackasm1(SB) + MOVD $1295, R12 + B callbackasm1(SB) + MOVD $1296, R12 + B callbackasm1(SB) + MOVD $1297, R12 + B callbackasm1(SB) + MOVD $1298, R12 + B callbackasm1(SB) + MOVD $1299, R12 + B callbackasm1(SB) + MOVD $1300, R12 + B callbackasm1(SB) + MOVD $1301, R12 + B callbackasm1(SB) + MOVD $1302, R12 + B callbackasm1(SB) + MOVD $1303, R12 + B callbackasm1(SB) + MOVD $1304, R12 + B callbackasm1(SB) + MOVD $1305, R12 + B callbackasm1(SB) + MOVD $1306, R12 + B callbackasm1(SB) + MOVD $1307, R12 + B callbackasm1(SB) + MOVD $1308, R12 + B callbackasm1(SB) + MOVD $1309, R12 + B callbackasm1(SB) + MOVD $1310, R12 + B callbackasm1(SB) + MOVD $1311, R12 + B callbackasm1(SB) + MOVD $1312, R12 + B callbackasm1(SB) + MOVD $1313, R12 + B callbackasm1(SB) + MOVD $1314, R12 + B callbackasm1(SB) + MOVD $1315, R12 + B callbackasm1(SB) + MOVD $1316, R12 + B callbackasm1(SB) + MOVD $1317, R12 + B callbackasm1(SB) + MOVD $1318, R12 + B callbackasm1(SB) + MOVD $1319, R12 + B callbackasm1(SB) + MOVD $1320, R12 + B callbackasm1(SB) + MOVD $1321, R12 + B callbackasm1(SB) + MOVD $1322, R12 + B callbackasm1(SB) + MOVD $1323, R12 + B callbackasm1(SB) + MOVD $1324, R12 + B callbackasm1(SB) + MOVD $1325, R12 + B callbackasm1(SB) + MOVD $1326, R12 + B callbackasm1(SB) + MOVD $1327, R12 + B callbackasm1(SB) + MOVD $1328, R12 + B callbackasm1(SB) + MOVD $1329, R12 + B callbackasm1(SB) + MOVD $1330, R12 + B callbackasm1(SB) + MOVD $1331, R12 + B callbackasm1(SB) + MOVD $1332, R12 + B callbackasm1(SB) + MOVD $1333, R12 + B callbackasm1(SB) + MOVD $1334, R12 + B callbackasm1(SB) + MOVD $1335, R12 + B callbackasm1(SB) + MOVD $1336, R12 + B callbackasm1(SB) + MOVD $1337, R12 + B callbackasm1(SB) + MOVD $1338, R12 + B callbackasm1(SB) + MOVD $1339, R12 + B callbackasm1(SB) + MOVD $1340, R12 + B callbackasm1(SB) + MOVD $1341, R12 + B callbackasm1(SB) + MOVD $1342, R12 + B callbackasm1(SB) + MOVD $1343, R12 + B callbackasm1(SB) + MOVD $1344, R12 + B callbackasm1(SB) + MOVD $1345, R12 + B callbackasm1(SB) + MOVD $1346, R12 + B callbackasm1(SB) + MOVD $1347, R12 + B callbackasm1(SB) + MOVD $1348, R12 + B callbackasm1(SB) + MOVD $1349, R12 + B callbackasm1(SB) + MOVD $1350, R12 + B callbackasm1(SB) + MOVD $1351, R12 + B callbackasm1(SB) + MOVD $1352, R12 + B callbackasm1(SB) + MOVD $1353, R12 + B callbackasm1(SB) + MOVD $1354, R12 + B callbackasm1(SB) + MOVD $1355, R12 + B callbackasm1(SB) + MOVD $1356, R12 + B callbackasm1(SB) + MOVD $1357, R12 + B callbackasm1(SB) + MOVD $1358, R12 + B callbackasm1(SB) + MOVD $1359, R12 + B callbackasm1(SB) + MOVD $1360, R12 + B callbackasm1(SB) + MOVD $1361, R12 + B callbackasm1(SB) + MOVD $1362, R12 + B callbackasm1(SB) + MOVD $1363, R12 + B callbackasm1(SB) + MOVD $1364, R12 + B callbackasm1(SB) + MOVD $1365, R12 + B callbackasm1(SB) + MOVD $1366, R12 + B callbackasm1(SB) + MOVD $1367, R12 + B callbackasm1(SB) + MOVD $1368, R12 + B callbackasm1(SB) + MOVD $1369, R12 + B callbackasm1(SB) + MOVD $1370, R12 + B callbackasm1(SB) + MOVD $1371, R12 + B callbackasm1(SB) + MOVD $1372, R12 + B callbackasm1(SB) + MOVD $1373, R12 + B callbackasm1(SB) + MOVD $1374, R12 + B callbackasm1(SB) + MOVD $1375, R12 + B callbackasm1(SB) + MOVD $1376, R12 + B callbackasm1(SB) + MOVD $1377, R12 + B callbackasm1(SB) + MOVD $1378, R12 + B callbackasm1(SB) + MOVD $1379, R12 + B callbackasm1(SB) + MOVD $1380, R12 + B callbackasm1(SB) + MOVD $1381, R12 + B callbackasm1(SB) + MOVD $1382, R12 + B callbackasm1(SB) + MOVD $1383, R12 + B callbackasm1(SB) + MOVD $1384, R12 + B callbackasm1(SB) + MOVD $1385, R12 + B callbackasm1(SB) + MOVD $1386, R12 + B callbackasm1(SB) + MOVD $1387, R12 + B callbackasm1(SB) + MOVD $1388, R12 + B callbackasm1(SB) + MOVD $1389, R12 + B callbackasm1(SB) + MOVD $1390, R12 + B callbackasm1(SB) + MOVD $1391, R12 + B callbackasm1(SB) + MOVD $1392, R12 + B callbackasm1(SB) + MOVD $1393, R12 + B callbackasm1(SB) + MOVD $1394, R12 + B callbackasm1(SB) + MOVD $1395, R12 + B callbackasm1(SB) + MOVD $1396, R12 + B callbackasm1(SB) + MOVD $1397, R12 + B callbackasm1(SB) + MOVD $1398, R12 + B callbackasm1(SB) + MOVD $1399, R12 + B callbackasm1(SB) + MOVD $1400, R12 + B callbackasm1(SB) + MOVD $1401, R12 + B callbackasm1(SB) + MOVD $1402, R12 + B callbackasm1(SB) + MOVD $1403, R12 + B callbackasm1(SB) + MOVD $1404, R12 + B callbackasm1(SB) + MOVD $1405, R12 + B callbackasm1(SB) + MOVD $1406, R12 + B callbackasm1(SB) + MOVD $1407, R12 + B callbackasm1(SB) + MOVD $1408, R12 + B callbackasm1(SB) + MOVD $1409, R12 + B callbackasm1(SB) + MOVD $1410, R12 + B callbackasm1(SB) + MOVD $1411, R12 + B callbackasm1(SB) + MOVD $1412, R12 + B callbackasm1(SB) + MOVD $1413, R12 + B callbackasm1(SB) + MOVD $1414, R12 + B callbackasm1(SB) + MOVD $1415, R12 + B callbackasm1(SB) + MOVD $1416, R12 + B callbackasm1(SB) + MOVD $1417, R12 + B callbackasm1(SB) + MOVD $1418, R12 + B callbackasm1(SB) + MOVD $1419, R12 + B callbackasm1(SB) + MOVD $1420, R12 + B callbackasm1(SB) + MOVD $1421, R12 + B callbackasm1(SB) + MOVD $1422, R12 + B callbackasm1(SB) + MOVD $1423, R12 + B callbackasm1(SB) + MOVD $1424, R12 + B callbackasm1(SB) + MOVD $1425, R12 + B callbackasm1(SB) + MOVD $1426, R12 + B callbackasm1(SB) + MOVD $1427, R12 + B callbackasm1(SB) + MOVD $1428, R12 + B callbackasm1(SB) + MOVD $1429, R12 + B callbackasm1(SB) + MOVD $1430, R12 + B callbackasm1(SB) + MOVD $1431, R12 + B callbackasm1(SB) + MOVD $1432, R12 + B callbackasm1(SB) + MOVD $1433, R12 + B callbackasm1(SB) + MOVD $1434, R12 + B callbackasm1(SB) + MOVD $1435, R12 + B callbackasm1(SB) + MOVD $1436, R12 + B callbackasm1(SB) + MOVD $1437, R12 + B callbackasm1(SB) + MOVD $1438, R12 + B callbackasm1(SB) + MOVD $1439, R12 + B callbackasm1(SB) + MOVD $1440, R12 + B callbackasm1(SB) + MOVD $1441, R12 + B callbackasm1(SB) + MOVD $1442, R12 + B callbackasm1(SB) + MOVD $1443, R12 + B callbackasm1(SB) + MOVD $1444, R12 + B callbackasm1(SB) + MOVD $1445, R12 + B callbackasm1(SB) + MOVD $1446, R12 + B callbackasm1(SB) + MOVD $1447, R12 + B callbackasm1(SB) + MOVD $1448, R12 + B callbackasm1(SB) + MOVD $1449, R12 + B callbackasm1(SB) + MOVD $1450, R12 + B callbackasm1(SB) + MOVD $1451, R12 + B callbackasm1(SB) + MOVD $1452, R12 + B callbackasm1(SB) + MOVD $1453, R12 + B callbackasm1(SB) + MOVD $1454, R12 + B callbackasm1(SB) + MOVD $1455, R12 + B callbackasm1(SB) + MOVD $1456, R12 + B callbackasm1(SB) + MOVD $1457, R12 + B callbackasm1(SB) + MOVD $1458, R12 + B callbackasm1(SB) + MOVD $1459, R12 + B callbackasm1(SB) + MOVD $1460, R12 + B callbackasm1(SB) + MOVD $1461, R12 + B callbackasm1(SB) + MOVD $1462, R12 + B callbackasm1(SB) + MOVD $1463, R12 + B callbackasm1(SB) + MOVD $1464, R12 + B callbackasm1(SB) + MOVD $1465, R12 + B callbackasm1(SB) + MOVD $1466, R12 + B callbackasm1(SB) + MOVD $1467, R12 + B callbackasm1(SB) + MOVD $1468, R12 + B callbackasm1(SB) + MOVD $1469, R12 + B callbackasm1(SB) + MOVD $1470, R12 + B callbackasm1(SB) + MOVD $1471, R12 + B callbackasm1(SB) + MOVD $1472, R12 + B callbackasm1(SB) + MOVD $1473, R12 + B callbackasm1(SB) + MOVD $1474, R12 + B callbackasm1(SB) + MOVD $1475, R12 + B callbackasm1(SB) + MOVD $1476, R12 + B callbackasm1(SB) + MOVD $1477, R12 + B callbackasm1(SB) + MOVD $1478, R12 + B callbackasm1(SB) + MOVD $1479, R12 + B callbackasm1(SB) + MOVD $1480, R12 + B callbackasm1(SB) + MOVD $1481, R12 + B callbackasm1(SB) + MOVD $1482, R12 + B callbackasm1(SB) + MOVD $1483, R12 + B callbackasm1(SB) + MOVD $1484, R12 + B callbackasm1(SB) + MOVD $1485, R12 + B callbackasm1(SB) + MOVD $1486, R12 + B callbackasm1(SB) + MOVD $1487, R12 + B callbackasm1(SB) + MOVD $1488, R12 + B callbackasm1(SB) + MOVD $1489, R12 + B callbackasm1(SB) + MOVD $1490, R12 + B callbackasm1(SB) + MOVD $1491, R12 + B callbackasm1(SB) + MOVD $1492, R12 + B callbackasm1(SB) + MOVD $1493, R12 + B callbackasm1(SB) + MOVD $1494, R12 + B callbackasm1(SB) + MOVD $1495, R12 + B callbackasm1(SB) + MOVD $1496, R12 + B callbackasm1(SB) + MOVD $1497, R12 + B callbackasm1(SB) + MOVD $1498, R12 + B callbackasm1(SB) + MOVD $1499, R12 + B callbackasm1(SB) + MOVD $1500, R12 + B callbackasm1(SB) + MOVD $1501, R12 + B callbackasm1(SB) + MOVD $1502, R12 + B callbackasm1(SB) + MOVD $1503, R12 + B callbackasm1(SB) + MOVD $1504, R12 + B callbackasm1(SB) + MOVD $1505, R12 + B callbackasm1(SB) + MOVD $1506, R12 + B callbackasm1(SB) + MOVD $1507, R12 + B callbackasm1(SB) + MOVD $1508, R12 + B callbackasm1(SB) + MOVD $1509, R12 + B callbackasm1(SB) + MOVD $1510, R12 + B callbackasm1(SB) + MOVD $1511, R12 + B callbackasm1(SB) + MOVD $1512, R12 + B callbackasm1(SB) + MOVD $1513, R12 + B callbackasm1(SB) + MOVD $1514, R12 + B callbackasm1(SB) + MOVD $1515, R12 + B callbackasm1(SB) + MOVD $1516, R12 + B callbackasm1(SB) + MOVD $1517, R12 + B callbackasm1(SB) + MOVD $1518, R12 + B callbackasm1(SB) + MOVD $1519, R12 + B callbackasm1(SB) + MOVD $1520, R12 + B callbackasm1(SB) + MOVD $1521, R12 + B callbackasm1(SB) + MOVD $1522, R12 + B callbackasm1(SB) + MOVD $1523, R12 + B callbackasm1(SB) + MOVD $1524, R12 + B callbackasm1(SB) + MOVD $1525, R12 + B callbackasm1(SB) + MOVD $1526, R12 + B callbackasm1(SB) + MOVD $1527, R12 + B callbackasm1(SB) + MOVD $1528, R12 + B callbackasm1(SB) + MOVD $1529, R12 + B callbackasm1(SB) + MOVD $1530, R12 + B callbackasm1(SB) + MOVD $1531, R12 + B callbackasm1(SB) + MOVD $1532, R12 + B callbackasm1(SB) + MOVD $1533, R12 + B callbackasm1(SB) + MOVD $1534, R12 + B callbackasm1(SB) + MOVD $1535, R12 + B callbackasm1(SB) + MOVD $1536, R12 + B callbackasm1(SB) + MOVD $1537, R12 + B callbackasm1(SB) + MOVD $1538, R12 + B callbackasm1(SB) + MOVD $1539, R12 + B callbackasm1(SB) + MOVD $1540, R12 + B callbackasm1(SB) + MOVD $1541, R12 + B callbackasm1(SB) + MOVD $1542, R12 + B callbackasm1(SB) + MOVD $1543, R12 + B callbackasm1(SB) + MOVD $1544, R12 + B callbackasm1(SB) + MOVD $1545, R12 + B callbackasm1(SB) + MOVD $1546, R12 + B callbackasm1(SB) + MOVD $1547, R12 + B callbackasm1(SB) + MOVD $1548, R12 + B callbackasm1(SB) + MOVD $1549, R12 + B callbackasm1(SB) + MOVD $1550, R12 + B callbackasm1(SB) + MOVD $1551, R12 + B callbackasm1(SB) + MOVD $1552, R12 + B callbackasm1(SB) + MOVD $1553, R12 + B callbackasm1(SB) + MOVD $1554, R12 + B callbackasm1(SB) + MOVD $1555, R12 + B callbackasm1(SB) + MOVD $1556, R12 + B callbackasm1(SB) + MOVD $1557, R12 + B callbackasm1(SB) + MOVD $1558, R12 + B callbackasm1(SB) + MOVD $1559, R12 + B callbackasm1(SB) + MOVD $1560, R12 + B callbackasm1(SB) + MOVD $1561, R12 + B callbackasm1(SB) + MOVD $1562, R12 + B callbackasm1(SB) + MOVD $1563, R12 + B callbackasm1(SB) + MOVD $1564, R12 + B callbackasm1(SB) + MOVD $1565, R12 + B callbackasm1(SB) + MOVD $1566, R12 + B callbackasm1(SB) + MOVD $1567, R12 + B callbackasm1(SB) + MOVD $1568, R12 + B callbackasm1(SB) + MOVD $1569, R12 + B callbackasm1(SB) + MOVD $1570, R12 + B callbackasm1(SB) + MOVD $1571, R12 + B callbackasm1(SB) + MOVD $1572, R12 + B callbackasm1(SB) + MOVD $1573, R12 + B callbackasm1(SB) + MOVD $1574, R12 + B callbackasm1(SB) + MOVD $1575, R12 + B callbackasm1(SB) + MOVD $1576, R12 + B callbackasm1(SB) + MOVD $1577, R12 + B callbackasm1(SB) + MOVD $1578, R12 + B callbackasm1(SB) + MOVD $1579, R12 + B callbackasm1(SB) + MOVD $1580, R12 + B callbackasm1(SB) + MOVD $1581, R12 + B callbackasm1(SB) + MOVD $1582, R12 + B callbackasm1(SB) + MOVD $1583, R12 + B callbackasm1(SB) + MOVD $1584, R12 + B callbackasm1(SB) + MOVD $1585, R12 + B callbackasm1(SB) + MOVD $1586, R12 + B callbackasm1(SB) + MOVD $1587, R12 + B callbackasm1(SB) + MOVD $1588, R12 + B callbackasm1(SB) + MOVD $1589, R12 + B callbackasm1(SB) + MOVD $1590, R12 + B callbackasm1(SB) + MOVD $1591, R12 + B callbackasm1(SB) + MOVD $1592, R12 + B callbackasm1(SB) + MOVD $1593, R12 + B callbackasm1(SB) + MOVD $1594, R12 + B callbackasm1(SB) + MOVD $1595, R12 + B callbackasm1(SB) + MOVD $1596, R12 + B callbackasm1(SB) + MOVD $1597, R12 + B callbackasm1(SB) + MOVD $1598, R12 + B callbackasm1(SB) + MOVD $1599, R12 + B callbackasm1(SB) + MOVD $1600, R12 + B callbackasm1(SB) + MOVD $1601, R12 + B callbackasm1(SB) + MOVD $1602, R12 + B callbackasm1(SB) + MOVD $1603, R12 + B callbackasm1(SB) + MOVD $1604, R12 + B callbackasm1(SB) + MOVD $1605, R12 + B callbackasm1(SB) + MOVD $1606, R12 + B callbackasm1(SB) + MOVD $1607, R12 + B callbackasm1(SB) + MOVD $1608, R12 + B callbackasm1(SB) + MOVD $1609, R12 + B callbackasm1(SB) + MOVD $1610, R12 + B callbackasm1(SB) + MOVD $1611, R12 + B callbackasm1(SB) + MOVD $1612, R12 + B callbackasm1(SB) + MOVD $1613, R12 + B callbackasm1(SB) + MOVD $1614, R12 + B callbackasm1(SB) + MOVD $1615, R12 + B callbackasm1(SB) + MOVD $1616, R12 + B callbackasm1(SB) + MOVD $1617, R12 + B callbackasm1(SB) + MOVD $1618, R12 + B callbackasm1(SB) + MOVD $1619, R12 + B callbackasm1(SB) + MOVD $1620, R12 + B callbackasm1(SB) + MOVD $1621, R12 + B callbackasm1(SB) + MOVD $1622, R12 + B callbackasm1(SB) + MOVD $1623, R12 + B callbackasm1(SB) + MOVD $1624, R12 + B callbackasm1(SB) + MOVD $1625, R12 + B callbackasm1(SB) + MOVD $1626, R12 + B callbackasm1(SB) + MOVD $1627, R12 + B callbackasm1(SB) + MOVD $1628, R12 + B callbackasm1(SB) + MOVD $1629, R12 + B callbackasm1(SB) + MOVD $1630, R12 + B callbackasm1(SB) + MOVD $1631, R12 + B callbackasm1(SB) + MOVD $1632, R12 + B callbackasm1(SB) + MOVD $1633, R12 + B callbackasm1(SB) + MOVD $1634, R12 + B callbackasm1(SB) + MOVD $1635, R12 + B callbackasm1(SB) + MOVD $1636, R12 + B callbackasm1(SB) + MOVD $1637, R12 + B callbackasm1(SB) + MOVD $1638, R12 + B callbackasm1(SB) + MOVD $1639, R12 + B callbackasm1(SB) + MOVD $1640, R12 + B callbackasm1(SB) + MOVD $1641, R12 + B callbackasm1(SB) + MOVD $1642, R12 + B callbackasm1(SB) + MOVD $1643, R12 + B callbackasm1(SB) + MOVD $1644, R12 + B callbackasm1(SB) + MOVD $1645, R12 + B callbackasm1(SB) + MOVD $1646, R12 + B callbackasm1(SB) + MOVD $1647, R12 + B callbackasm1(SB) + MOVD $1648, R12 + B callbackasm1(SB) + MOVD $1649, R12 + B callbackasm1(SB) + MOVD $1650, R12 + B callbackasm1(SB) + MOVD $1651, R12 + B callbackasm1(SB) + MOVD $1652, R12 + B callbackasm1(SB) + MOVD $1653, R12 + B callbackasm1(SB) + MOVD $1654, R12 + B callbackasm1(SB) + MOVD $1655, R12 + B callbackasm1(SB) + MOVD $1656, R12 + B callbackasm1(SB) + MOVD $1657, R12 + B callbackasm1(SB) + MOVD $1658, R12 + B callbackasm1(SB) + MOVD $1659, R12 + B callbackasm1(SB) + MOVD $1660, R12 + B callbackasm1(SB) + MOVD $1661, R12 + B callbackasm1(SB) + MOVD $1662, R12 + B callbackasm1(SB) + MOVD $1663, R12 + B callbackasm1(SB) + MOVD $1664, R12 + B callbackasm1(SB) + MOVD $1665, R12 + B callbackasm1(SB) + MOVD $1666, R12 + B callbackasm1(SB) + MOVD $1667, R12 + B callbackasm1(SB) + MOVD $1668, R12 + B callbackasm1(SB) + MOVD $1669, R12 + B callbackasm1(SB) + MOVD $1670, R12 + B callbackasm1(SB) + MOVD $1671, R12 + B callbackasm1(SB) + MOVD $1672, R12 + B callbackasm1(SB) + MOVD $1673, R12 + B callbackasm1(SB) + MOVD $1674, R12 + B callbackasm1(SB) + MOVD $1675, R12 + B callbackasm1(SB) + MOVD $1676, R12 + B callbackasm1(SB) + MOVD $1677, R12 + B callbackasm1(SB) + MOVD $1678, R12 + B callbackasm1(SB) + MOVD $1679, R12 + B callbackasm1(SB) + MOVD $1680, R12 + B callbackasm1(SB) + MOVD $1681, R12 + B callbackasm1(SB) + MOVD $1682, R12 + B callbackasm1(SB) + MOVD $1683, R12 + B callbackasm1(SB) + MOVD $1684, R12 + B callbackasm1(SB) + MOVD $1685, R12 + B callbackasm1(SB) + MOVD $1686, R12 + B callbackasm1(SB) + MOVD $1687, R12 + B callbackasm1(SB) + MOVD $1688, R12 + B callbackasm1(SB) + MOVD $1689, R12 + B callbackasm1(SB) + MOVD $1690, R12 + B callbackasm1(SB) + MOVD $1691, R12 + B callbackasm1(SB) + MOVD $1692, R12 + B callbackasm1(SB) + MOVD $1693, R12 + B callbackasm1(SB) + MOVD $1694, R12 + B callbackasm1(SB) + MOVD $1695, R12 + B callbackasm1(SB) + MOVD $1696, R12 + B callbackasm1(SB) + MOVD $1697, R12 + B callbackasm1(SB) + MOVD $1698, R12 + B callbackasm1(SB) + MOVD $1699, R12 + B callbackasm1(SB) + MOVD $1700, R12 + B callbackasm1(SB) + MOVD $1701, R12 + B callbackasm1(SB) + MOVD $1702, R12 + B callbackasm1(SB) + MOVD $1703, R12 + B callbackasm1(SB) + MOVD $1704, R12 + B callbackasm1(SB) + MOVD $1705, R12 + B callbackasm1(SB) + MOVD $1706, R12 + B callbackasm1(SB) + MOVD $1707, R12 + B callbackasm1(SB) + MOVD $1708, R12 + B callbackasm1(SB) + MOVD $1709, R12 + B callbackasm1(SB) + MOVD $1710, R12 + B callbackasm1(SB) + MOVD $1711, R12 + B callbackasm1(SB) + MOVD $1712, R12 + B callbackasm1(SB) + MOVD $1713, R12 + B callbackasm1(SB) + MOVD $1714, R12 + B callbackasm1(SB) + MOVD $1715, R12 + B callbackasm1(SB) + MOVD $1716, R12 + B callbackasm1(SB) + MOVD $1717, R12 + B callbackasm1(SB) + MOVD $1718, R12 + B callbackasm1(SB) + MOVD $1719, R12 + B callbackasm1(SB) + MOVD $1720, R12 + B callbackasm1(SB) + MOVD $1721, R12 + B callbackasm1(SB) + MOVD $1722, R12 + B callbackasm1(SB) + MOVD $1723, R12 + B callbackasm1(SB) + MOVD $1724, R12 + B callbackasm1(SB) + MOVD $1725, R12 + B callbackasm1(SB) + MOVD $1726, R12 + B callbackasm1(SB) + MOVD $1727, R12 + B callbackasm1(SB) + MOVD $1728, R12 + B callbackasm1(SB) + MOVD $1729, R12 + B callbackasm1(SB) + MOVD $1730, R12 + B callbackasm1(SB) + MOVD $1731, R12 + B callbackasm1(SB) + MOVD $1732, R12 + B callbackasm1(SB) + MOVD $1733, R12 + B callbackasm1(SB) + MOVD $1734, R12 + B callbackasm1(SB) + MOVD $1735, R12 + B callbackasm1(SB) + MOVD $1736, R12 + B callbackasm1(SB) + MOVD $1737, R12 + B callbackasm1(SB) + MOVD $1738, R12 + B callbackasm1(SB) + MOVD $1739, R12 + B callbackasm1(SB) + MOVD $1740, R12 + B callbackasm1(SB) + MOVD $1741, R12 + B callbackasm1(SB) + MOVD $1742, R12 + B callbackasm1(SB) + MOVD $1743, R12 + B callbackasm1(SB) + MOVD $1744, R12 + B callbackasm1(SB) + MOVD $1745, R12 + B callbackasm1(SB) + MOVD $1746, R12 + B callbackasm1(SB) + MOVD $1747, R12 + B callbackasm1(SB) + MOVD $1748, R12 + B callbackasm1(SB) + MOVD $1749, R12 + B callbackasm1(SB) + MOVD $1750, R12 + B callbackasm1(SB) + MOVD $1751, R12 + B callbackasm1(SB) + MOVD $1752, R12 + B callbackasm1(SB) + MOVD $1753, R12 + B callbackasm1(SB) + MOVD $1754, R12 + B callbackasm1(SB) + MOVD $1755, R12 + B callbackasm1(SB) + MOVD $1756, R12 + B callbackasm1(SB) + MOVD $1757, R12 + B callbackasm1(SB) + MOVD $1758, R12 + B callbackasm1(SB) + MOVD $1759, R12 + B callbackasm1(SB) + MOVD $1760, R12 + B callbackasm1(SB) + MOVD $1761, R12 + B callbackasm1(SB) + MOVD $1762, R12 + B callbackasm1(SB) + MOVD $1763, R12 + B callbackasm1(SB) + MOVD $1764, R12 + B callbackasm1(SB) + MOVD $1765, R12 + B callbackasm1(SB) + MOVD $1766, R12 + B callbackasm1(SB) + MOVD $1767, R12 + B callbackasm1(SB) + MOVD $1768, R12 + B callbackasm1(SB) + MOVD $1769, R12 + B callbackasm1(SB) + MOVD $1770, R12 + B callbackasm1(SB) + MOVD $1771, R12 + B callbackasm1(SB) + MOVD $1772, R12 + B callbackasm1(SB) + MOVD $1773, R12 + B callbackasm1(SB) + MOVD $1774, R12 + B callbackasm1(SB) + MOVD $1775, R12 + B callbackasm1(SB) + MOVD $1776, R12 + B callbackasm1(SB) + MOVD $1777, R12 + B callbackasm1(SB) + MOVD $1778, R12 + B callbackasm1(SB) + MOVD $1779, R12 + B callbackasm1(SB) + MOVD $1780, R12 + B callbackasm1(SB) + MOVD $1781, R12 + B callbackasm1(SB) + MOVD $1782, R12 + B callbackasm1(SB) + MOVD $1783, R12 + B callbackasm1(SB) + MOVD $1784, R12 + B callbackasm1(SB) + MOVD $1785, R12 + B callbackasm1(SB) + MOVD $1786, R12 + B callbackasm1(SB) + MOVD $1787, R12 + B callbackasm1(SB) + MOVD $1788, R12 + B callbackasm1(SB) + MOVD $1789, R12 + B callbackasm1(SB) + MOVD $1790, R12 + B callbackasm1(SB) + MOVD $1791, R12 + B callbackasm1(SB) + MOVD $1792, R12 + B callbackasm1(SB) + MOVD $1793, R12 + B callbackasm1(SB) + MOVD $1794, R12 + B callbackasm1(SB) + MOVD $1795, R12 + B callbackasm1(SB) + MOVD $1796, R12 + B callbackasm1(SB) + MOVD $1797, R12 + B callbackasm1(SB) + MOVD $1798, R12 + B callbackasm1(SB) + MOVD $1799, R12 + B callbackasm1(SB) + MOVD $1800, R12 + B callbackasm1(SB) + MOVD $1801, R12 + B callbackasm1(SB) + MOVD $1802, R12 + B callbackasm1(SB) + MOVD $1803, R12 + B callbackasm1(SB) + MOVD $1804, R12 + B callbackasm1(SB) + MOVD $1805, R12 + B callbackasm1(SB) + MOVD $1806, R12 + B callbackasm1(SB) + MOVD $1807, R12 + B callbackasm1(SB) + MOVD $1808, R12 + B callbackasm1(SB) + MOVD $1809, R12 + B callbackasm1(SB) + MOVD $1810, R12 + B callbackasm1(SB) + MOVD $1811, R12 + B callbackasm1(SB) + MOVD $1812, R12 + B callbackasm1(SB) + MOVD $1813, R12 + B callbackasm1(SB) + MOVD $1814, R12 + B callbackasm1(SB) + MOVD $1815, R12 + B callbackasm1(SB) + MOVD $1816, R12 + B callbackasm1(SB) + MOVD $1817, R12 + B callbackasm1(SB) + MOVD $1818, R12 + B callbackasm1(SB) + MOVD $1819, R12 + B callbackasm1(SB) + MOVD $1820, R12 + B callbackasm1(SB) + MOVD $1821, R12 + B callbackasm1(SB) + MOVD $1822, R12 + B callbackasm1(SB) + MOVD $1823, R12 + B callbackasm1(SB) + MOVD $1824, R12 + B callbackasm1(SB) + MOVD $1825, R12 + B callbackasm1(SB) + MOVD $1826, R12 + B callbackasm1(SB) + MOVD $1827, R12 + B callbackasm1(SB) + MOVD $1828, R12 + B callbackasm1(SB) + MOVD $1829, R12 + B callbackasm1(SB) + MOVD $1830, R12 + B callbackasm1(SB) + MOVD $1831, R12 + B callbackasm1(SB) + MOVD $1832, R12 + B callbackasm1(SB) + MOVD $1833, R12 + B callbackasm1(SB) + MOVD $1834, R12 + B callbackasm1(SB) + MOVD $1835, R12 + B callbackasm1(SB) + MOVD $1836, R12 + B callbackasm1(SB) + MOVD $1837, R12 + B callbackasm1(SB) + MOVD $1838, R12 + B callbackasm1(SB) + MOVD $1839, R12 + B callbackasm1(SB) + MOVD $1840, R12 + B callbackasm1(SB) + MOVD $1841, R12 + B callbackasm1(SB) + MOVD $1842, R12 + B callbackasm1(SB) + MOVD $1843, R12 + B callbackasm1(SB) + MOVD $1844, R12 + B callbackasm1(SB) + MOVD $1845, R12 + B callbackasm1(SB) + MOVD $1846, R12 + B callbackasm1(SB) + MOVD $1847, R12 + B callbackasm1(SB) + MOVD $1848, R12 + B callbackasm1(SB) + MOVD $1849, R12 + B callbackasm1(SB) + MOVD $1850, R12 + B callbackasm1(SB) + MOVD $1851, R12 + B callbackasm1(SB) + MOVD $1852, R12 + B callbackasm1(SB) + MOVD $1853, R12 + B callbackasm1(SB) + MOVD $1854, R12 + B callbackasm1(SB) + MOVD $1855, R12 + B callbackasm1(SB) + MOVD $1856, R12 + B callbackasm1(SB) + MOVD $1857, R12 + B callbackasm1(SB) + MOVD $1858, R12 + B callbackasm1(SB) + MOVD $1859, R12 + B callbackasm1(SB) + MOVD $1860, R12 + B callbackasm1(SB) + MOVD $1861, R12 + B callbackasm1(SB) + MOVD $1862, R12 + B callbackasm1(SB) + MOVD $1863, R12 + B callbackasm1(SB) + MOVD $1864, R12 + B callbackasm1(SB) + MOVD $1865, R12 + B callbackasm1(SB) + MOVD $1866, R12 + B callbackasm1(SB) + MOVD $1867, R12 + B callbackasm1(SB) + MOVD $1868, R12 + B callbackasm1(SB) + MOVD $1869, R12 + B callbackasm1(SB) + MOVD $1870, R12 + B callbackasm1(SB) + MOVD $1871, R12 + B callbackasm1(SB) + MOVD $1872, R12 + B callbackasm1(SB) + MOVD $1873, R12 + B callbackasm1(SB) + MOVD $1874, R12 + B callbackasm1(SB) + MOVD $1875, R12 + B callbackasm1(SB) + MOVD $1876, R12 + B callbackasm1(SB) + MOVD $1877, R12 + B callbackasm1(SB) + MOVD $1878, R12 + B callbackasm1(SB) + MOVD $1879, R12 + B callbackasm1(SB) + MOVD $1880, R12 + B callbackasm1(SB) + MOVD $1881, R12 + B callbackasm1(SB) + MOVD $1882, R12 + B callbackasm1(SB) + MOVD $1883, R12 + B callbackasm1(SB) + MOVD $1884, R12 + B callbackasm1(SB) + MOVD $1885, R12 + B callbackasm1(SB) + MOVD $1886, R12 + B callbackasm1(SB) + MOVD $1887, R12 + B callbackasm1(SB) + MOVD $1888, R12 + B callbackasm1(SB) + MOVD $1889, R12 + B callbackasm1(SB) + MOVD $1890, R12 + B callbackasm1(SB) + MOVD $1891, R12 + B callbackasm1(SB) + MOVD $1892, R12 + B callbackasm1(SB) + MOVD $1893, R12 + B callbackasm1(SB) + MOVD $1894, R12 + B callbackasm1(SB) + MOVD $1895, R12 + B callbackasm1(SB) + MOVD $1896, R12 + B callbackasm1(SB) + MOVD $1897, R12 + B callbackasm1(SB) + MOVD $1898, R12 + B callbackasm1(SB) + MOVD $1899, R12 + B callbackasm1(SB) + MOVD $1900, R12 + B callbackasm1(SB) + MOVD $1901, R12 + B callbackasm1(SB) + MOVD $1902, R12 + B callbackasm1(SB) + MOVD $1903, R12 + B callbackasm1(SB) + MOVD $1904, R12 + B callbackasm1(SB) + MOVD $1905, R12 + B callbackasm1(SB) + MOVD $1906, R12 + B callbackasm1(SB) + MOVD $1907, R12 + B callbackasm1(SB) + MOVD $1908, R12 + B callbackasm1(SB) + MOVD $1909, R12 + B callbackasm1(SB) + MOVD $1910, R12 + B callbackasm1(SB) + MOVD $1911, R12 + B callbackasm1(SB) + MOVD $1912, R12 + B callbackasm1(SB) + MOVD $1913, R12 + B callbackasm1(SB) + MOVD $1914, R12 + B callbackasm1(SB) + MOVD $1915, R12 + B callbackasm1(SB) + MOVD $1916, R12 + B callbackasm1(SB) + MOVD $1917, R12 + B callbackasm1(SB) + MOVD $1918, R12 + B callbackasm1(SB) + MOVD $1919, R12 + B callbackasm1(SB) + MOVD $1920, R12 + B callbackasm1(SB) + MOVD $1921, R12 + B callbackasm1(SB) + MOVD $1922, R12 + B callbackasm1(SB) + MOVD $1923, R12 + B callbackasm1(SB) + MOVD $1924, R12 + B callbackasm1(SB) + MOVD $1925, R12 + B callbackasm1(SB) + MOVD $1926, R12 + B callbackasm1(SB) + MOVD $1927, R12 + B callbackasm1(SB) + MOVD $1928, R12 + B callbackasm1(SB) + MOVD $1929, R12 + B callbackasm1(SB) + MOVD $1930, R12 + B callbackasm1(SB) + MOVD $1931, R12 + B callbackasm1(SB) + MOVD $1932, R12 + B callbackasm1(SB) + MOVD $1933, R12 + B callbackasm1(SB) + MOVD $1934, R12 + B callbackasm1(SB) + MOVD $1935, R12 + B callbackasm1(SB) + MOVD $1936, R12 + B callbackasm1(SB) + MOVD $1937, R12 + B callbackasm1(SB) + MOVD $1938, R12 + B callbackasm1(SB) + MOVD $1939, R12 + B callbackasm1(SB) + MOVD $1940, R12 + B callbackasm1(SB) + MOVD $1941, R12 + B callbackasm1(SB) + MOVD $1942, R12 + B callbackasm1(SB) + MOVD $1943, R12 + B callbackasm1(SB) + MOVD $1944, R12 + B callbackasm1(SB) + MOVD $1945, R12 + B callbackasm1(SB) + MOVD $1946, R12 + B callbackasm1(SB) + MOVD $1947, R12 + B callbackasm1(SB) + MOVD $1948, R12 + B callbackasm1(SB) + MOVD $1949, R12 + B callbackasm1(SB) + MOVD $1950, R12 + B callbackasm1(SB) + MOVD $1951, R12 + B callbackasm1(SB) + MOVD $1952, R12 + B callbackasm1(SB) + MOVD $1953, R12 + B callbackasm1(SB) + MOVD $1954, R12 + B callbackasm1(SB) + MOVD $1955, R12 + B callbackasm1(SB) + MOVD $1956, R12 + B callbackasm1(SB) + MOVD $1957, R12 + B callbackasm1(SB) + MOVD $1958, R12 + B callbackasm1(SB) + MOVD $1959, R12 + B callbackasm1(SB) + MOVD $1960, R12 + B callbackasm1(SB) + MOVD $1961, R12 + B callbackasm1(SB) + MOVD $1962, R12 + B callbackasm1(SB) + MOVD $1963, R12 + B callbackasm1(SB) + MOVD $1964, R12 + B callbackasm1(SB) + MOVD $1965, R12 + B callbackasm1(SB) + MOVD $1966, R12 + B callbackasm1(SB) + MOVD $1967, R12 + B callbackasm1(SB) + MOVD $1968, R12 + B callbackasm1(SB) + MOVD $1969, R12 + B callbackasm1(SB) + MOVD $1970, R12 + B callbackasm1(SB) + MOVD $1971, R12 + B callbackasm1(SB) + MOVD $1972, R12 + B callbackasm1(SB) + MOVD $1973, R12 + B callbackasm1(SB) + MOVD $1974, R12 + B callbackasm1(SB) + MOVD $1975, R12 + B callbackasm1(SB) + MOVD $1976, R12 + B callbackasm1(SB) + MOVD $1977, R12 + B callbackasm1(SB) + MOVD $1978, R12 + B callbackasm1(SB) + MOVD $1979, R12 + B callbackasm1(SB) + MOVD $1980, R12 + B callbackasm1(SB) + MOVD $1981, R12 + B callbackasm1(SB) + MOVD $1982, R12 + B callbackasm1(SB) + MOVD $1983, R12 + B callbackasm1(SB) + MOVD $1984, R12 + B callbackasm1(SB) + MOVD $1985, R12 + B callbackasm1(SB) + MOVD $1986, R12 + B callbackasm1(SB) + MOVD $1987, R12 + B callbackasm1(SB) + MOVD $1988, R12 + B callbackasm1(SB) + MOVD $1989, R12 + B callbackasm1(SB) + MOVD $1990, R12 + B callbackasm1(SB) + MOVD $1991, R12 + B callbackasm1(SB) + MOVD $1992, R12 + B callbackasm1(SB) + MOVD $1993, R12 + B callbackasm1(SB) + MOVD $1994, R12 + B callbackasm1(SB) + MOVD $1995, R12 + B callbackasm1(SB) + MOVD $1996, R12 + B callbackasm1(SB) + MOVD $1997, R12 + B callbackasm1(SB) + MOVD $1998, R12 + B callbackasm1(SB) + MOVD $1999, R12 + B callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_loong64.s b/vendor/github.com/ebitengine/purego/zcallback_loong64.s new file mode 100644 index 00000000..c5dcd48e --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_loong64.s @@ -0,0 +1,4014 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build darwin || freebsd || linux || netbsd + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOVV and JMP instructions. +// The MOVV instruction loads R12 with the callback index, and the +// JMP instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R12 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + MOVV $0, R12 + JMP callbackasm1(SB) + MOVV $1, R12 + JMP callbackasm1(SB) + MOVV $2, R12 + JMP callbackasm1(SB) + MOVV $3, R12 + JMP callbackasm1(SB) + MOVV $4, R12 + JMP callbackasm1(SB) + MOVV $5, R12 + JMP callbackasm1(SB) + MOVV $6, R12 + JMP callbackasm1(SB) + MOVV $7, R12 + JMP callbackasm1(SB) + MOVV $8, R12 + JMP callbackasm1(SB) + MOVV $9, R12 + JMP callbackasm1(SB) + MOVV $10, R12 + JMP callbackasm1(SB) + MOVV $11, R12 + JMP callbackasm1(SB) + MOVV $12, R12 + JMP callbackasm1(SB) + MOVV $13, R12 + JMP callbackasm1(SB) + MOVV $14, R12 + JMP callbackasm1(SB) + MOVV $15, R12 + JMP callbackasm1(SB) + MOVV $16, R12 + JMP callbackasm1(SB) + MOVV $17, R12 + JMP callbackasm1(SB) + MOVV $18, R12 + JMP callbackasm1(SB) + MOVV $19, R12 + JMP callbackasm1(SB) + MOVV $20, R12 + JMP callbackasm1(SB) + MOVV $21, R12 + JMP callbackasm1(SB) + MOVV $22, R12 + JMP callbackasm1(SB) + MOVV $23, R12 + JMP callbackasm1(SB) + MOVV $24, R12 + JMP callbackasm1(SB) + MOVV $25, R12 + JMP callbackasm1(SB) + MOVV $26, R12 + JMP callbackasm1(SB) + MOVV $27, R12 + JMP callbackasm1(SB) + MOVV $28, R12 + JMP callbackasm1(SB) + MOVV $29, R12 + JMP callbackasm1(SB) + MOVV $30, R12 + JMP callbackasm1(SB) + MOVV $31, R12 + JMP callbackasm1(SB) + MOVV $32, R12 + JMP callbackasm1(SB) + MOVV $33, R12 + JMP callbackasm1(SB) + MOVV $34, R12 + JMP callbackasm1(SB) + MOVV $35, R12 + JMP callbackasm1(SB) + MOVV $36, R12 + JMP callbackasm1(SB) + MOVV $37, R12 + JMP callbackasm1(SB) + MOVV $38, R12 + JMP callbackasm1(SB) + MOVV $39, R12 + JMP callbackasm1(SB) + MOVV $40, R12 + JMP callbackasm1(SB) + MOVV $41, R12 + JMP callbackasm1(SB) + MOVV $42, R12 + JMP callbackasm1(SB) + MOVV $43, R12 + JMP callbackasm1(SB) + MOVV $44, R12 + JMP callbackasm1(SB) + MOVV $45, R12 + JMP callbackasm1(SB) + MOVV $46, R12 + JMP callbackasm1(SB) + MOVV $47, R12 + JMP callbackasm1(SB) + MOVV $48, R12 + JMP callbackasm1(SB) + MOVV $49, R12 + JMP callbackasm1(SB) + MOVV $50, R12 + JMP callbackasm1(SB) + MOVV $51, R12 + JMP callbackasm1(SB) + MOVV $52, R12 + JMP callbackasm1(SB) + MOVV $53, R12 + JMP callbackasm1(SB) + MOVV $54, R12 + JMP callbackasm1(SB) + MOVV $55, R12 + JMP callbackasm1(SB) + MOVV $56, R12 + JMP callbackasm1(SB) + MOVV $57, R12 + JMP callbackasm1(SB) + MOVV $58, R12 + JMP callbackasm1(SB) + MOVV $59, R12 + JMP callbackasm1(SB) + MOVV $60, R12 + JMP callbackasm1(SB) + MOVV $61, R12 + JMP callbackasm1(SB) + MOVV $62, R12 + JMP callbackasm1(SB) + MOVV $63, R12 + JMP callbackasm1(SB) + MOVV $64, R12 + JMP callbackasm1(SB) + MOVV $65, R12 + JMP callbackasm1(SB) + MOVV $66, R12 + JMP callbackasm1(SB) + MOVV $67, R12 + JMP callbackasm1(SB) + MOVV $68, R12 + JMP callbackasm1(SB) + MOVV $69, R12 + JMP callbackasm1(SB) + MOVV $70, R12 + JMP callbackasm1(SB) + MOVV $71, R12 + JMP callbackasm1(SB) + MOVV $72, R12 + JMP callbackasm1(SB) + MOVV $73, R12 + JMP callbackasm1(SB) + MOVV $74, R12 + JMP callbackasm1(SB) + MOVV $75, R12 + JMP callbackasm1(SB) + MOVV $76, R12 + JMP callbackasm1(SB) + MOVV $77, R12 + JMP callbackasm1(SB) + MOVV $78, R12 + JMP callbackasm1(SB) + MOVV $79, R12 + JMP callbackasm1(SB) + MOVV $80, R12 + JMP callbackasm1(SB) + MOVV $81, R12 + JMP callbackasm1(SB) + MOVV $82, R12 + JMP callbackasm1(SB) + MOVV $83, R12 + JMP callbackasm1(SB) + MOVV $84, R12 + JMP callbackasm1(SB) + MOVV $85, R12 + JMP callbackasm1(SB) + MOVV $86, R12 + JMP callbackasm1(SB) + MOVV $87, R12 + JMP callbackasm1(SB) + MOVV $88, R12 + JMP callbackasm1(SB) + MOVV $89, R12 + JMP callbackasm1(SB) + MOVV $90, R12 + JMP callbackasm1(SB) + MOVV $91, R12 + JMP callbackasm1(SB) + MOVV $92, R12 + JMP callbackasm1(SB) + MOVV $93, R12 + JMP callbackasm1(SB) + MOVV $94, R12 + JMP callbackasm1(SB) + MOVV $95, R12 + JMP callbackasm1(SB) + MOVV $96, R12 + JMP callbackasm1(SB) + MOVV $97, R12 + JMP callbackasm1(SB) + MOVV $98, R12 + JMP callbackasm1(SB) + MOVV $99, R12 + JMP callbackasm1(SB) + MOVV $100, R12 + JMP callbackasm1(SB) + MOVV $101, R12 + JMP callbackasm1(SB) + MOVV $102, R12 + JMP callbackasm1(SB) + MOVV $103, R12 + JMP callbackasm1(SB) + MOVV $104, R12 + JMP callbackasm1(SB) + MOVV $105, R12 + JMP callbackasm1(SB) + MOVV $106, R12 + JMP callbackasm1(SB) + MOVV $107, R12 + JMP callbackasm1(SB) + MOVV $108, R12 + JMP callbackasm1(SB) + MOVV $109, R12 + JMP callbackasm1(SB) + MOVV $110, R12 + JMP callbackasm1(SB) + MOVV $111, R12 + JMP callbackasm1(SB) + MOVV $112, R12 + JMP callbackasm1(SB) + MOVV $113, R12 + JMP callbackasm1(SB) + MOVV $114, R12 + JMP callbackasm1(SB) + MOVV $115, R12 + JMP callbackasm1(SB) + MOVV $116, R12 + JMP callbackasm1(SB) + MOVV $117, R12 + JMP callbackasm1(SB) + MOVV $118, R12 + JMP callbackasm1(SB) + MOVV $119, R12 + JMP callbackasm1(SB) + MOVV $120, R12 + JMP callbackasm1(SB) + MOVV $121, R12 + JMP callbackasm1(SB) + MOVV $122, R12 + JMP callbackasm1(SB) + MOVV $123, R12 + JMP callbackasm1(SB) + MOVV $124, R12 + JMP callbackasm1(SB) + MOVV $125, R12 + JMP callbackasm1(SB) + MOVV $126, R12 + JMP callbackasm1(SB) + MOVV $127, R12 + JMP callbackasm1(SB) + MOVV $128, R12 + JMP callbackasm1(SB) + MOVV $129, R12 + JMP callbackasm1(SB) + MOVV $130, R12 + JMP callbackasm1(SB) + MOVV $131, R12 + JMP callbackasm1(SB) + MOVV $132, R12 + JMP callbackasm1(SB) + MOVV $133, R12 + JMP callbackasm1(SB) + MOVV $134, R12 + JMP callbackasm1(SB) + MOVV $135, R12 + JMP callbackasm1(SB) + MOVV $136, R12 + JMP callbackasm1(SB) + MOVV $137, R12 + JMP callbackasm1(SB) + MOVV $138, R12 + JMP callbackasm1(SB) + MOVV $139, R12 + JMP callbackasm1(SB) + MOVV $140, R12 + JMP callbackasm1(SB) + MOVV $141, R12 + JMP callbackasm1(SB) + MOVV $142, R12 + JMP callbackasm1(SB) + MOVV $143, R12 + JMP callbackasm1(SB) + MOVV $144, R12 + JMP callbackasm1(SB) + MOVV $145, R12 + JMP callbackasm1(SB) + MOVV $146, R12 + JMP callbackasm1(SB) + MOVV $147, R12 + JMP callbackasm1(SB) + MOVV $148, R12 + JMP callbackasm1(SB) + MOVV $149, R12 + JMP callbackasm1(SB) + MOVV $150, R12 + JMP callbackasm1(SB) + MOVV $151, R12 + JMP callbackasm1(SB) + MOVV $152, R12 + JMP callbackasm1(SB) + MOVV $153, R12 + JMP callbackasm1(SB) + MOVV $154, R12 + JMP callbackasm1(SB) + MOVV $155, R12 + JMP callbackasm1(SB) + MOVV $156, R12 + JMP callbackasm1(SB) + MOVV $157, R12 + JMP callbackasm1(SB) + MOVV $158, R12 + JMP callbackasm1(SB) + MOVV $159, R12 + JMP callbackasm1(SB) + MOVV $160, R12 + JMP callbackasm1(SB) + MOVV $161, R12 + JMP callbackasm1(SB) + MOVV $162, R12 + JMP callbackasm1(SB) + MOVV $163, R12 + JMP callbackasm1(SB) + MOVV $164, R12 + JMP callbackasm1(SB) + MOVV $165, R12 + JMP callbackasm1(SB) + MOVV $166, R12 + JMP callbackasm1(SB) + MOVV $167, R12 + JMP callbackasm1(SB) + MOVV $168, R12 + JMP callbackasm1(SB) + MOVV $169, R12 + JMP callbackasm1(SB) + MOVV $170, R12 + JMP callbackasm1(SB) + MOVV $171, R12 + JMP callbackasm1(SB) + MOVV $172, R12 + JMP callbackasm1(SB) + MOVV $173, R12 + JMP callbackasm1(SB) + MOVV $174, R12 + JMP callbackasm1(SB) + MOVV $175, R12 + JMP callbackasm1(SB) + MOVV $176, R12 + JMP callbackasm1(SB) + MOVV $177, R12 + JMP callbackasm1(SB) + MOVV $178, R12 + JMP callbackasm1(SB) + MOVV $179, R12 + JMP callbackasm1(SB) + MOVV $180, R12 + JMP callbackasm1(SB) + MOVV $181, R12 + JMP callbackasm1(SB) + MOVV $182, R12 + JMP callbackasm1(SB) + MOVV $183, R12 + JMP callbackasm1(SB) + MOVV $184, R12 + JMP callbackasm1(SB) + MOVV $185, R12 + JMP callbackasm1(SB) + MOVV $186, R12 + JMP callbackasm1(SB) + MOVV $187, R12 + JMP callbackasm1(SB) + MOVV $188, R12 + JMP callbackasm1(SB) + MOVV $189, R12 + JMP callbackasm1(SB) + MOVV $190, R12 + JMP callbackasm1(SB) + MOVV $191, R12 + JMP callbackasm1(SB) + MOVV $192, R12 + JMP callbackasm1(SB) + MOVV $193, R12 + JMP callbackasm1(SB) + MOVV $194, R12 + JMP callbackasm1(SB) + MOVV $195, R12 + JMP callbackasm1(SB) + MOVV $196, R12 + JMP callbackasm1(SB) + MOVV $197, R12 + JMP callbackasm1(SB) + MOVV $198, R12 + JMP callbackasm1(SB) + MOVV $199, R12 + JMP callbackasm1(SB) + MOVV $200, R12 + JMP callbackasm1(SB) + MOVV $201, R12 + JMP callbackasm1(SB) + MOVV $202, R12 + JMP callbackasm1(SB) + MOVV $203, R12 + JMP callbackasm1(SB) + MOVV $204, R12 + JMP callbackasm1(SB) + MOVV $205, R12 + JMP callbackasm1(SB) + MOVV $206, R12 + JMP callbackasm1(SB) + MOVV $207, R12 + JMP callbackasm1(SB) + MOVV $208, R12 + JMP callbackasm1(SB) + MOVV $209, R12 + JMP callbackasm1(SB) + MOVV $210, R12 + JMP callbackasm1(SB) + MOVV $211, R12 + JMP callbackasm1(SB) + MOVV $212, R12 + JMP callbackasm1(SB) + MOVV $213, R12 + JMP callbackasm1(SB) + MOVV $214, R12 + JMP callbackasm1(SB) + MOVV $215, R12 + JMP callbackasm1(SB) + MOVV $216, R12 + JMP callbackasm1(SB) + MOVV $217, R12 + JMP callbackasm1(SB) + MOVV $218, R12 + JMP callbackasm1(SB) + MOVV $219, R12 + JMP callbackasm1(SB) + MOVV $220, R12 + JMP callbackasm1(SB) + MOVV $221, R12 + JMP callbackasm1(SB) + MOVV $222, R12 + JMP callbackasm1(SB) + MOVV $223, R12 + JMP callbackasm1(SB) + MOVV $224, R12 + JMP callbackasm1(SB) + MOVV $225, R12 + JMP callbackasm1(SB) + MOVV $226, R12 + JMP callbackasm1(SB) + MOVV $227, R12 + JMP callbackasm1(SB) + MOVV $228, R12 + JMP callbackasm1(SB) + MOVV $229, R12 + JMP callbackasm1(SB) + MOVV $230, R12 + JMP callbackasm1(SB) + MOVV $231, R12 + JMP callbackasm1(SB) + MOVV $232, R12 + JMP callbackasm1(SB) + MOVV $233, R12 + JMP callbackasm1(SB) + MOVV $234, R12 + JMP callbackasm1(SB) + MOVV $235, R12 + JMP callbackasm1(SB) + MOVV $236, R12 + JMP callbackasm1(SB) + MOVV $237, R12 + JMP callbackasm1(SB) + MOVV $238, R12 + JMP callbackasm1(SB) + MOVV $239, R12 + JMP callbackasm1(SB) + MOVV $240, R12 + JMP callbackasm1(SB) + MOVV $241, R12 + JMP callbackasm1(SB) + MOVV $242, R12 + JMP callbackasm1(SB) + MOVV $243, R12 + JMP callbackasm1(SB) + MOVV $244, R12 + JMP callbackasm1(SB) + MOVV $245, R12 + JMP callbackasm1(SB) + MOVV $246, R12 + JMP callbackasm1(SB) + MOVV $247, R12 + JMP callbackasm1(SB) + MOVV $248, R12 + JMP callbackasm1(SB) + MOVV $249, R12 + JMP callbackasm1(SB) + MOVV $250, R12 + JMP callbackasm1(SB) + MOVV $251, R12 + JMP callbackasm1(SB) + MOVV $252, R12 + JMP callbackasm1(SB) + MOVV $253, R12 + JMP callbackasm1(SB) + MOVV $254, R12 + JMP callbackasm1(SB) + MOVV $255, R12 + JMP callbackasm1(SB) + MOVV $256, R12 + JMP callbackasm1(SB) + MOVV $257, R12 + JMP callbackasm1(SB) + MOVV $258, R12 + JMP callbackasm1(SB) + MOVV $259, R12 + JMP callbackasm1(SB) + MOVV $260, R12 + JMP callbackasm1(SB) + MOVV $261, R12 + JMP callbackasm1(SB) + MOVV $262, R12 + JMP callbackasm1(SB) + MOVV $263, R12 + JMP callbackasm1(SB) + MOVV $264, R12 + JMP callbackasm1(SB) + MOVV $265, R12 + JMP callbackasm1(SB) + MOVV $266, R12 + JMP callbackasm1(SB) + MOVV $267, R12 + JMP callbackasm1(SB) + MOVV $268, R12 + JMP callbackasm1(SB) + MOVV $269, R12 + JMP callbackasm1(SB) + MOVV $270, R12 + JMP callbackasm1(SB) + MOVV $271, R12 + JMP callbackasm1(SB) + MOVV $272, R12 + JMP callbackasm1(SB) + MOVV $273, R12 + JMP callbackasm1(SB) + MOVV $274, R12 + JMP callbackasm1(SB) + MOVV $275, R12 + JMP callbackasm1(SB) + MOVV $276, R12 + JMP callbackasm1(SB) + MOVV $277, R12 + JMP callbackasm1(SB) + MOVV $278, R12 + JMP callbackasm1(SB) + MOVV $279, R12 + JMP callbackasm1(SB) + MOVV $280, R12 + JMP callbackasm1(SB) + MOVV $281, R12 + JMP callbackasm1(SB) + MOVV $282, R12 + JMP callbackasm1(SB) + MOVV $283, R12 + JMP callbackasm1(SB) + MOVV $284, R12 + JMP callbackasm1(SB) + MOVV $285, R12 + JMP callbackasm1(SB) + MOVV $286, R12 + JMP callbackasm1(SB) + MOVV $287, R12 + JMP callbackasm1(SB) + MOVV $288, R12 + JMP callbackasm1(SB) + MOVV $289, R12 + JMP callbackasm1(SB) + MOVV $290, R12 + JMP callbackasm1(SB) + MOVV $291, R12 + JMP callbackasm1(SB) + MOVV $292, R12 + JMP callbackasm1(SB) + MOVV $293, R12 + JMP callbackasm1(SB) + MOVV $294, R12 + JMP callbackasm1(SB) + MOVV $295, R12 + JMP callbackasm1(SB) + MOVV $296, R12 + JMP callbackasm1(SB) + MOVV $297, R12 + JMP callbackasm1(SB) + MOVV $298, R12 + JMP callbackasm1(SB) + MOVV $299, R12 + JMP callbackasm1(SB) + MOVV $300, R12 + JMP callbackasm1(SB) + MOVV $301, R12 + JMP callbackasm1(SB) + MOVV $302, R12 + JMP callbackasm1(SB) + MOVV $303, R12 + JMP callbackasm1(SB) + MOVV $304, R12 + JMP callbackasm1(SB) + MOVV $305, R12 + JMP callbackasm1(SB) + MOVV $306, R12 + JMP callbackasm1(SB) + MOVV $307, R12 + JMP callbackasm1(SB) + MOVV $308, R12 + JMP callbackasm1(SB) + MOVV $309, R12 + JMP callbackasm1(SB) + MOVV $310, R12 + JMP callbackasm1(SB) + MOVV $311, R12 + JMP callbackasm1(SB) + MOVV $312, R12 + JMP callbackasm1(SB) + MOVV $313, R12 + JMP callbackasm1(SB) + MOVV $314, R12 + JMP callbackasm1(SB) + MOVV $315, R12 + JMP callbackasm1(SB) + MOVV $316, R12 + JMP callbackasm1(SB) + MOVV $317, R12 + JMP callbackasm1(SB) + MOVV $318, R12 + JMP callbackasm1(SB) + MOVV $319, R12 + JMP callbackasm1(SB) + MOVV $320, R12 + JMP callbackasm1(SB) + MOVV $321, R12 + JMP callbackasm1(SB) + MOVV $322, R12 + JMP callbackasm1(SB) + MOVV $323, R12 + JMP callbackasm1(SB) + MOVV $324, R12 + JMP callbackasm1(SB) + MOVV $325, R12 + JMP callbackasm1(SB) + MOVV $326, R12 + JMP callbackasm1(SB) + MOVV $327, R12 + JMP callbackasm1(SB) + MOVV $328, R12 + JMP callbackasm1(SB) + MOVV $329, R12 + JMP callbackasm1(SB) + MOVV $330, R12 + JMP callbackasm1(SB) + MOVV $331, R12 + JMP callbackasm1(SB) + MOVV $332, R12 + JMP callbackasm1(SB) + MOVV $333, R12 + JMP callbackasm1(SB) + MOVV $334, R12 + JMP callbackasm1(SB) + MOVV $335, R12 + JMP callbackasm1(SB) + MOVV $336, R12 + JMP callbackasm1(SB) + MOVV $337, R12 + JMP callbackasm1(SB) + MOVV $338, R12 + JMP callbackasm1(SB) + MOVV $339, R12 + JMP callbackasm1(SB) + MOVV $340, R12 + JMP callbackasm1(SB) + MOVV $341, R12 + JMP callbackasm1(SB) + MOVV $342, R12 + JMP callbackasm1(SB) + MOVV $343, R12 + JMP callbackasm1(SB) + MOVV $344, R12 + JMP callbackasm1(SB) + MOVV $345, R12 + JMP callbackasm1(SB) + MOVV $346, R12 + JMP callbackasm1(SB) + MOVV $347, R12 + JMP callbackasm1(SB) + MOVV $348, R12 + JMP callbackasm1(SB) + MOVV $349, R12 + JMP callbackasm1(SB) + MOVV $350, R12 + JMP callbackasm1(SB) + MOVV $351, R12 + JMP callbackasm1(SB) + MOVV $352, R12 + JMP callbackasm1(SB) + MOVV $353, R12 + JMP callbackasm1(SB) + MOVV $354, R12 + JMP callbackasm1(SB) + MOVV $355, R12 + JMP callbackasm1(SB) + MOVV $356, R12 + JMP callbackasm1(SB) + MOVV $357, R12 + JMP callbackasm1(SB) + MOVV $358, R12 + JMP callbackasm1(SB) + MOVV $359, R12 + JMP callbackasm1(SB) + MOVV $360, R12 + JMP callbackasm1(SB) + MOVV $361, R12 + JMP callbackasm1(SB) + MOVV $362, R12 + JMP callbackasm1(SB) + MOVV $363, R12 + JMP callbackasm1(SB) + MOVV $364, R12 + JMP callbackasm1(SB) + MOVV $365, R12 + JMP callbackasm1(SB) + MOVV $366, R12 + JMP callbackasm1(SB) + MOVV $367, R12 + JMP callbackasm1(SB) + MOVV $368, R12 + JMP callbackasm1(SB) + MOVV $369, R12 + JMP callbackasm1(SB) + MOVV $370, R12 + JMP callbackasm1(SB) + MOVV $371, R12 + JMP callbackasm1(SB) + MOVV $372, R12 + JMP callbackasm1(SB) + MOVV $373, R12 + JMP callbackasm1(SB) + MOVV $374, R12 + JMP callbackasm1(SB) + MOVV $375, R12 + JMP callbackasm1(SB) + MOVV $376, R12 + JMP callbackasm1(SB) + MOVV $377, R12 + JMP callbackasm1(SB) + MOVV $378, R12 + JMP callbackasm1(SB) + MOVV $379, R12 + JMP callbackasm1(SB) + MOVV $380, R12 + JMP callbackasm1(SB) + MOVV $381, R12 + JMP callbackasm1(SB) + MOVV $382, R12 + JMP callbackasm1(SB) + MOVV $383, R12 + JMP callbackasm1(SB) + MOVV $384, R12 + JMP callbackasm1(SB) + MOVV $385, R12 + JMP callbackasm1(SB) + MOVV $386, R12 + JMP callbackasm1(SB) + MOVV $387, R12 + JMP callbackasm1(SB) + MOVV $388, R12 + JMP callbackasm1(SB) + MOVV $389, R12 + JMP callbackasm1(SB) + MOVV $390, R12 + JMP callbackasm1(SB) + MOVV $391, R12 + JMP callbackasm1(SB) + MOVV $392, R12 + JMP callbackasm1(SB) + MOVV $393, R12 + JMP callbackasm1(SB) + MOVV $394, R12 + JMP callbackasm1(SB) + MOVV $395, R12 + JMP callbackasm1(SB) + MOVV $396, R12 + JMP callbackasm1(SB) + MOVV $397, R12 + JMP callbackasm1(SB) + MOVV $398, R12 + JMP callbackasm1(SB) + MOVV $399, R12 + JMP callbackasm1(SB) + MOVV $400, R12 + JMP callbackasm1(SB) + MOVV $401, R12 + JMP callbackasm1(SB) + MOVV $402, R12 + JMP callbackasm1(SB) + MOVV $403, R12 + JMP callbackasm1(SB) + MOVV $404, R12 + JMP callbackasm1(SB) + MOVV $405, R12 + JMP callbackasm1(SB) + MOVV $406, R12 + JMP callbackasm1(SB) + MOVV $407, R12 + JMP callbackasm1(SB) + MOVV $408, R12 + JMP callbackasm1(SB) + MOVV $409, R12 + JMP callbackasm1(SB) + MOVV $410, R12 + JMP callbackasm1(SB) + MOVV $411, R12 + JMP callbackasm1(SB) + MOVV $412, R12 + JMP callbackasm1(SB) + MOVV $413, R12 + JMP callbackasm1(SB) + MOVV $414, R12 + JMP callbackasm1(SB) + MOVV $415, R12 + JMP callbackasm1(SB) + MOVV $416, R12 + JMP callbackasm1(SB) + MOVV $417, R12 + JMP callbackasm1(SB) + MOVV $418, R12 + JMP callbackasm1(SB) + MOVV $419, R12 + JMP callbackasm1(SB) + MOVV $420, R12 + JMP callbackasm1(SB) + MOVV $421, R12 + JMP callbackasm1(SB) + MOVV $422, R12 + JMP callbackasm1(SB) + MOVV $423, R12 + JMP callbackasm1(SB) + MOVV $424, R12 + JMP callbackasm1(SB) + MOVV $425, R12 + JMP callbackasm1(SB) + MOVV $426, R12 + JMP callbackasm1(SB) + MOVV $427, R12 + JMP callbackasm1(SB) + MOVV $428, R12 + JMP callbackasm1(SB) + MOVV $429, R12 + JMP callbackasm1(SB) + MOVV $430, R12 + JMP callbackasm1(SB) + MOVV $431, R12 + JMP callbackasm1(SB) + MOVV $432, R12 + JMP callbackasm1(SB) + MOVV $433, R12 + JMP callbackasm1(SB) + MOVV $434, R12 + JMP callbackasm1(SB) + MOVV $435, R12 + JMP callbackasm1(SB) + MOVV $436, R12 + JMP callbackasm1(SB) + MOVV $437, R12 + JMP callbackasm1(SB) + MOVV $438, R12 + JMP callbackasm1(SB) + MOVV $439, R12 + JMP callbackasm1(SB) + MOVV $440, R12 + JMP callbackasm1(SB) + MOVV $441, R12 + JMP callbackasm1(SB) + MOVV $442, R12 + JMP callbackasm1(SB) + MOVV $443, R12 + JMP callbackasm1(SB) + MOVV $444, R12 + JMP callbackasm1(SB) + MOVV $445, R12 + JMP callbackasm1(SB) + MOVV $446, R12 + JMP callbackasm1(SB) + MOVV $447, R12 + JMP callbackasm1(SB) + MOVV $448, R12 + JMP callbackasm1(SB) + MOVV $449, R12 + JMP callbackasm1(SB) + MOVV $450, R12 + JMP callbackasm1(SB) + MOVV $451, R12 + JMP callbackasm1(SB) + MOVV $452, R12 + JMP callbackasm1(SB) + MOVV $453, R12 + JMP callbackasm1(SB) + MOVV $454, R12 + JMP callbackasm1(SB) + MOVV $455, R12 + JMP callbackasm1(SB) + MOVV $456, R12 + JMP callbackasm1(SB) + MOVV $457, R12 + JMP callbackasm1(SB) + MOVV $458, R12 + JMP callbackasm1(SB) + MOVV $459, R12 + JMP callbackasm1(SB) + MOVV $460, R12 + JMP callbackasm1(SB) + MOVV $461, R12 + JMP callbackasm1(SB) + MOVV $462, R12 + JMP callbackasm1(SB) + MOVV $463, R12 + JMP callbackasm1(SB) + MOVV $464, R12 + JMP callbackasm1(SB) + MOVV $465, R12 + JMP callbackasm1(SB) + MOVV $466, R12 + JMP callbackasm1(SB) + MOVV $467, R12 + JMP callbackasm1(SB) + MOVV $468, R12 + JMP callbackasm1(SB) + MOVV $469, R12 + JMP callbackasm1(SB) + MOVV $470, R12 + JMP callbackasm1(SB) + MOVV $471, R12 + JMP callbackasm1(SB) + MOVV $472, R12 + JMP callbackasm1(SB) + MOVV $473, R12 + JMP callbackasm1(SB) + MOVV $474, R12 + JMP callbackasm1(SB) + MOVV $475, R12 + JMP callbackasm1(SB) + MOVV $476, R12 + JMP callbackasm1(SB) + MOVV $477, R12 + JMP callbackasm1(SB) + MOVV $478, R12 + JMP callbackasm1(SB) + MOVV $479, R12 + JMP callbackasm1(SB) + MOVV $480, R12 + JMP callbackasm1(SB) + MOVV $481, R12 + JMP callbackasm1(SB) + MOVV $482, R12 + JMP callbackasm1(SB) + MOVV $483, R12 + JMP callbackasm1(SB) + MOVV $484, R12 + JMP callbackasm1(SB) + MOVV $485, R12 + JMP callbackasm1(SB) + MOVV $486, R12 + JMP callbackasm1(SB) + MOVV $487, R12 + JMP callbackasm1(SB) + MOVV $488, R12 + JMP callbackasm1(SB) + MOVV $489, R12 + JMP callbackasm1(SB) + MOVV $490, R12 + JMP callbackasm1(SB) + MOVV $491, R12 + JMP callbackasm1(SB) + MOVV $492, R12 + JMP callbackasm1(SB) + MOVV $493, R12 + JMP callbackasm1(SB) + MOVV $494, R12 + JMP callbackasm1(SB) + MOVV $495, R12 + JMP callbackasm1(SB) + MOVV $496, R12 + JMP callbackasm1(SB) + MOVV $497, R12 + JMP callbackasm1(SB) + MOVV $498, R12 + JMP callbackasm1(SB) + MOVV $499, R12 + JMP callbackasm1(SB) + MOVV $500, R12 + JMP callbackasm1(SB) + MOVV $501, R12 + JMP callbackasm1(SB) + MOVV $502, R12 + JMP callbackasm1(SB) + MOVV $503, R12 + JMP callbackasm1(SB) + MOVV $504, R12 + JMP callbackasm1(SB) + MOVV $505, R12 + JMP callbackasm1(SB) + MOVV $506, R12 + JMP callbackasm1(SB) + MOVV $507, R12 + JMP callbackasm1(SB) + MOVV $508, R12 + JMP callbackasm1(SB) + MOVV $509, R12 + JMP callbackasm1(SB) + MOVV $510, R12 + JMP callbackasm1(SB) + MOVV $511, R12 + JMP callbackasm1(SB) + MOVV $512, R12 + JMP callbackasm1(SB) + MOVV $513, R12 + JMP callbackasm1(SB) + MOVV $514, R12 + JMP callbackasm1(SB) + MOVV $515, R12 + JMP callbackasm1(SB) + MOVV $516, R12 + JMP callbackasm1(SB) + MOVV $517, R12 + JMP callbackasm1(SB) + MOVV $518, R12 + JMP callbackasm1(SB) + MOVV $519, R12 + JMP callbackasm1(SB) + MOVV $520, R12 + JMP callbackasm1(SB) + MOVV $521, R12 + JMP callbackasm1(SB) + MOVV $522, R12 + JMP callbackasm1(SB) + MOVV $523, R12 + JMP callbackasm1(SB) + MOVV $524, R12 + JMP callbackasm1(SB) + MOVV $525, R12 + JMP callbackasm1(SB) + MOVV $526, R12 + JMP callbackasm1(SB) + MOVV $527, R12 + JMP callbackasm1(SB) + MOVV $528, R12 + JMP callbackasm1(SB) + MOVV $529, R12 + JMP callbackasm1(SB) + MOVV $530, R12 + JMP callbackasm1(SB) + MOVV $531, R12 + JMP callbackasm1(SB) + MOVV $532, R12 + JMP callbackasm1(SB) + MOVV $533, R12 + JMP callbackasm1(SB) + MOVV $534, R12 + JMP callbackasm1(SB) + MOVV $535, R12 + JMP callbackasm1(SB) + MOVV $536, R12 + JMP callbackasm1(SB) + MOVV $537, R12 + JMP callbackasm1(SB) + MOVV $538, R12 + JMP callbackasm1(SB) + MOVV $539, R12 + JMP callbackasm1(SB) + MOVV $540, R12 + JMP callbackasm1(SB) + MOVV $541, R12 + JMP callbackasm1(SB) + MOVV $542, R12 + JMP callbackasm1(SB) + MOVV $543, R12 + JMP callbackasm1(SB) + MOVV $544, R12 + JMP callbackasm1(SB) + MOVV $545, R12 + JMP callbackasm1(SB) + MOVV $546, R12 + JMP callbackasm1(SB) + MOVV $547, R12 + JMP callbackasm1(SB) + MOVV $548, R12 + JMP callbackasm1(SB) + MOVV $549, R12 + JMP callbackasm1(SB) + MOVV $550, R12 + JMP callbackasm1(SB) + MOVV $551, R12 + JMP callbackasm1(SB) + MOVV $552, R12 + JMP callbackasm1(SB) + MOVV $553, R12 + JMP callbackasm1(SB) + MOVV $554, R12 + JMP callbackasm1(SB) + MOVV $555, R12 + JMP callbackasm1(SB) + MOVV $556, R12 + JMP callbackasm1(SB) + MOVV $557, R12 + JMP callbackasm1(SB) + MOVV $558, R12 + JMP callbackasm1(SB) + MOVV $559, R12 + JMP callbackasm1(SB) + MOVV $560, R12 + JMP callbackasm1(SB) + MOVV $561, R12 + JMP callbackasm1(SB) + MOVV $562, R12 + JMP callbackasm1(SB) + MOVV $563, R12 + JMP callbackasm1(SB) + MOVV $564, R12 + JMP callbackasm1(SB) + MOVV $565, R12 + JMP callbackasm1(SB) + MOVV $566, R12 + JMP callbackasm1(SB) + MOVV $567, R12 + JMP callbackasm1(SB) + MOVV $568, R12 + JMP callbackasm1(SB) + MOVV $569, R12 + JMP callbackasm1(SB) + MOVV $570, R12 + JMP callbackasm1(SB) + MOVV $571, R12 + JMP callbackasm1(SB) + MOVV $572, R12 + JMP callbackasm1(SB) + MOVV $573, R12 + JMP callbackasm1(SB) + MOVV $574, R12 + JMP callbackasm1(SB) + MOVV $575, R12 + JMP callbackasm1(SB) + MOVV $576, R12 + JMP callbackasm1(SB) + MOVV $577, R12 + JMP callbackasm1(SB) + MOVV $578, R12 + JMP callbackasm1(SB) + MOVV $579, R12 + JMP callbackasm1(SB) + MOVV $580, R12 + JMP callbackasm1(SB) + MOVV $581, R12 + JMP callbackasm1(SB) + MOVV $582, R12 + JMP callbackasm1(SB) + MOVV $583, R12 + JMP callbackasm1(SB) + MOVV $584, R12 + JMP callbackasm1(SB) + MOVV $585, R12 + JMP callbackasm1(SB) + MOVV $586, R12 + JMP callbackasm1(SB) + MOVV $587, R12 + JMP callbackasm1(SB) + MOVV $588, R12 + JMP callbackasm1(SB) + MOVV $589, R12 + JMP callbackasm1(SB) + MOVV $590, R12 + JMP callbackasm1(SB) + MOVV $591, R12 + JMP callbackasm1(SB) + MOVV $592, R12 + JMP callbackasm1(SB) + MOVV $593, R12 + JMP callbackasm1(SB) + MOVV $594, R12 + JMP callbackasm1(SB) + MOVV $595, R12 + JMP callbackasm1(SB) + MOVV $596, R12 + JMP callbackasm1(SB) + MOVV $597, R12 + JMP callbackasm1(SB) + MOVV $598, R12 + JMP callbackasm1(SB) + MOVV $599, R12 + JMP callbackasm1(SB) + MOVV $600, R12 + JMP callbackasm1(SB) + MOVV $601, R12 + JMP callbackasm1(SB) + MOVV $602, R12 + JMP callbackasm1(SB) + MOVV $603, R12 + JMP callbackasm1(SB) + MOVV $604, R12 + JMP callbackasm1(SB) + MOVV $605, R12 + JMP callbackasm1(SB) + MOVV $606, R12 + JMP callbackasm1(SB) + MOVV $607, R12 + JMP callbackasm1(SB) + MOVV $608, R12 + JMP callbackasm1(SB) + MOVV $609, R12 + JMP callbackasm1(SB) + MOVV $610, R12 + JMP callbackasm1(SB) + MOVV $611, R12 + JMP callbackasm1(SB) + MOVV $612, R12 + JMP callbackasm1(SB) + MOVV $613, R12 + JMP callbackasm1(SB) + MOVV $614, R12 + JMP callbackasm1(SB) + MOVV $615, R12 + JMP callbackasm1(SB) + MOVV $616, R12 + JMP callbackasm1(SB) + MOVV $617, R12 + JMP callbackasm1(SB) + MOVV $618, R12 + JMP callbackasm1(SB) + MOVV $619, R12 + JMP callbackasm1(SB) + MOVV $620, R12 + JMP callbackasm1(SB) + MOVV $621, R12 + JMP callbackasm1(SB) + MOVV $622, R12 + JMP callbackasm1(SB) + MOVV $623, R12 + JMP callbackasm1(SB) + MOVV $624, R12 + JMP callbackasm1(SB) + MOVV $625, R12 + JMP callbackasm1(SB) + MOVV $626, R12 + JMP callbackasm1(SB) + MOVV $627, R12 + JMP callbackasm1(SB) + MOVV $628, R12 + JMP callbackasm1(SB) + MOVV $629, R12 + JMP callbackasm1(SB) + MOVV $630, R12 + JMP callbackasm1(SB) + MOVV $631, R12 + JMP callbackasm1(SB) + MOVV $632, R12 + JMP callbackasm1(SB) + MOVV $633, R12 + JMP callbackasm1(SB) + MOVV $634, R12 + JMP callbackasm1(SB) + MOVV $635, R12 + JMP callbackasm1(SB) + MOVV $636, R12 + JMP callbackasm1(SB) + MOVV $637, R12 + JMP callbackasm1(SB) + MOVV $638, R12 + JMP callbackasm1(SB) + MOVV $639, R12 + JMP callbackasm1(SB) + MOVV $640, R12 + JMP callbackasm1(SB) + MOVV $641, R12 + JMP callbackasm1(SB) + MOVV $642, R12 + JMP callbackasm1(SB) + MOVV $643, R12 + JMP callbackasm1(SB) + MOVV $644, R12 + JMP callbackasm1(SB) + MOVV $645, R12 + JMP callbackasm1(SB) + MOVV $646, R12 + JMP callbackasm1(SB) + MOVV $647, R12 + JMP callbackasm1(SB) + MOVV $648, R12 + JMP callbackasm1(SB) + MOVV $649, R12 + JMP callbackasm1(SB) + MOVV $650, R12 + JMP callbackasm1(SB) + MOVV $651, R12 + JMP callbackasm1(SB) + MOVV $652, R12 + JMP callbackasm1(SB) + MOVV $653, R12 + JMP callbackasm1(SB) + MOVV $654, R12 + JMP callbackasm1(SB) + MOVV $655, R12 + JMP callbackasm1(SB) + MOVV $656, R12 + JMP callbackasm1(SB) + MOVV $657, R12 + JMP callbackasm1(SB) + MOVV $658, R12 + JMP callbackasm1(SB) + MOVV $659, R12 + JMP callbackasm1(SB) + MOVV $660, R12 + JMP callbackasm1(SB) + MOVV $661, R12 + JMP callbackasm1(SB) + MOVV $662, R12 + JMP callbackasm1(SB) + MOVV $663, R12 + JMP callbackasm1(SB) + MOVV $664, R12 + JMP callbackasm1(SB) + MOVV $665, R12 + JMP callbackasm1(SB) + MOVV $666, R12 + JMP callbackasm1(SB) + MOVV $667, R12 + JMP callbackasm1(SB) + MOVV $668, R12 + JMP callbackasm1(SB) + MOVV $669, R12 + JMP callbackasm1(SB) + MOVV $670, R12 + JMP callbackasm1(SB) + MOVV $671, R12 + JMP callbackasm1(SB) + MOVV $672, R12 + JMP callbackasm1(SB) + MOVV $673, R12 + JMP callbackasm1(SB) + MOVV $674, R12 + JMP callbackasm1(SB) + MOVV $675, R12 + JMP callbackasm1(SB) + MOVV $676, R12 + JMP callbackasm1(SB) + MOVV $677, R12 + JMP callbackasm1(SB) + MOVV $678, R12 + JMP callbackasm1(SB) + MOVV $679, R12 + JMP callbackasm1(SB) + MOVV $680, R12 + JMP callbackasm1(SB) + MOVV $681, R12 + JMP callbackasm1(SB) + MOVV $682, R12 + JMP callbackasm1(SB) + MOVV $683, R12 + JMP callbackasm1(SB) + MOVV $684, R12 + JMP callbackasm1(SB) + MOVV $685, R12 + JMP callbackasm1(SB) + MOVV $686, R12 + JMP callbackasm1(SB) + MOVV $687, R12 + JMP callbackasm1(SB) + MOVV $688, R12 + JMP callbackasm1(SB) + MOVV $689, R12 + JMP callbackasm1(SB) + MOVV $690, R12 + JMP callbackasm1(SB) + MOVV $691, R12 + JMP callbackasm1(SB) + MOVV $692, R12 + JMP callbackasm1(SB) + MOVV $693, R12 + JMP callbackasm1(SB) + MOVV $694, R12 + JMP callbackasm1(SB) + MOVV $695, R12 + JMP callbackasm1(SB) + MOVV $696, R12 + JMP callbackasm1(SB) + MOVV $697, R12 + JMP callbackasm1(SB) + MOVV $698, R12 + JMP callbackasm1(SB) + MOVV $699, R12 + JMP callbackasm1(SB) + MOVV $700, R12 + JMP callbackasm1(SB) + MOVV $701, R12 + JMP callbackasm1(SB) + MOVV $702, R12 + JMP callbackasm1(SB) + MOVV $703, R12 + JMP callbackasm1(SB) + MOVV $704, R12 + JMP callbackasm1(SB) + MOVV $705, R12 + JMP callbackasm1(SB) + MOVV $706, R12 + JMP callbackasm1(SB) + MOVV $707, R12 + JMP callbackasm1(SB) + MOVV $708, R12 + JMP callbackasm1(SB) + MOVV $709, R12 + JMP callbackasm1(SB) + MOVV $710, R12 + JMP callbackasm1(SB) + MOVV $711, R12 + JMP callbackasm1(SB) + MOVV $712, R12 + JMP callbackasm1(SB) + MOVV $713, R12 + JMP callbackasm1(SB) + MOVV $714, R12 + JMP callbackasm1(SB) + MOVV $715, R12 + JMP callbackasm1(SB) + MOVV $716, R12 + JMP callbackasm1(SB) + MOVV $717, R12 + JMP callbackasm1(SB) + MOVV $718, R12 + JMP callbackasm1(SB) + MOVV $719, R12 + JMP callbackasm1(SB) + MOVV $720, R12 + JMP callbackasm1(SB) + MOVV $721, R12 + JMP callbackasm1(SB) + MOVV $722, R12 + JMP callbackasm1(SB) + MOVV $723, R12 + JMP callbackasm1(SB) + MOVV $724, R12 + JMP callbackasm1(SB) + MOVV $725, R12 + JMP callbackasm1(SB) + MOVV $726, R12 + JMP callbackasm1(SB) + MOVV $727, R12 + JMP callbackasm1(SB) + MOVV $728, R12 + JMP callbackasm1(SB) + MOVV $729, R12 + JMP callbackasm1(SB) + MOVV $730, R12 + JMP callbackasm1(SB) + MOVV $731, R12 + JMP callbackasm1(SB) + MOVV $732, R12 + JMP callbackasm1(SB) + MOVV $733, R12 + JMP callbackasm1(SB) + MOVV $734, R12 + JMP callbackasm1(SB) + MOVV $735, R12 + JMP callbackasm1(SB) + MOVV $736, R12 + JMP callbackasm1(SB) + MOVV $737, R12 + JMP callbackasm1(SB) + MOVV $738, R12 + JMP callbackasm1(SB) + MOVV $739, R12 + JMP callbackasm1(SB) + MOVV $740, R12 + JMP callbackasm1(SB) + MOVV $741, R12 + JMP callbackasm1(SB) + MOVV $742, R12 + JMP callbackasm1(SB) + MOVV $743, R12 + JMP callbackasm1(SB) + MOVV $744, R12 + JMP callbackasm1(SB) + MOVV $745, R12 + JMP callbackasm1(SB) + MOVV $746, R12 + JMP callbackasm1(SB) + MOVV $747, R12 + JMP callbackasm1(SB) + MOVV $748, R12 + JMP callbackasm1(SB) + MOVV $749, R12 + JMP callbackasm1(SB) + MOVV $750, R12 + JMP callbackasm1(SB) + MOVV $751, R12 + JMP callbackasm1(SB) + MOVV $752, R12 + JMP callbackasm1(SB) + MOVV $753, R12 + JMP callbackasm1(SB) + MOVV $754, R12 + JMP callbackasm1(SB) + MOVV $755, R12 + JMP callbackasm1(SB) + MOVV $756, R12 + JMP callbackasm1(SB) + MOVV $757, R12 + JMP callbackasm1(SB) + MOVV $758, R12 + JMP callbackasm1(SB) + MOVV $759, R12 + JMP callbackasm1(SB) + MOVV $760, R12 + JMP callbackasm1(SB) + MOVV $761, R12 + JMP callbackasm1(SB) + MOVV $762, R12 + JMP callbackasm1(SB) + MOVV $763, R12 + JMP callbackasm1(SB) + MOVV $764, R12 + JMP callbackasm1(SB) + MOVV $765, R12 + JMP callbackasm1(SB) + MOVV $766, R12 + JMP callbackasm1(SB) + MOVV $767, R12 + JMP callbackasm1(SB) + MOVV $768, R12 + JMP callbackasm1(SB) + MOVV $769, R12 + JMP callbackasm1(SB) + MOVV $770, R12 + JMP callbackasm1(SB) + MOVV $771, R12 + JMP callbackasm1(SB) + MOVV $772, R12 + JMP callbackasm1(SB) + MOVV $773, R12 + JMP callbackasm1(SB) + MOVV $774, R12 + JMP callbackasm1(SB) + MOVV $775, R12 + JMP callbackasm1(SB) + MOVV $776, R12 + JMP callbackasm1(SB) + MOVV $777, R12 + JMP callbackasm1(SB) + MOVV $778, R12 + JMP callbackasm1(SB) + MOVV $779, R12 + JMP callbackasm1(SB) + MOVV $780, R12 + JMP callbackasm1(SB) + MOVV $781, R12 + JMP callbackasm1(SB) + MOVV $782, R12 + JMP callbackasm1(SB) + MOVV $783, R12 + JMP callbackasm1(SB) + MOVV $784, R12 + JMP callbackasm1(SB) + MOVV $785, R12 + JMP callbackasm1(SB) + MOVV $786, R12 + JMP callbackasm1(SB) + MOVV $787, R12 + JMP callbackasm1(SB) + MOVV $788, R12 + JMP callbackasm1(SB) + MOVV $789, R12 + JMP callbackasm1(SB) + MOVV $790, R12 + JMP callbackasm1(SB) + MOVV $791, R12 + JMP callbackasm1(SB) + MOVV $792, R12 + JMP callbackasm1(SB) + MOVV $793, R12 + JMP callbackasm1(SB) + MOVV $794, R12 + JMP callbackasm1(SB) + MOVV $795, R12 + JMP callbackasm1(SB) + MOVV $796, R12 + JMP callbackasm1(SB) + MOVV $797, R12 + JMP callbackasm1(SB) + MOVV $798, R12 + JMP callbackasm1(SB) + MOVV $799, R12 + JMP callbackasm1(SB) + MOVV $800, R12 + JMP callbackasm1(SB) + MOVV $801, R12 + JMP callbackasm1(SB) + MOVV $802, R12 + JMP callbackasm1(SB) + MOVV $803, R12 + JMP callbackasm1(SB) + MOVV $804, R12 + JMP callbackasm1(SB) + MOVV $805, R12 + JMP callbackasm1(SB) + MOVV $806, R12 + JMP callbackasm1(SB) + MOVV $807, R12 + JMP callbackasm1(SB) + MOVV $808, R12 + JMP callbackasm1(SB) + MOVV $809, R12 + JMP callbackasm1(SB) + MOVV $810, R12 + JMP callbackasm1(SB) + MOVV $811, R12 + JMP callbackasm1(SB) + MOVV $812, R12 + JMP callbackasm1(SB) + MOVV $813, R12 + JMP callbackasm1(SB) + MOVV $814, R12 + JMP callbackasm1(SB) + MOVV $815, R12 + JMP callbackasm1(SB) + MOVV $816, R12 + JMP callbackasm1(SB) + MOVV $817, R12 + JMP callbackasm1(SB) + MOVV $818, R12 + JMP callbackasm1(SB) + MOVV $819, R12 + JMP callbackasm1(SB) + MOVV $820, R12 + JMP callbackasm1(SB) + MOVV $821, R12 + JMP callbackasm1(SB) + MOVV $822, R12 + JMP callbackasm1(SB) + MOVV $823, R12 + JMP callbackasm1(SB) + MOVV $824, R12 + JMP callbackasm1(SB) + MOVV $825, R12 + JMP callbackasm1(SB) + MOVV $826, R12 + JMP callbackasm1(SB) + MOVV $827, R12 + JMP callbackasm1(SB) + MOVV $828, R12 + JMP callbackasm1(SB) + MOVV $829, R12 + JMP callbackasm1(SB) + MOVV $830, R12 + JMP callbackasm1(SB) + MOVV $831, R12 + JMP callbackasm1(SB) + MOVV $832, R12 + JMP callbackasm1(SB) + MOVV $833, R12 + JMP callbackasm1(SB) + MOVV $834, R12 + JMP callbackasm1(SB) + MOVV $835, R12 + JMP callbackasm1(SB) + MOVV $836, R12 + JMP callbackasm1(SB) + MOVV $837, R12 + JMP callbackasm1(SB) + MOVV $838, R12 + JMP callbackasm1(SB) + MOVV $839, R12 + JMP callbackasm1(SB) + MOVV $840, R12 + JMP callbackasm1(SB) + MOVV $841, R12 + JMP callbackasm1(SB) + MOVV $842, R12 + JMP callbackasm1(SB) + MOVV $843, R12 + JMP callbackasm1(SB) + MOVV $844, R12 + JMP callbackasm1(SB) + MOVV $845, R12 + JMP callbackasm1(SB) + MOVV $846, R12 + JMP callbackasm1(SB) + MOVV $847, R12 + JMP callbackasm1(SB) + MOVV $848, R12 + JMP callbackasm1(SB) + MOVV $849, R12 + JMP callbackasm1(SB) + MOVV $850, R12 + JMP callbackasm1(SB) + MOVV $851, R12 + JMP callbackasm1(SB) + MOVV $852, R12 + JMP callbackasm1(SB) + MOVV $853, R12 + JMP callbackasm1(SB) + MOVV $854, R12 + JMP callbackasm1(SB) + MOVV $855, R12 + JMP callbackasm1(SB) + MOVV $856, R12 + JMP callbackasm1(SB) + MOVV $857, R12 + JMP callbackasm1(SB) + MOVV $858, R12 + JMP callbackasm1(SB) + MOVV $859, R12 + JMP callbackasm1(SB) + MOVV $860, R12 + JMP callbackasm1(SB) + MOVV $861, R12 + JMP callbackasm1(SB) + MOVV $862, R12 + JMP callbackasm1(SB) + MOVV $863, R12 + JMP callbackasm1(SB) + MOVV $864, R12 + JMP callbackasm1(SB) + MOVV $865, R12 + JMP callbackasm1(SB) + MOVV $866, R12 + JMP callbackasm1(SB) + MOVV $867, R12 + JMP callbackasm1(SB) + MOVV $868, R12 + JMP callbackasm1(SB) + MOVV $869, R12 + JMP callbackasm1(SB) + MOVV $870, R12 + JMP callbackasm1(SB) + MOVV $871, R12 + JMP callbackasm1(SB) + MOVV $872, R12 + JMP callbackasm1(SB) + MOVV $873, R12 + JMP callbackasm1(SB) + MOVV $874, R12 + JMP callbackasm1(SB) + MOVV $875, R12 + JMP callbackasm1(SB) + MOVV $876, R12 + JMP callbackasm1(SB) + MOVV $877, R12 + JMP callbackasm1(SB) + MOVV $878, R12 + JMP callbackasm1(SB) + MOVV $879, R12 + JMP callbackasm1(SB) + MOVV $880, R12 + JMP callbackasm1(SB) + MOVV $881, R12 + JMP callbackasm1(SB) + MOVV $882, R12 + JMP callbackasm1(SB) + MOVV $883, R12 + JMP callbackasm1(SB) + MOVV $884, R12 + JMP callbackasm1(SB) + MOVV $885, R12 + JMP callbackasm1(SB) + MOVV $886, R12 + JMP callbackasm1(SB) + MOVV $887, R12 + JMP callbackasm1(SB) + MOVV $888, R12 + JMP callbackasm1(SB) + MOVV $889, R12 + JMP callbackasm1(SB) + MOVV $890, R12 + JMP callbackasm1(SB) + MOVV $891, R12 + JMP callbackasm1(SB) + MOVV $892, R12 + JMP callbackasm1(SB) + MOVV $893, R12 + JMP callbackasm1(SB) + MOVV $894, R12 + JMP callbackasm1(SB) + MOVV $895, R12 + JMP callbackasm1(SB) + MOVV $896, R12 + JMP callbackasm1(SB) + MOVV $897, R12 + JMP callbackasm1(SB) + MOVV $898, R12 + JMP callbackasm1(SB) + MOVV $899, R12 + JMP callbackasm1(SB) + MOVV $900, R12 + JMP callbackasm1(SB) + MOVV $901, R12 + JMP callbackasm1(SB) + MOVV $902, R12 + JMP callbackasm1(SB) + MOVV $903, R12 + JMP callbackasm1(SB) + MOVV $904, R12 + JMP callbackasm1(SB) + MOVV $905, R12 + JMP callbackasm1(SB) + MOVV $906, R12 + JMP callbackasm1(SB) + MOVV $907, R12 + JMP callbackasm1(SB) + MOVV $908, R12 + JMP callbackasm1(SB) + MOVV $909, R12 + JMP callbackasm1(SB) + MOVV $910, R12 + JMP callbackasm1(SB) + MOVV $911, R12 + JMP callbackasm1(SB) + MOVV $912, R12 + JMP callbackasm1(SB) + MOVV $913, R12 + JMP callbackasm1(SB) + MOVV $914, R12 + JMP callbackasm1(SB) + MOVV $915, R12 + JMP callbackasm1(SB) + MOVV $916, R12 + JMP callbackasm1(SB) + MOVV $917, R12 + JMP callbackasm1(SB) + MOVV $918, R12 + JMP callbackasm1(SB) + MOVV $919, R12 + JMP callbackasm1(SB) + MOVV $920, R12 + JMP callbackasm1(SB) + MOVV $921, R12 + JMP callbackasm1(SB) + MOVV $922, R12 + JMP callbackasm1(SB) + MOVV $923, R12 + JMP callbackasm1(SB) + MOVV $924, R12 + JMP callbackasm1(SB) + MOVV $925, R12 + JMP callbackasm1(SB) + MOVV $926, R12 + JMP callbackasm1(SB) + MOVV $927, R12 + JMP callbackasm1(SB) + MOVV $928, R12 + JMP callbackasm1(SB) + MOVV $929, R12 + JMP callbackasm1(SB) + MOVV $930, R12 + JMP callbackasm1(SB) + MOVV $931, R12 + JMP callbackasm1(SB) + MOVV $932, R12 + JMP callbackasm1(SB) + MOVV $933, R12 + JMP callbackasm1(SB) + MOVV $934, R12 + JMP callbackasm1(SB) + MOVV $935, R12 + JMP callbackasm1(SB) + MOVV $936, R12 + JMP callbackasm1(SB) + MOVV $937, R12 + JMP callbackasm1(SB) + MOVV $938, R12 + JMP callbackasm1(SB) + MOVV $939, R12 + JMP callbackasm1(SB) + MOVV $940, R12 + JMP callbackasm1(SB) + MOVV $941, R12 + JMP callbackasm1(SB) + MOVV $942, R12 + JMP callbackasm1(SB) + MOVV $943, R12 + JMP callbackasm1(SB) + MOVV $944, R12 + JMP callbackasm1(SB) + MOVV $945, R12 + JMP callbackasm1(SB) + MOVV $946, R12 + JMP callbackasm1(SB) + MOVV $947, R12 + JMP callbackasm1(SB) + MOVV $948, R12 + JMP callbackasm1(SB) + MOVV $949, R12 + JMP callbackasm1(SB) + MOVV $950, R12 + JMP callbackasm1(SB) + MOVV $951, R12 + JMP callbackasm1(SB) + MOVV $952, R12 + JMP callbackasm1(SB) + MOVV $953, R12 + JMP callbackasm1(SB) + MOVV $954, R12 + JMP callbackasm1(SB) + MOVV $955, R12 + JMP callbackasm1(SB) + MOVV $956, R12 + JMP callbackasm1(SB) + MOVV $957, R12 + JMP callbackasm1(SB) + MOVV $958, R12 + JMP callbackasm1(SB) + MOVV $959, R12 + JMP callbackasm1(SB) + MOVV $960, R12 + JMP callbackasm1(SB) + MOVV $961, R12 + JMP callbackasm1(SB) + MOVV $962, R12 + JMP callbackasm1(SB) + MOVV $963, R12 + JMP callbackasm1(SB) + MOVV $964, R12 + JMP callbackasm1(SB) + MOVV $965, R12 + JMP callbackasm1(SB) + MOVV $966, R12 + JMP callbackasm1(SB) + MOVV $967, R12 + JMP callbackasm1(SB) + MOVV $968, R12 + JMP callbackasm1(SB) + MOVV $969, R12 + JMP callbackasm1(SB) + MOVV $970, R12 + JMP callbackasm1(SB) + MOVV $971, R12 + JMP callbackasm1(SB) + MOVV $972, R12 + JMP callbackasm1(SB) + MOVV $973, R12 + JMP callbackasm1(SB) + MOVV $974, R12 + JMP callbackasm1(SB) + MOVV $975, R12 + JMP callbackasm1(SB) + MOVV $976, R12 + JMP callbackasm1(SB) + MOVV $977, R12 + JMP callbackasm1(SB) + MOVV $978, R12 + JMP callbackasm1(SB) + MOVV $979, R12 + JMP callbackasm1(SB) + MOVV $980, R12 + JMP callbackasm1(SB) + MOVV $981, R12 + JMP callbackasm1(SB) + MOVV $982, R12 + JMP callbackasm1(SB) + MOVV $983, R12 + JMP callbackasm1(SB) + MOVV $984, R12 + JMP callbackasm1(SB) + MOVV $985, R12 + JMP callbackasm1(SB) + MOVV $986, R12 + JMP callbackasm1(SB) + MOVV $987, R12 + JMP callbackasm1(SB) + MOVV $988, R12 + JMP callbackasm1(SB) + MOVV $989, R12 + JMP callbackasm1(SB) + MOVV $990, R12 + JMP callbackasm1(SB) + MOVV $991, R12 + JMP callbackasm1(SB) + MOVV $992, R12 + JMP callbackasm1(SB) + MOVV $993, R12 + JMP callbackasm1(SB) + MOVV $994, R12 + JMP callbackasm1(SB) + MOVV $995, R12 + JMP callbackasm1(SB) + MOVV $996, R12 + JMP callbackasm1(SB) + MOVV $997, R12 + JMP callbackasm1(SB) + MOVV $998, R12 + JMP callbackasm1(SB) + MOVV $999, R12 + JMP callbackasm1(SB) + MOVV $1000, R12 + JMP callbackasm1(SB) + MOVV $1001, R12 + JMP callbackasm1(SB) + MOVV $1002, R12 + JMP callbackasm1(SB) + MOVV $1003, R12 + JMP callbackasm1(SB) + MOVV $1004, R12 + JMP callbackasm1(SB) + MOVV $1005, R12 + JMP callbackasm1(SB) + MOVV $1006, R12 + JMP callbackasm1(SB) + MOVV $1007, R12 + JMP callbackasm1(SB) + MOVV $1008, R12 + JMP callbackasm1(SB) + MOVV $1009, R12 + JMP callbackasm1(SB) + MOVV $1010, R12 + JMP callbackasm1(SB) + MOVV $1011, R12 + JMP callbackasm1(SB) + MOVV $1012, R12 + JMP callbackasm1(SB) + MOVV $1013, R12 + JMP callbackasm1(SB) + MOVV $1014, R12 + JMP callbackasm1(SB) + MOVV $1015, R12 + JMP callbackasm1(SB) + MOVV $1016, R12 + JMP callbackasm1(SB) + MOVV $1017, R12 + JMP callbackasm1(SB) + MOVV $1018, R12 + JMP callbackasm1(SB) + MOVV $1019, R12 + JMP callbackasm1(SB) + MOVV $1020, R12 + JMP callbackasm1(SB) + MOVV $1021, R12 + JMP callbackasm1(SB) + MOVV $1022, R12 + JMP callbackasm1(SB) + MOVV $1023, R12 + JMP callbackasm1(SB) + MOVV $1024, R12 + JMP callbackasm1(SB) + MOVV $1025, R12 + JMP callbackasm1(SB) + MOVV $1026, R12 + JMP callbackasm1(SB) + MOVV $1027, R12 + JMP callbackasm1(SB) + MOVV $1028, R12 + JMP callbackasm1(SB) + MOVV $1029, R12 + JMP callbackasm1(SB) + MOVV $1030, R12 + JMP callbackasm1(SB) + MOVV $1031, R12 + JMP callbackasm1(SB) + MOVV $1032, R12 + JMP callbackasm1(SB) + MOVV $1033, R12 + JMP callbackasm1(SB) + MOVV $1034, R12 + JMP callbackasm1(SB) + MOVV $1035, R12 + JMP callbackasm1(SB) + MOVV $1036, R12 + JMP callbackasm1(SB) + MOVV $1037, R12 + JMP callbackasm1(SB) + MOVV $1038, R12 + JMP callbackasm1(SB) + MOVV $1039, R12 + JMP callbackasm1(SB) + MOVV $1040, R12 + JMP callbackasm1(SB) + MOVV $1041, R12 + JMP callbackasm1(SB) + MOVV $1042, R12 + JMP callbackasm1(SB) + MOVV $1043, R12 + JMP callbackasm1(SB) + MOVV $1044, R12 + JMP callbackasm1(SB) + MOVV $1045, R12 + JMP callbackasm1(SB) + MOVV $1046, R12 + JMP callbackasm1(SB) + MOVV $1047, R12 + JMP callbackasm1(SB) + MOVV $1048, R12 + JMP callbackasm1(SB) + MOVV $1049, R12 + JMP callbackasm1(SB) + MOVV $1050, R12 + JMP callbackasm1(SB) + MOVV $1051, R12 + JMP callbackasm1(SB) + MOVV $1052, R12 + JMP callbackasm1(SB) + MOVV $1053, R12 + JMP callbackasm1(SB) + MOVV $1054, R12 + JMP callbackasm1(SB) + MOVV $1055, R12 + JMP callbackasm1(SB) + MOVV $1056, R12 + JMP callbackasm1(SB) + MOVV $1057, R12 + JMP callbackasm1(SB) + MOVV $1058, R12 + JMP callbackasm1(SB) + MOVV $1059, R12 + JMP callbackasm1(SB) + MOVV $1060, R12 + JMP callbackasm1(SB) + MOVV $1061, R12 + JMP callbackasm1(SB) + MOVV $1062, R12 + JMP callbackasm1(SB) + MOVV $1063, R12 + JMP callbackasm1(SB) + MOVV $1064, R12 + JMP callbackasm1(SB) + MOVV $1065, R12 + JMP callbackasm1(SB) + MOVV $1066, R12 + JMP callbackasm1(SB) + MOVV $1067, R12 + JMP callbackasm1(SB) + MOVV $1068, R12 + JMP callbackasm1(SB) + MOVV $1069, R12 + JMP callbackasm1(SB) + MOVV $1070, R12 + JMP callbackasm1(SB) + MOVV $1071, R12 + JMP callbackasm1(SB) + MOVV $1072, R12 + JMP callbackasm1(SB) + MOVV $1073, R12 + JMP callbackasm1(SB) + MOVV $1074, R12 + JMP callbackasm1(SB) + MOVV $1075, R12 + JMP callbackasm1(SB) + MOVV $1076, R12 + JMP callbackasm1(SB) + MOVV $1077, R12 + JMP callbackasm1(SB) + MOVV $1078, R12 + JMP callbackasm1(SB) + MOVV $1079, R12 + JMP callbackasm1(SB) + MOVV $1080, R12 + JMP callbackasm1(SB) + MOVV $1081, R12 + JMP callbackasm1(SB) + MOVV $1082, R12 + JMP callbackasm1(SB) + MOVV $1083, R12 + JMP callbackasm1(SB) + MOVV $1084, R12 + JMP callbackasm1(SB) + MOVV $1085, R12 + JMP callbackasm1(SB) + MOVV $1086, R12 + JMP callbackasm1(SB) + MOVV $1087, R12 + JMP callbackasm1(SB) + MOVV $1088, R12 + JMP callbackasm1(SB) + MOVV $1089, R12 + JMP callbackasm1(SB) + MOVV $1090, R12 + JMP callbackasm1(SB) + MOVV $1091, R12 + JMP callbackasm1(SB) + MOVV $1092, R12 + JMP callbackasm1(SB) + MOVV $1093, R12 + JMP callbackasm1(SB) + MOVV $1094, R12 + JMP callbackasm1(SB) + MOVV $1095, R12 + JMP callbackasm1(SB) + MOVV $1096, R12 + JMP callbackasm1(SB) + MOVV $1097, R12 + JMP callbackasm1(SB) + MOVV $1098, R12 + JMP callbackasm1(SB) + MOVV $1099, R12 + JMP callbackasm1(SB) + MOVV $1100, R12 + JMP callbackasm1(SB) + MOVV $1101, R12 + JMP callbackasm1(SB) + MOVV $1102, R12 + JMP callbackasm1(SB) + MOVV $1103, R12 + JMP callbackasm1(SB) + MOVV $1104, R12 + JMP callbackasm1(SB) + MOVV $1105, R12 + JMP callbackasm1(SB) + MOVV $1106, R12 + JMP callbackasm1(SB) + MOVV $1107, R12 + JMP callbackasm1(SB) + MOVV $1108, R12 + JMP callbackasm1(SB) + MOVV $1109, R12 + JMP callbackasm1(SB) + MOVV $1110, R12 + JMP callbackasm1(SB) + MOVV $1111, R12 + JMP callbackasm1(SB) + MOVV $1112, R12 + JMP callbackasm1(SB) + MOVV $1113, R12 + JMP callbackasm1(SB) + MOVV $1114, R12 + JMP callbackasm1(SB) + MOVV $1115, R12 + JMP callbackasm1(SB) + MOVV $1116, R12 + JMP callbackasm1(SB) + MOVV $1117, R12 + JMP callbackasm1(SB) + MOVV $1118, R12 + JMP callbackasm1(SB) + MOVV $1119, R12 + JMP callbackasm1(SB) + MOVV $1120, R12 + JMP callbackasm1(SB) + MOVV $1121, R12 + JMP callbackasm1(SB) + MOVV $1122, R12 + JMP callbackasm1(SB) + MOVV $1123, R12 + JMP callbackasm1(SB) + MOVV $1124, R12 + JMP callbackasm1(SB) + MOVV $1125, R12 + JMP callbackasm1(SB) + MOVV $1126, R12 + JMP callbackasm1(SB) + MOVV $1127, R12 + JMP callbackasm1(SB) + MOVV $1128, R12 + JMP callbackasm1(SB) + MOVV $1129, R12 + JMP callbackasm1(SB) + MOVV $1130, R12 + JMP callbackasm1(SB) + MOVV $1131, R12 + JMP callbackasm1(SB) + MOVV $1132, R12 + JMP callbackasm1(SB) + MOVV $1133, R12 + JMP callbackasm1(SB) + MOVV $1134, R12 + JMP callbackasm1(SB) + MOVV $1135, R12 + JMP callbackasm1(SB) + MOVV $1136, R12 + JMP callbackasm1(SB) + MOVV $1137, R12 + JMP callbackasm1(SB) + MOVV $1138, R12 + JMP callbackasm1(SB) + MOVV $1139, R12 + JMP callbackasm1(SB) + MOVV $1140, R12 + JMP callbackasm1(SB) + MOVV $1141, R12 + JMP callbackasm1(SB) + MOVV $1142, R12 + JMP callbackasm1(SB) + MOVV $1143, R12 + JMP callbackasm1(SB) + MOVV $1144, R12 + JMP callbackasm1(SB) + MOVV $1145, R12 + JMP callbackasm1(SB) + MOVV $1146, R12 + JMP callbackasm1(SB) + MOVV $1147, R12 + JMP callbackasm1(SB) + MOVV $1148, R12 + JMP callbackasm1(SB) + MOVV $1149, R12 + JMP callbackasm1(SB) + MOVV $1150, R12 + JMP callbackasm1(SB) + MOVV $1151, R12 + JMP callbackasm1(SB) + MOVV $1152, R12 + JMP callbackasm1(SB) + MOVV $1153, R12 + JMP callbackasm1(SB) + MOVV $1154, R12 + JMP callbackasm1(SB) + MOVV $1155, R12 + JMP callbackasm1(SB) + MOVV $1156, R12 + JMP callbackasm1(SB) + MOVV $1157, R12 + JMP callbackasm1(SB) + MOVV $1158, R12 + JMP callbackasm1(SB) + MOVV $1159, R12 + JMP callbackasm1(SB) + MOVV $1160, R12 + JMP callbackasm1(SB) + MOVV $1161, R12 + JMP callbackasm1(SB) + MOVV $1162, R12 + JMP callbackasm1(SB) + MOVV $1163, R12 + JMP callbackasm1(SB) + MOVV $1164, R12 + JMP callbackasm1(SB) + MOVV $1165, R12 + JMP callbackasm1(SB) + MOVV $1166, R12 + JMP callbackasm1(SB) + MOVV $1167, R12 + JMP callbackasm1(SB) + MOVV $1168, R12 + JMP callbackasm1(SB) + MOVV $1169, R12 + JMP callbackasm1(SB) + MOVV $1170, R12 + JMP callbackasm1(SB) + MOVV $1171, R12 + JMP callbackasm1(SB) + MOVV $1172, R12 + JMP callbackasm1(SB) + MOVV $1173, R12 + JMP callbackasm1(SB) + MOVV $1174, R12 + JMP callbackasm1(SB) + MOVV $1175, R12 + JMP callbackasm1(SB) + MOVV $1176, R12 + JMP callbackasm1(SB) + MOVV $1177, R12 + JMP callbackasm1(SB) + MOVV $1178, R12 + JMP callbackasm1(SB) + MOVV $1179, R12 + JMP callbackasm1(SB) + MOVV $1180, R12 + JMP callbackasm1(SB) + MOVV $1181, R12 + JMP callbackasm1(SB) + MOVV $1182, R12 + JMP callbackasm1(SB) + MOVV $1183, R12 + JMP callbackasm1(SB) + MOVV $1184, R12 + JMP callbackasm1(SB) + MOVV $1185, R12 + JMP callbackasm1(SB) + MOVV $1186, R12 + JMP callbackasm1(SB) + MOVV $1187, R12 + JMP callbackasm1(SB) + MOVV $1188, R12 + JMP callbackasm1(SB) + MOVV $1189, R12 + JMP callbackasm1(SB) + MOVV $1190, R12 + JMP callbackasm1(SB) + MOVV $1191, R12 + JMP callbackasm1(SB) + MOVV $1192, R12 + JMP callbackasm1(SB) + MOVV $1193, R12 + JMP callbackasm1(SB) + MOVV $1194, R12 + JMP callbackasm1(SB) + MOVV $1195, R12 + JMP callbackasm1(SB) + MOVV $1196, R12 + JMP callbackasm1(SB) + MOVV $1197, R12 + JMP callbackasm1(SB) + MOVV $1198, R12 + JMP callbackasm1(SB) + MOVV $1199, R12 + JMP callbackasm1(SB) + MOVV $1200, R12 + JMP callbackasm1(SB) + MOVV $1201, R12 + JMP callbackasm1(SB) + MOVV $1202, R12 + JMP callbackasm1(SB) + MOVV $1203, R12 + JMP callbackasm1(SB) + MOVV $1204, R12 + JMP callbackasm1(SB) + MOVV $1205, R12 + JMP callbackasm1(SB) + MOVV $1206, R12 + JMP callbackasm1(SB) + MOVV $1207, R12 + JMP callbackasm1(SB) + MOVV $1208, R12 + JMP callbackasm1(SB) + MOVV $1209, R12 + JMP callbackasm1(SB) + MOVV $1210, R12 + JMP callbackasm1(SB) + MOVV $1211, R12 + JMP callbackasm1(SB) + MOVV $1212, R12 + JMP callbackasm1(SB) + MOVV $1213, R12 + JMP callbackasm1(SB) + MOVV $1214, R12 + JMP callbackasm1(SB) + MOVV $1215, R12 + JMP callbackasm1(SB) + MOVV $1216, R12 + JMP callbackasm1(SB) + MOVV $1217, R12 + JMP callbackasm1(SB) + MOVV $1218, R12 + JMP callbackasm1(SB) + MOVV $1219, R12 + JMP callbackasm1(SB) + MOVV $1220, R12 + JMP callbackasm1(SB) + MOVV $1221, R12 + JMP callbackasm1(SB) + MOVV $1222, R12 + JMP callbackasm1(SB) + MOVV $1223, R12 + JMP callbackasm1(SB) + MOVV $1224, R12 + JMP callbackasm1(SB) + MOVV $1225, R12 + JMP callbackasm1(SB) + MOVV $1226, R12 + JMP callbackasm1(SB) + MOVV $1227, R12 + JMP callbackasm1(SB) + MOVV $1228, R12 + JMP callbackasm1(SB) + MOVV $1229, R12 + JMP callbackasm1(SB) + MOVV $1230, R12 + JMP callbackasm1(SB) + MOVV $1231, R12 + JMP callbackasm1(SB) + MOVV $1232, R12 + JMP callbackasm1(SB) + MOVV $1233, R12 + JMP callbackasm1(SB) + MOVV $1234, R12 + JMP callbackasm1(SB) + MOVV $1235, R12 + JMP callbackasm1(SB) + MOVV $1236, R12 + JMP callbackasm1(SB) + MOVV $1237, R12 + JMP callbackasm1(SB) + MOVV $1238, R12 + JMP callbackasm1(SB) + MOVV $1239, R12 + JMP callbackasm1(SB) + MOVV $1240, R12 + JMP callbackasm1(SB) + MOVV $1241, R12 + JMP callbackasm1(SB) + MOVV $1242, R12 + JMP callbackasm1(SB) + MOVV $1243, R12 + JMP callbackasm1(SB) + MOVV $1244, R12 + JMP callbackasm1(SB) + MOVV $1245, R12 + JMP callbackasm1(SB) + MOVV $1246, R12 + JMP callbackasm1(SB) + MOVV $1247, R12 + JMP callbackasm1(SB) + MOVV $1248, R12 + JMP callbackasm1(SB) + MOVV $1249, R12 + JMP callbackasm1(SB) + MOVV $1250, R12 + JMP callbackasm1(SB) + MOVV $1251, R12 + JMP callbackasm1(SB) + MOVV $1252, R12 + JMP callbackasm1(SB) + MOVV $1253, R12 + JMP callbackasm1(SB) + MOVV $1254, R12 + JMP callbackasm1(SB) + MOVV $1255, R12 + JMP callbackasm1(SB) + MOVV $1256, R12 + JMP callbackasm1(SB) + MOVV $1257, R12 + JMP callbackasm1(SB) + MOVV $1258, R12 + JMP callbackasm1(SB) + MOVV $1259, R12 + JMP callbackasm1(SB) + MOVV $1260, R12 + JMP callbackasm1(SB) + MOVV $1261, R12 + JMP callbackasm1(SB) + MOVV $1262, R12 + JMP callbackasm1(SB) + MOVV $1263, R12 + JMP callbackasm1(SB) + MOVV $1264, R12 + JMP callbackasm1(SB) + MOVV $1265, R12 + JMP callbackasm1(SB) + MOVV $1266, R12 + JMP callbackasm1(SB) + MOVV $1267, R12 + JMP callbackasm1(SB) + MOVV $1268, R12 + JMP callbackasm1(SB) + MOVV $1269, R12 + JMP callbackasm1(SB) + MOVV $1270, R12 + JMP callbackasm1(SB) + MOVV $1271, R12 + JMP callbackasm1(SB) + MOVV $1272, R12 + JMP callbackasm1(SB) + MOVV $1273, R12 + JMP callbackasm1(SB) + MOVV $1274, R12 + JMP callbackasm1(SB) + MOVV $1275, R12 + JMP callbackasm1(SB) + MOVV $1276, R12 + JMP callbackasm1(SB) + MOVV $1277, R12 + JMP callbackasm1(SB) + MOVV $1278, R12 + JMP callbackasm1(SB) + MOVV $1279, R12 + JMP callbackasm1(SB) + MOVV $1280, R12 + JMP callbackasm1(SB) + MOVV $1281, R12 + JMP callbackasm1(SB) + MOVV $1282, R12 + JMP callbackasm1(SB) + MOVV $1283, R12 + JMP callbackasm1(SB) + MOVV $1284, R12 + JMP callbackasm1(SB) + MOVV $1285, R12 + JMP callbackasm1(SB) + MOVV $1286, R12 + JMP callbackasm1(SB) + MOVV $1287, R12 + JMP callbackasm1(SB) + MOVV $1288, R12 + JMP callbackasm1(SB) + MOVV $1289, R12 + JMP callbackasm1(SB) + MOVV $1290, R12 + JMP callbackasm1(SB) + MOVV $1291, R12 + JMP callbackasm1(SB) + MOVV $1292, R12 + JMP callbackasm1(SB) + MOVV $1293, R12 + JMP callbackasm1(SB) + MOVV $1294, R12 + JMP callbackasm1(SB) + MOVV $1295, R12 + JMP callbackasm1(SB) + MOVV $1296, R12 + JMP callbackasm1(SB) + MOVV $1297, R12 + JMP callbackasm1(SB) + MOVV $1298, R12 + JMP callbackasm1(SB) + MOVV $1299, R12 + JMP callbackasm1(SB) + MOVV $1300, R12 + JMP callbackasm1(SB) + MOVV $1301, R12 + JMP callbackasm1(SB) + MOVV $1302, R12 + JMP callbackasm1(SB) + MOVV $1303, R12 + JMP callbackasm1(SB) + MOVV $1304, R12 + JMP callbackasm1(SB) + MOVV $1305, R12 + JMP callbackasm1(SB) + MOVV $1306, R12 + JMP callbackasm1(SB) + MOVV $1307, R12 + JMP callbackasm1(SB) + MOVV $1308, R12 + JMP callbackasm1(SB) + MOVV $1309, R12 + JMP callbackasm1(SB) + MOVV $1310, R12 + JMP callbackasm1(SB) + MOVV $1311, R12 + JMP callbackasm1(SB) + MOVV $1312, R12 + JMP callbackasm1(SB) + MOVV $1313, R12 + JMP callbackasm1(SB) + MOVV $1314, R12 + JMP callbackasm1(SB) + MOVV $1315, R12 + JMP callbackasm1(SB) + MOVV $1316, R12 + JMP callbackasm1(SB) + MOVV $1317, R12 + JMP callbackasm1(SB) + MOVV $1318, R12 + JMP callbackasm1(SB) + MOVV $1319, R12 + JMP callbackasm1(SB) + MOVV $1320, R12 + JMP callbackasm1(SB) + MOVV $1321, R12 + JMP callbackasm1(SB) + MOVV $1322, R12 + JMP callbackasm1(SB) + MOVV $1323, R12 + JMP callbackasm1(SB) + MOVV $1324, R12 + JMP callbackasm1(SB) + MOVV $1325, R12 + JMP callbackasm1(SB) + MOVV $1326, R12 + JMP callbackasm1(SB) + MOVV $1327, R12 + JMP callbackasm1(SB) + MOVV $1328, R12 + JMP callbackasm1(SB) + MOVV $1329, R12 + JMP callbackasm1(SB) + MOVV $1330, R12 + JMP callbackasm1(SB) + MOVV $1331, R12 + JMP callbackasm1(SB) + MOVV $1332, R12 + JMP callbackasm1(SB) + MOVV $1333, R12 + JMP callbackasm1(SB) + MOVV $1334, R12 + JMP callbackasm1(SB) + MOVV $1335, R12 + JMP callbackasm1(SB) + MOVV $1336, R12 + JMP callbackasm1(SB) + MOVV $1337, R12 + JMP callbackasm1(SB) + MOVV $1338, R12 + JMP callbackasm1(SB) + MOVV $1339, R12 + JMP callbackasm1(SB) + MOVV $1340, R12 + JMP callbackasm1(SB) + MOVV $1341, R12 + JMP callbackasm1(SB) + MOVV $1342, R12 + JMP callbackasm1(SB) + MOVV $1343, R12 + JMP callbackasm1(SB) + MOVV $1344, R12 + JMP callbackasm1(SB) + MOVV $1345, R12 + JMP callbackasm1(SB) + MOVV $1346, R12 + JMP callbackasm1(SB) + MOVV $1347, R12 + JMP callbackasm1(SB) + MOVV $1348, R12 + JMP callbackasm1(SB) + MOVV $1349, R12 + JMP callbackasm1(SB) + MOVV $1350, R12 + JMP callbackasm1(SB) + MOVV $1351, R12 + JMP callbackasm1(SB) + MOVV $1352, R12 + JMP callbackasm1(SB) + MOVV $1353, R12 + JMP callbackasm1(SB) + MOVV $1354, R12 + JMP callbackasm1(SB) + MOVV $1355, R12 + JMP callbackasm1(SB) + MOVV $1356, R12 + JMP callbackasm1(SB) + MOVV $1357, R12 + JMP callbackasm1(SB) + MOVV $1358, R12 + JMP callbackasm1(SB) + MOVV $1359, R12 + JMP callbackasm1(SB) + MOVV $1360, R12 + JMP callbackasm1(SB) + MOVV $1361, R12 + JMP callbackasm1(SB) + MOVV $1362, R12 + JMP callbackasm1(SB) + MOVV $1363, R12 + JMP callbackasm1(SB) + MOVV $1364, R12 + JMP callbackasm1(SB) + MOVV $1365, R12 + JMP callbackasm1(SB) + MOVV $1366, R12 + JMP callbackasm1(SB) + MOVV $1367, R12 + JMP callbackasm1(SB) + MOVV $1368, R12 + JMP callbackasm1(SB) + MOVV $1369, R12 + JMP callbackasm1(SB) + MOVV $1370, R12 + JMP callbackasm1(SB) + MOVV $1371, R12 + JMP callbackasm1(SB) + MOVV $1372, R12 + JMP callbackasm1(SB) + MOVV $1373, R12 + JMP callbackasm1(SB) + MOVV $1374, R12 + JMP callbackasm1(SB) + MOVV $1375, R12 + JMP callbackasm1(SB) + MOVV $1376, R12 + JMP callbackasm1(SB) + MOVV $1377, R12 + JMP callbackasm1(SB) + MOVV $1378, R12 + JMP callbackasm1(SB) + MOVV $1379, R12 + JMP callbackasm1(SB) + MOVV $1380, R12 + JMP callbackasm1(SB) + MOVV $1381, R12 + JMP callbackasm1(SB) + MOVV $1382, R12 + JMP callbackasm1(SB) + MOVV $1383, R12 + JMP callbackasm1(SB) + MOVV $1384, R12 + JMP callbackasm1(SB) + MOVV $1385, R12 + JMP callbackasm1(SB) + MOVV $1386, R12 + JMP callbackasm1(SB) + MOVV $1387, R12 + JMP callbackasm1(SB) + MOVV $1388, R12 + JMP callbackasm1(SB) + MOVV $1389, R12 + JMP callbackasm1(SB) + MOVV $1390, R12 + JMP callbackasm1(SB) + MOVV $1391, R12 + JMP callbackasm1(SB) + MOVV $1392, R12 + JMP callbackasm1(SB) + MOVV $1393, R12 + JMP callbackasm1(SB) + MOVV $1394, R12 + JMP callbackasm1(SB) + MOVV $1395, R12 + JMP callbackasm1(SB) + MOVV $1396, R12 + JMP callbackasm1(SB) + MOVV $1397, R12 + JMP callbackasm1(SB) + MOVV $1398, R12 + JMP callbackasm1(SB) + MOVV $1399, R12 + JMP callbackasm1(SB) + MOVV $1400, R12 + JMP callbackasm1(SB) + MOVV $1401, R12 + JMP callbackasm1(SB) + MOVV $1402, R12 + JMP callbackasm1(SB) + MOVV $1403, R12 + JMP callbackasm1(SB) + MOVV $1404, R12 + JMP callbackasm1(SB) + MOVV $1405, R12 + JMP callbackasm1(SB) + MOVV $1406, R12 + JMP callbackasm1(SB) + MOVV $1407, R12 + JMP callbackasm1(SB) + MOVV $1408, R12 + JMP callbackasm1(SB) + MOVV $1409, R12 + JMP callbackasm1(SB) + MOVV $1410, R12 + JMP callbackasm1(SB) + MOVV $1411, R12 + JMP callbackasm1(SB) + MOVV $1412, R12 + JMP callbackasm1(SB) + MOVV $1413, R12 + JMP callbackasm1(SB) + MOVV $1414, R12 + JMP callbackasm1(SB) + MOVV $1415, R12 + JMP callbackasm1(SB) + MOVV $1416, R12 + JMP callbackasm1(SB) + MOVV $1417, R12 + JMP callbackasm1(SB) + MOVV $1418, R12 + JMP callbackasm1(SB) + MOVV $1419, R12 + JMP callbackasm1(SB) + MOVV $1420, R12 + JMP callbackasm1(SB) + MOVV $1421, R12 + JMP callbackasm1(SB) + MOVV $1422, R12 + JMP callbackasm1(SB) + MOVV $1423, R12 + JMP callbackasm1(SB) + MOVV $1424, R12 + JMP callbackasm1(SB) + MOVV $1425, R12 + JMP callbackasm1(SB) + MOVV $1426, R12 + JMP callbackasm1(SB) + MOVV $1427, R12 + JMP callbackasm1(SB) + MOVV $1428, R12 + JMP callbackasm1(SB) + MOVV $1429, R12 + JMP callbackasm1(SB) + MOVV $1430, R12 + JMP callbackasm1(SB) + MOVV $1431, R12 + JMP callbackasm1(SB) + MOVV $1432, R12 + JMP callbackasm1(SB) + MOVV $1433, R12 + JMP callbackasm1(SB) + MOVV $1434, R12 + JMP callbackasm1(SB) + MOVV $1435, R12 + JMP callbackasm1(SB) + MOVV $1436, R12 + JMP callbackasm1(SB) + MOVV $1437, R12 + JMP callbackasm1(SB) + MOVV $1438, R12 + JMP callbackasm1(SB) + MOVV $1439, R12 + JMP callbackasm1(SB) + MOVV $1440, R12 + JMP callbackasm1(SB) + MOVV $1441, R12 + JMP callbackasm1(SB) + MOVV $1442, R12 + JMP callbackasm1(SB) + MOVV $1443, R12 + JMP callbackasm1(SB) + MOVV $1444, R12 + JMP callbackasm1(SB) + MOVV $1445, R12 + JMP callbackasm1(SB) + MOVV $1446, R12 + JMP callbackasm1(SB) + MOVV $1447, R12 + JMP callbackasm1(SB) + MOVV $1448, R12 + JMP callbackasm1(SB) + MOVV $1449, R12 + JMP callbackasm1(SB) + MOVV $1450, R12 + JMP callbackasm1(SB) + MOVV $1451, R12 + JMP callbackasm1(SB) + MOVV $1452, R12 + JMP callbackasm1(SB) + MOVV $1453, R12 + JMP callbackasm1(SB) + MOVV $1454, R12 + JMP callbackasm1(SB) + MOVV $1455, R12 + JMP callbackasm1(SB) + MOVV $1456, R12 + JMP callbackasm1(SB) + MOVV $1457, R12 + JMP callbackasm1(SB) + MOVV $1458, R12 + JMP callbackasm1(SB) + MOVV $1459, R12 + JMP callbackasm1(SB) + MOVV $1460, R12 + JMP callbackasm1(SB) + MOVV $1461, R12 + JMP callbackasm1(SB) + MOVV $1462, R12 + JMP callbackasm1(SB) + MOVV $1463, R12 + JMP callbackasm1(SB) + MOVV $1464, R12 + JMP callbackasm1(SB) + MOVV $1465, R12 + JMP callbackasm1(SB) + MOVV $1466, R12 + JMP callbackasm1(SB) + MOVV $1467, R12 + JMP callbackasm1(SB) + MOVV $1468, R12 + JMP callbackasm1(SB) + MOVV $1469, R12 + JMP callbackasm1(SB) + MOVV $1470, R12 + JMP callbackasm1(SB) + MOVV $1471, R12 + JMP callbackasm1(SB) + MOVV $1472, R12 + JMP callbackasm1(SB) + MOVV $1473, R12 + JMP callbackasm1(SB) + MOVV $1474, R12 + JMP callbackasm1(SB) + MOVV $1475, R12 + JMP callbackasm1(SB) + MOVV $1476, R12 + JMP callbackasm1(SB) + MOVV $1477, R12 + JMP callbackasm1(SB) + MOVV $1478, R12 + JMP callbackasm1(SB) + MOVV $1479, R12 + JMP callbackasm1(SB) + MOVV $1480, R12 + JMP callbackasm1(SB) + MOVV $1481, R12 + JMP callbackasm1(SB) + MOVV $1482, R12 + JMP callbackasm1(SB) + MOVV $1483, R12 + JMP callbackasm1(SB) + MOVV $1484, R12 + JMP callbackasm1(SB) + MOVV $1485, R12 + JMP callbackasm1(SB) + MOVV $1486, R12 + JMP callbackasm1(SB) + MOVV $1487, R12 + JMP callbackasm1(SB) + MOVV $1488, R12 + JMP callbackasm1(SB) + MOVV $1489, R12 + JMP callbackasm1(SB) + MOVV $1490, R12 + JMP callbackasm1(SB) + MOVV $1491, R12 + JMP callbackasm1(SB) + MOVV $1492, R12 + JMP callbackasm1(SB) + MOVV $1493, R12 + JMP callbackasm1(SB) + MOVV $1494, R12 + JMP callbackasm1(SB) + MOVV $1495, R12 + JMP callbackasm1(SB) + MOVV $1496, R12 + JMP callbackasm1(SB) + MOVV $1497, R12 + JMP callbackasm1(SB) + MOVV $1498, R12 + JMP callbackasm1(SB) + MOVV $1499, R12 + JMP callbackasm1(SB) + MOVV $1500, R12 + JMP callbackasm1(SB) + MOVV $1501, R12 + JMP callbackasm1(SB) + MOVV $1502, R12 + JMP callbackasm1(SB) + MOVV $1503, R12 + JMP callbackasm1(SB) + MOVV $1504, R12 + JMP callbackasm1(SB) + MOVV $1505, R12 + JMP callbackasm1(SB) + MOVV $1506, R12 + JMP callbackasm1(SB) + MOVV $1507, R12 + JMP callbackasm1(SB) + MOVV $1508, R12 + JMP callbackasm1(SB) + MOVV $1509, R12 + JMP callbackasm1(SB) + MOVV $1510, R12 + JMP callbackasm1(SB) + MOVV $1511, R12 + JMP callbackasm1(SB) + MOVV $1512, R12 + JMP callbackasm1(SB) + MOVV $1513, R12 + JMP callbackasm1(SB) + MOVV $1514, R12 + JMP callbackasm1(SB) + MOVV $1515, R12 + JMP callbackasm1(SB) + MOVV $1516, R12 + JMP callbackasm1(SB) + MOVV $1517, R12 + JMP callbackasm1(SB) + MOVV $1518, R12 + JMP callbackasm1(SB) + MOVV $1519, R12 + JMP callbackasm1(SB) + MOVV $1520, R12 + JMP callbackasm1(SB) + MOVV $1521, R12 + JMP callbackasm1(SB) + MOVV $1522, R12 + JMP callbackasm1(SB) + MOVV $1523, R12 + JMP callbackasm1(SB) + MOVV $1524, R12 + JMP callbackasm1(SB) + MOVV $1525, R12 + JMP callbackasm1(SB) + MOVV $1526, R12 + JMP callbackasm1(SB) + MOVV $1527, R12 + JMP callbackasm1(SB) + MOVV $1528, R12 + JMP callbackasm1(SB) + MOVV $1529, R12 + JMP callbackasm1(SB) + MOVV $1530, R12 + JMP callbackasm1(SB) + MOVV $1531, R12 + JMP callbackasm1(SB) + MOVV $1532, R12 + JMP callbackasm1(SB) + MOVV $1533, R12 + JMP callbackasm1(SB) + MOVV $1534, R12 + JMP callbackasm1(SB) + MOVV $1535, R12 + JMP callbackasm1(SB) + MOVV $1536, R12 + JMP callbackasm1(SB) + MOVV $1537, R12 + JMP callbackasm1(SB) + MOVV $1538, R12 + JMP callbackasm1(SB) + MOVV $1539, R12 + JMP callbackasm1(SB) + MOVV $1540, R12 + JMP callbackasm1(SB) + MOVV $1541, R12 + JMP callbackasm1(SB) + MOVV $1542, R12 + JMP callbackasm1(SB) + MOVV $1543, R12 + JMP callbackasm1(SB) + MOVV $1544, R12 + JMP callbackasm1(SB) + MOVV $1545, R12 + JMP callbackasm1(SB) + MOVV $1546, R12 + JMP callbackasm1(SB) + MOVV $1547, R12 + JMP callbackasm1(SB) + MOVV $1548, R12 + JMP callbackasm1(SB) + MOVV $1549, R12 + JMP callbackasm1(SB) + MOVV $1550, R12 + JMP callbackasm1(SB) + MOVV $1551, R12 + JMP callbackasm1(SB) + MOVV $1552, R12 + JMP callbackasm1(SB) + MOVV $1553, R12 + JMP callbackasm1(SB) + MOVV $1554, R12 + JMP callbackasm1(SB) + MOVV $1555, R12 + JMP callbackasm1(SB) + MOVV $1556, R12 + JMP callbackasm1(SB) + MOVV $1557, R12 + JMP callbackasm1(SB) + MOVV $1558, R12 + JMP callbackasm1(SB) + MOVV $1559, R12 + JMP callbackasm1(SB) + MOVV $1560, R12 + JMP callbackasm1(SB) + MOVV $1561, R12 + JMP callbackasm1(SB) + MOVV $1562, R12 + JMP callbackasm1(SB) + MOVV $1563, R12 + JMP callbackasm1(SB) + MOVV $1564, R12 + JMP callbackasm1(SB) + MOVV $1565, R12 + JMP callbackasm1(SB) + MOVV $1566, R12 + JMP callbackasm1(SB) + MOVV $1567, R12 + JMP callbackasm1(SB) + MOVV $1568, R12 + JMP callbackasm1(SB) + MOVV $1569, R12 + JMP callbackasm1(SB) + MOVV $1570, R12 + JMP callbackasm1(SB) + MOVV $1571, R12 + JMP callbackasm1(SB) + MOVV $1572, R12 + JMP callbackasm1(SB) + MOVV $1573, R12 + JMP callbackasm1(SB) + MOVV $1574, R12 + JMP callbackasm1(SB) + MOVV $1575, R12 + JMP callbackasm1(SB) + MOVV $1576, R12 + JMP callbackasm1(SB) + MOVV $1577, R12 + JMP callbackasm1(SB) + MOVV $1578, R12 + JMP callbackasm1(SB) + MOVV $1579, R12 + JMP callbackasm1(SB) + MOVV $1580, R12 + JMP callbackasm1(SB) + MOVV $1581, R12 + JMP callbackasm1(SB) + MOVV $1582, R12 + JMP callbackasm1(SB) + MOVV $1583, R12 + JMP callbackasm1(SB) + MOVV $1584, R12 + JMP callbackasm1(SB) + MOVV $1585, R12 + JMP callbackasm1(SB) + MOVV $1586, R12 + JMP callbackasm1(SB) + MOVV $1587, R12 + JMP callbackasm1(SB) + MOVV $1588, R12 + JMP callbackasm1(SB) + MOVV $1589, R12 + JMP callbackasm1(SB) + MOVV $1590, R12 + JMP callbackasm1(SB) + MOVV $1591, R12 + JMP callbackasm1(SB) + MOVV $1592, R12 + JMP callbackasm1(SB) + MOVV $1593, R12 + JMP callbackasm1(SB) + MOVV $1594, R12 + JMP callbackasm1(SB) + MOVV $1595, R12 + JMP callbackasm1(SB) + MOVV $1596, R12 + JMP callbackasm1(SB) + MOVV $1597, R12 + JMP callbackasm1(SB) + MOVV $1598, R12 + JMP callbackasm1(SB) + MOVV $1599, R12 + JMP callbackasm1(SB) + MOVV $1600, R12 + JMP callbackasm1(SB) + MOVV $1601, R12 + JMP callbackasm1(SB) + MOVV $1602, R12 + JMP callbackasm1(SB) + MOVV $1603, R12 + JMP callbackasm1(SB) + MOVV $1604, R12 + JMP callbackasm1(SB) + MOVV $1605, R12 + JMP callbackasm1(SB) + MOVV $1606, R12 + JMP callbackasm1(SB) + MOVV $1607, R12 + JMP callbackasm1(SB) + MOVV $1608, R12 + JMP callbackasm1(SB) + MOVV $1609, R12 + JMP callbackasm1(SB) + MOVV $1610, R12 + JMP callbackasm1(SB) + MOVV $1611, R12 + JMP callbackasm1(SB) + MOVV $1612, R12 + JMP callbackasm1(SB) + MOVV $1613, R12 + JMP callbackasm1(SB) + MOVV $1614, R12 + JMP callbackasm1(SB) + MOVV $1615, R12 + JMP callbackasm1(SB) + MOVV $1616, R12 + JMP callbackasm1(SB) + MOVV $1617, R12 + JMP callbackasm1(SB) + MOVV $1618, R12 + JMP callbackasm1(SB) + MOVV $1619, R12 + JMP callbackasm1(SB) + MOVV $1620, R12 + JMP callbackasm1(SB) + MOVV $1621, R12 + JMP callbackasm1(SB) + MOVV $1622, R12 + JMP callbackasm1(SB) + MOVV $1623, R12 + JMP callbackasm1(SB) + MOVV $1624, R12 + JMP callbackasm1(SB) + MOVV $1625, R12 + JMP callbackasm1(SB) + MOVV $1626, R12 + JMP callbackasm1(SB) + MOVV $1627, R12 + JMP callbackasm1(SB) + MOVV $1628, R12 + JMP callbackasm1(SB) + MOVV $1629, R12 + JMP callbackasm1(SB) + MOVV $1630, R12 + JMP callbackasm1(SB) + MOVV $1631, R12 + JMP callbackasm1(SB) + MOVV $1632, R12 + JMP callbackasm1(SB) + MOVV $1633, R12 + JMP callbackasm1(SB) + MOVV $1634, R12 + JMP callbackasm1(SB) + MOVV $1635, R12 + JMP callbackasm1(SB) + MOVV $1636, R12 + JMP callbackasm1(SB) + MOVV $1637, R12 + JMP callbackasm1(SB) + MOVV $1638, R12 + JMP callbackasm1(SB) + MOVV $1639, R12 + JMP callbackasm1(SB) + MOVV $1640, R12 + JMP callbackasm1(SB) + MOVV $1641, R12 + JMP callbackasm1(SB) + MOVV $1642, R12 + JMP callbackasm1(SB) + MOVV $1643, R12 + JMP callbackasm1(SB) + MOVV $1644, R12 + JMP callbackasm1(SB) + MOVV $1645, R12 + JMP callbackasm1(SB) + MOVV $1646, R12 + JMP callbackasm1(SB) + MOVV $1647, R12 + JMP callbackasm1(SB) + MOVV $1648, R12 + JMP callbackasm1(SB) + MOVV $1649, R12 + JMP callbackasm1(SB) + MOVV $1650, R12 + JMP callbackasm1(SB) + MOVV $1651, R12 + JMP callbackasm1(SB) + MOVV $1652, R12 + JMP callbackasm1(SB) + MOVV $1653, R12 + JMP callbackasm1(SB) + MOVV $1654, R12 + JMP callbackasm1(SB) + MOVV $1655, R12 + JMP callbackasm1(SB) + MOVV $1656, R12 + JMP callbackasm1(SB) + MOVV $1657, R12 + JMP callbackasm1(SB) + MOVV $1658, R12 + JMP callbackasm1(SB) + MOVV $1659, R12 + JMP callbackasm1(SB) + MOVV $1660, R12 + JMP callbackasm1(SB) + MOVV $1661, R12 + JMP callbackasm1(SB) + MOVV $1662, R12 + JMP callbackasm1(SB) + MOVV $1663, R12 + JMP callbackasm1(SB) + MOVV $1664, R12 + JMP callbackasm1(SB) + MOVV $1665, R12 + JMP callbackasm1(SB) + MOVV $1666, R12 + JMP callbackasm1(SB) + MOVV $1667, R12 + JMP callbackasm1(SB) + MOVV $1668, R12 + JMP callbackasm1(SB) + MOVV $1669, R12 + JMP callbackasm1(SB) + MOVV $1670, R12 + JMP callbackasm1(SB) + MOVV $1671, R12 + JMP callbackasm1(SB) + MOVV $1672, R12 + JMP callbackasm1(SB) + MOVV $1673, R12 + JMP callbackasm1(SB) + MOVV $1674, R12 + JMP callbackasm1(SB) + MOVV $1675, R12 + JMP callbackasm1(SB) + MOVV $1676, R12 + JMP callbackasm1(SB) + MOVV $1677, R12 + JMP callbackasm1(SB) + MOVV $1678, R12 + JMP callbackasm1(SB) + MOVV $1679, R12 + JMP callbackasm1(SB) + MOVV $1680, R12 + JMP callbackasm1(SB) + MOVV $1681, R12 + JMP callbackasm1(SB) + MOVV $1682, R12 + JMP callbackasm1(SB) + MOVV $1683, R12 + JMP callbackasm1(SB) + MOVV $1684, R12 + JMP callbackasm1(SB) + MOVV $1685, R12 + JMP callbackasm1(SB) + MOVV $1686, R12 + JMP callbackasm1(SB) + MOVV $1687, R12 + JMP callbackasm1(SB) + MOVV $1688, R12 + JMP callbackasm1(SB) + MOVV $1689, R12 + JMP callbackasm1(SB) + MOVV $1690, R12 + JMP callbackasm1(SB) + MOVV $1691, R12 + JMP callbackasm1(SB) + MOVV $1692, R12 + JMP callbackasm1(SB) + MOVV $1693, R12 + JMP callbackasm1(SB) + MOVV $1694, R12 + JMP callbackasm1(SB) + MOVV $1695, R12 + JMP callbackasm1(SB) + MOVV $1696, R12 + JMP callbackasm1(SB) + MOVV $1697, R12 + JMP callbackasm1(SB) + MOVV $1698, R12 + JMP callbackasm1(SB) + MOVV $1699, R12 + JMP callbackasm1(SB) + MOVV $1700, R12 + JMP callbackasm1(SB) + MOVV $1701, R12 + JMP callbackasm1(SB) + MOVV $1702, R12 + JMP callbackasm1(SB) + MOVV $1703, R12 + JMP callbackasm1(SB) + MOVV $1704, R12 + JMP callbackasm1(SB) + MOVV $1705, R12 + JMP callbackasm1(SB) + MOVV $1706, R12 + JMP callbackasm1(SB) + MOVV $1707, R12 + JMP callbackasm1(SB) + MOVV $1708, R12 + JMP callbackasm1(SB) + MOVV $1709, R12 + JMP callbackasm1(SB) + MOVV $1710, R12 + JMP callbackasm1(SB) + MOVV $1711, R12 + JMP callbackasm1(SB) + MOVV $1712, R12 + JMP callbackasm1(SB) + MOVV $1713, R12 + JMP callbackasm1(SB) + MOVV $1714, R12 + JMP callbackasm1(SB) + MOVV $1715, R12 + JMP callbackasm1(SB) + MOVV $1716, R12 + JMP callbackasm1(SB) + MOVV $1717, R12 + JMP callbackasm1(SB) + MOVV $1718, R12 + JMP callbackasm1(SB) + MOVV $1719, R12 + JMP callbackasm1(SB) + MOVV $1720, R12 + JMP callbackasm1(SB) + MOVV $1721, R12 + JMP callbackasm1(SB) + MOVV $1722, R12 + JMP callbackasm1(SB) + MOVV $1723, R12 + JMP callbackasm1(SB) + MOVV $1724, R12 + JMP callbackasm1(SB) + MOVV $1725, R12 + JMP callbackasm1(SB) + MOVV $1726, R12 + JMP callbackasm1(SB) + MOVV $1727, R12 + JMP callbackasm1(SB) + MOVV $1728, R12 + JMP callbackasm1(SB) + MOVV $1729, R12 + JMP callbackasm1(SB) + MOVV $1730, R12 + JMP callbackasm1(SB) + MOVV $1731, R12 + JMP callbackasm1(SB) + MOVV $1732, R12 + JMP callbackasm1(SB) + MOVV $1733, R12 + JMP callbackasm1(SB) + MOVV $1734, R12 + JMP callbackasm1(SB) + MOVV $1735, R12 + JMP callbackasm1(SB) + MOVV $1736, R12 + JMP callbackasm1(SB) + MOVV $1737, R12 + JMP callbackasm1(SB) + MOVV $1738, R12 + JMP callbackasm1(SB) + MOVV $1739, R12 + JMP callbackasm1(SB) + MOVV $1740, R12 + JMP callbackasm1(SB) + MOVV $1741, R12 + JMP callbackasm1(SB) + MOVV $1742, R12 + JMP callbackasm1(SB) + MOVV $1743, R12 + JMP callbackasm1(SB) + MOVV $1744, R12 + JMP callbackasm1(SB) + MOVV $1745, R12 + JMP callbackasm1(SB) + MOVV $1746, R12 + JMP callbackasm1(SB) + MOVV $1747, R12 + JMP callbackasm1(SB) + MOVV $1748, R12 + JMP callbackasm1(SB) + MOVV $1749, R12 + JMP callbackasm1(SB) + MOVV $1750, R12 + JMP callbackasm1(SB) + MOVV $1751, R12 + JMP callbackasm1(SB) + MOVV $1752, R12 + JMP callbackasm1(SB) + MOVV $1753, R12 + JMP callbackasm1(SB) + MOVV $1754, R12 + JMP callbackasm1(SB) + MOVV $1755, R12 + JMP callbackasm1(SB) + MOVV $1756, R12 + JMP callbackasm1(SB) + MOVV $1757, R12 + JMP callbackasm1(SB) + MOVV $1758, R12 + JMP callbackasm1(SB) + MOVV $1759, R12 + JMP callbackasm1(SB) + MOVV $1760, R12 + JMP callbackasm1(SB) + MOVV $1761, R12 + JMP callbackasm1(SB) + MOVV $1762, R12 + JMP callbackasm1(SB) + MOVV $1763, R12 + JMP callbackasm1(SB) + MOVV $1764, R12 + JMP callbackasm1(SB) + MOVV $1765, R12 + JMP callbackasm1(SB) + MOVV $1766, R12 + JMP callbackasm1(SB) + MOVV $1767, R12 + JMP callbackasm1(SB) + MOVV $1768, R12 + JMP callbackasm1(SB) + MOVV $1769, R12 + JMP callbackasm1(SB) + MOVV $1770, R12 + JMP callbackasm1(SB) + MOVV $1771, R12 + JMP callbackasm1(SB) + MOVV $1772, R12 + JMP callbackasm1(SB) + MOVV $1773, R12 + JMP callbackasm1(SB) + MOVV $1774, R12 + JMP callbackasm1(SB) + MOVV $1775, R12 + JMP callbackasm1(SB) + MOVV $1776, R12 + JMP callbackasm1(SB) + MOVV $1777, R12 + JMP callbackasm1(SB) + MOVV $1778, R12 + JMP callbackasm1(SB) + MOVV $1779, R12 + JMP callbackasm1(SB) + MOVV $1780, R12 + JMP callbackasm1(SB) + MOVV $1781, R12 + JMP callbackasm1(SB) + MOVV $1782, R12 + JMP callbackasm1(SB) + MOVV $1783, R12 + JMP callbackasm1(SB) + MOVV $1784, R12 + JMP callbackasm1(SB) + MOVV $1785, R12 + JMP callbackasm1(SB) + MOVV $1786, R12 + JMP callbackasm1(SB) + MOVV $1787, R12 + JMP callbackasm1(SB) + MOVV $1788, R12 + JMP callbackasm1(SB) + MOVV $1789, R12 + JMP callbackasm1(SB) + MOVV $1790, R12 + JMP callbackasm1(SB) + MOVV $1791, R12 + JMP callbackasm1(SB) + MOVV $1792, R12 + JMP callbackasm1(SB) + MOVV $1793, R12 + JMP callbackasm1(SB) + MOVV $1794, R12 + JMP callbackasm1(SB) + MOVV $1795, R12 + JMP callbackasm1(SB) + MOVV $1796, R12 + JMP callbackasm1(SB) + MOVV $1797, R12 + JMP callbackasm1(SB) + MOVV $1798, R12 + JMP callbackasm1(SB) + MOVV $1799, R12 + JMP callbackasm1(SB) + MOVV $1800, R12 + JMP callbackasm1(SB) + MOVV $1801, R12 + JMP callbackasm1(SB) + MOVV $1802, R12 + JMP callbackasm1(SB) + MOVV $1803, R12 + JMP callbackasm1(SB) + MOVV $1804, R12 + JMP callbackasm1(SB) + MOVV $1805, R12 + JMP callbackasm1(SB) + MOVV $1806, R12 + JMP callbackasm1(SB) + MOVV $1807, R12 + JMP callbackasm1(SB) + MOVV $1808, R12 + JMP callbackasm1(SB) + MOVV $1809, R12 + JMP callbackasm1(SB) + MOVV $1810, R12 + JMP callbackasm1(SB) + MOVV $1811, R12 + JMP callbackasm1(SB) + MOVV $1812, R12 + JMP callbackasm1(SB) + MOVV $1813, R12 + JMP callbackasm1(SB) + MOVV $1814, R12 + JMP callbackasm1(SB) + MOVV $1815, R12 + JMP callbackasm1(SB) + MOVV $1816, R12 + JMP callbackasm1(SB) + MOVV $1817, R12 + JMP callbackasm1(SB) + MOVV $1818, R12 + JMP callbackasm1(SB) + MOVV $1819, R12 + JMP callbackasm1(SB) + MOVV $1820, R12 + JMP callbackasm1(SB) + MOVV $1821, R12 + JMP callbackasm1(SB) + MOVV $1822, R12 + JMP callbackasm1(SB) + MOVV $1823, R12 + JMP callbackasm1(SB) + MOVV $1824, R12 + JMP callbackasm1(SB) + MOVV $1825, R12 + JMP callbackasm1(SB) + MOVV $1826, R12 + JMP callbackasm1(SB) + MOVV $1827, R12 + JMP callbackasm1(SB) + MOVV $1828, R12 + JMP callbackasm1(SB) + MOVV $1829, R12 + JMP callbackasm1(SB) + MOVV $1830, R12 + JMP callbackasm1(SB) + MOVV $1831, R12 + JMP callbackasm1(SB) + MOVV $1832, R12 + JMP callbackasm1(SB) + MOVV $1833, R12 + JMP callbackasm1(SB) + MOVV $1834, R12 + JMP callbackasm1(SB) + MOVV $1835, R12 + JMP callbackasm1(SB) + MOVV $1836, R12 + JMP callbackasm1(SB) + MOVV $1837, R12 + JMP callbackasm1(SB) + MOVV $1838, R12 + JMP callbackasm1(SB) + MOVV $1839, R12 + JMP callbackasm1(SB) + MOVV $1840, R12 + JMP callbackasm1(SB) + MOVV $1841, R12 + JMP callbackasm1(SB) + MOVV $1842, R12 + JMP callbackasm1(SB) + MOVV $1843, R12 + JMP callbackasm1(SB) + MOVV $1844, R12 + JMP callbackasm1(SB) + MOVV $1845, R12 + JMP callbackasm1(SB) + MOVV $1846, R12 + JMP callbackasm1(SB) + MOVV $1847, R12 + JMP callbackasm1(SB) + MOVV $1848, R12 + JMP callbackasm1(SB) + MOVV $1849, R12 + JMP callbackasm1(SB) + MOVV $1850, R12 + JMP callbackasm1(SB) + MOVV $1851, R12 + JMP callbackasm1(SB) + MOVV $1852, R12 + JMP callbackasm1(SB) + MOVV $1853, R12 + JMP callbackasm1(SB) + MOVV $1854, R12 + JMP callbackasm1(SB) + MOVV $1855, R12 + JMP callbackasm1(SB) + MOVV $1856, R12 + JMP callbackasm1(SB) + MOVV $1857, R12 + JMP callbackasm1(SB) + MOVV $1858, R12 + JMP callbackasm1(SB) + MOVV $1859, R12 + JMP callbackasm1(SB) + MOVV $1860, R12 + JMP callbackasm1(SB) + MOVV $1861, R12 + JMP callbackasm1(SB) + MOVV $1862, R12 + JMP callbackasm1(SB) + MOVV $1863, R12 + JMP callbackasm1(SB) + MOVV $1864, R12 + JMP callbackasm1(SB) + MOVV $1865, R12 + JMP callbackasm1(SB) + MOVV $1866, R12 + JMP callbackasm1(SB) + MOVV $1867, R12 + JMP callbackasm1(SB) + MOVV $1868, R12 + JMP callbackasm1(SB) + MOVV $1869, R12 + JMP callbackasm1(SB) + MOVV $1870, R12 + JMP callbackasm1(SB) + MOVV $1871, R12 + JMP callbackasm1(SB) + MOVV $1872, R12 + JMP callbackasm1(SB) + MOVV $1873, R12 + JMP callbackasm1(SB) + MOVV $1874, R12 + JMP callbackasm1(SB) + MOVV $1875, R12 + JMP callbackasm1(SB) + MOVV $1876, R12 + JMP callbackasm1(SB) + MOVV $1877, R12 + JMP callbackasm1(SB) + MOVV $1878, R12 + JMP callbackasm1(SB) + MOVV $1879, R12 + JMP callbackasm1(SB) + MOVV $1880, R12 + JMP callbackasm1(SB) + MOVV $1881, R12 + JMP callbackasm1(SB) + MOVV $1882, R12 + JMP callbackasm1(SB) + MOVV $1883, R12 + JMP callbackasm1(SB) + MOVV $1884, R12 + JMP callbackasm1(SB) + MOVV $1885, R12 + JMP callbackasm1(SB) + MOVV $1886, R12 + JMP callbackasm1(SB) + MOVV $1887, R12 + JMP callbackasm1(SB) + MOVV $1888, R12 + JMP callbackasm1(SB) + MOVV $1889, R12 + JMP callbackasm1(SB) + MOVV $1890, R12 + JMP callbackasm1(SB) + MOVV $1891, R12 + JMP callbackasm1(SB) + MOVV $1892, R12 + JMP callbackasm1(SB) + MOVV $1893, R12 + JMP callbackasm1(SB) + MOVV $1894, R12 + JMP callbackasm1(SB) + MOVV $1895, R12 + JMP callbackasm1(SB) + MOVV $1896, R12 + JMP callbackasm1(SB) + MOVV $1897, R12 + JMP callbackasm1(SB) + MOVV $1898, R12 + JMP callbackasm1(SB) + MOVV $1899, R12 + JMP callbackasm1(SB) + MOVV $1900, R12 + JMP callbackasm1(SB) + MOVV $1901, R12 + JMP callbackasm1(SB) + MOVV $1902, R12 + JMP callbackasm1(SB) + MOVV $1903, R12 + JMP callbackasm1(SB) + MOVV $1904, R12 + JMP callbackasm1(SB) + MOVV $1905, R12 + JMP callbackasm1(SB) + MOVV $1906, R12 + JMP callbackasm1(SB) + MOVV $1907, R12 + JMP callbackasm1(SB) + MOVV $1908, R12 + JMP callbackasm1(SB) + MOVV $1909, R12 + JMP callbackasm1(SB) + MOVV $1910, R12 + JMP callbackasm1(SB) + MOVV $1911, R12 + JMP callbackasm1(SB) + MOVV $1912, R12 + JMP callbackasm1(SB) + MOVV $1913, R12 + JMP callbackasm1(SB) + MOVV $1914, R12 + JMP callbackasm1(SB) + MOVV $1915, R12 + JMP callbackasm1(SB) + MOVV $1916, R12 + JMP callbackasm1(SB) + MOVV $1917, R12 + JMP callbackasm1(SB) + MOVV $1918, R12 + JMP callbackasm1(SB) + MOVV $1919, R12 + JMP callbackasm1(SB) + MOVV $1920, R12 + JMP callbackasm1(SB) + MOVV $1921, R12 + JMP callbackasm1(SB) + MOVV $1922, R12 + JMP callbackasm1(SB) + MOVV $1923, R12 + JMP callbackasm1(SB) + MOVV $1924, R12 + JMP callbackasm1(SB) + MOVV $1925, R12 + JMP callbackasm1(SB) + MOVV $1926, R12 + JMP callbackasm1(SB) + MOVV $1927, R12 + JMP callbackasm1(SB) + MOVV $1928, R12 + JMP callbackasm1(SB) + MOVV $1929, R12 + JMP callbackasm1(SB) + MOVV $1930, R12 + JMP callbackasm1(SB) + MOVV $1931, R12 + JMP callbackasm1(SB) + MOVV $1932, R12 + JMP callbackasm1(SB) + MOVV $1933, R12 + JMP callbackasm1(SB) + MOVV $1934, R12 + JMP callbackasm1(SB) + MOVV $1935, R12 + JMP callbackasm1(SB) + MOVV $1936, R12 + JMP callbackasm1(SB) + MOVV $1937, R12 + JMP callbackasm1(SB) + MOVV $1938, R12 + JMP callbackasm1(SB) + MOVV $1939, R12 + JMP callbackasm1(SB) + MOVV $1940, R12 + JMP callbackasm1(SB) + MOVV $1941, R12 + JMP callbackasm1(SB) + MOVV $1942, R12 + JMP callbackasm1(SB) + MOVV $1943, R12 + JMP callbackasm1(SB) + MOVV $1944, R12 + JMP callbackasm1(SB) + MOVV $1945, R12 + JMP callbackasm1(SB) + MOVV $1946, R12 + JMP callbackasm1(SB) + MOVV $1947, R12 + JMP callbackasm1(SB) + MOVV $1948, R12 + JMP callbackasm1(SB) + MOVV $1949, R12 + JMP callbackasm1(SB) + MOVV $1950, R12 + JMP callbackasm1(SB) + MOVV $1951, R12 + JMP callbackasm1(SB) + MOVV $1952, R12 + JMP callbackasm1(SB) + MOVV $1953, R12 + JMP callbackasm1(SB) + MOVV $1954, R12 + JMP callbackasm1(SB) + MOVV $1955, R12 + JMP callbackasm1(SB) + MOVV $1956, R12 + JMP callbackasm1(SB) + MOVV $1957, R12 + JMP callbackasm1(SB) + MOVV $1958, R12 + JMP callbackasm1(SB) + MOVV $1959, R12 + JMP callbackasm1(SB) + MOVV $1960, R12 + JMP callbackasm1(SB) + MOVV $1961, R12 + JMP callbackasm1(SB) + MOVV $1962, R12 + JMP callbackasm1(SB) + MOVV $1963, R12 + JMP callbackasm1(SB) + MOVV $1964, R12 + JMP callbackasm1(SB) + MOVV $1965, R12 + JMP callbackasm1(SB) + MOVV $1966, R12 + JMP callbackasm1(SB) + MOVV $1967, R12 + JMP callbackasm1(SB) + MOVV $1968, R12 + JMP callbackasm1(SB) + MOVV $1969, R12 + JMP callbackasm1(SB) + MOVV $1970, R12 + JMP callbackasm1(SB) + MOVV $1971, R12 + JMP callbackasm1(SB) + MOVV $1972, R12 + JMP callbackasm1(SB) + MOVV $1973, R12 + JMP callbackasm1(SB) + MOVV $1974, R12 + JMP callbackasm1(SB) + MOVV $1975, R12 + JMP callbackasm1(SB) + MOVV $1976, R12 + JMP callbackasm1(SB) + MOVV $1977, R12 + JMP callbackasm1(SB) + MOVV $1978, R12 + JMP callbackasm1(SB) + MOVV $1979, R12 + JMP callbackasm1(SB) + MOVV $1980, R12 + JMP callbackasm1(SB) + MOVV $1981, R12 + JMP callbackasm1(SB) + MOVV $1982, R12 + JMP callbackasm1(SB) + MOVV $1983, R12 + JMP callbackasm1(SB) + MOVV $1984, R12 + JMP callbackasm1(SB) + MOVV $1985, R12 + JMP callbackasm1(SB) + MOVV $1986, R12 + JMP callbackasm1(SB) + MOVV $1987, R12 + JMP callbackasm1(SB) + MOVV $1988, R12 + JMP callbackasm1(SB) + MOVV $1989, R12 + JMP callbackasm1(SB) + MOVV $1990, R12 + JMP callbackasm1(SB) + MOVV $1991, R12 + JMP callbackasm1(SB) + MOVV $1992, R12 + JMP callbackasm1(SB) + MOVV $1993, R12 + JMP callbackasm1(SB) + MOVV $1994, R12 + JMP callbackasm1(SB) + MOVV $1995, R12 + JMP callbackasm1(SB) + MOVV $1996, R12 + JMP callbackasm1(SB) + MOVV $1997, R12 + JMP callbackasm1(SB) + MOVV $1998, R12 + JMP callbackasm1(SB) + MOVV $1999, R12 + JMP callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_ppc64le.s b/vendor/github.com/ebitengine/purego/zcallback_ppc64le.s new file mode 100644 index 00000000..702243b1 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_ppc64le.s @@ -0,0 +1,4014 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build linux + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOVD and BR instructions. +// The MOVD instruction loads R11 with the callback index, and the +// BR instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R11 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + MOVD $0, R11 + BR callbackasm1(SB) + MOVD $1, R11 + BR callbackasm1(SB) + MOVD $2, R11 + BR callbackasm1(SB) + MOVD $3, R11 + BR callbackasm1(SB) + MOVD $4, R11 + BR callbackasm1(SB) + MOVD $5, R11 + BR callbackasm1(SB) + MOVD $6, R11 + BR callbackasm1(SB) + MOVD $7, R11 + BR callbackasm1(SB) + MOVD $8, R11 + BR callbackasm1(SB) + MOVD $9, R11 + BR callbackasm1(SB) + MOVD $10, R11 + BR callbackasm1(SB) + MOVD $11, R11 + BR callbackasm1(SB) + MOVD $12, R11 + BR callbackasm1(SB) + MOVD $13, R11 + BR callbackasm1(SB) + MOVD $14, R11 + BR callbackasm1(SB) + MOVD $15, R11 + BR callbackasm1(SB) + MOVD $16, R11 + BR callbackasm1(SB) + MOVD $17, R11 + BR callbackasm1(SB) + MOVD $18, R11 + BR callbackasm1(SB) + MOVD $19, R11 + BR callbackasm1(SB) + MOVD $20, R11 + BR callbackasm1(SB) + MOVD $21, R11 + BR callbackasm1(SB) + MOVD $22, R11 + BR callbackasm1(SB) + MOVD $23, R11 + BR callbackasm1(SB) + MOVD $24, R11 + BR callbackasm1(SB) + MOVD $25, R11 + BR callbackasm1(SB) + MOVD $26, R11 + BR callbackasm1(SB) + MOVD $27, R11 + BR callbackasm1(SB) + MOVD $28, R11 + BR callbackasm1(SB) + MOVD $29, R11 + BR callbackasm1(SB) + MOVD $30, R11 + BR callbackasm1(SB) + MOVD $31, R11 + BR callbackasm1(SB) + MOVD $32, R11 + BR callbackasm1(SB) + MOVD $33, R11 + BR callbackasm1(SB) + MOVD $34, R11 + BR callbackasm1(SB) + MOVD $35, R11 + BR callbackasm1(SB) + MOVD $36, R11 + BR callbackasm1(SB) + MOVD $37, R11 + BR callbackasm1(SB) + MOVD $38, R11 + BR callbackasm1(SB) + MOVD $39, R11 + BR callbackasm1(SB) + MOVD $40, R11 + BR callbackasm1(SB) + MOVD $41, R11 + BR callbackasm1(SB) + MOVD $42, R11 + BR callbackasm1(SB) + MOVD $43, R11 + BR callbackasm1(SB) + MOVD $44, R11 + BR callbackasm1(SB) + MOVD $45, R11 + BR callbackasm1(SB) + MOVD $46, R11 + BR callbackasm1(SB) + MOVD $47, R11 + BR callbackasm1(SB) + MOVD $48, R11 + BR callbackasm1(SB) + MOVD $49, R11 + BR callbackasm1(SB) + MOVD $50, R11 + BR callbackasm1(SB) + MOVD $51, R11 + BR callbackasm1(SB) + MOVD $52, R11 + BR callbackasm1(SB) + MOVD $53, R11 + BR callbackasm1(SB) + MOVD $54, R11 + BR callbackasm1(SB) + MOVD $55, R11 + BR callbackasm1(SB) + MOVD $56, R11 + BR callbackasm1(SB) + MOVD $57, R11 + BR callbackasm1(SB) + MOVD $58, R11 + BR callbackasm1(SB) + MOVD $59, R11 + BR callbackasm1(SB) + MOVD $60, R11 + BR callbackasm1(SB) + MOVD $61, R11 + BR callbackasm1(SB) + MOVD $62, R11 + BR callbackasm1(SB) + MOVD $63, R11 + BR callbackasm1(SB) + MOVD $64, R11 + BR callbackasm1(SB) + MOVD $65, R11 + BR callbackasm1(SB) + MOVD $66, R11 + BR callbackasm1(SB) + MOVD $67, R11 + BR callbackasm1(SB) + MOVD $68, R11 + BR callbackasm1(SB) + MOVD $69, R11 + BR callbackasm1(SB) + MOVD $70, R11 + BR callbackasm1(SB) + MOVD $71, R11 + BR callbackasm1(SB) + MOVD $72, R11 + BR callbackasm1(SB) + MOVD $73, R11 + BR callbackasm1(SB) + MOVD $74, R11 + BR callbackasm1(SB) + MOVD $75, R11 + BR callbackasm1(SB) + MOVD $76, R11 + BR callbackasm1(SB) + MOVD $77, R11 + BR callbackasm1(SB) + MOVD $78, R11 + BR callbackasm1(SB) + MOVD $79, R11 + BR callbackasm1(SB) + MOVD $80, R11 + BR callbackasm1(SB) + MOVD $81, R11 + BR callbackasm1(SB) + MOVD $82, R11 + BR callbackasm1(SB) + MOVD $83, R11 + BR callbackasm1(SB) + MOVD $84, R11 + BR callbackasm1(SB) + MOVD $85, R11 + BR callbackasm1(SB) + MOVD $86, R11 + BR callbackasm1(SB) + MOVD $87, R11 + BR callbackasm1(SB) + MOVD $88, R11 + BR callbackasm1(SB) + MOVD $89, R11 + BR callbackasm1(SB) + MOVD $90, R11 + BR callbackasm1(SB) + MOVD $91, R11 + BR callbackasm1(SB) + MOVD $92, R11 + BR callbackasm1(SB) + MOVD $93, R11 + BR callbackasm1(SB) + MOVD $94, R11 + BR callbackasm1(SB) + MOVD $95, R11 + BR callbackasm1(SB) + MOVD $96, R11 + BR callbackasm1(SB) + MOVD $97, R11 + BR callbackasm1(SB) + MOVD $98, R11 + BR callbackasm1(SB) + MOVD $99, R11 + BR callbackasm1(SB) + MOVD $100, R11 + BR callbackasm1(SB) + MOVD $101, R11 + BR callbackasm1(SB) + MOVD $102, R11 + BR callbackasm1(SB) + MOVD $103, R11 + BR callbackasm1(SB) + MOVD $104, R11 + BR callbackasm1(SB) + MOVD $105, R11 + BR callbackasm1(SB) + MOVD $106, R11 + BR callbackasm1(SB) + MOVD $107, R11 + BR callbackasm1(SB) + MOVD $108, R11 + BR callbackasm1(SB) + MOVD $109, R11 + BR callbackasm1(SB) + MOVD $110, R11 + BR callbackasm1(SB) + MOVD $111, R11 + BR callbackasm1(SB) + MOVD $112, R11 + BR callbackasm1(SB) + MOVD $113, R11 + BR callbackasm1(SB) + MOVD $114, R11 + BR callbackasm1(SB) + MOVD $115, R11 + BR callbackasm1(SB) + MOVD $116, R11 + BR callbackasm1(SB) + MOVD $117, R11 + BR callbackasm1(SB) + MOVD $118, R11 + BR callbackasm1(SB) + MOVD $119, R11 + BR callbackasm1(SB) + MOVD $120, R11 + BR callbackasm1(SB) + MOVD $121, R11 + BR callbackasm1(SB) + MOVD $122, R11 + BR callbackasm1(SB) + MOVD $123, R11 + BR callbackasm1(SB) + MOVD $124, R11 + BR callbackasm1(SB) + MOVD $125, R11 + BR callbackasm1(SB) + MOVD $126, R11 + BR callbackasm1(SB) + MOVD $127, R11 + BR callbackasm1(SB) + MOVD $128, R11 + BR callbackasm1(SB) + MOVD $129, R11 + BR callbackasm1(SB) + MOVD $130, R11 + BR callbackasm1(SB) + MOVD $131, R11 + BR callbackasm1(SB) + MOVD $132, R11 + BR callbackasm1(SB) + MOVD $133, R11 + BR callbackasm1(SB) + MOVD $134, R11 + BR callbackasm1(SB) + MOVD $135, R11 + BR callbackasm1(SB) + MOVD $136, R11 + BR callbackasm1(SB) + MOVD $137, R11 + BR callbackasm1(SB) + MOVD $138, R11 + BR callbackasm1(SB) + MOVD $139, R11 + BR callbackasm1(SB) + MOVD $140, R11 + BR callbackasm1(SB) + MOVD $141, R11 + BR callbackasm1(SB) + MOVD $142, R11 + BR callbackasm1(SB) + MOVD $143, R11 + BR callbackasm1(SB) + MOVD $144, R11 + BR callbackasm1(SB) + MOVD $145, R11 + BR callbackasm1(SB) + MOVD $146, R11 + BR callbackasm1(SB) + MOVD $147, R11 + BR callbackasm1(SB) + MOVD $148, R11 + BR callbackasm1(SB) + MOVD $149, R11 + BR callbackasm1(SB) + MOVD $150, R11 + BR callbackasm1(SB) + MOVD $151, R11 + BR callbackasm1(SB) + MOVD $152, R11 + BR callbackasm1(SB) + MOVD $153, R11 + BR callbackasm1(SB) + MOVD $154, R11 + BR callbackasm1(SB) + MOVD $155, R11 + BR callbackasm1(SB) + MOVD $156, R11 + BR callbackasm1(SB) + MOVD $157, R11 + BR callbackasm1(SB) + MOVD $158, R11 + BR callbackasm1(SB) + MOVD $159, R11 + BR callbackasm1(SB) + MOVD $160, R11 + BR callbackasm1(SB) + MOVD $161, R11 + BR callbackasm1(SB) + MOVD $162, R11 + BR callbackasm1(SB) + MOVD $163, R11 + BR callbackasm1(SB) + MOVD $164, R11 + BR callbackasm1(SB) + MOVD $165, R11 + BR callbackasm1(SB) + MOVD $166, R11 + BR callbackasm1(SB) + MOVD $167, R11 + BR callbackasm1(SB) + MOVD $168, R11 + BR callbackasm1(SB) + MOVD $169, R11 + BR callbackasm1(SB) + MOVD $170, R11 + BR callbackasm1(SB) + MOVD $171, R11 + BR callbackasm1(SB) + MOVD $172, R11 + BR callbackasm1(SB) + MOVD $173, R11 + BR callbackasm1(SB) + MOVD $174, R11 + BR callbackasm1(SB) + MOVD $175, R11 + BR callbackasm1(SB) + MOVD $176, R11 + BR callbackasm1(SB) + MOVD $177, R11 + BR callbackasm1(SB) + MOVD $178, R11 + BR callbackasm1(SB) + MOVD $179, R11 + BR callbackasm1(SB) + MOVD $180, R11 + BR callbackasm1(SB) + MOVD $181, R11 + BR callbackasm1(SB) + MOVD $182, R11 + BR callbackasm1(SB) + MOVD $183, R11 + BR callbackasm1(SB) + MOVD $184, R11 + BR callbackasm1(SB) + MOVD $185, R11 + BR callbackasm1(SB) + MOVD $186, R11 + BR callbackasm1(SB) + MOVD $187, R11 + BR callbackasm1(SB) + MOVD $188, R11 + BR callbackasm1(SB) + MOVD $189, R11 + BR callbackasm1(SB) + MOVD $190, R11 + BR callbackasm1(SB) + MOVD $191, R11 + BR callbackasm1(SB) + MOVD $192, R11 + BR callbackasm1(SB) + MOVD $193, R11 + BR callbackasm1(SB) + MOVD $194, R11 + BR callbackasm1(SB) + MOVD $195, R11 + BR callbackasm1(SB) + MOVD $196, R11 + BR callbackasm1(SB) + MOVD $197, R11 + BR callbackasm1(SB) + MOVD $198, R11 + BR callbackasm1(SB) + MOVD $199, R11 + BR callbackasm1(SB) + MOVD $200, R11 + BR callbackasm1(SB) + MOVD $201, R11 + BR callbackasm1(SB) + MOVD $202, R11 + BR callbackasm1(SB) + MOVD $203, R11 + BR callbackasm1(SB) + MOVD $204, R11 + BR callbackasm1(SB) + MOVD $205, R11 + BR callbackasm1(SB) + MOVD $206, R11 + BR callbackasm1(SB) + MOVD $207, R11 + BR callbackasm1(SB) + MOVD $208, R11 + BR callbackasm1(SB) + MOVD $209, R11 + BR callbackasm1(SB) + MOVD $210, R11 + BR callbackasm1(SB) + MOVD $211, R11 + BR callbackasm1(SB) + MOVD $212, R11 + BR callbackasm1(SB) + MOVD $213, R11 + BR callbackasm1(SB) + MOVD $214, R11 + BR callbackasm1(SB) + MOVD $215, R11 + BR callbackasm1(SB) + MOVD $216, R11 + BR callbackasm1(SB) + MOVD $217, R11 + BR callbackasm1(SB) + MOVD $218, R11 + BR callbackasm1(SB) + MOVD $219, R11 + BR callbackasm1(SB) + MOVD $220, R11 + BR callbackasm1(SB) + MOVD $221, R11 + BR callbackasm1(SB) + MOVD $222, R11 + BR callbackasm1(SB) + MOVD $223, R11 + BR callbackasm1(SB) + MOVD $224, R11 + BR callbackasm1(SB) + MOVD $225, R11 + BR callbackasm1(SB) + MOVD $226, R11 + BR callbackasm1(SB) + MOVD $227, R11 + BR callbackasm1(SB) + MOVD $228, R11 + BR callbackasm1(SB) + MOVD $229, R11 + BR callbackasm1(SB) + MOVD $230, R11 + BR callbackasm1(SB) + MOVD $231, R11 + BR callbackasm1(SB) + MOVD $232, R11 + BR callbackasm1(SB) + MOVD $233, R11 + BR callbackasm1(SB) + MOVD $234, R11 + BR callbackasm1(SB) + MOVD $235, R11 + BR callbackasm1(SB) + MOVD $236, R11 + BR callbackasm1(SB) + MOVD $237, R11 + BR callbackasm1(SB) + MOVD $238, R11 + BR callbackasm1(SB) + MOVD $239, R11 + BR callbackasm1(SB) + MOVD $240, R11 + BR callbackasm1(SB) + MOVD $241, R11 + BR callbackasm1(SB) + MOVD $242, R11 + BR callbackasm1(SB) + MOVD $243, R11 + BR callbackasm1(SB) + MOVD $244, R11 + BR callbackasm1(SB) + MOVD $245, R11 + BR callbackasm1(SB) + MOVD $246, R11 + BR callbackasm1(SB) + MOVD $247, R11 + BR callbackasm1(SB) + MOVD $248, R11 + BR callbackasm1(SB) + MOVD $249, R11 + BR callbackasm1(SB) + MOVD $250, R11 + BR callbackasm1(SB) + MOVD $251, R11 + BR callbackasm1(SB) + MOVD $252, R11 + BR callbackasm1(SB) + MOVD $253, R11 + BR callbackasm1(SB) + MOVD $254, R11 + BR callbackasm1(SB) + MOVD $255, R11 + BR callbackasm1(SB) + MOVD $256, R11 + BR callbackasm1(SB) + MOVD $257, R11 + BR callbackasm1(SB) + MOVD $258, R11 + BR callbackasm1(SB) + MOVD $259, R11 + BR callbackasm1(SB) + MOVD $260, R11 + BR callbackasm1(SB) + MOVD $261, R11 + BR callbackasm1(SB) + MOVD $262, R11 + BR callbackasm1(SB) + MOVD $263, R11 + BR callbackasm1(SB) + MOVD $264, R11 + BR callbackasm1(SB) + MOVD $265, R11 + BR callbackasm1(SB) + MOVD $266, R11 + BR callbackasm1(SB) + MOVD $267, R11 + BR callbackasm1(SB) + MOVD $268, R11 + BR callbackasm1(SB) + MOVD $269, R11 + BR callbackasm1(SB) + MOVD $270, R11 + BR callbackasm1(SB) + MOVD $271, R11 + BR callbackasm1(SB) + MOVD $272, R11 + BR callbackasm1(SB) + MOVD $273, R11 + BR callbackasm1(SB) + MOVD $274, R11 + BR callbackasm1(SB) + MOVD $275, R11 + BR callbackasm1(SB) + MOVD $276, R11 + BR callbackasm1(SB) + MOVD $277, R11 + BR callbackasm1(SB) + MOVD $278, R11 + BR callbackasm1(SB) + MOVD $279, R11 + BR callbackasm1(SB) + MOVD $280, R11 + BR callbackasm1(SB) + MOVD $281, R11 + BR callbackasm1(SB) + MOVD $282, R11 + BR callbackasm1(SB) + MOVD $283, R11 + BR callbackasm1(SB) + MOVD $284, R11 + BR callbackasm1(SB) + MOVD $285, R11 + BR callbackasm1(SB) + MOVD $286, R11 + BR callbackasm1(SB) + MOVD $287, R11 + BR callbackasm1(SB) + MOVD $288, R11 + BR callbackasm1(SB) + MOVD $289, R11 + BR callbackasm1(SB) + MOVD $290, R11 + BR callbackasm1(SB) + MOVD $291, R11 + BR callbackasm1(SB) + MOVD $292, R11 + BR callbackasm1(SB) + MOVD $293, R11 + BR callbackasm1(SB) + MOVD $294, R11 + BR callbackasm1(SB) + MOVD $295, R11 + BR callbackasm1(SB) + MOVD $296, R11 + BR callbackasm1(SB) + MOVD $297, R11 + BR callbackasm1(SB) + MOVD $298, R11 + BR callbackasm1(SB) + MOVD $299, R11 + BR callbackasm1(SB) + MOVD $300, R11 + BR callbackasm1(SB) + MOVD $301, R11 + BR callbackasm1(SB) + MOVD $302, R11 + BR callbackasm1(SB) + MOVD $303, R11 + BR callbackasm1(SB) + MOVD $304, R11 + BR callbackasm1(SB) + MOVD $305, R11 + BR callbackasm1(SB) + MOVD $306, R11 + BR callbackasm1(SB) + MOVD $307, R11 + BR callbackasm1(SB) + MOVD $308, R11 + BR callbackasm1(SB) + MOVD $309, R11 + BR callbackasm1(SB) + MOVD $310, R11 + BR callbackasm1(SB) + MOVD $311, R11 + BR callbackasm1(SB) + MOVD $312, R11 + BR callbackasm1(SB) + MOVD $313, R11 + BR callbackasm1(SB) + MOVD $314, R11 + BR callbackasm1(SB) + MOVD $315, R11 + BR callbackasm1(SB) + MOVD $316, R11 + BR callbackasm1(SB) + MOVD $317, R11 + BR callbackasm1(SB) + MOVD $318, R11 + BR callbackasm1(SB) + MOVD $319, R11 + BR callbackasm1(SB) + MOVD $320, R11 + BR callbackasm1(SB) + MOVD $321, R11 + BR callbackasm1(SB) + MOVD $322, R11 + BR callbackasm1(SB) + MOVD $323, R11 + BR callbackasm1(SB) + MOVD $324, R11 + BR callbackasm1(SB) + MOVD $325, R11 + BR callbackasm1(SB) + MOVD $326, R11 + BR callbackasm1(SB) + MOVD $327, R11 + BR callbackasm1(SB) + MOVD $328, R11 + BR callbackasm1(SB) + MOVD $329, R11 + BR callbackasm1(SB) + MOVD $330, R11 + BR callbackasm1(SB) + MOVD $331, R11 + BR callbackasm1(SB) + MOVD $332, R11 + BR callbackasm1(SB) + MOVD $333, R11 + BR callbackasm1(SB) + MOVD $334, R11 + BR callbackasm1(SB) + MOVD $335, R11 + BR callbackasm1(SB) + MOVD $336, R11 + BR callbackasm1(SB) + MOVD $337, R11 + BR callbackasm1(SB) + MOVD $338, R11 + BR callbackasm1(SB) + MOVD $339, R11 + BR callbackasm1(SB) + MOVD $340, R11 + BR callbackasm1(SB) + MOVD $341, R11 + BR callbackasm1(SB) + MOVD $342, R11 + BR callbackasm1(SB) + MOVD $343, R11 + BR callbackasm1(SB) + MOVD $344, R11 + BR callbackasm1(SB) + MOVD $345, R11 + BR callbackasm1(SB) + MOVD $346, R11 + BR callbackasm1(SB) + MOVD $347, R11 + BR callbackasm1(SB) + MOVD $348, R11 + BR callbackasm1(SB) + MOVD $349, R11 + BR callbackasm1(SB) + MOVD $350, R11 + BR callbackasm1(SB) + MOVD $351, R11 + BR callbackasm1(SB) + MOVD $352, R11 + BR callbackasm1(SB) + MOVD $353, R11 + BR callbackasm1(SB) + MOVD $354, R11 + BR callbackasm1(SB) + MOVD $355, R11 + BR callbackasm1(SB) + MOVD $356, R11 + BR callbackasm1(SB) + MOVD $357, R11 + BR callbackasm1(SB) + MOVD $358, R11 + BR callbackasm1(SB) + MOVD $359, R11 + BR callbackasm1(SB) + MOVD $360, R11 + BR callbackasm1(SB) + MOVD $361, R11 + BR callbackasm1(SB) + MOVD $362, R11 + BR callbackasm1(SB) + MOVD $363, R11 + BR callbackasm1(SB) + MOVD $364, R11 + BR callbackasm1(SB) + MOVD $365, R11 + BR callbackasm1(SB) + MOVD $366, R11 + BR callbackasm1(SB) + MOVD $367, R11 + BR callbackasm1(SB) + MOVD $368, R11 + BR callbackasm1(SB) + MOVD $369, R11 + BR callbackasm1(SB) + MOVD $370, R11 + BR callbackasm1(SB) + MOVD $371, R11 + BR callbackasm1(SB) + MOVD $372, R11 + BR callbackasm1(SB) + MOVD $373, R11 + BR callbackasm1(SB) + MOVD $374, R11 + BR callbackasm1(SB) + MOVD $375, R11 + BR callbackasm1(SB) + MOVD $376, R11 + BR callbackasm1(SB) + MOVD $377, R11 + BR callbackasm1(SB) + MOVD $378, R11 + BR callbackasm1(SB) + MOVD $379, R11 + BR callbackasm1(SB) + MOVD $380, R11 + BR callbackasm1(SB) + MOVD $381, R11 + BR callbackasm1(SB) + MOVD $382, R11 + BR callbackasm1(SB) + MOVD $383, R11 + BR callbackasm1(SB) + MOVD $384, R11 + BR callbackasm1(SB) + MOVD $385, R11 + BR callbackasm1(SB) + MOVD $386, R11 + BR callbackasm1(SB) + MOVD $387, R11 + BR callbackasm1(SB) + MOVD $388, R11 + BR callbackasm1(SB) + MOVD $389, R11 + BR callbackasm1(SB) + MOVD $390, R11 + BR callbackasm1(SB) + MOVD $391, R11 + BR callbackasm1(SB) + MOVD $392, R11 + BR callbackasm1(SB) + MOVD $393, R11 + BR callbackasm1(SB) + MOVD $394, R11 + BR callbackasm1(SB) + MOVD $395, R11 + BR callbackasm1(SB) + MOVD $396, R11 + BR callbackasm1(SB) + MOVD $397, R11 + BR callbackasm1(SB) + MOVD $398, R11 + BR callbackasm1(SB) + MOVD $399, R11 + BR callbackasm1(SB) + MOVD $400, R11 + BR callbackasm1(SB) + MOVD $401, R11 + BR callbackasm1(SB) + MOVD $402, R11 + BR callbackasm1(SB) + MOVD $403, R11 + BR callbackasm1(SB) + MOVD $404, R11 + BR callbackasm1(SB) + MOVD $405, R11 + BR callbackasm1(SB) + MOVD $406, R11 + BR callbackasm1(SB) + MOVD $407, R11 + BR callbackasm1(SB) + MOVD $408, R11 + BR callbackasm1(SB) + MOVD $409, R11 + BR callbackasm1(SB) + MOVD $410, R11 + BR callbackasm1(SB) + MOVD $411, R11 + BR callbackasm1(SB) + MOVD $412, R11 + BR callbackasm1(SB) + MOVD $413, R11 + BR callbackasm1(SB) + MOVD $414, R11 + BR callbackasm1(SB) + MOVD $415, R11 + BR callbackasm1(SB) + MOVD $416, R11 + BR callbackasm1(SB) + MOVD $417, R11 + BR callbackasm1(SB) + MOVD $418, R11 + BR callbackasm1(SB) + MOVD $419, R11 + BR callbackasm1(SB) + MOVD $420, R11 + BR callbackasm1(SB) + MOVD $421, R11 + BR callbackasm1(SB) + MOVD $422, R11 + BR callbackasm1(SB) + MOVD $423, R11 + BR callbackasm1(SB) + MOVD $424, R11 + BR callbackasm1(SB) + MOVD $425, R11 + BR callbackasm1(SB) + MOVD $426, R11 + BR callbackasm1(SB) + MOVD $427, R11 + BR callbackasm1(SB) + MOVD $428, R11 + BR callbackasm1(SB) + MOVD $429, R11 + BR callbackasm1(SB) + MOVD $430, R11 + BR callbackasm1(SB) + MOVD $431, R11 + BR callbackasm1(SB) + MOVD $432, R11 + BR callbackasm1(SB) + MOVD $433, R11 + BR callbackasm1(SB) + MOVD $434, R11 + BR callbackasm1(SB) + MOVD $435, R11 + BR callbackasm1(SB) + MOVD $436, R11 + BR callbackasm1(SB) + MOVD $437, R11 + BR callbackasm1(SB) + MOVD $438, R11 + BR callbackasm1(SB) + MOVD $439, R11 + BR callbackasm1(SB) + MOVD $440, R11 + BR callbackasm1(SB) + MOVD $441, R11 + BR callbackasm1(SB) + MOVD $442, R11 + BR callbackasm1(SB) + MOVD $443, R11 + BR callbackasm1(SB) + MOVD $444, R11 + BR callbackasm1(SB) + MOVD $445, R11 + BR callbackasm1(SB) + MOVD $446, R11 + BR callbackasm1(SB) + MOVD $447, R11 + BR callbackasm1(SB) + MOVD $448, R11 + BR callbackasm1(SB) + MOVD $449, R11 + BR callbackasm1(SB) + MOVD $450, R11 + BR callbackasm1(SB) + MOVD $451, R11 + BR callbackasm1(SB) + MOVD $452, R11 + BR callbackasm1(SB) + MOVD $453, R11 + BR callbackasm1(SB) + MOVD $454, R11 + BR callbackasm1(SB) + MOVD $455, R11 + BR callbackasm1(SB) + MOVD $456, R11 + BR callbackasm1(SB) + MOVD $457, R11 + BR callbackasm1(SB) + MOVD $458, R11 + BR callbackasm1(SB) + MOVD $459, R11 + BR callbackasm1(SB) + MOVD $460, R11 + BR callbackasm1(SB) + MOVD $461, R11 + BR callbackasm1(SB) + MOVD $462, R11 + BR callbackasm1(SB) + MOVD $463, R11 + BR callbackasm1(SB) + MOVD $464, R11 + BR callbackasm1(SB) + MOVD $465, R11 + BR callbackasm1(SB) + MOVD $466, R11 + BR callbackasm1(SB) + MOVD $467, R11 + BR callbackasm1(SB) + MOVD $468, R11 + BR callbackasm1(SB) + MOVD $469, R11 + BR callbackasm1(SB) + MOVD $470, R11 + BR callbackasm1(SB) + MOVD $471, R11 + BR callbackasm1(SB) + MOVD $472, R11 + BR callbackasm1(SB) + MOVD $473, R11 + BR callbackasm1(SB) + MOVD $474, R11 + BR callbackasm1(SB) + MOVD $475, R11 + BR callbackasm1(SB) + MOVD $476, R11 + BR callbackasm1(SB) + MOVD $477, R11 + BR callbackasm1(SB) + MOVD $478, R11 + BR callbackasm1(SB) + MOVD $479, R11 + BR callbackasm1(SB) + MOVD $480, R11 + BR callbackasm1(SB) + MOVD $481, R11 + BR callbackasm1(SB) + MOVD $482, R11 + BR callbackasm1(SB) + MOVD $483, R11 + BR callbackasm1(SB) + MOVD $484, R11 + BR callbackasm1(SB) + MOVD $485, R11 + BR callbackasm1(SB) + MOVD $486, R11 + BR callbackasm1(SB) + MOVD $487, R11 + BR callbackasm1(SB) + MOVD $488, R11 + BR callbackasm1(SB) + MOVD $489, R11 + BR callbackasm1(SB) + MOVD $490, R11 + BR callbackasm1(SB) + MOVD $491, R11 + BR callbackasm1(SB) + MOVD $492, R11 + BR callbackasm1(SB) + MOVD $493, R11 + BR callbackasm1(SB) + MOVD $494, R11 + BR callbackasm1(SB) + MOVD $495, R11 + BR callbackasm1(SB) + MOVD $496, R11 + BR callbackasm1(SB) + MOVD $497, R11 + BR callbackasm1(SB) + MOVD $498, R11 + BR callbackasm1(SB) + MOVD $499, R11 + BR callbackasm1(SB) + MOVD $500, R11 + BR callbackasm1(SB) + MOVD $501, R11 + BR callbackasm1(SB) + MOVD $502, R11 + BR callbackasm1(SB) + MOVD $503, R11 + BR callbackasm1(SB) + MOVD $504, R11 + BR callbackasm1(SB) + MOVD $505, R11 + BR callbackasm1(SB) + MOVD $506, R11 + BR callbackasm1(SB) + MOVD $507, R11 + BR callbackasm1(SB) + MOVD $508, R11 + BR callbackasm1(SB) + MOVD $509, R11 + BR callbackasm1(SB) + MOVD $510, R11 + BR callbackasm1(SB) + MOVD $511, R11 + BR callbackasm1(SB) + MOVD $512, R11 + BR callbackasm1(SB) + MOVD $513, R11 + BR callbackasm1(SB) + MOVD $514, R11 + BR callbackasm1(SB) + MOVD $515, R11 + BR callbackasm1(SB) + MOVD $516, R11 + BR callbackasm1(SB) + MOVD $517, R11 + BR callbackasm1(SB) + MOVD $518, R11 + BR callbackasm1(SB) + MOVD $519, R11 + BR callbackasm1(SB) + MOVD $520, R11 + BR callbackasm1(SB) + MOVD $521, R11 + BR callbackasm1(SB) + MOVD $522, R11 + BR callbackasm1(SB) + MOVD $523, R11 + BR callbackasm1(SB) + MOVD $524, R11 + BR callbackasm1(SB) + MOVD $525, R11 + BR callbackasm1(SB) + MOVD $526, R11 + BR callbackasm1(SB) + MOVD $527, R11 + BR callbackasm1(SB) + MOVD $528, R11 + BR callbackasm1(SB) + MOVD $529, R11 + BR callbackasm1(SB) + MOVD $530, R11 + BR callbackasm1(SB) + MOVD $531, R11 + BR callbackasm1(SB) + MOVD $532, R11 + BR callbackasm1(SB) + MOVD $533, R11 + BR callbackasm1(SB) + MOVD $534, R11 + BR callbackasm1(SB) + MOVD $535, R11 + BR callbackasm1(SB) + MOVD $536, R11 + BR callbackasm1(SB) + MOVD $537, R11 + BR callbackasm1(SB) + MOVD $538, R11 + BR callbackasm1(SB) + MOVD $539, R11 + BR callbackasm1(SB) + MOVD $540, R11 + BR callbackasm1(SB) + MOVD $541, R11 + BR callbackasm1(SB) + MOVD $542, R11 + BR callbackasm1(SB) + MOVD $543, R11 + BR callbackasm1(SB) + MOVD $544, R11 + BR callbackasm1(SB) + MOVD $545, R11 + BR callbackasm1(SB) + MOVD $546, R11 + BR callbackasm1(SB) + MOVD $547, R11 + BR callbackasm1(SB) + MOVD $548, R11 + BR callbackasm1(SB) + MOVD $549, R11 + BR callbackasm1(SB) + MOVD $550, R11 + BR callbackasm1(SB) + MOVD $551, R11 + BR callbackasm1(SB) + MOVD $552, R11 + BR callbackasm1(SB) + MOVD $553, R11 + BR callbackasm1(SB) + MOVD $554, R11 + BR callbackasm1(SB) + MOVD $555, R11 + BR callbackasm1(SB) + MOVD $556, R11 + BR callbackasm1(SB) + MOVD $557, R11 + BR callbackasm1(SB) + MOVD $558, R11 + BR callbackasm1(SB) + MOVD $559, R11 + BR callbackasm1(SB) + MOVD $560, R11 + BR callbackasm1(SB) + MOVD $561, R11 + BR callbackasm1(SB) + MOVD $562, R11 + BR callbackasm1(SB) + MOVD $563, R11 + BR callbackasm1(SB) + MOVD $564, R11 + BR callbackasm1(SB) + MOVD $565, R11 + BR callbackasm1(SB) + MOVD $566, R11 + BR callbackasm1(SB) + MOVD $567, R11 + BR callbackasm1(SB) + MOVD $568, R11 + BR callbackasm1(SB) + MOVD $569, R11 + BR callbackasm1(SB) + MOVD $570, R11 + BR callbackasm1(SB) + MOVD $571, R11 + BR callbackasm1(SB) + MOVD $572, R11 + BR callbackasm1(SB) + MOVD $573, R11 + BR callbackasm1(SB) + MOVD $574, R11 + BR callbackasm1(SB) + MOVD $575, R11 + BR callbackasm1(SB) + MOVD $576, R11 + BR callbackasm1(SB) + MOVD $577, R11 + BR callbackasm1(SB) + MOVD $578, R11 + BR callbackasm1(SB) + MOVD $579, R11 + BR callbackasm1(SB) + MOVD $580, R11 + BR callbackasm1(SB) + MOVD $581, R11 + BR callbackasm1(SB) + MOVD $582, R11 + BR callbackasm1(SB) + MOVD $583, R11 + BR callbackasm1(SB) + MOVD $584, R11 + BR callbackasm1(SB) + MOVD $585, R11 + BR callbackasm1(SB) + MOVD $586, R11 + BR callbackasm1(SB) + MOVD $587, R11 + BR callbackasm1(SB) + MOVD $588, R11 + BR callbackasm1(SB) + MOVD $589, R11 + BR callbackasm1(SB) + MOVD $590, R11 + BR callbackasm1(SB) + MOVD $591, R11 + BR callbackasm1(SB) + MOVD $592, R11 + BR callbackasm1(SB) + MOVD $593, R11 + BR callbackasm1(SB) + MOVD $594, R11 + BR callbackasm1(SB) + MOVD $595, R11 + BR callbackasm1(SB) + MOVD $596, R11 + BR callbackasm1(SB) + MOVD $597, R11 + BR callbackasm1(SB) + MOVD $598, R11 + BR callbackasm1(SB) + MOVD $599, R11 + BR callbackasm1(SB) + MOVD $600, R11 + BR callbackasm1(SB) + MOVD $601, R11 + BR callbackasm1(SB) + MOVD $602, R11 + BR callbackasm1(SB) + MOVD $603, R11 + BR callbackasm1(SB) + MOVD $604, R11 + BR callbackasm1(SB) + MOVD $605, R11 + BR callbackasm1(SB) + MOVD $606, R11 + BR callbackasm1(SB) + MOVD $607, R11 + BR callbackasm1(SB) + MOVD $608, R11 + BR callbackasm1(SB) + MOVD $609, R11 + BR callbackasm1(SB) + MOVD $610, R11 + BR callbackasm1(SB) + MOVD $611, R11 + BR callbackasm1(SB) + MOVD $612, R11 + BR callbackasm1(SB) + MOVD $613, R11 + BR callbackasm1(SB) + MOVD $614, R11 + BR callbackasm1(SB) + MOVD $615, R11 + BR callbackasm1(SB) + MOVD $616, R11 + BR callbackasm1(SB) + MOVD $617, R11 + BR callbackasm1(SB) + MOVD $618, R11 + BR callbackasm1(SB) + MOVD $619, R11 + BR callbackasm1(SB) + MOVD $620, R11 + BR callbackasm1(SB) + MOVD $621, R11 + BR callbackasm1(SB) + MOVD $622, R11 + BR callbackasm1(SB) + MOVD $623, R11 + BR callbackasm1(SB) + MOVD $624, R11 + BR callbackasm1(SB) + MOVD $625, R11 + BR callbackasm1(SB) + MOVD $626, R11 + BR callbackasm1(SB) + MOVD $627, R11 + BR callbackasm1(SB) + MOVD $628, R11 + BR callbackasm1(SB) + MOVD $629, R11 + BR callbackasm1(SB) + MOVD $630, R11 + BR callbackasm1(SB) + MOVD $631, R11 + BR callbackasm1(SB) + MOVD $632, R11 + BR callbackasm1(SB) + MOVD $633, R11 + BR callbackasm1(SB) + MOVD $634, R11 + BR callbackasm1(SB) + MOVD $635, R11 + BR callbackasm1(SB) + MOVD $636, R11 + BR callbackasm1(SB) + MOVD $637, R11 + BR callbackasm1(SB) + MOVD $638, R11 + BR callbackasm1(SB) + MOVD $639, R11 + BR callbackasm1(SB) + MOVD $640, R11 + BR callbackasm1(SB) + MOVD $641, R11 + BR callbackasm1(SB) + MOVD $642, R11 + BR callbackasm1(SB) + MOVD $643, R11 + BR callbackasm1(SB) + MOVD $644, R11 + BR callbackasm1(SB) + MOVD $645, R11 + BR callbackasm1(SB) + MOVD $646, R11 + BR callbackasm1(SB) + MOVD $647, R11 + BR callbackasm1(SB) + MOVD $648, R11 + BR callbackasm1(SB) + MOVD $649, R11 + BR callbackasm1(SB) + MOVD $650, R11 + BR callbackasm1(SB) + MOVD $651, R11 + BR callbackasm1(SB) + MOVD $652, R11 + BR callbackasm1(SB) + MOVD $653, R11 + BR callbackasm1(SB) + MOVD $654, R11 + BR callbackasm1(SB) + MOVD $655, R11 + BR callbackasm1(SB) + MOVD $656, R11 + BR callbackasm1(SB) + MOVD $657, R11 + BR callbackasm1(SB) + MOVD $658, R11 + BR callbackasm1(SB) + MOVD $659, R11 + BR callbackasm1(SB) + MOVD $660, R11 + BR callbackasm1(SB) + MOVD $661, R11 + BR callbackasm1(SB) + MOVD $662, R11 + BR callbackasm1(SB) + MOVD $663, R11 + BR callbackasm1(SB) + MOVD $664, R11 + BR callbackasm1(SB) + MOVD $665, R11 + BR callbackasm1(SB) + MOVD $666, R11 + BR callbackasm1(SB) + MOVD $667, R11 + BR callbackasm1(SB) + MOVD $668, R11 + BR callbackasm1(SB) + MOVD $669, R11 + BR callbackasm1(SB) + MOVD $670, R11 + BR callbackasm1(SB) + MOVD $671, R11 + BR callbackasm1(SB) + MOVD $672, R11 + BR callbackasm1(SB) + MOVD $673, R11 + BR callbackasm1(SB) + MOVD $674, R11 + BR callbackasm1(SB) + MOVD $675, R11 + BR callbackasm1(SB) + MOVD $676, R11 + BR callbackasm1(SB) + MOVD $677, R11 + BR callbackasm1(SB) + MOVD $678, R11 + BR callbackasm1(SB) + MOVD $679, R11 + BR callbackasm1(SB) + MOVD $680, R11 + BR callbackasm1(SB) + MOVD $681, R11 + BR callbackasm1(SB) + MOVD $682, R11 + BR callbackasm1(SB) + MOVD $683, R11 + BR callbackasm1(SB) + MOVD $684, R11 + BR callbackasm1(SB) + MOVD $685, R11 + BR callbackasm1(SB) + MOVD $686, R11 + BR callbackasm1(SB) + MOVD $687, R11 + BR callbackasm1(SB) + MOVD $688, R11 + BR callbackasm1(SB) + MOVD $689, R11 + BR callbackasm1(SB) + MOVD $690, R11 + BR callbackasm1(SB) + MOVD $691, R11 + BR callbackasm1(SB) + MOVD $692, R11 + BR callbackasm1(SB) + MOVD $693, R11 + BR callbackasm1(SB) + MOVD $694, R11 + BR callbackasm1(SB) + MOVD $695, R11 + BR callbackasm1(SB) + MOVD $696, R11 + BR callbackasm1(SB) + MOVD $697, R11 + BR callbackasm1(SB) + MOVD $698, R11 + BR callbackasm1(SB) + MOVD $699, R11 + BR callbackasm1(SB) + MOVD $700, R11 + BR callbackasm1(SB) + MOVD $701, R11 + BR callbackasm1(SB) + MOVD $702, R11 + BR callbackasm1(SB) + MOVD $703, R11 + BR callbackasm1(SB) + MOVD $704, R11 + BR callbackasm1(SB) + MOVD $705, R11 + BR callbackasm1(SB) + MOVD $706, R11 + BR callbackasm1(SB) + MOVD $707, R11 + BR callbackasm1(SB) + MOVD $708, R11 + BR callbackasm1(SB) + MOVD $709, R11 + BR callbackasm1(SB) + MOVD $710, R11 + BR callbackasm1(SB) + MOVD $711, R11 + BR callbackasm1(SB) + MOVD $712, R11 + BR callbackasm1(SB) + MOVD $713, R11 + BR callbackasm1(SB) + MOVD $714, R11 + BR callbackasm1(SB) + MOVD $715, R11 + BR callbackasm1(SB) + MOVD $716, R11 + BR callbackasm1(SB) + MOVD $717, R11 + BR callbackasm1(SB) + MOVD $718, R11 + BR callbackasm1(SB) + MOVD $719, R11 + BR callbackasm1(SB) + MOVD $720, R11 + BR callbackasm1(SB) + MOVD $721, R11 + BR callbackasm1(SB) + MOVD $722, R11 + BR callbackasm1(SB) + MOVD $723, R11 + BR callbackasm1(SB) + MOVD $724, R11 + BR callbackasm1(SB) + MOVD $725, R11 + BR callbackasm1(SB) + MOVD $726, R11 + BR callbackasm1(SB) + MOVD $727, R11 + BR callbackasm1(SB) + MOVD $728, R11 + BR callbackasm1(SB) + MOVD $729, R11 + BR callbackasm1(SB) + MOVD $730, R11 + BR callbackasm1(SB) + MOVD $731, R11 + BR callbackasm1(SB) + MOVD $732, R11 + BR callbackasm1(SB) + MOVD $733, R11 + BR callbackasm1(SB) + MOVD $734, R11 + BR callbackasm1(SB) + MOVD $735, R11 + BR callbackasm1(SB) + MOVD $736, R11 + BR callbackasm1(SB) + MOVD $737, R11 + BR callbackasm1(SB) + MOVD $738, R11 + BR callbackasm1(SB) + MOVD $739, R11 + BR callbackasm1(SB) + MOVD $740, R11 + BR callbackasm1(SB) + MOVD $741, R11 + BR callbackasm1(SB) + MOVD $742, R11 + BR callbackasm1(SB) + MOVD $743, R11 + BR callbackasm1(SB) + MOVD $744, R11 + BR callbackasm1(SB) + MOVD $745, R11 + BR callbackasm1(SB) + MOVD $746, R11 + BR callbackasm1(SB) + MOVD $747, R11 + BR callbackasm1(SB) + MOVD $748, R11 + BR callbackasm1(SB) + MOVD $749, R11 + BR callbackasm1(SB) + MOVD $750, R11 + BR callbackasm1(SB) + MOVD $751, R11 + BR callbackasm1(SB) + MOVD $752, R11 + BR callbackasm1(SB) + MOVD $753, R11 + BR callbackasm1(SB) + MOVD $754, R11 + BR callbackasm1(SB) + MOVD $755, R11 + BR callbackasm1(SB) + MOVD $756, R11 + BR callbackasm1(SB) + MOVD $757, R11 + BR callbackasm1(SB) + MOVD $758, R11 + BR callbackasm1(SB) + MOVD $759, R11 + BR callbackasm1(SB) + MOVD $760, R11 + BR callbackasm1(SB) + MOVD $761, R11 + BR callbackasm1(SB) + MOVD $762, R11 + BR callbackasm1(SB) + MOVD $763, R11 + BR callbackasm1(SB) + MOVD $764, R11 + BR callbackasm1(SB) + MOVD $765, R11 + BR callbackasm1(SB) + MOVD $766, R11 + BR callbackasm1(SB) + MOVD $767, R11 + BR callbackasm1(SB) + MOVD $768, R11 + BR callbackasm1(SB) + MOVD $769, R11 + BR callbackasm1(SB) + MOVD $770, R11 + BR callbackasm1(SB) + MOVD $771, R11 + BR callbackasm1(SB) + MOVD $772, R11 + BR callbackasm1(SB) + MOVD $773, R11 + BR callbackasm1(SB) + MOVD $774, R11 + BR callbackasm1(SB) + MOVD $775, R11 + BR callbackasm1(SB) + MOVD $776, R11 + BR callbackasm1(SB) + MOVD $777, R11 + BR callbackasm1(SB) + MOVD $778, R11 + BR callbackasm1(SB) + MOVD $779, R11 + BR callbackasm1(SB) + MOVD $780, R11 + BR callbackasm1(SB) + MOVD $781, R11 + BR callbackasm1(SB) + MOVD $782, R11 + BR callbackasm1(SB) + MOVD $783, R11 + BR callbackasm1(SB) + MOVD $784, R11 + BR callbackasm1(SB) + MOVD $785, R11 + BR callbackasm1(SB) + MOVD $786, R11 + BR callbackasm1(SB) + MOVD $787, R11 + BR callbackasm1(SB) + MOVD $788, R11 + BR callbackasm1(SB) + MOVD $789, R11 + BR callbackasm1(SB) + MOVD $790, R11 + BR callbackasm1(SB) + MOVD $791, R11 + BR callbackasm1(SB) + MOVD $792, R11 + BR callbackasm1(SB) + MOVD $793, R11 + BR callbackasm1(SB) + MOVD $794, R11 + BR callbackasm1(SB) + MOVD $795, R11 + BR callbackasm1(SB) + MOVD $796, R11 + BR callbackasm1(SB) + MOVD $797, R11 + BR callbackasm1(SB) + MOVD $798, R11 + BR callbackasm1(SB) + MOVD $799, R11 + BR callbackasm1(SB) + MOVD $800, R11 + BR callbackasm1(SB) + MOVD $801, R11 + BR callbackasm1(SB) + MOVD $802, R11 + BR callbackasm1(SB) + MOVD $803, R11 + BR callbackasm1(SB) + MOVD $804, R11 + BR callbackasm1(SB) + MOVD $805, R11 + BR callbackasm1(SB) + MOVD $806, R11 + BR callbackasm1(SB) + MOVD $807, R11 + BR callbackasm1(SB) + MOVD $808, R11 + BR callbackasm1(SB) + MOVD $809, R11 + BR callbackasm1(SB) + MOVD $810, R11 + BR callbackasm1(SB) + MOVD $811, R11 + BR callbackasm1(SB) + MOVD $812, R11 + BR callbackasm1(SB) + MOVD $813, R11 + BR callbackasm1(SB) + MOVD $814, R11 + BR callbackasm1(SB) + MOVD $815, R11 + BR callbackasm1(SB) + MOVD $816, R11 + BR callbackasm1(SB) + MOVD $817, R11 + BR callbackasm1(SB) + MOVD $818, R11 + BR callbackasm1(SB) + MOVD $819, R11 + BR callbackasm1(SB) + MOVD $820, R11 + BR callbackasm1(SB) + MOVD $821, R11 + BR callbackasm1(SB) + MOVD $822, R11 + BR callbackasm1(SB) + MOVD $823, R11 + BR callbackasm1(SB) + MOVD $824, R11 + BR callbackasm1(SB) + MOVD $825, R11 + BR callbackasm1(SB) + MOVD $826, R11 + BR callbackasm1(SB) + MOVD $827, R11 + BR callbackasm1(SB) + MOVD $828, R11 + BR callbackasm1(SB) + MOVD $829, R11 + BR callbackasm1(SB) + MOVD $830, R11 + BR callbackasm1(SB) + MOVD $831, R11 + BR callbackasm1(SB) + MOVD $832, R11 + BR callbackasm1(SB) + MOVD $833, R11 + BR callbackasm1(SB) + MOVD $834, R11 + BR callbackasm1(SB) + MOVD $835, R11 + BR callbackasm1(SB) + MOVD $836, R11 + BR callbackasm1(SB) + MOVD $837, R11 + BR callbackasm1(SB) + MOVD $838, R11 + BR callbackasm1(SB) + MOVD $839, R11 + BR callbackasm1(SB) + MOVD $840, R11 + BR callbackasm1(SB) + MOVD $841, R11 + BR callbackasm1(SB) + MOVD $842, R11 + BR callbackasm1(SB) + MOVD $843, R11 + BR callbackasm1(SB) + MOVD $844, R11 + BR callbackasm1(SB) + MOVD $845, R11 + BR callbackasm1(SB) + MOVD $846, R11 + BR callbackasm1(SB) + MOVD $847, R11 + BR callbackasm1(SB) + MOVD $848, R11 + BR callbackasm1(SB) + MOVD $849, R11 + BR callbackasm1(SB) + MOVD $850, R11 + BR callbackasm1(SB) + MOVD $851, R11 + BR callbackasm1(SB) + MOVD $852, R11 + BR callbackasm1(SB) + MOVD $853, R11 + BR callbackasm1(SB) + MOVD $854, R11 + BR callbackasm1(SB) + MOVD $855, R11 + BR callbackasm1(SB) + MOVD $856, R11 + BR callbackasm1(SB) + MOVD $857, R11 + BR callbackasm1(SB) + MOVD $858, R11 + BR callbackasm1(SB) + MOVD $859, R11 + BR callbackasm1(SB) + MOVD $860, R11 + BR callbackasm1(SB) + MOVD $861, R11 + BR callbackasm1(SB) + MOVD $862, R11 + BR callbackasm1(SB) + MOVD $863, R11 + BR callbackasm1(SB) + MOVD $864, R11 + BR callbackasm1(SB) + MOVD $865, R11 + BR callbackasm1(SB) + MOVD $866, R11 + BR callbackasm1(SB) + MOVD $867, R11 + BR callbackasm1(SB) + MOVD $868, R11 + BR callbackasm1(SB) + MOVD $869, R11 + BR callbackasm1(SB) + MOVD $870, R11 + BR callbackasm1(SB) + MOVD $871, R11 + BR callbackasm1(SB) + MOVD $872, R11 + BR callbackasm1(SB) + MOVD $873, R11 + BR callbackasm1(SB) + MOVD $874, R11 + BR callbackasm1(SB) + MOVD $875, R11 + BR callbackasm1(SB) + MOVD $876, R11 + BR callbackasm1(SB) + MOVD $877, R11 + BR callbackasm1(SB) + MOVD $878, R11 + BR callbackasm1(SB) + MOVD $879, R11 + BR callbackasm1(SB) + MOVD $880, R11 + BR callbackasm1(SB) + MOVD $881, R11 + BR callbackasm1(SB) + MOVD $882, R11 + BR callbackasm1(SB) + MOVD $883, R11 + BR callbackasm1(SB) + MOVD $884, R11 + BR callbackasm1(SB) + MOVD $885, R11 + BR callbackasm1(SB) + MOVD $886, R11 + BR callbackasm1(SB) + MOVD $887, R11 + BR callbackasm1(SB) + MOVD $888, R11 + BR callbackasm1(SB) + MOVD $889, R11 + BR callbackasm1(SB) + MOVD $890, R11 + BR callbackasm1(SB) + MOVD $891, R11 + BR callbackasm1(SB) + MOVD $892, R11 + BR callbackasm1(SB) + MOVD $893, R11 + BR callbackasm1(SB) + MOVD $894, R11 + BR callbackasm1(SB) + MOVD $895, R11 + BR callbackasm1(SB) + MOVD $896, R11 + BR callbackasm1(SB) + MOVD $897, R11 + BR callbackasm1(SB) + MOVD $898, R11 + BR callbackasm1(SB) + MOVD $899, R11 + BR callbackasm1(SB) + MOVD $900, R11 + BR callbackasm1(SB) + MOVD $901, R11 + BR callbackasm1(SB) + MOVD $902, R11 + BR callbackasm1(SB) + MOVD $903, R11 + BR callbackasm1(SB) + MOVD $904, R11 + BR callbackasm1(SB) + MOVD $905, R11 + BR callbackasm1(SB) + MOVD $906, R11 + BR callbackasm1(SB) + MOVD $907, R11 + BR callbackasm1(SB) + MOVD $908, R11 + BR callbackasm1(SB) + MOVD $909, R11 + BR callbackasm1(SB) + MOVD $910, R11 + BR callbackasm1(SB) + MOVD $911, R11 + BR callbackasm1(SB) + MOVD $912, R11 + BR callbackasm1(SB) + MOVD $913, R11 + BR callbackasm1(SB) + MOVD $914, R11 + BR callbackasm1(SB) + MOVD $915, R11 + BR callbackasm1(SB) + MOVD $916, R11 + BR callbackasm1(SB) + MOVD $917, R11 + BR callbackasm1(SB) + MOVD $918, R11 + BR callbackasm1(SB) + MOVD $919, R11 + BR callbackasm1(SB) + MOVD $920, R11 + BR callbackasm1(SB) + MOVD $921, R11 + BR callbackasm1(SB) + MOVD $922, R11 + BR callbackasm1(SB) + MOVD $923, R11 + BR callbackasm1(SB) + MOVD $924, R11 + BR callbackasm1(SB) + MOVD $925, R11 + BR callbackasm1(SB) + MOVD $926, R11 + BR callbackasm1(SB) + MOVD $927, R11 + BR callbackasm1(SB) + MOVD $928, R11 + BR callbackasm1(SB) + MOVD $929, R11 + BR callbackasm1(SB) + MOVD $930, R11 + BR callbackasm1(SB) + MOVD $931, R11 + BR callbackasm1(SB) + MOVD $932, R11 + BR callbackasm1(SB) + MOVD $933, R11 + BR callbackasm1(SB) + MOVD $934, R11 + BR callbackasm1(SB) + MOVD $935, R11 + BR callbackasm1(SB) + MOVD $936, R11 + BR callbackasm1(SB) + MOVD $937, R11 + BR callbackasm1(SB) + MOVD $938, R11 + BR callbackasm1(SB) + MOVD $939, R11 + BR callbackasm1(SB) + MOVD $940, R11 + BR callbackasm1(SB) + MOVD $941, R11 + BR callbackasm1(SB) + MOVD $942, R11 + BR callbackasm1(SB) + MOVD $943, R11 + BR callbackasm1(SB) + MOVD $944, R11 + BR callbackasm1(SB) + MOVD $945, R11 + BR callbackasm1(SB) + MOVD $946, R11 + BR callbackasm1(SB) + MOVD $947, R11 + BR callbackasm1(SB) + MOVD $948, R11 + BR callbackasm1(SB) + MOVD $949, R11 + BR callbackasm1(SB) + MOVD $950, R11 + BR callbackasm1(SB) + MOVD $951, R11 + BR callbackasm1(SB) + MOVD $952, R11 + BR callbackasm1(SB) + MOVD $953, R11 + BR callbackasm1(SB) + MOVD $954, R11 + BR callbackasm1(SB) + MOVD $955, R11 + BR callbackasm1(SB) + MOVD $956, R11 + BR callbackasm1(SB) + MOVD $957, R11 + BR callbackasm1(SB) + MOVD $958, R11 + BR callbackasm1(SB) + MOVD $959, R11 + BR callbackasm1(SB) + MOVD $960, R11 + BR callbackasm1(SB) + MOVD $961, R11 + BR callbackasm1(SB) + MOVD $962, R11 + BR callbackasm1(SB) + MOVD $963, R11 + BR callbackasm1(SB) + MOVD $964, R11 + BR callbackasm1(SB) + MOVD $965, R11 + BR callbackasm1(SB) + MOVD $966, R11 + BR callbackasm1(SB) + MOVD $967, R11 + BR callbackasm1(SB) + MOVD $968, R11 + BR callbackasm1(SB) + MOVD $969, R11 + BR callbackasm1(SB) + MOVD $970, R11 + BR callbackasm1(SB) + MOVD $971, R11 + BR callbackasm1(SB) + MOVD $972, R11 + BR callbackasm1(SB) + MOVD $973, R11 + BR callbackasm1(SB) + MOVD $974, R11 + BR callbackasm1(SB) + MOVD $975, R11 + BR callbackasm1(SB) + MOVD $976, R11 + BR callbackasm1(SB) + MOVD $977, R11 + BR callbackasm1(SB) + MOVD $978, R11 + BR callbackasm1(SB) + MOVD $979, R11 + BR callbackasm1(SB) + MOVD $980, R11 + BR callbackasm1(SB) + MOVD $981, R11 + BR callbackasm1(SB) + MOVD $982, R11 + BR callbackasm1(SB) + MOVD $983, R11 + BR callbackasm1(SB) + MOVD $984, R11 + BR callbackasm1(SB) + MOVD $985, R11 + BR callbackasm1(SB) + MOVD $986, R11 + BR callbackasm1(SB) + MOVD $987, R11 + BR callbackasm1(SB) + MOVD $988, R11 + BR callbackasm1(SB) + MOVD $989, R11 + BR callbackasm1(SB) + MOVD $990, R11 + BR callbackasm1(SB) + MOVD $991, R11 + BR callbackasm1(SB) + MOVD $992, R11 + BR callbackasm1(SB) + MOVD $993, R11 + BR callbackasm1(SB) + MOVD $994, R11 + BR callbackasm1(SB) + MOVD $995, R11 + BR callbackasm1(SB) + MOVD $996, R11 + BR callbackasm1(SB) + MOVD $997, R11 + BR callbackasm1(SB) + MOVD $998, R11 + BR callbackasm1(SB) + MOVD $999, R11 + BR callbackasm1(SB) + MOVD $1000, R11 + BR callbackasm1(SB) + MOVD $1001, R11 + BR callbackasm1(SB) + MOVD $1002, R11 + BR callbackasm1(SB) + MOVD $1003, R11 + BR callbackasm1(SB) + MOVD $1004, R11 + BR callbackasm1(SB) + MOVD $1005, R11 + BR callbackasm1(SB) + MOVD $1006, R11 + BR callbackasm1(SB) + MOVD $1007, R11 + BR callbackasm1(SB) + MOVD $1008, R11 + BR callbackasm1(SB) + MOVD $1009, R11 + BR callbackasm1(SB) + MOVD $1010, R11 + BR callbackasm1(SB) + MOVD $1011, R11 + BR callbackasm1(SB) + MOVD $1012, R11 + BR callbackasm1(SB) + MOVD $1013, R11 + BR callbackasm1(SB) + MOVD $1014, R11 + BR callbackasm1(SB) + MOVD $1015, R11 + BR callbackasm1(SB) + MOVD $1016, R11 + BR callbackasm1(SB) + MOVD $1017, R11 + BR callbackasm1(SB) + MOVD $1018, R11 + BR callbackasm1(SB) + MOVD $1019, R11 + BR callbackasm1(SB) + MOVD $1020, R11 + BR callbackasm1(SB) + MOVD $1021, R11 + BR callbackasm1(SB) + MOVD $1022, R11 + BR callbackasm1(SB) + MOVD $1023, R11 + BR callbackasm1(SB) + MOVD $1024, R11 + BR callbackasm1(SB) + MOVD $1025, R11 + BR callbackasm1(SB) + MOVD $1026, R11 + BR callbackasm1(SB) + MOVD $1027, R11 + BR callbackasm1(SB) + MOVD $1028, R11 + BR callbackasm1(SB) + MOVD $1029, R11 + BR callbackasm1(SB) + MOVD $1030, R11 + BR callbackasm1(SB) + MOVD $1031, R11 + BR callbackasm1(SB) + MOVD $1032, R11 + BR callbackasm1(SB) + MOVD $1033, R11 + BR callbackasm1(SB) + MOVD $1034, R11 + BR callbackasm1(SB) + MOVD $1035, R11 + BR callbackasm1(SB) + MOVD $1036, R11 + BR callbackasm1(SB) + MOVD $1037, R11 + BR callbackasm1(SB) + MOVD $1038, R11 + BR callbackasm1(SB) + MOVD $1039, R11 + BR callbackasm1(SB) + MOVD $1040, R11 + BR callbackasm1(SB) + MOVD $1041, R11 + BR callbackasm1(SB) + MOVD $1042, R11 + BR callbackasm1(SB) + MOVD $1043, R11 + BR callbackasm1(SB) + MOVD $1044, R11 + BR callbackasm1(SB) + MOVD $1045, R11 + BR callbackasm1(SB) + MOVD $1046, R11 + BR callbackasm1(SB) + MOVD $1047, R11 + BR callbackasm1(SB) + MOVD $1048, R11 + BR callbackasm1(SB) + MOVD $1049, R11 + BR callbackasm1(SB) + MOVD $1050, R11 + BR callbackasm1(SB) + MOVD $1051, R11 + BR callbackasm1(SB) + MOVD $1052, R11 + BR callbackasm1(SB) + MOVD $1053, R11 + BR callbackasm1(SB) + MOVD $1054, R11 + BR callbackasm1(SB) + MOVD $1055, R11 + BR callbackasm1(SB) + MOVD $1056, R11 + BR callbackasm1(SB) + MOVD $1057, R11 + BR callbackasm1(SB) + MOVD $1058, R11 + BR callbackasm1(SB) + MOVD $1059, R11 + BR callbackasm1(SB) + MOVD $1060, R11 + BR callbackasm1(SB) + MOVD $1061, R11 + BR callbackasm1(SB) + MOVD $1062, R11 + BR callbackasm1(SB) + MOVD $1063, R11 + BR callbackasm1(SB) + MOVD $1064, R11 + BR callbackasm1(SB) + MOVD $1065, R11 + BR callbackasm1(SB) + MOVD $1066, R11 + BR callbackasm1(SB) + MOVD $1067, R11 + BR callbackasm1(SB) + MOVD $1068, R11 + BR callbackasm1(SB) + MOVD $1069, R11 + BR callbackasm1(SB) + MOVD $1070, R11 + BR callbackasm1(SB) + MOVD $1071, R11 + BR callbackasm1(SB) + MOVD $1072, R11 + BR callbackasm1(SB) + MOVD $1073, R11 + BR callbackasm1(SB) + MOVD $1074, R11 + BR callbackasm1(SB) + MOVD $1075, R11 + BR callbackasm1(SB) + MOVD $1076, R11 + BR callbackasm1(SB) + MOVD $1077, R11 + BR callbackasm1(SB) + MOVD $1078, R11 + BR callbackasm1(SB) + MOVD $1079, R11 + BR callbackasm1(SB) + MOVD $1080, R11 + BR callbackasm1(SB) + MOVD $1081, R11 + BR callbackasm1(SB) + MOVD $1082, R11 + BR callbackasm1(SB) + MOVD $1083, R11 + BR callbackasm1(SB) + MOVD $1084, R11 + BR callbackasm1(SB) + MOVD $1085, R11 + BR callbackasm1(SB) + MOVD $1086, R11 + BR callbackasm1(SB) + MOVD $1087, R11 + BR callbackasm1(SB) + MOVD $1088, R11 + BR callbackasm1(SB) + MOVD $1089, R11 + BR callbackasm1(SB) + MOVD $1090, R11 + BR callbackasm1(SB) + MOVD $1091, R11 + BR callbackasm1(SB) + MOVD $1092, R11 + BR callbackasm1(SB) + MOVD $1093, R11 + BR callbackasm1(SB) + MOVD $1094, R11 + BR callbackasm1(SB) + MOVD $1095, R11 + BR callbackasm1(SB) + MOVD $1096, R11 + BR callbackasm1(SB) + MOVD $1097, R11 + BR callbackasm1(SB) + MOVD $1098, R11 + BR callbackasm1(SB) + MOVD $1099, R11 + BR callbackasm1(SB) + MOVD $1100, R11 + BR callbackasm1(SB) + MOVD $1101, R11 + BR callbackasm1(SB) + MOVD $1102, R11 + BR callbackasm1(SB) + MOVD $1103, R11 + BR callbackasm1(SB) + MOVD $1104, R11 + BR callbackasm1(SB) + MOVD $1105, R11 + BR callbackasm1(SB) + MOVD $1106, R11 + BR callbackasm1(SB) + MOVD $1107, R11 + BR callbackasm1(SB) + MOVD $1108, R11 + BR callbackasm1(SB) + MOVD $1109, R11 + BR callbackasm1(SB) + MOVD $1110, R11 + BR callbackasm1(SB) + MOVD $1111, R11 + BR callbackasm1(SB) + MOVD $1112, R11 + BR callbackasm1(SB) + MOVD $1113, R11 + BR callbackasm1(SB) + MOVD $1114, R11 + BR callbackasm1(SB) + MOVD $1115, R11 + BR callbackasm1(SB) + MOVD $1116, R11 + BR callbackasm1(SB) + MOVD $1117, R11 + BR callbackasm1(SB) + MOVD $1118, R11 + BR callbackasm1(SB) + MOVD $1119, R11 + BR callbackasm1(SB) + MOVD $1120, R11 + BR callbackasm1(SB) + MOVD $1121, R11 + BR callbackasm1(SB) + MOVD $1122, R11 + BR callbackasm1(SB) + MOVD $1123, R11 + BR callbackasm1(SB) + MOVD $1124, R11 + BR callbackasm1(SB) + MOVD $1125, R11 + BR callbackasm1(SB) + MOVD $1126, R11 + BR callbackasm1(SB) + MOVD $1127, R11 + BR callbackasm1(SB) + MOVD $1128, R11 + BR callbackasm1(SB) + MOVD $1129, R11 + BR callbackasm1(SB) + MOVD $1130, R11 + BR callbackasm1(SB) + MOVD $1131, R11 + BR callbackasm1(SB) + MOVD $1132, R11 + BR callbackasm1(SB) + MOVD $1133, R11 + BR callbackasm1(SB) + MOVD $1134, R11 + BR callbackasm1(SB) + MOVD $1135, R11 + BR callbackasm1(SB) + MOVD $1136, R11 + BR callbackasm1(SB) + MOVD $1137, R11 + BR callbackasm1(SB) + MOVD $1138, R11 + BR callbackasm1(SB) + MOVD $1139, R11 + BR callbackasm1(SB) + MOVD $1140, R11 + BR callbackasm1(SB) + MOVD $1141, R11 + BR callbackasm1(SB) + MOVD $1142, R11 + BR callbackasm1(SB) + MOVD $1143, R11 + BR callbackasm1(SB) + MOVD $1144, R11 + BR callbackasm1(SB) + MOVD $1145, R11 + BR callbackasm1(SB) + MOVD $1146, R11 + BR callbackasm1(SB) + MOVD $1147, R11 + BR callbackasm1(SB) + MOVD $1148, R11 + BR callbackasm1(SB) + MOVD $1149, R11 + BR callbackasm1(SB) + MOVD $1150, R11 + BR callbackasm1(SB) + MOVD $1151, R11 + BR callbackasm1(SB) + MOVD $1152, R11 + BR callbackasm1(SB) + MOVD $1153, R11 + BR callbackasm1(SB) + MOVD $1154, R11 + BR callbackasm1(SB) + MOVD $1155, R11 + BR callbackasm1(SB) + MOVD $1156, R11 + BR callbackasm1(SB) + MOVD $1157, R11 + BR callbackasm1(SB) + MOVD $1158, R11 + BR callbackasm1(SB) + MOVD $1159, R11 + BR callbackasm1(SB) + MOVD $1160, R11 + BR callbackasm1(SB) + MOVD $1161, R11 + BR callbackasm1(SB) + MOVD $1162, R11 + BR callbackasm1(SB) + MOVD $1163, R11 + BR callbackasm1(SB) + MOVD $1164, R11 + BR callbackasm1(SB) + MOVD $1165, R11 + BR callbackasm1(SB) + MOVD $1166, R11 + BR callbackasm1(SB) + MOVD $1167, R11 + BR callbackasm1(SB) + MOVD $1168, R11 + BR callbackasm1(SB) + MOVD $1169, R11 + BR callbackasm1(SB) + MOVD $1170, R11 + BR callbackasm1(SB) + MOVD $1171, R11 + BR callbackasm1(SB) + MOVD $1172, R11 + BR callbackasm1(SB) + MOVD $1173, R11 + BR callbackasm1(SB) + MOVD $1174, R11 + BR callbackasm1(SB) + MOVD $1175, R11 + BR callbackasm1(SB) + MOVD $1176, R11 + BR callbackasm1(SB) + MOVD $1177, R11 + BR callbackasm1(SB) + MOVD $1178, R11 + BR callbackasm1(SB) + MOVD $1179, R11 + BR callbackasm1(SB) + MOVD $1180, R11 + BR callbackasm1(SB) + MOVD $1181, R11 + BR callbackasm1(SB) + MOVD $1182, R11 + BR callbackasm1(SB) + MOVD $1183, R11 + BR callbackasm1(SB) + MOVD $1184, R11 + BR callbackasm1(SB) + MOVD $1185, R11 + BR callbackasm1(SB) + MOVD $1186, R11 + BR callbackasm1(SB) + MOVD $1187, R11 + BR callbackasm1(SB) + MOVD $1188, R11 + BR callbackasm1(SB) + MOVD $1189, R11 + BR callbackasm1(SB) + MOVD $1190, R11 + BR callbackasm1(SB) + MOVD $1191, R11 + BR callbackasm1(SB) + MOVD $1192, R11 + BR callbackasm1(SB) + MOVD $1193, R11 + BR callbackasm1(SB) + MOVD $1194, R11 + BR callbackasm1(SB) + MOVD $1195, R11 + BR callbackasm1(SB) + MOVD $1196, R11 + BR callbackasm1(SB) + MOVD $1197, R11 + BR callbackasm1(SB) + MOVD $1198, R11 + BR callbackasm1(SB) + MOVD $1199, R11 + BR callbackasm1(SB) + MOVD $1200, R11 + BR callbackasm1(SB) + MOVD $1201, R11 + BR callbackasm1(SB) + MOVD $1202, R11 + BR callbackasm1(SB) + MOVD $1203, R11 + BR callbackasm1(SB) + MOVD $1204, R11 + BR callbackasm1(SB) + MOVD $1205, R11 + BR callbackasm1(SB) + MOVD $1206, R11 + BR callbackasm1(SB) + MOVD $1207, R11 + BR callbackasm1(SB) + MOVD $1208, R11 + BR callbackasm1(SB) + MOVD $1209, R11 + BR callbackasm1(SB) + MOVD $1210, R11 + BR callbackasm1(SB) + MOVD $1211, R11 + BR callbackasm1(SB) + MOVD $1212, R11 + BR callbackasm1(SB) + MOVD $1213, R11 + BR callbackasm1(SB) + MOVD $1214, R11 + BR callbackasm1(SB) + MOVD $1215, R11 + BR callbackasm1(SB) + MOVD $1216, R11 + BR callbackasm1(SB) + MOVD $1217, R11 + BR callbackasm1(SB) + MOVD $1218, R11 + BR callbackasm1(SB) + MOVD $1219, R11 + BR callbackasm1(SB) + MOVD $1220, R11 + BR callbackasm1(SB) + MOVD $1221, R11 + BR callbackasm1(SB) + MOVD $1222, R11 + BR callbackasm1(SB) + MOVD $1223, R11 + BR callbackasm1(SB) + MOVD $1224, R11 + BR callbackasm1(SB) + MOVD $1225, R11 + BR callbackasm1(SB) + MOVD $1226, R11 + BR callbackasm1(SB) + MOVD $1227, R11 + BR callbackasm1(SB) + MOVD $1228, R11 + BR callbackasm1(SB) + MOVD $1229, R11 + BR callbackasm1(SB) + MOVD $1230, R11 + BR callbackasm1(SB) + MOVD $1231, R11 + BR callbackasm1(SB) + MOVD $1232, R11 + BR callbackasm1(SB) + MOVD $1233, R11 + BR callbackasm1(SB) + MOVD $1234, R11 + BR callbackasm1(SB) + MOVD $1235, R11 + BR callbackasm1(SB) + MOVD $1236, R11 + BR callbackasm1(SB) + MOVD $1237, R11 + BR callbackasm1(SB) + MOVD $1238, R11 + BR callbackasm1(SB) + MOVD $1239, R11 + BR callbackasm1(SB) + MOVD $1240, R11 + BR callbackasm1(SB) + MOVD $1241, R11 + BR callbackasm1(SB) + MOVD $1242, R11 + BR callbackasm1(SB) + MOVD $1243, R11 + BR callbackasm1(SB) + MOVD $1244, R11 + BR callbackasm1(SB) + MOVD $1245, R11 + BR callbackasm1(SB) + MOVD $1246, R11 + BR callbackasm1(SB) + MOVD $1247, R11 + BR callbackasm1(SB) + MOVD $1248, R11 + BR callbackasm1(SB) + MOVD $1249, R11 + BR callbackasm1(SB) + MOVD $1250, R11 + BR callbackasm1(SB) + MOVD $1251, R11 + BR callbackasm1(SB) + MOVD $1252, R11 + BR callbackasm1(SB) + MOVD $1253, R11 + BR callbackasm1(SB) + MOVD $1254, R11 + BR callbackasm1(SB) + MOVD $1255, R11 + BR callbackasm1(SB) + MOVD $1256, R11 + BR callbackasm1(SB) + MOVD $1257, R11 + BR callbackasm1(SB) + MOVD $1258, R11 + BR callbackasm1(SB) + MOVD $1259, R11 + BR callbackasm1(SB) + MOVD $1260, R11 + BR callbackasm1(SB) + MOVD $1261, R11 + BR callbackasm1(SB) + MOVD $1262, R11 + BR callbackasm1(SB) + MOVD $1263, R11 + BR callbackasm1(SB) + MOVD $1264, R11 + BR callbackasm1(SB) + MOVD $1265, R11 + BR callbackasm1(SB) + MOVD $1266, R11 + BR callbackasm1(SB) + MOVD $1267, R11 + BR callbackasm1(SB) + MOVD $1268, R11 + BR callbackasm1(SB) + MOVD $1269, R11 + BR callbackasm1(SB) + MOVD $1270, R11 + BR callbackasm1(SB) + MOVD $1271, R11 + BR callbackasm1(SB) + MOVD $1272, R11 + BR callbackasm1(SB) + MOVD $1273, R11 + BR callbackasm1(SB) + MOVD $1274, R11 + BR callbackasm1(SB) + MOVD $1275, R11 + BR callbackasm1(SB) + MOVD $1276, R11 + BR callbackasm1(SB) + MOVD $1277, R11 + BR callbackasm1(SB) + MOVD $1278, R11 + BR callbackasm1(SB) + MOVD $1279, R11 + BR callbackasm1(SB) + MOVD $1280, R11 + BR callbackasm1(SB) + MOVD $1281, R11 + BR callbackasm1(SB) + MOVD $1282, R11 + BR callbackasm1(SB) + MOVD $1283, R11 + BR callbackasm1(SB) + MOVD $1284, R11 + BR callbackasm1(SB) + MOVD $1285, R11 + BR callbackasm1(SB) + MOVD $1286, R11 + BR callbackasm1(SB) + MOVD $1287, R11 + BR callbackasm1(SB) + MOVD $1288, R11 + BR callbackasm1(SB) + MOVD $1289, R11 + BR callbackasm1(SB) + MOVD $1290, R11 + BR callbackasm1(SB) + MOVD $1291, R11 + BR callbackasm1(SB) + MOVD $1292, R11 + BR callbackasm1(SB) + MOVD $1293, R11 + BR callbackasm1(SB) + MOVD $1294, R11 + BR callbackasm1(SB) + MOVD $1295, R11 + BR callbackasm1(SB) + MOVD $1296, R11 + BR callbackasm1(SB) + MOVD $1297, R11 + BR callbackasm1(SB) + MOVD $1298, R11 + BR callbackasm1(SB) + MOVD $1299, R11 + BR callbackasm1(SB) + MOVD $1300, R11 + BR callbackasm1(SB) + MOVD $1301, R11 + BR callbackasm1(SB) + MOVD $1302, R11 + BR callbackasm1(SB) + MOVD $1303, R11 + BR callbackasm1(SB) + MOVD $1304, R11 + BR callbackasm1(SB) + MOVD $1305, R11 + BR callbackasm1(SB) + MOVD $1306, R11 + BR callbackasm1(SB) + MOVD $1307, R11 + BR callbackasm1(SB) + MOVD $1308, R11 + BR callbackasm1(SB) + MOVD $1309, R11 + BR callbackasm1(SB) + MOVD $1310, R11 + BR callbackasm1(SB) + MOVD $1311, R11 + BR callbackasm1(SB) + MOVD $1312, R11 + BR callbackasm1(SB) + MOVD $1313, R11 + BR callbackasm1(SB) + MOVD $1314, R11 + BR callbackasm1(SB) + MOVD $1315, R11 + BR callbackasm1(SB) + MOVD $1316, R11 + BR callbackasm1(SB) + MOVD $1317, R11 + BR callbackasm1(SB) + MOVD $1318, R11 + BR callbackasm1(SB) + MOVD $1319, R11 + BR callbackasm1(SB) + MOVD $1320, R11 + BR callbackasm1(SB) + MOVD $1321, R11 + BR callbackasm1(SB) + MOVD $1322, R11 + BR callbackasm1(SB) + MOVD $1323, R11 + BR callbackasm1(SB) + MOVD $1324, R11 + BR callbackasm1(SB) + MOVD $1325, R11 + BR callbackasm1(SB) + MOVD $1326, R11 + BR callbackasm1(SB) + MOVD $1327, R11 + BR callbackasm1(SB) + MOVD $1328, R11 + BR callbackasm1(SB) + MOVD $1329, R11 + BR callbackasm1(SB) + MOVD $1330, R11 + BR callbackasm1(SB) + MOVD $1331, R11 + BR callbackasm1(SB) + MOVD $1332, R11 + BR callbackasm1(SB) + MOVD $1333, R11 + BR callbackasm1(SB) + MOVD $1334, R11 + BR callbackasm1(SB) + MOVD $1335, R11 + BR callbackasm1(SB) + MOVD $1336, R11 + BR callbackasm1(SB) + MOVD $1337, R11 + BR callbackasm1(SB) + MOVD $1338, R11 + BR callbackasm1(SB) + MOVD $1339, R11 + BR callbackasm1(SB) + MOVD $1340, R11 + BR callbackasm1(SB) + MOVD $1341, R11 + BR callbackasm1(SB) + MOVD $1342, R11 + BR callbackasm1(SB) + MOVD $1343, R11 + BR callbackasm1(SB) + MOVD $1344, R11 + BR callbackasm1(SB) + MOVD $1345, R11 + BR callbackasm1(SB) + MOVD $1346, R11 + BR callbackasm1(SB) + MOVD $1347, R11 + BR callbackasm1(SB) + MOVD $1348, R11 + BR callbackasm1(SB) + MOVD $1349, R11 + BR callbackasm1(SB) + MOVD $1350, R11 + BR callbackasm1(SB) + MOVD $1351, R11 + BR callbackasm1(SB) + MOVD $1352, R11 + BR callbackasm1(SB) + MOVD $1353, R11 + BR callbackasm1(SB) + MOVD $1354, R11 + BR callbackasm1(SB) + MOVD $1355, R11 + BR callbackasm1(SB) + MOVD $1356, R11 + BR callbackasm1(SB) + MOVD $1357, R11 + BR callbackasm1(SB) + MOVD $1358, R11 + BR callbackasm1(SB) + MOVD $1359, R11 + BR callbackasm1(SB) + MOVD $1360, R11 + BR callbackasm1(SB) + MOVD $1361, R11 + BR callbackasm1(SB) + MOVD $1362, R11 + BR callbackasm1(SB) + MOVD $1363, R11 + BR callbackasm1(SB) + MOVD $1364, R11 + BR callbackasm1(SB) + MOVD $1365, R11 + BR callbackasm1(SB) + MOVD $1366, R11 + BR callbackasm1(SB) + MOVD $1367, R11 + BR callbackasm1(SB) + MOVD $1368, R11 + BR callbackasm1(SB) + MOVD $1369, R11 + BR callbackasm1(SB) + MOVD $1370, R11 + BR callbackasm1(SB) + MOVD $1371, R11 + BR callbackasm1(SB) + MOVD $1372, R11 + BR callbackasm1(SB) + MOVD $1373, R11 + BR callbackasm1(SB) + MOVD $1374, R11 + BR callbackasm1(SB) + MOVD $1375, R11 + BR callbackasm1(SB) + MOVD $1376, R11 + BR callbackasm1(SB) + MOVD $1377, R11 + BR callbackasm1(SB) + MOVD $1378, R11 + BR callbackasm1(SB) + MOVD $1379, R11 + BR callbackasm1(SB) + MOVD $1380, R11 + BR callbackasm1(SB) + MOVD $1381, R11 + BR callbackasm1(SB) + MOVD $1382, R11 + BR callbackasm1(SB) + MOVD $1383, R11 + BR callbackasm1(SB) + MOVD $1384, R11 + BR callbackasm1(SB) + MOVD $1385, R11 + BR callbackasm1(SB) + MOVD $1386, R11 + BR callbackasm1(SB) + MOVD $1387, R11 + BR callbackasm1(SB) + MOVD $1388, R11 + BR callbackasm1(SB) + MOVD $1389, R11 + BR callbackasm1(SB) + MOVD $1390, R11 + BR callbackasm1(SB) + MOVD $1391, R11 + BR callbackasm1(SB) + MOVD $1392, R11 + BR callbackasm1(SB) + MOVD $1393, R11 + BR callbackasm1(SB) + MOVD $1394, R11 + BR callbackasm1(SB) + MOVD $1395, R11 + BR callbackasm1(SB) + MOVD $1396, R11 + BR callbackasm1(SB) + MOVD $1397, R11 + BR callbackasm1(SB) + MOVD $1398, R11 + BR callbackasm1(SB) + MOVD $1399, R11 + BR callbackasm1(SB) + MOVD $1400, R11 + BR callbackasm1(SB) + MOVD $1401, R11 + BR callbackasm1(SB) + MOVD $1402, R11 + BR callbackasm1(SB) + MOVD $1403, R11 + BR callbackasm1(SB) + MOVD $1404, R11 + BR callbackasm1(SB) + MOVD $1405, R11 + BR callbackasm1(SB) + MOVD $1406, R11 + BR callbackasm1(SB) + MOVD $1407, R11 + BR callbackasm1(SB) + MOVD $1408, R11 + BR callbackasm1(SB) + MOVD $1409, R11 + BR callbackasm1(SB) + MOVD $1410, R11 + BR callbackasm1(SB) + MOVD $1411, R11 + BR callbackasm1(SB) + MOVD $1412, R11 + BR callbackasm1(SB) + MOVD $1413, R11 + BR callbackasm1(SB) + MOVD $1414, R11 + BR callbackasm1(SB) + MOVD $1415, R11 + BR callbackasm1(SB) + MOVD $1416, R11 + BR callbackasm1(SB) + MOVD $1417, R11 + BR callbackasm1(SB) + MOVD $1418, R11 + BR callbackasm1(SB) + MOVD $1419, R11 + BR callbackasm1(SB) + MOVD $1420, R11 + BR callbackasm1(SB) + MOVD $1421, R11 + BR callbackasm1(SB) + MOVD $1422, R11 + BR callbackasm1(SB) + MOVD $1423, R11 + BR callbackasm1(SB) + MOVD $1424, R11 + BR callbackasm1(SB) + MOVD $1425, R11 + BR callbackasm1(SB) + MOVD $1426, R11 + BR callbackasm1(SB) + MOVD $1427, R11 + BR callbackasm1(SB) + MOVD $1428, R11 + BR callbackasm1(SB) + MOVD $1429, R11 + BR callbackasm1(SB) + MOVD $1430, R11 + BR callbackasm1(SB) + MOVD $1431, R11 + BR callbackasm1(SB) + MOVD $1432, R11 + BR callbackasm1(SB) + MOVD $1433, R11 + BR callbackasm1(SB) + MOVD $1434, R11 + BR callbackasm1(SB) + MOVD $1435, R11 + BR callbackasm1(SB) + MOVD $1436, R11 + BR callbackasm1(SB) + MOVD $1437, R11 + BR callbackasm1(SB) + MOVD $1438, R11 + BR callbackasm1(SB) + MOVD $1439, R11 + BR callbackasm1(SB) + MOVD $1440, R11 + BR callbackasm1(SB) + MOVD $1441, R11 + BR callbackasm1(SB) + MOVD $1442, R11 + BR callbackasm1(SB) + MOVD $1443, R11 + BR callbackasm1(SB) + MOVD $1444, R11 + BR callbackasm1(SB) + MOVD $1445, R11 + BR callbackasm1(SB) + MOVD $1446, R11 + BR callbackasm1(SB) + MOVD $1447, R11 + BR callbackasm1(SB) + MOVD $1448, R11 + BR callbackasm1(SB) + MOVD $1449, R11 + BR callbackasm1(SB) + MOVD $1450, R11 + BR callbackasm1(SB) + MOVD $1451, R11 + BR callbackasm1(SB) + MOVD $1452, R11 + BR callbackasm1(SB) + MOVD $1453, R11 + BR callbackasm1(SB) + MOVD $1454, R11 + BR callbackasm1(SB) + MOVD $1455, R11 + BR callbackasm1(SB) + MOVD $1456, R11 + BR callbackasm1(SB) + MOVD $1457, R11 + BR callbackasm1(SB) + MOVD $1458, R11 + BR callbackasm1(SB) + MOVD $1459, R11 + BR callbackasm1(SB) + MOVD $1460, R11 + BR callbackasm1(SB) + MOVD $1461, R11 + BR callbackasm1(SB) + MOVD $1462, R11 + BR callbackasm1(SB) + MOVD $1463, R11 + BR callbackasm1(SB) + MOVD $1464, R11 + BR callbackasm1(SB) + MOVD $1465, R11 + BR callbackasm1(SB) + MOVD $1466, R11 + BR callbackasm1(SB) + MOVD $1467, R11 + BR callbackasm1(SB) + MOVD $1468, R11 + BR callbackasm1(SB) + MOVD $1469, R11 + BR callbackasm1(SB) + MOVD $1470, R11 + BR callbackasm1(SB) + MOVD $1471, R11 + BR callbackasm1(SB) + MOVD $1472, R11 + BR callbackasm1(SB) + MOVD $1473, R11 + BR callbackasm1(SB) + MOVD $1474, R11 + BR callbackasm1(SB) + MOVD $1475, R11 + BR callbackasm1(SB) + MOVD $1476, R11 + BR callbackasm1(SB) + MOVD $1477, R11 + BR callbackasm1(SB) + MOVD $1478, R11 + BR callbackasm1(SB) + MOVD $1479, R11 + BR callbackasm1(SB) + MOVD $1480, R11 + BR callbackasm1(SB) + MOVD $1481, R11 + BR callbackasm1(SB) + MOVD $1482, R11 + BR callbackasm1(SB) + MOVD $1483, R11 + BR callbackasm1(SB) + MOVD $1484, R11 + BR callbackasm1(SB) + MOVD $1485, R11 + BR callbackasm1(SB) + MOVD $1486, R11 + BR callbackasm1(SB) + MOVD $1487, R11 + BR callbackasm1(SB) + MOVD $1488, R11 + BR callbackasm1(SB) + MOVD $1489, R11 + BR callbackasm1(SB) + MOVD $1490, R11 + BR callbackasm1(SB) + MOVD $1491, R11 + BR callbackasm1(SB) + MOVD $1492, R11 + BR callbackasm1(SB) + MOVD $1493, R11 + BR callbackasm1(SB) + MOVD $1494, R11 + BR callbackasm1(SB) + MOVD $1495, R11 + BR callbackasm1(SB) + MOVD $1496, R11 + BR callbackasm1(SB) + MOVD $1497, R11 + BR callbackasm1(SB) + MOVD $1498, R11 + BR callbackasm1(SB) + MOVD $1499, R11 + BR callbackasm1(SB) + MOVD $1500, R11 + BR callbackasm1(SB) + MOVD $1501, R11 + BR callbackasm1(SB) + MOVD $1502, R11 + BR callbackasm1(SB) + MOVD $1503, R11 + BR callbackasm1(SB) + MOVD $1504, R11 + BR callbackasm1(SB) + MOVD $1505, R11 + BR callbackasm1(SB) + MOVD $1506, R11 + BR callbackasm1(SB) + MOVD $1507, R11 + BR callbackasm1(SB) + MOVD $1508, R11 + BR callbackasm1(SB) + MOVD $1509, R11 + BR callbackasm1(SB) + MOVD $1510, R11 + BR callbackasm1(SB) + MOVD $1511, R11 + BR callbackasm1(SB) + MOVD $1512, R11 + BR callbackasm1(SB) + MOVD $1513, R11 + BR callbackasm1(SB) + MOVD $1514, R11 + BR callbackasm1(SB) + MOVD $1515, R11 + BR callbackasm1(SB) + MOVD $1516, R11 + BR callbackasm1(SB) + MOVD $1517, R11 + BR callbackasm1(SB) + MOVD $1518, R11 + BR callbackasm1(SB) + MOVD $1519, R11 + BR callbackasm1(SB) + MOVD $1520, R11 + BR callbackasm1(SB) + MOVD $1521, R11 + BR callbackasm1(SB) + MOVD $1522, R11 + BR callbackasm1(SB) + MOVD $1523, R11 + BR callbackasm1(SB) + MOVD $1524, R11 + BR callbackasm1(SB) + MOVD $1525, R11 + BR callbackasm1(SB) + MOVD $1526, R11 + BR callbackasm1(SB) + MOVD $1527, R11 + BR callbackasm1(SB) + MOVD $1528, R11 + BR callbackasm1(SB) + MOVD $1529, R11 + BR callbackasm1(SB) + MOVD $1530, R11 + BR callbackasm1(SB) + MOVD $1531, R11 + BR callbackasm1(SB) + MOVD $1532, R11 + BR callbackasm1(SB) + MOVD $1533, R11 + BR callbackasm1(SB) + MOVD $1534, R11 + BR callbackasm1(SB) + MOVD $1535, R11 + BR callbackasm1(SB) + MOVD $1536, R11 + BR callbackasm1(SB) + MOVD $1537, R11 + BR callbackasm1(SB) + MOVD $1538, R11 + BR callbackasm1(SB) + MOVD $1539, R11 + BR callbackasm1(SB) + MOVD $1540, R11 + BR callbackasm1(SB) + MOVD $1541, R11 + BR callbackasm1(SB) + MOVD $1542, R11 + BR callbackasm1(SB) + MOVD $1543, R11 + BR callbackasm1(SB) + MOVD $1544, R11 + BR callbackasm1(SB) + MOVD $1545, R11 + BR callbackasm1(SB) + MOVD $1546, R11 + BR callbackasm1(SB) + MOVD $1547, R11 + BR callbackasm1(SB) + MOVD $1548, R11 + BR callbackasm1(SB) + MOVD $1549, R11 + BR callbackasm1(SB) + MOVD $1550, R11 + BR callbackasm1(SB) + MOVD $1551, R11 + BR callbackasm1(SB) + MOVD $1552, R11 + BR callbackasm1(SB) + MOVD $1553, R11 + BR callbackasm1(SB) + MOVD $1554, R11 + BR callbackasm1(SB) + MOVD $1555, R11 + BR callbackasm1(SB) + MOVD $1556, R11 + BR callbackasm1(SB) + MOVD $1557, R11 + BR callbackasm1(SB) + MOVD $1558, R11 + BR callbackasm1(SB) + MOVD $1559, R11 + BR callbackasm1(SB) + MOVD $1560, R11 + BR callbackasm1(SB) + MOVD $1561, R11 + BR callbackasm1(SB) + MOVD $1562, R11 + BR callbackasm1(SB) + MOVD $1563, R11 + BR callbackasm1(SB) + MOVD $1564, R11 + BR callbackasm1(SB) + MOVD $1565, R11 + BR callbackasm1(SB) + MOVD $1566, R11 + BR callbackasm1(SB) + MOVD $1567, R11 + BR callbackasm1(SB) + MOVD $1568, R11 + BR callbackasm1(SB) + MOVD $1569, R11 + BR callbackasm1(SB) + MOVD $1570, R11 + BR callbackasm1(SB) + MOVD $1571, R11 + BR callbackasm1(SB) + MOVD $1572, R11 + BR callbackasm1(SB) + MOVD $1573, R11 + BR callbackasm1(SB) + MOVD $1574, R11 + BR callbackasm1(SB) + MOVD $1575, R11 + BR callbackasm1(SB) + MOVD $1576, R11 + BR callbackasm1(SB) + MOVD $1577, R11 + BR callbackasm1(SB) + MOVD $1578, R11 + BR callbackasm1(SB) + MOVD $1579, R11 + BR callbackasm1(SB) + MOVD $1580, R11 + BR callbackasm1(SB) + MOVD $1581, R11 + BR callbackasm1(SB) + MOVD $1582, R11 + BR callbackasm1(SB) + MOVD $1583, R11 + BR callbackasm1(SB) + MOVD $1584, R11 + BR callbackasm1(SB) + MOVD $1585, R11 + BR callbackasm1(SB) + MOVD $1586, R11 + BR callbackasm1(SB) + MOVD $1587, R11 + BR callbackasm1(SB) + MOVD $1588, R11 + BR callbackasm1(SB) + MOVD $1589, R11 + BR callbackasm1(SB) + MOVD $1590, R11 + BR callbackasm1(SB) + MOVD $1591, R11 + BR callbackasm1(SB) + MOVD $1592, R11 + BR callbackasm1(SB) + MOVD $1593, R11 + BR callbackasm1(SB) + MOVD $1594, R11 + BR callbackasm1(SB) + MOVD $1595, R11 + BR callbackasm1(SB) + MOVD $1596, R11 + BR callbackasm1(SB) + MOVD $1597, R11 + BR callbackasm1(SB) + MOVD $1598, R11 + BR callbackasm1(SB) + MOVD $1599, R11 + BR callbackasm1(SB) + MOVD $1600, R11 + BR callbackasm1(SB) + MOVD $1601, R11 + BR callbackasm1(SB) + MOVD $1602, R11 + BR callbackasm1(SB) + MOVD $1603, R11 + BR callbackasm1(SB) + MOVD $1604, R11 + BR callbackasm1(SB) + MOVD $1605, R11 + BR callbackasm1(SB) + MOVD $1606, R11 + BR callbackasm1(SB) + MOVD $1607, R11 + BR callbackasm1(SB) + MOVD $1608, R11 + BR callbackasm1(SB) + MOVD $1609, R11 + BR callbackasm1(SB) + MOVD $1610, R11 + BR callbackasm1(SB) + MOVD $1611, R11 + BR callbackasm1(SB) + MOVD $1612, R11 + BR callbackasm1(SB) + MOVD $1613, R11 + BR callbackasm1(SB) + MOVD $1614, R11 + BR callbackasm1(SB) + MOVD $1615, R11 + BR callbackasm1(SB) + MOVD $1616, R11 + BR callbackasm1(SB) + MOVD $1617, R11 + BR callbackasm1(SB) + MOVD $1618, R11 + BR callbackasm1(SB) + MOVD $1619, R11 + BR callbackasm1(SB) + MOVD $1620, R11 + BR callbackasm1(SB) + MOVD $1621, R11 + BR callbackasm1(SB) + MOVD $1622, R11 + BR callbackasm1(SB) + MOVD $1623, R11 + BR callbackasm1(SB) + MOVD $1624, R11 + BR callbackasm1(SB) + MOVD $1625, R11 + BR callbackasm1(SB) + MOVD $1626, R11 + BR callbackasm1(SB) + MOVD $1627, R11 + BR callbackasm1(SB) + MOVD $1628, R11 + BR callbackasm1(SB) + MOVD $1629, R11 + BR callbackasm1(SB) + MOVD $1630, R11 + BR callbackasm1(SB) + MOVD $1631, R11 + BR callbackasm1(SB) + MOVD $1632, R11 + BR callbackasm1(SB) + MOVD $1633, R11 + BR callbackasm1(SB) + MOVD $1634, R11 + BR callbackasm1(SB) + MOVD $1635, R11 + BR callbackasm1(SB) + MOVD $1636, R11 + BR callbackasm1(SB) + MOVD $1637, R11 + BR callbackasm1(SB) + MOVD $1638, R11 + BR callbackasm1(SB) + MOVD $1639, R11 + BR callbackasm1(SB) + MOVD $1640, R11 + BR callbackasm1(SB) + MOVD $1641, R11 + BR callbackasm1(SB) + MOVD $1642, R11 + BR callbackasm1(SB) + MOVD $1643, R11 + BR callbackasm1(SB) + MOVD $1644, R11 + BR callbackasm1(SB) + MOVD $1645, R11 + BR callbackasm1(SB) + MOVD $1646, R11 + BR callbackasm1(SB) + MOVD $1647, R11 + BR callbackasm1(SB) + MOVD $1648, R11 + BR callbackasm1(SB) + MOVD $1649, R11 + BR callbackasm1(SB) + MOVD $1650, R11 + BR callbackasm1(SB) + MOVD $1651, R11 + BR callbackasm1(SB) + MOVD $1652, R11 + BR callbackasm1(SB) + MOVD $1653, R11 + BR callbackasm1(SB) + MOVD $1654, R11 + BR callbackasm1(SB) + MOVD $1655, R11 + BR callbackasm1(SB) + MOVD $1656, R11 + BR callbackasm1(SB) + MOVD $1657, R11 + BR callbackasm1(SB) + MOVD $1658, R11 + BR callbackasm1(SB) + MOVD $1659, R11 + BR callbackasm1(SB) + MOVD $1660, R11 + BR callbackasm1(SB) + MOVD $1661, R11 + BR callbackasm1(SB) + MOVD $1662, R11 + BR callbackasm1(SB) + MOVD $1663, R11 + BR callbackasm1(SB) + MOVD $1664, R11 + BR callbackasm1(SB) + MOVD $1665, R11 + BR callbackasm1(SB) + MOVD $1666, R11 + BR callbackasm1(SB) + MOVD $1667, R11 + BR callbackasm1(SB) + MOVD $1668, R11 + BR callbackasm1(SB) + MOVD $1669, R11 + BR callbackasm1(SB) + MOVD $1670, R11 + BR callbackasm1(SB) + MOVD $1671, R11 + BR callbackasm1(SB) + MOVD $1672, R11 + BR callbackasm1(SB) + MOVD $1673, R11 + BR callbackasm1(SB) + MOVD $1674, R11 + BR callbackasm1(SB) + MOVD $1675, R11 + BR callbackasm1(SB) + MOVD $1676, R11 + BR callbackasm1(SB) + MOVD $1677, R11 + BR callbackasm1(SB) + MOVD $1678, R11 + BR callbackasm1(SB) + MOVD $1679, R11 + BR callbackasm1(SB) + MOVD $1680, R11 + BR callbackasm1(SB) + MOVD $1681, R11 + BR callbackasm1(SB) + MOVD $1682, R11 + BR callbackasm1(SB) + MOVD $1683, R11 + BR callbackasm1(SB) + MOVD $1684, R11 + BR callbackasm1(SB) + MOVD $1685, R11 + BR callbackasm1(SB) + MOVD $1686, R11 + BR callbackasm1(SB) + MOVD $1687, R11 + BR callbackasm1(SB) + MOVD $1688, R11 + BR callbackasm1(SB) + MOVD $1689, R11 + BR callbackasm1(SB) + MOVD $1690, R11 + BR callbackasm1(SB) + MOVD $1691, R11 + BR callbackasm1(SB) + MOVD $1692, R11 + BR callbackasm1(SB) + MOVD $1693, R11 + BR callbackasm1(SB) + MOVD $1694, R11 + BR callbackasm1(SB) + MOVD $1695, R11 + BR callbackasm1(SB) + MOVD $1696, R11 + BR callbackasm1(SB) + MOVD $1697, R11 + BR callbackasm1(SB) + MOVD $1698, R11 + BR callbackasm1(SB) + MOVD $1699, R11 + BR callbackasm1(SB) + MOVD $1700, R11 + BR callbackasm1(SB) + MOVD $1701, R11 + BR callbackasm1(SB) + MOVD $1702, R11 + BR callbackasm1(SB) + MOVD $1703, R11 + BR callbackasm1(SB) + MOVD $1704, R11 + BR callbackasm1(SB) + MOVD $1705, R11 + BR callbackasm1(SB) + MOVD $1706, R11 + BR callbackasm1(SB) + MOVD $1707, R11 + BR callbackasm1(SB) + MOVD $1708, R11 + BR callbackasm1(SB) + MOVD $1709, R11 + BR callbackasm1(SB) + MOVD $1710, R11 + BR callbackasm1(SB) + MOVD $1711, R11 + BR callbackasm1(SB) + MOVD $1712, R11 + BR callbackasm1(SB) + MOVD $1713, R11 + BR callbackasm1(SB) + MOVD $1714, R11 + BR callbackasm1(SB) + MOVD $1715, R11 + BR callbackasm1(SB) + MOVD $1716, R11 + BR callbackasm1(SB) + MOVD $1717, R11 + BR callbackasm1(SB) + MOVD $1718, R11 + BR callbackasm1(SB) + MOVD $1719, R11 + BR callbackasm1(SB) + MOVD $1720, R11 + BR callbackasm1(SB) + MOVD $1721, R11 + BR callbackasm1(SB) + MOVD $1722, R11 + BR callbackasm1(SB) + MOVD $1723, R11 + BR callbackasm1(SB) + MOVD $1724, R11 + BR callbackasm1(SB) + MOVD $1725, R11 + BR callbackasm1(SB) + MOVD $1726, R11 + BR callbackasm1(SB) + MOVD $1727, R11 + BR callbackasm1(SB) + MOVD $1728, R11 + BR callbackasm1(SB) + MOVD $1729, R11 + BR callbackasm1(SB) + MOVD $1730, R11 + BR callbackasm1(SB) + MOVD $1731, R11 + BR callbackasm1(SB) + MOVD $1732, R11 + BR callbackasm1(SB) + MOVD $1733, R11 + BR callbackasm1(SB) + MOVD $1734, R11 + BR callbackasm1(SB) + MOVD $1735, R11 + BR callbackasm1(SB) + MOVD $1736, R11 + BR callbackasm1(SB) + MOVD $1737, R11 + BR callbackasm1(SB) + MOVD $1738, R11 + BR callbackasm1(SB) + MOVD $1739, R11 + BR callbackasm1(SB) + MOVD $1740, R11 + BR callbackasm1(SB) + MOVD $1741, R11 + BR callbackasm1(SB) + MOVD $1742, R11 + BR callbackasm1(SB) + MOVD $1743, R11 + BR callbackasm1(SB) + MOVD $1744, R11 + BR callbackasm1(SB) + MOVD $1745, R11 + BR callbackasm1(SB) + MOVD $1746, R11 + BR callbackasm1(SB) + MOVD $1747, R11 + BR callbackasm1(SB) + MOVD $1748, R11 + BR callbackasm1(SB) + MOVD $1749, R11 + BR callbackasm1(SB) + MOVD $1750, R11 + BR callbackasm1(SB) + MOVD $1751, R11 + BR callbackasm1(SB) + MOVD $1752, R11 + BR callbackasm1(SB) + MOVD $1753, R11 + BR callbackasm1(SB) + MOVD $1754, R11 + BR callbackasm1(SB) + MOVD $1755, R11 + BR callbackasm1(SB) + MOVD $1756, R11 + BR callbackasm1(SB) + MOVD $1757, R11 + BR callbackasm1(SB) + MOVD $1758, R11 + BR callbackasm1(SB) + MOVD $1759, R11 + BR callbackasm1(SB) + MOVD $1760, R11 + BR callbackasm1(SB) + MOVD $1761, R11 + BR callbackasm1(SB) + MOVD $1762, R11 + BR callbackasm1(SB) + MOVD $1763, R11 + BR callbackasm1(SB) + MOVD $1764, R11 + BR callbackasm1(SB) + MOVD $1765, R11 + BR callbackasm1(SB) + MOVD $1766, R11 + BR callbackasm1(SB) + MOVD $1767, R11 + BR callbackasm1(SB) + MOVD $1768, R11 + BR callbackasm1(SB) + MOVD $1769, R11 + BR callbackasm1(SB) + MOVD $1770, R11 + BR callbackasm1(SB) + MOVD $1771, R11 + BR callbackasm1(SB) + MOVD $1772, R11 + BR callbackasm1(SB) + MOVD $1773, R11 + BR callbackasm1(SB) + MOVD $1774, R11 + BR callbackasm1(SB) + MOVD $1775, R11 + BR callbackasm1(SB) + MOVD $1776, R11 + BR callbackasm1(SB) + MOVD $1777, R11 + BR callbackasm1(SB) + MOVD $1778, R11 + BR callbackasm1(SB) + MOVD $1779, R11 + BR callbackasm1(SB) + MOVD $1780, R11 + BR callbackasm1(SB) + MOVD $1781, R11 + BR callbackasm1(SB) + MOVD $1782, R11 + BR callbackasm1(SB) + MOVD $1783, R11 + BR callbackasm1(SB) + MOVD $1784, R11 + BR callbackasm1(SB) + MOVD $1785, R11 + BR callbackasm1(SB) + MOVD $1786, R11 + BR callbackasm1(SB) + MOVD $1787, R11 + BR callbackasm1(SB) + MOVD $1788, R11 + BR callbackasm1(SB) + MOVD $1789, R11 + BR callbackasm1(SB) + MOVD $1790, R11 + BR callbackasm1(SB) + MOVD $1791, R11 + BR callbackasm1(SB) + MOVD $1792, R11 + BR callbackasm1(SB) + MOVD $1793, R11 + BR callbackasm1(SB) + MOVD $1794, R11 + BR callbackasm1(SB) + MOVD $1795, R11 + BR callbackasm1(SB) + MOVD $1796, R11 + BR callbackasm1(SB) + MOVD $1797, R11 + BR callbackasm1(SB) + MOVD $1798, R11 + BR callbackasm1(SB) + MOVD $1799, R11 + BR callbackasm1(SB) + MOVD $1800, R11 + BR callbackasm1(SB) + MOVD $1801, R11 + BR callbackasm1(SB) + MOVD $1802, R11 + BR callbackasm1(SB) + MOVD $1803, R11 + BR callbackasm1(SB) + MOVD $1804, R11 + BR callbackasm1(SB) + MOVD $1805, R11 + BR callbackasm1(SB) + MOVD $1806, R11 + BR callbackasm1(SB) + MOVD $1807, R11 + BR callbackasm1(SB) + MOVD $1808, R11 + BR callbackasm1(SB) + MOVD $1809, R11 + BR callbackasm1(SB) + MOVD $1810, R11 + BR callbackasm1(SB) + MOVD $1811, R11 + BR callbackasm1(SB) + MOVD $1812, R11 + BR callbackasm1(SB) + MOVD $1813, R11 + BR callbackasm1(SB) + MOVD $1814, R11 + BR callbackasm1(SB) + MOVD $1815, R11 + BR callbackasm1(SB) + MOVD $1816, R11 + BR callbackasm1(SB) + MOVD $1817, R11 + BR callbackasm1(SB) + MOVD $1818, R11 + BR callbackasm1(SB) + MOVD $1819, R11 + BR callbackasm1(SB) + MOVD $1820, R11 + BR callbackasm1(SB) + MOVD $1821, R11 + BR callbackasm1(SB) + MOVD $1822, R11 + BR callbackasm1(SB) + MOVD $1823, R11 + BR callbackasm1(SB) + MOVD $1824, R11 + BR callbackasm1(SB) + MOVD $1825, R11 + BR callbackasm1(SB) + MOVD $1826, R11 + BR callbackasm1(SB) + MOVD $1827, R11 + BR callbackasm1(SB) + MOVD $1828, R11 + BR callbackasm1(SB) + MOVD $1829, R11 + BR callbackasm1(SB) + MOVD $1830, R11 + BR callbackasm1(SB) + MOVD $1831, R11 + BR callbackasm1(SB) + MOVD $1832, R11 + BR callbackasm1(SB) + MOVD $1833, R11 + BR callbackasm1(SB) + MOVD $1834, R11 + BR callbackasm1(SB) + MOVD $1835, R11 + BR callbackasm1(SB) + MOVD $1836, R11 + BR callbackasm1(SB) + MOVD $1837, R11 + BR callbackasm1(SB) + MOVD $1838, R11 + BR callbackasm1(SB) + MOVD $1839, R11 + BR callbackasm1(SB) + MOVD $1840, R11 + BR callbackasm1(SB) + MOVD $1841, R11 + BR callbackasm1(SB) + MOVD $1842, R11 + BR callbackasm1(SB) + MOVD $1843, R11 + BR callbackasm1(SB) + MOVD $1844, R11 + BR callbackasm1(SB) + MOVD $1845, R11 + BR callbackasm1(SB) + MOVD $1846, R11 + BR callbackasm1(SB) + MOVD $1847, R11 + BR callbackasm1(SB) + MOVD $1848, R11 + BR callbackasm1(SB) + MOVD $1849, R11 + BR callbackasm1(SB) + MOVD $1850, R11 + BR callbackasm1(SB) + MOVD $1851, R11 + BR callbackasm1(SB) + MOVD $1852, R11 + BR callbackasm1(SB) + MOVD $1853, R11 + BR callbackasm1(SB) + MOVD $1854, R11 + BR callbackasm1(SB) + MOVD $1855, R11 + BR callbackasm1(SB) + MOVD $1856, R11 + BR callbackasm1(SB) + MOVD $1857, R11 + BR callbackasm1(SB) + MOVD $1858, R11 + BR callbackasm1(SB) + MOVD $1859, R11 + BR callbackasm1(SB) + MOVD $1860, R11 + BR callbackasm1(SB) + MOVD $1861, R11 + BR callbackasm1(SB) + MOVD $1862, R11 + BR callbackasm1(SB) + MOVD $1863, R11 + BR callbackasm1(SB) + MOVD $1864, R11 + BR callbackasm1(SB) + MOVD $1865, R11 + BR callbackasm1(SB) + MOVD $1866, R11 + BR callbackasm1(SB) + MOVD $1867, R11 + BR callbackasm1(SB) + MOVD $1868, R11 + BR callbackasm1(SB) + MOVD $1869, R11 + BR callbackasm1(SB) + MOVD $1870, R11 + BR callbackasm1(SB) + MOVD $1871, R11 + BR callbackasm1(SB) + MOVD $1872, R11 + BR callbackasm1(SB) + MOVD $1873, R11 + BR callbackasm1(SB) + MOVD $1874, R11 + BR callbackasm1(SB) + MOVD $1875, R11 + BR callbackasm1(SB) + MOVD $1876, R11 + BR callbackasm1(SB) + MOVD $1877, R11 + BR callbackasm1(SB) + MOVD $1878, R11 + BR callbackasm1(SB) + MOVD $1879, R11 + BR callbackasm1(SB) + MOVD $1880, R11 + BR callbackasm1(SB) + MOVD $1881, R11 + BR callbackasm1(SB) + MOVD $1882, R11 + BR callbackasm1(SB) + MOVD $1883, R11 + BR callbackasm1(SB) + MOVD $1884, R11 + BR callbackasm1(SB) + MOVD $1885, R11 + BR callbackasm1(SB) + MOVD $1886, R11 + BR callbackasm1(SB) + MOVD $1887, R11 + BR callbackasm1(SB) + MOVD $1888, R11 + BR callbackasm1(SB) + MOVD $1889, R11 + BR callbackasm1(SB) + MOVD $1890, R11 + BR callbackasm1(SB) + MOVD $1891, R11 + BR callbackasm1(SB) + MOVD $1892, R11 + BR callbackasm1(SB) + MOVD $1893, R11 + BR callbackasm1(SB) + MOVD $1894, R11 + BR callbackasm1(SB) + MOVD $1895, R11 + BR callbackasm1(SB) + MOVD $1896, R11 + BR callbackasm1(SB) + MOVD $1897, R11 + BR callbackasm1(SB) + MOVD $1898, R11 + BR callbackasm1(SB) + MOVD $1899, R11 + BR callbackasm1(SB) + MOVD $1900, R11 + BR callbackasm1(SB) + MOVD $1901, R11 + BR callbackasm1(SB) + MOVD $1902, R11 + BR callbackasm1(SB) + MOVD $1903, R11 + BR callbackasm1(SB) + MOVD $1904, R11 + BR callbackasm1(SB) + MOVD $1905, R11 + BR callbackasm1(SB) + MOVD $1906, R11 + BR callbackasm1(SB) + MOVD $1907, R11 + BR callbackasm1(SB) + MOVD $1908, R11 + BR callbackasm1(SB) + MOVD $1909, R11 + BR callbackasm1(SB) + MOVD $1910, R11 + BR callbackasm1(SB) + MOVD $1911, R11 + BR callbackasm1(SB) + MOVD $1912, R11 + BR callbackasm1(SB) + MOVD $1913, R11 + BR callbackasm1(SB) + MOVD $1914, R11 + BR callbackasm1(SB) + MOVD $1915, R11 + BR callbackasm1(SB) + MOVD $1916, R11 + BR callbackasm1(SB) + MOVD $1917, R11 + BR callbackasm1(SB) + MOVD $1918, R11 + BR callbackasm1(SB) + MOVD $1919, R11 + BR callbackasm1(SB) + MOVD $1920, R11 + BR callbackasm1(SB) + MOVD $1921, R11 + BR callbackasm1(SB) + MOVD $1922, R11 + BR callbackasm1(SB) + MOVD $1923, R11 + BR callbackasm1(SB) + MOVD $1924, R11 + BR callbackasm1(SB) + MOVD $1925, R11 + BR callbackasm1(SB) + MOVD $1926, R11 + BR callbackasm1(SB) + MOVD $1927, R11 + BR callbackasm1(SB) + MOVD $1928, R11 + BR callbackasm1(SB) + MOVD $1929, R11 + BR callbackasm1(SB) + MOVD $1930, R11 + BR callbackasm1(SB) + MOVD $1931, R11 + BR callbackasm1(SB) + MOVD $1932, R11 + BR callbackasm1(SB) + MOVD $1933, R11 + BR callbackasm1(SB) + MOVD $1934, R11 + BR callbackasm1(SB) + MOVD $1935, R11 + BR callbackasm1(SB) + MOVD $1936, R11 + BR callbackasm1(SB) + MOVD $1937, R11 + BR callbackasm1(SB) + MOVD $1938, R11 + BR callbackasm1(SB) + MOVD $1939, R11 + BR callbackasm1(SB) + MOVD $1940, R11 + BR callbackasm1(SB) + MOVD $1941, R11 + BR callbackasm1(SB) + MOVD $1942, R11 + BR callbackasm1(SB) + MOVD $1943, R11 + BR callbackasm1(SB) + MOVD $1944, R11 + BR callbackasm1(SB) + MOVD $1945, R11 + BR callbackasm1(SB) + MOVD $1946, R11 + BR callbackasm1(SB) + MOVD $1947, R11 + BR callbackasm1(SB) + MOVD $1948, R11 + BR callbackasm1(SB) + MOVD $1949, R11 + BR callbackasm1(SB) + MOVD $1950, R11 + BR callbackasm1(SB) + MOVD $1951, R11 + BR callbackasm1(SB) + MOVD $1952, R11 + BR callbackasm1(SB) + MOVD $1953, R11 + BR callbackasm1(SB) + MOVD $1954, R11 + BR callbackasm1(SB) + MOVD $1955, R11 + BR callbackasm1(SB) + MOVD $1956, R11 + BR callbackasm1(SB) + MOVD $1957, R11 + BR callbackasm1(SB) + MOVD $1958, R11 + BR callbackasm1(SB) + MOVD $1959, R11 + BR callbackasm1(SB) + MOVD $1960, R11 + BR callbackasm1(SB) + MOVD $1961, R11 + BR callbackasm1(SB) + MOVD $1962, R11 + BR callbackasm1(SB) + MOVD $1963, R11 + BR callbackasm1(SB) + MOVD $1964, R11 + BR callbackasm1(SB) + MOVD $1965, R11 + BR callbackasm1(SB) + MOVD $1966, R11 + BR callbackasm1(SB) + MOVD $1967, R11 + BR callbackasm1(SB) + MOVD $1968, R11 + BR callbackasm1(SB) + MOVD $1969, R11 + BR callbackasm1(SB) + MOVD $1970, R11 + BR callbackasm1(SB) + MOVD $1971, R11 + BR callbackasm1(SB) + MOVD $1972, R11 + BR callbackasm1(SB) + MOVD $1973, R11 + BR callbackasm1(SB) + MOVD $1974, R11 + BR callbackasm1(SB) + MOVD $1975, R11 + BR callbackasm1(SB) + MOVD $1976, R11 + BR callbackasm1(SB) + MOVD $1977, R11 + BR callbackasm1(SB) + MOVD $1978, R11 + BR callbackasm1(SB) + MOVD $1979, R11 + BR callbackasm1(SB) + MOVD $1980, R11 + BR callbackasm1(SB) + MOVD $1981, R11 + BR callbackasm1(SB) + MOVD $1982, R11 + BR callbackasm1(SB) + MOVD $1983, R11 + BR callbackasm1(SB) + MOVD $1984, R11 + BR callbackasm1(SB) + MOVD $1985, R11 + BR callbackasm1(SB) + MOVD $1986, R11 + BR callbackasm1(SB) + MOVD $1987, R11 + BR callbackasm1(SB) + MOVD $1988, R11 + BR callbackasm1(SB) + MOVD $1989, R11 + BR callbackasm1(SB) + MOVD $1990, R11 + BR callbackasm1(SB) + MOVD $1991, R11 + BR callbackasm1(SB) + MOVD $1992, R11 + BR callbackasm1(SB) + MOVD $1993, R11 + BR callbackasm1(SB) + MOVD $1994, R11 + BR callbackasm1(SB) + MOVD $1995, R11 + BR callbackasm1(SB) + MOVD $1996, R11 + BR callbackasm1(SB) + MOVD $1997, R11 + BR callbackasm1(SB) + MOVD $1998, R11 + BR callbackasm1(SB) + MOVD $1999, R11 + BR callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_riscv64.s b/vendor/github.com/ebitengine/purego/zcallback_riscv64.s new file mode 100644 index 00000000..f341a87e --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_riscv64.s @@ -0,0 +1,4051 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build darwin || freebsd || linux || netbsd + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOV and JMP instructions. +// Since Go 1.26, MOV instructions with immediate values lower than or equal to 32 +// are encoded in 2 bytes rather than 4 bytes, which breaks the assumption that each +// callback entry is 8 bytes long. Therefore, for callback indices less than or equal to 32, +// add a PCALIGN directive to align the next instruction to an 8-byte boundary. +// The MOV instruction loads X7 with the callback index, and the +// JMP instruction branches to callbackasm1. +// callbackasm1 takes the callback index from X7 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + PCALIGN $8 + MOV $0, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $1, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $2, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $3, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $4, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $5, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $6, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $7, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $8, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $9, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $10, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $11, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $12, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $13, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $14, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $15, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $16, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $17, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $18, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $19, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $20, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $21, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $22, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $23, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $24, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $25, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $26, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $27, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $28, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $29, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $30, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $31, X7 + JMP callbackasm1(SB) + PCALIGN $8 + MOV $32, X7 + JMP callbackasm1(SB) + MOV $33, X7 + JMP callbackasm1(SB) + MOV $34, X7 + JMP callbackasm1(SB) + MOV $35, X7 + JMP callbackasm1(SB) + MOV $36, X7 + JMP callbackasm1(SB) + MOV $37, X7 + JMP callbackasm1(SB) + MOV $38, X7 + JMP callbackasm1(SB) + MOV $39, X7 + JMP callbackasm1(SB) + MOV $40, X7 + JMP callbackasm1(SB) + MOV $41, X7 + JMP callbackasm1(SB) + MOV $42, X7 + JMP callbackasm1(SB) + MOV $43, X7 + JMP callbackasm1(SB) + MOV $44, X7 + JMP callbackasm1(SB) + MOV $45, X7 + JMP callbackasm1(SB) + MOV $46, X7 + JMP callbackasm1(SB) + MOV $47, X7 + JMP callbackasm1(SB) + MOV $48, X7 + JMP callbackasm1(SB) + MOV $49, X7 + JMP callbackasm1(SB) + MOV $50, X7 + JMP callbackasm1(SB) + MOV $51, X7 + JMP callbackasm1(SB) + MOV $52, X7 + JMP callbackasm1(SB) + MOV $53, X7 + JMP callbackasm1(SB) + MOV $54, X7 + JMP callbackasm1(SB) + MOV $55, X7 + JMP callbackasm1(SB) + MOV $56, X7 + JMP callbackasm1(SB) + MOV $57, X7 + JMP callbackasm1(SB) + MOV $58, X7 + JMP callbackasm1(SB) + MOV $59, X7 + JMP callbackasm1(SB) + MOV $60, X7 + JMP callbackasm1(SB) + MOV $61, X7 + JMP callbackasm1(SB) + MOV $62, X7 + JMP callbackasm1(SB) + MOV $63, X7 + JMP callbackasm1(SB) + MOV $64, X7 + JMP callbackasm1(SB) + MOV $65, X7 + JMP callbackasm1(SB) + MOV $66, X7 + JMP callbackasm1(SB) + MOV $67, X7 + JMP callbackasm1(SB) + MOV $68, X7 + JMP callbackasm1(SB) + MOV $69, X7 + JMP callbackasm1(SB) + MOV $70, X7 + JMP callbackasm1(SB) + MOV $71, X7 + JMP callbackasm1(SB) + MOV $72, X7 + JMP callbackasm1(SB) + MOV $73, X7 + JMP callbackasm1(SB) + MOV $74, X7 + JMP callbackasm1(SB) + MOV $75, X7 + JMP callbackasm1(SB) + MOV $76, X7 + JMP callbackasm1(SB) + MOV $77, X7 + JMP callbackasm1(SB) + MOV $78, X7 + JMP callbackasm1(SB) + MOV $79, X7 + JMP callbackasm1(SB) + MOV $80, X7 + JMP callbackasm1(SB) + MOV $81, X7 + JMP callbackasm1(SB) + MOV $82, X7 + JMP callbackasm1(SB) + MOV $83, X7 + JMP callbackasm1(SB) + MOV $84, X7 + JMP callbackasm1(SB) + MOV $85, X7 + JMP callbackasm1(SB) + MOV $86, X7 + JMP callbackasm1(SB) + MOV $87, X7 + JMP callbackasm1(SB) + MOV $88, X7 + JMP callbackasm1(SB) + MOV $89, X7 + JMP callbackasm1(SB) + MOV $90, X7 + JMP callbackasm1(SB) + MOV $91, X7 + JMP callbackasm1(SB) + MOV $92, X7 + JMP callbackasm1(SB) + MOV $93, X7 + JMP callbackasm1(SB) + MOV $94, X7 + JMP callbackasm1(SB) + MOV $95, X7 + JMP callbackasm1(SB) + MOV $96, X7 + JMP callbackasm1(SB) + MOV $97, X7 + JMP callbackasm1(SB) + MOV $98, X7 + JMP callbackasm1(SB) + MOV $99, X7 + JMP callbackasm1(SB) + MOV $100, X7 + JMP callbackasm1(SB) + MOV $101, X7 + JMP callbackasm1(SB) + MOV $102, X7 + JMP callbackasm1(SB) + MOV $103, X7 + JMP callbackasm1(SB) + MOV $104, X7 + JMP callbackasm1(SB) + MOV $105, X7 + JMP callbackasm1(SB) + MOV $106, X7 + JMP callbackasm1(SB) + MOV $107, X7 + JMP callbackasm1(SB) + MOV $108, X7 + JMP callbackasm1(SB) + MOV $109, X7 + JMP callbackasm1(SB) + MOV $110, X7 + JMP callbackasm1(SB) + MOV $111, X7 + JMP callbackasm1(SB) + MOV $112, X7 + JMP callbackasm1(SB) + MOV $113, X7 + JMP callbackasm1(SB) + MOV $114, X7 + JMP callbackasm1(SB) + MOV $115, X7 + JMP callbackasm1(SB) + MOV $116, X7 + JMP callbackasm1(SB) + MOV $117, X7 + JMP callbackasm1(SB) + MOV $118, X7 + JMP callbackasm1(SB) + MOV $119, X7 + JMP callbackasm1(SB) + MOV $120, X7 + JMP callbackasm1(SB) + MOV $121, X7 + JMP callbackasm1(SB) + MOV $122, X7 + JMP callbackasm1(SB) + MOV $123, X7 + JMP callbackasm1(SB) + MOV $124, X7 + JMP callbackasm1(SB) + MOV $125, X7 + JMP callbackasm1(SB) + MOV $126, X7 + JMP callbackasm1(SB) + MOV $127, X7 + JMP callbackasm1(SB) + MOV $128, X7 + JMP callbackasm1(SB) + MOV $129, X7 + JMP callbackasm1(SB) + MOV $130, X7 + JMP callbackasm1(SB) + MOV $131, X7 + JMP callbackasm1(SB) + MOV $132, X7 + JMP callbackasm1(SB) + MOV $133, X7 + JMP callbackasm1(SB) + MOV $134, X7 + JMP callbackasm1(SB) + MOV $135, X7 + JMP callbackasm1(SB) + MOV $136, X7 + JMP callbackasm1(SB) + MOV $137, X7 + JMP callbackasm1(SB) + MOV $138, X7 + JMP callbackasm1(SB) + MOV $139, X7 + JMP callbackasm1(SB) + MOV $140, X7 + JMP callbackasm1(SB) + MOV $141, X7 + JMP callbackasm1(SB) + MOV $142, X7 + JMP callbackasm1(SB) + MOV $143, X7 + JMP callbackasm1(SB) + MOV $144, X7 + JMP callbackasm1(SB) + MOV $145, X7 + JMP callbackasm1(SB) + MOV $146, X7 + JMP callbackasm1(SB) + MOV $147, X7 + JMP callbackasm1(SB) + MOV $148, X7 + JMP callbackasm1(SB) + MOV $149, X7 + JMP callbackasm1(SB) + MOV $150, X7 + JMP callbackasm1(SB) + MOV $151, X7 + JMP callbackasm1(SB) + MOV $152, X7 + JMP callbackasm1(SB) + MOV $153, X7 + JMP callbackasm1(SB) + MOV $154, X7 + JMP callbackasm1(SB) + MOV $155, X7 + JMP callbackasm1(SB) + MOV $156, X7 + JMP callbackasm1(SB) + MOV $157, X7 + JMP callbackasm1(SB) + MOV $158, X7 + JMP callbackasm1(SB) + MOV $159, X7 + JMP callbackasm1(SB) + MOV $160, X7 + JMP callbackasm1(SB) + MOV $161, X7 + JMP callbackasm1(SB) + MOV $162, X7 + JMP callbackasm1(SB) + MOV $163, X7 + JMP callbackasm1(SB) + MOV $164, X7 + JMP callbackasm1(SB) + MOV $165, X7 + JMP callbackasm1(SB) + MOV $166, X7 + JMP callbackasm1(SB) + MOV $167, X7 + JMP callbackasm1(SB) + MOV $168, X7 + JMP callbackasm1(SB) + MOV $169, X7 + JMP callbackasm1(SB) + MOV $170, X7 + JMP callbackasm1(SB) + MOV $171, X7 + JMP callbackasm1(SB) + MOV $172, X7 + JMP callbackasm1(SB) + MOV $173, X7 + JMP callbackasm1(SB) + MOV $174, X7 + JMP callbackasm1(SB) + MOV $175, X7 + JMP callbackasm1(SB) + MOV $176, X7 + JMP callbackasm1(SB) + MOV $177, X7 + JMP callbackasm1(SB) + MOV $178, X7 + JMP callbackasm1(SB) + MOV $179, X7 + JMP callbackasm1(SB) + MOV $180, X7 + JMP callbackasm1(SB) + MOV $181, X7 + JMP callbackasm1(SB) + MOV $182, X7 + JMP callbackasm1(SB) + MOV $183, X7 + JMP callbackasm1(SB) + MOV $184, X7 + JMP callbackasm1(SB) + MOV $185, X7 + JMP callbackasm1(SB) + MOV $186, X7 + JMP callbackasm1(SB) + MOV $187, X7 + JMP callbackasm1(SB) + MOV $188, X7 + JMP callbackasm1(SB) + MOV $189, X7 + JMP callbackasm1(SB) + MOV $190, X7 + JMP callbackasm1(SB) + MOV $191, X7 + JMP callbackasm1(SB) + MOV $192, X7 + JMP callbackasm1(SB) + MOV $193, X7 + JMP callbackasm1(SB) + MOV $194, X7 + JMP callbackasm1(SB) + MOV $195, X7 + JMP callbackasm1(SB) + MOV $196, X7 + JMP callbackasm1(SB) + MOV $197, X7 + JMP callbackasm1(SB) + MOV $198, X7 + JMP callbackasm1(SB) + MOV $199, X7 + JMP callbackasm1(SB) + MOV $200, X7 + JMP callbackasm1(SB) + MOV $201, X7 + JMP callbackasm1(SB) + MOV $202, X7 + JMP callbackasm1(SB) + MOV $203, X7 + JMP callbackasm1(SB) + MOV $204, X7 + JMP callbackasm1(SB) + MOV $205, X7 + JMP callbackasm1(SB) + MOV $206, X7 + JMP callbackasm1(SB) + MOV $207, X7 + JMP callbackasm1(SB) + MOV $208, X7 + JMP callbackasm1(SB) + MOV $209, X7 + JMP callbackasm1(SB) + MOV $210, X7 + JMP callbackasm1(SB) + MOV $211, X7 + JMP callbackasm1(SB) + MOV $212, X7 + JMP callbackasm1(SB) + MOV $213, X7 + JMP callbackasm1(SB) + MOV $214, X7 + JMP callbackasm1(SB) + MOV $215, X7 + JMP callbackasm1(SB) + MOV $216, X7 + JMP callbackasm1(SB) + MOV $217, X7 + JMP callbackasm1(SB) + MOV $218, X7 + JMP callbackasm1(SB) + MOV $219, X7 + JMP callbackasm1(SB) + MOV $220, X7 + JMP callbackasm1(SB) + MOV $221, X7 + JMP callbackasm1(SB) + MOV $222, X7 + JMP callbackasm1(SB) + MOV $223, X7 + JMP callbackasm1(SB) + MOV $224, X7 + JMP callbackasm1(SB) + MOV $225, X7 + JMP callbackasm1(SB) + MOV $226, X7 + JMP callbackasm1(SB) + MOV $227, X7 + JMP callbackasm1(SB) + MOV $228, X7 + JMP callbackasm1(SB) + MOV $229, X7 + JMP callbackasm1(SB) + MOV $230, X7 + JMP callbackasm1(SB) + MOV $231, X7 + JMP callbackasm1(SB) + MOV $232, X7 + JMP callbackasm1(SB) + MOV $233, X7 + JMP callbackasm1(SB) + MOV $234, X7 + JMP callbackasm1(SB) + MOV $235, X7 + JMP callbackasm1(SB) + MOV $236, X7 + JMP callbackasm1(SB) + MOV $237, X7 + JMP callbackasm1(SB) + MOV $238, X7 + JMP callbackasm1(SB) + MOV $239, X7 + JMP callbackasm1(SB) + MOV $240, X7 + JMP callbackasm1(SB) + MOV $241, X7 + JMP callbackasm1(SB) + MOV $242, X7 + JMP callbackasm1(SB) + MOV $243, X7 + JMP callbackasm1(SB) + MOV $244, X7 + JMP callbackasm1(SB) + MOV $245, X7 + JMP callbackasm1(SB) + MOV $246, X7 + JMP callbackasm1(SB) + MOV $247, X7 + JMP callbackasm1(SB) + MOV $248, X7 + JMP callbackasm1(SB) + MOV $249, X7 + JMP callbackasm1(SB) + MOV $250, X7 + JMP callbackasm1(SB) + MOV $251, X7 + JMP callbackasm1(SB) + MOV $252, X7 + JMP callbackasm1(SB) + MOV $253, X7 + JMP callbackasm1(SB) + MOV $254, X7 + JMP callbackasm1(SB) + MOV $255, X7 + JMP callbackasm1(SB) + MOV $256, X7 + JMP callbackasm1(SB) + MOV $257, X7 + JMP callbackasm1(SB) + MOV $258, X7 + JMP callbackasm1(SB) + MOV $259, X7 + JMP callbackasm1(SB) + MOV $260, X7 + JMP callbackasm1(SB) + MOV $261, X7 + JMP callbackasm1(SB) + MOV $262, X7 + JMP callbackasm1(SB) + MOV $263, X7 + JMP callbackasm1(SB) + MOV $264, X7 + JMP callbackasm1(SB) + MOV $265, X7 + JMP callbackasm1(SB) + MOV $266, X7 + JMP callbackasm1(SB) + MOV $267, X7 + JMP callbackasm1(SB) + MOV $268, X7 + JMP callbackasm1(SB) + MOV $269, X7 + JMP callbackasm1(SB) + MOV $270, X7 + JMP callbackasm1(SB) + MOV $271, X7 + JMP callbackasm1(SB) + MOV $272, X7 + JMP callbackasm1(SB) + MOV $273, X7 + JMP callbackasm1(SB) + MOV $274, X7 + JMP callbackasm1(SB) + MOV $275, X7 + JMP callbackasm1(SB) + MOV $276, X7 + JMP callbackasm1(SB) + MOV $277, X7 + JMP callbackasm1(SB) + MOV $278, X7 + JMP callbackasm1(SB) + MOV $279, X7 + JMP callbackasm1(SB) + MOV $280, X7 + JMP callbackasm1(SB) + MOV $281, X7 + JMP callbackasm1(SB) + MOV $282, X7 + JMP callbackasm1(SB) + MOV $283, X7 + JMP callbackasm1(SB) + MOV $284, X7 + JMP callbackasm1(SB) + MOV $285, X7 + JMP callbackasm1(SB) + MOV $286, X7 + JMP callbackasm1(SB) + MOV $287, X7 + JMP callbackasm1(SB) + MOV $288, X7 + JMP callbackasm1(SB) + MOV $289, X7 + JMP callbackasm1(SB) + MOV $290, X7 + JMP callbackasm1(SB) + MOV $291, X7 + JMP callbackasm1(SB) + MOV $292, X7 + JMP callbackasm1(SB) + MOV $293, X7 + JMP callbackasm1(SB) + MOV $294, X7 + JMP callbackasm1(SB) + MOV $295, X7 + JMP callbackasm1(SB) + MOV $296, X7 + JMP callbackasm1(SB) + MOV $297, X7 + JMP callbackasm1(SB) + MOV $298, X7 + JMP callbackasm1(SB) + MOV $299, X7 + JMP callbackasm1(SB) + MOV $300, X7 + JMP callbackasm1(SB) + MOV $301, X7 + JMP callbackasm1(SB) + MOV $302, X7 + JMP callbackasm1(SB) + MOV $303, X7 + JMP callbackasm1(SB) + MOV $304, X7 + JMP callbackasm1(SB) + MOV $305, X7 + JMP callbackasm1(SB) + MOV $306, X7 + JMP callbackasm1(SB) + MOV $307, X7 + JMP callbackasm1(SB) + MOV $308, X7 + JMP callbackasm1(SB) + MOV $309, X7 + JMP callbackasm1(SB) + MOV $310, X7 + JMP callbackasm1(SB) + MOV $311, X7 + JMP callbackasm1(SB) + MOV $312, X7 + JMP callbackasm1(SB) + MOV $313, X7 + JMP callbackasm1(SB) + MOV $314, X7 + JMP callbackasm1(SB) + MOV $315, X7 + JMP callbackasm1(SB) + MOV $316, X7 + JMP callbackasm1(SB) + MOV $317, X7 + JMP callbackasm1(SB) + MOV $318, X7 + JMP callbackasm1(SB) + MOV $319, X7 + JMP callbackasm1(SB) + MOV $320, X7 + JMP callbackasm1(SB) + MOV $321, X7 + JMP callbackasm1(SB) + MOV $322, X7 + JMP callbackasm1(SB) + MOV $323, X7 + JMP callbackasm1(SB) + MOV $324, X7 + JMP callbackasm1(SB) + MOV $325, X7 + JMP callbackasm1(SB) + MOV $326, X7 + JMP callbackasm1(SB) + MOV $327, X7 + JMP callbackasm1(SB) + MOV $328, X7 + JMP callbackasm1(SB) + MOV $329, X7 + JMP callbackasm1(SB) + MOV $330, X7 + JMP callbackasm1(SB) + MOV $331, X7 + JMP callbackasm1(SB) + MOV $332, X7 + JMP callbackasm1(SB) + MOV $333, X7 + JMP callbackasm1(SB) + MOV $334, X7 + JMP callbackasm1(SB) + MOV $335, X7 + JMP callbackasm1(SB) + MOV $336, X7 + JMP callbackasm1(SB) + MOV $337, X7 + JMP callbackasm1(SB) + MOV $338, X7 + JMP callbackasm1(SB) + MOV $339, X7 + JMP callbackasm1(SB) + MOV $340, X7 + JMP callbackasm1(SB) + MOV $341, X7 + JMP callbackasm1(SB) + MOV $342, X7 + JMP callbackasm1(SB) + MOV $343, X7 + JMP callbackasm1(SB) + MOV $344, X7 + JMP callbackasm1(SB) + MOV $345, X7 + JMP callbackasm1(SB) + MOV $346, X7 + JMP callbackasm1(SB) + MOV $347, X7 + JMP callbackasm1(SB) + MOV $348, X7 + JMP callbackasm1(SB) + MOV $349, X7 + JMP callbackasm1(SB) + MOV $350, X7 + JMP callbackasm1(SB) + MOV $351, X7 + JMP callbackasm1(SB) + MOV $352, X7 + JMP callbackasm1(SB) + MOV $353, X7 + JMP callbackasm1(SB) + MOV $354, X7 + JMP callbackasm1(SB) + MOV $355, X7 + JMP callbackasm1(SB) + MOV $356, X7 + JMP callbackasm1(SB) + MOV $357, X7 + JMP callbackasm1(SB) + MOV $358, X7 + JMP callbackasm1(SB) + MOV $359, X7 + JMP callbackasm1(SB) + MOV $360, X7 + JMP callbackasm1(SB) + MOV $361, X7 + JMP callbackasm1(SB) + MOV $362, X7 + JMP callbackasm1(SB) + MOV $363, X7 + JMP callbackasm1(SB) + MOV $364, X7 + JMP callbackasm1(SB) + MOV $365, X7 + JMP callbackasm1(SB) + MOV $366, X7 + JMP callbackasm1(SB) + MOV $367, X7 + JMP callbackasm1(SB) + MOV $368, X7 + JMP callbackasm1(SB) + MOV $369, X7 + JMP callbackasm1(SB) + MOV $370, X7 + JMP callbackasm1(SB) + MOV $371, X7 + JMP callbackasm1(SB) + MOV $372, X7 + JMP callbackasm1(SB) + MOV $373, X7 + JMP callbackasm1(SB) + MOV $374, X7 + JMP callbackasm1(SB) + MOV $375, X7 + JMP callbackasm1(SB) + MOV $376, X7 + JMP callbackasm1(SB) + MOV $377, X7 + JMP callbackasm1(SB) + MOV $378, X7 + JMP callbackasm1(SB) + MOV $379, X7 + JMP callbackasm1(SB) + MOV $380, X7 + JMP callbackasm1(SB) + MOV $381, X7 + JMP callbackasm1(SB) + MOV $382, X7 + JMP callbackasm1(SB) + MOV $383, X7 + JMP callbackasm1(SB) + MOV $384, X7 + JMP callbackasm1(SB) + MOV $385, X7 + JMP callbackasm1(SB) + MOV $386, X7 + JMP callbackasm1(SB) + MOV $387, X7 + JMP callbackasm1(SB) + MOV $388, X7 + JMP callbackasm1(SB) + MOV $389, X7 + JMP callbackasm1(SB) + MOV $390, X7 + JMP callbackasm1(SB) + MOV $391, X7 + JMP callbackasm1(SB) + MOV $392, X7 + JMP callbackasm1(SB) + MOV $393, X7 + JMP callbackasm1(SB) + MOV $394, X7 + JMP callbackasm1(SB) + MOV $395, X7 + JMP callbackasm1(SB) + MOV $396, X7 + JMP callbackasm1(SB) + MOV $397, X7 + JMP callbackasm1(SB) + MOV $398, X7 + JMP callbackasm1(SB) + MOV $399, X7 + JMP callbackasm1(SB) + MOV $400, X7 + JMP callbackasm1(SB) + MOV $401, X7 + JMP callbackasm1(SB) + MOV $402, X7 + JMP callbackasm1(SB) + MOV $403, X7 + JMP callbackasm1(SB) + MOV $404, X7 + JMP callbackasm1(SB) + MOV $405, X7 + JMP callbackasm1(SB) + MOV $406, X7 + JMP callbackasm1(SB) + MOV $407, X7 + JMP callbackasm1(SB) + MOV $408, X7 + JMP callbackasm1(SB) + MOV $409, X7 + JMP callbackasm1(SB) + MOV $410, X7 + JMP callbackasm1(SB) + MOV $411, X7 + JMP callbackasm1(SB) + MOV $412, X7 + JMP callbackasm1(SB) + MOV $413, X7 + JMP callbackasm1(SB) + MOV $414, X7 + JMP callbackasm1(SB) + MOV $415, X7 + JMP callbackasm1(SB) + MOV $416, X7 + JMP callbackasm1(SB) + MOV $417, X7 + JMP callbackasm1(SB) + MOV $418, X7 + JMP callbackasm1(SB) + MOV $419, X7 + JMP callbackasm1(SB) + MOV $420, X7 + JMP callbackasm1(SB) + MOV $421, X7 + JMP callbackasm1(SB) + MOV $422, X7 + JMP callbackasm1(SB) + MOV $423, X7 + JMP callbackasm1(SB) + MOV $424, X7 + JMP callbackasm1(SB) + MOV $425, X7 + JMP callbackasm1(SB) + MOV $426, X7 + JMP callbackasm1(SB) + MOV $427, X7 + JMP callbackasm1(SB) + MOV $428, X7 + JMP callbackasm1(SB) + MOV $429, X7 + JMP callbackasm1(SB) + MOV $430, X7 + JMP callbackasm1(SB) + MOV $431, X7 + JMP callbackasm1(SB) + MOV $432, X7 + JMP callbackasm1(SB) + MOV $433, X7 + JMP callbackasm1(SB) + MOV $434, X7 + JMP callbackasm1(SB) + MOV $435, X7 + JMP callbackasm1(SB) + MOV $436, X7 + JMP callbackasm1(SB) + MOV $437, X7 + JMP callbackasm1(SB) + MOV $438, X7 + JMP callbackasm1(SB) + MOV $439, X7 + JMP callbackasm1(SB) + MOV $440, X7 + JMP callbackasm1(SB) + MOV $441, X7 + JMP callbackasm1(SB) + MOV $442, X7 + JMP callbackasm1(SB) + MOV $443, X7 + JMP callbackasm1(SB) + MOV $444, X7 + JMP callbackasm1(SB) + MOV $445, X7 + JMP callbackasm1(SB) + MOV $446, X7 + JMP callbackasm1(SB) + MOV $447, X7 + JMP callbackasm1(SB) + MOV $448, X7 + JMP callbackasm1(SB) + MOV $449, X7 + JMP callbackasm1(SB) + MOV $450, X7 + JMP callbackasm1(SB) + MOV $451, X7 + JMP callbackasm1(SB) + MOV $452, X7 + JMP callbackasm1(SB) + MOV $453, X7 + JMP callbackasm1(SB) + MOV $454, X7 + JMP callbackasm1(SB) + MOV $455, X7 + JMP callbackasm1(SB) + MOV $456, X7 + JMP callbackasm1(SB) + MOV $457, X7 + JMP callbackasm1(SB) + MOV $458, X7 + JMP callbackasm1(SB) + MOV $459, X7 + JMP callbackasm1(SB) + MOV $460, X7 + JMP callbackasm1(SB) + MOV $461, X7 + JMP callbackasm1(SB) + MOV $462, X7 + JMP callbackasm1(SB) + MOV $463, X7 + JMP callbackasm1(SB) + MOV $464, X7 + JMP callbackasm1(SB) + MOV $465, X7 + JMP callbackasm1(SB) + MOV $466, X7 + JMP callbackasm1(SB) + MOV $467, X7 + JMP callbackasm1(SB) + MOV $468, X7 + JMP callbackasm1(SB) + MOV $469, X7 + JMP callbackasm1(SB) + MOV $470, X7 + JMP callbackasm1(SB) + MOV $471, X7 + JMP callbackasm1(SB) + MOV $472, X7 + JMP callbackasm1(SB) + MOV $473, X7 + JMP callbackasm1(SB) + MOV $474, X7 + JMP callbackasm1(SB) + MOV $475, X7 + JMP callbackasm1(SB) + MOV $476, X7 + JMP callbackasm1(SB) + MOV $477, X7 + JMP callbackasm1(SB) + MOV $478, X7 + JMP callbackasm1(SB) + MOV $479, X7 + JMP callbackasm1(SB) + MOV $480, X7 + JMP callbackasm1(SB) + MOV $481, X7 + JMP callbackasm1(SB) + MOV $482, X7 + JMP callbackasm1(SB) + MOV $483, X7 + JMP callbackasm1(SB) + MOV $484, X7 + JMP callbackasm1(SB) + MOV $485, X7 + JMP callbackasm1(SB) + MOV $486, X7 + JMP callbackasm1(SB) + MOV $487, X7 + JMP callbackasm1(SB) + MOV $488, X7 + JMP callbackasm1(SB) + MOV $489, X7 + JMP callbackasm1(SB) + MOV $490, X7 + JMP callbackasm1(SB) + MOV $491, X7 + JMP callbackasm1(SB) + MOV $492, X7 + JMP callbackasm1(SB) + MOV $493, X7 + JMP callbackasm1(SB) + MOV $494, X7 + JMP callbackasm1(SB) + MOV $495, X7 + JMP callbackasm1(SB) + MOV $496, X7 + JMP callbackasm1(SB) + MOV $497, X7 + JMP callbackasm1(SB) + MOV $498, X7 + JMP callbackasm1(SB) + MOV $499, X7 + JMP callbackasm1(SB) + MOV $500, X7 + JMP callbackasm1(SB) + MOV $501, X7 + JMP callbackasm1(SB) + MOV $502, X7 + JMP callbackasm1(SB) + MOV $503, X7 + JMP callbackasm1(SB) + MOV $504, X7 + JMP callbackasm1(SB) + MOV $505, X7 + JMP callbackasm1(SB) + MOV $506, X7 + JMP callbackasm1(SB) + MOV $507, X7 + JMP callbackasm1(SB) + MOV $508, X7 + JMP callbackasm1(SB) + MOV $509, X7 + JMP callbackasm1(SB) + MOV $510, X7 + JMP callbackasm1(SB) + MOV $511, X7 + JMP callbackasm1(SB) + MOV $512, X7 + JMP callbackasm1(SB) + MOV $513, X7 + JMP callbackasm1(SB) + MOV $514, X7 + JMP callbackasm1(SB) + MOV $515, X7 + JMP callbackasm1(SB) + MOV $516, X7 + JMP callbackasm1(SB) + MOV $517, X7 + JMP callbackasm1(SB) + MOV $518, X7 + JMP callbackasm1(SB) + MOV $519, X7 + JMP callbackasm1(SB) + MOV $520, X7 + JMP callbackasm1(SB) + MOV $521, X7 + JMP callbackasm1(SB) + MOV $522, X7 + JMP callbackasm1(SB) + MOV $523, X7 + JMP callbackasm1(SB) + MOV $524, X7 + JMP callbackasm1(SB) + MOV $525, X7 + JMP callbackasm1(SB) + MOV $526, X7 + JMP callbackasm1(SB) + MOV $527, X7 + JMP callbackasm1(SB) + MOV $528, X7 + JMP callbackasm1(SB) + MOV $529, X7 + JMP callbackasm1(SB) + MOV $530, X7 + JMP callbackasm1(SB) + MOV $531, X7 + JMP callbackasm1(SB) + MOV $532, X7 + JMP callbackasm1(SB) + MOV $533, X7 + JMP callbackasm1(SB) + MOV $534, X7 + JMP callbackasm1(SB) + MOV $535, X7 + JMP callbackasm1(SB) + MOV $536, X7 + JMP callbackasm1(SB) + MOV $537, X7 + JMP callbackasm1(SB) + MOV $538, X7 + JMP callbackasm1(SB) + MOV $539, X7 + JMP callbackasm1(SB) + MOV $540, X7 + JMP callbackasm1(SB) + MOV $541, X7 + JMP callbackasm1(SB) + MOV $542, X7 + JMP callbackasm1(SB) + MOV $543, X7 + JMP callbackasm1(SB) + MOV $544, X7 + JMP callbackasm1(SB) + MOV $545, X7 + JMP callbackasm1(SB) + MOV $546, X7 + JMP callbackasm1(SB) + MOV $547, X7 + JMP callbackasm1(SB) + MOV $548, X7 + JMP callbackasm1(SB) + MOV $549, X7 + JMP callbackasm1(SB) + MOV $550, X7 + JMP callbackasm1(SB) + MOV $551, X7 + JMP callbackasm1(SB) + MOV $552, X7 + JMP callbackasm1(SB) + MOV $553, X7 + JMP callbackasm1(SB) + MOV $554, X7 + JMP callbackasm1(SB) + MOV $555, X7 + JMP callbackasm1(SB) + MOV $556, X7 + JMP callbackasm1(SB) + MOV $557, X7 + JMP callbackasm1(SB) + MOV $558, X7 + JMP callbackasm1(SB) + MOV $559, X7 + JMP callbackasm1(SB) + MOV $560, X7 + JMP callbackasm1(SB) + MOV $561, X7 + JMP callbackasm1(SB) + MOV $562, X7 + JMP callbackasm1(SB) + MOV $563, X7 + JMP callbackasm1(SB) + MOV $564, X7 + JMP callbackasm1(SB) + MOV $565, X7 + JMP callbackasm1(SB) + MOV $566, X7 + JMP callbackasm1(SB) + MOV $567, X7 + JMP callbackasm1(SB) + MOV $568, X7 + JMP callbackasm1(SB) + MOV $569, X7 + JMP callbackasm1(SB) + MOV $570, X7 + JMP callbackasm1(SB) + MOV $571, X7 + JMP callbackasm1(SB) + MOV $572, X7 + JMP callbackasm1(SB) + MOV $573, X7 + JMP callbackasm1(SB) + MOV $574, X7 + JMP callbackasm1(SB) + MOV $575, X7 + JMP callbackasm1(SB) + MOV $576, X7 + JMP callbackasm1(SB) + MOV $577, X7 + JMP callbackasm1(SB) + MOV $578, X7 + JMP callbackasm1(SB) + MOV $579, X7 + JMP callbackasm1(SB) + MOV $580, X7 + JMP callbackasm1(SB) + MOV $581, X7 + JMP callbackasm1(SB) + MOV $582, X7 + JMP callbackasm1(SB) + MOV $583, X7 + JMP callbackasm1(SB) + MOV $584, X7 + JMP callbackasm1(SB) + MOV $585, X7 + JMP callbackasm1(SB) + MOV $586, X7 + JMP callbackasm1(SB) + MOV $587, X7 + JMP callbackasm1(SB) + MOV $588, X7 + JMP callbackasm1(SB) + MOV $589, X7 + JMP callbackasm1(SB) + MOV $590, X7 + JMP callbackasm1(SB) + MOV $591, X7 + JMP callbackasm1(SB) + MOV $592, X7 + JMP callbackasm1(SB) + MOV $593, X7 + JMP callbackasm1(SB) + MOV $594, X7 + JMP callbackasm1(SB) + MOV $595, X7 + JMP callbackasm1(SB) + MOV $596, X7 + JMP callbackasm1(SB) + MOV $597, X7 + JMP callbackasm1(SB) + MOV $598, X7 + JMP callbackasm1(SB) + MOV $599, X7 + JMP callbackasm1(SB) + MOV $600, X7 + JMP callbackasm1(SB) + MOV $601, X7 + JMP callbackasm1(SB) + MOV $602, X7 + JMP callbackasm1(SB) + MOV $603, X7 + JMP callbackasm1(SB) + MOV $604, X7 + JMP callbackasm1(SB) + MOV $605, X7 + JMP callbackasm1(SB) + MOV $606, X7 + JMP callbackasm1(SB) + MOV $607, X7 + JMP callbackasm1(SB) + MOV $608, X7 + JMP callbackasm1(SB) + MOV $609, X7 + JMP callbackasm1(SB) + MOV $610, X7 + JMP callbackasm1(SB) + MOV $611, X7 + JMP callbackasm1(SB) + MOV $612, X7 + JMP callbackasm1(SB) + MOV $613, X7 + JMP callbackasm1(SB) + MOV $614, X7 + JMP callbackasm1(SB) + MOV $615, X7 + JMP callbackasm1(SB) + MOV $616, X7 + JMP callbackasm1(SB) + MOV $617, X7 + JMP callbackasm1(SB) + MOV $618, X7 + JMP callbackasm1(SB) + MOV $619, X7 + JMP callbackasm1(SB) + MOV $620, X7 + JMP callbackasm1(SB) + MOV $621, X7 + JMP callbackasm1(SB) + MOV $622, X7 + JMP callbackasm1(SB) + MOV $623, X7 + JMP callbackasm1(SB) + MOV $624, X7 + JMP callbackasm1(SB) + MOV $625, X7 + JMP callbackasm1(SB) + MOV $626, X7 + JMP callbackasm1(SB) + MOV $627, X7 + JMP callbackasm1(SB) + MOV $628, X7 + JMP callbackasm1(SB) + MOV $629, X7 + JMP callbackasm1(SB) + MOV $630, X7 + JMP callbackasm1(SB) + MOV $631, X7 + JMP callbackasm1(SB) + MOV $632, X7 + JMP callbackasm1(SB) + MOV $633, X7 + JMP callbackasm1(SB) + MOV $634, X7 + JMP callbackasm1(SB) + MOV $635, X7 + JMP callbackasm1(SB) + MOV $636, X7 + JMP callbackasm1(SB) + MOV $637, X7 + JMP callbackasm1(SB) + MOV $638, X7 + JMP callbackasm1(SB) + MOV $639, X7 + JMP callbackasm1(SB) + MOV $640, X7 + JMP callbackasm1(SB) + MOV $641, X7 + JMP callbackasm1(SB) + MOV $642, X7 + JMP callbackasm1(SB) + MOV $643, X7 + JMP callbackasm1(SB) + MOV $644, X7 + JMP callbackasm1(SB) + MOV $645, X7 + JMP callbackasm1(SB) + MOV $646, X7 + JMP callbackasm1(SB) + MOV $647, X7 + JMP callbackasm1(SB) + MOV $648, X7 + JMP callbackasm1(SB) + MOV $649, X7 + JMP callbackasm1(SB) + MOV $650, X7 + JMP callbackasm1(SB) + MOV $651, X7 + JMP callbackasm1(SB) + MOV $652, X7 + JMP callbackasm1(SB) + MOV $653, X7 + JMP callbackasm1(SB) + MOV $654, X7 + JMP callbackasm1(SB) + MOV $655, X7 + JMP callbackasm1(SB) + MOV $656, X7 + JMP callbackasm1(SB) + MOV $657, X7 + JMP callbackasm1(SB) + MOV $658, X7 + JMP callbackasm1(SB) + MOV $659, X7 + JMP callbackasm1(SB) + MOV $660, X7 + JMP callbackasm1(SB) + MOV $661, X7 + JMP callbackasm1(SB) + MOV $662, X7 + JMP callbackasm1(SB) + MOV $663, X7 + JMP callbackasm1(SB) + MOV $664, X7 + JMP callbackasm1(SB) + MOV $665, X7 + JMP callbackasm1(SB) + MOV $666, X7 + JMP callbackasm1(SB) + MOV $667, X7 + JMP callbackasm1(SB) + MOV $668, X7 + JMP callbackasm1(SB) + MOV $669, X7 + JMP callbackasm1(SB) + MOV $670, X7 + JMP callbackasm1(SB) + MOV $671, X7 + JMP callbackasm1(SB) + MOV $672, X7 + JMP callbackasm1(SB) + MOV $673, X7 + JMP callbackasm1(SB) + MOV $674, X7 + JMP callbackasm1(SB) + MOV $675, X7 + JMP callbackasm1(SB) + MOV $676, X7 + JMP callbackasm1(SB) + MOV $677, X7 + JMP callbackasm1(SB) + MOV $678, X7 + JMP callbackasm1(SB) + MOV $679, X7 + JMP callbackasm1(SB) + MOV $680, X7 + JMP callbackasm1(SB) + MOV $681, X7 + JMP callbackasm1(SB) + MOV $682, X7 + JMP callbackasm1(SB) + MOV $683, X7 + JMP callbackasm1(SB) + MOV $684, X7 + JMP callbackasm1(SB) + MOV $685, X7 + JMP callbackasm1(SB) + MOV $686, X7 + JMP callbackasm1(SB) + MOV $687, X7 + JMP callbackasm1(SB) + MOV $688, X7 + JMP callbackasm1(SB) + MOV $689, X7 + JMP callbackasm1(SB) + MOV $690, X7 + JMP callbackasm1(SB) + MOV $691, X7 + JMP callbackasm1(SB) + MOV $692, X7 + JMP callbackasm1(SB) + MOV $693, X7 + JMP callbackasm1(SB) + MOV $694, X7 + JMP callbackasm1(SB) + MOV $695, X7 + JMP callbackasm1(SB) + MOV $696, X7 + JMP callbackasm1(SB) + MOV $697, X7 + JMP callbackasm1(SB) + MOV $698, X7 + JMP callbackasm1(SB) + MOV $699, X7 + JMP callbackasm1(SB) + MOV $700, X7 + JMP callbackasm1(SB) + MOV $701, X7 + JMP callbackasm1(SB) + MOV $702, X7 + JMP callbackasm1(SB) + MOV $703, X7 + JMP callbackasm1(SB) + MOV $704, X7 + JMP callbackasm1(SB) + MOV $705, X7 + JMP callbackasm1(SB) + MOV $706, X7 + JMP callbackasm1(SB) + MOV $707, X7 + JMP callbackasm1(SB) + MOV $708, X7 + JMP callbackasm1(SB) + MOV $709, X7 + JMP callbackasm1(SB) + MOV $710, X7 + JMP callbackasm1(SB) + MOV $711, X7 + JMP callbackasm1(SB) + MOV $712, X7 + JMP callbackasm1(SB) + MOV $713, X7 + JMP callbackasm1(SB) + MOV $714, X7 + JMP callbackasm1(SB) + MOV $715, X7 + JMP callbackasm1(SB) + MOV $716, X7 + JMP callbackasm1(SB) + MOV $717, X7 + JMP callbackasm1(SB) + MOV $718, X7 + JMP callbackasm1(SB) + MOV $719, X7 + JMP callbackasm1(SB) + MOV $720, X7 + JMP callbackasm1(SB) + MOV $721, X7 + JMP callbackasm1(SB) + MOV $722, X7 + JMP callbackasm1(SB) + MOV $723, X7 + JMP callbackasm1(SB) + MOV $724, X7 + JMP callbackasm1(SB) + MOV $725, X7 + JMP callbackasm1(SB) + MOV $726, X7 + JMP callbackasm1(SB) + MOV $727, X7 + JMP callbackasm1(SB) + MOV $728, X7 + JMP callbackasm1(SB) + MOV $729, X7 + JMP callbackasm1(SB) + MOV $730, X7 + JMP callbackasm1(SB) + MOV $731, X7 + JMP callbackasm1(SB) + MOV $732, X7 + JMP callbackasm1(SB) + MOV $733, X7 + JMP callbackasm1(SB) + MOV $734, X7 + JMP callbackasm1(SB) + MOV $735, X7 + JMP callbackasm1(SB) + MOV $736, X7 + JMP callbackasm1(SB) + MOV $737, X7 + JMP callbackasm1(SB) + MOV $738, X7 + JMP callbackasm1(SB) + MOV $739, X7 + JMP callbackasm1(SB) + MOV $740, X7 + JMP callbackasm1(SB) + MOV $741, X7 + JMP callbackasm1(SB) + MOV $742, X7 + JMP callbackasm1(SB) + MOV $743, X7 + JMP callbackasm1(SB) + MOV $744, X7 + JMP callbackasm1(SB) + MOV $745, X7 + JMP callbackasm1(SB) + MOV $746, X7 + JMP callbackasm1(SB) + MOV $747, X7 + JMP callbackasm1(SB) + MOV $748, X7 + JMP callbackasm1(SB) + MOV $749, X7 + JMP callbackasm1(SB) + MOV $750, X7 + JMP callbackasm1(SB) + MOV $751, X7 + JMP callbackasm1(SB) + MOV $752, X7 + JMP callbackasm1(SB) + MOV $753, X7 + JMP callbackasm1(SB) + MOV $754, X7 + JMP callbackasm1(SB) + MOV $755, X7 + JMP callbackasm1(SB) + MOV $756, X7 + JMP callbackasm1(SB) + MOV $757, X7 + JMP callbackasm1(SB) + MOV $758, X7 + JMP callbackasm1(SB) + MOV $759, X7 + JMP callbackasm1(SB) + MOV $760, X7 + JMP callbackasm1(SB) + MOV $761, X7 + JMP callbackasm1(SB) + MOV $762, X7 + JMP callbackasm1(SB) + MOV $763, X7 + JMP callbackasm1(SB) + MOV $764, X7 + JMP callbackasm1(SB) + MOV $765, X7 + JMP callbackasm1(SB) + MOV $766, X7 + JMP callbackasm1(SB) + MOV $767, X7 + JMP callbackasm1(SB) + MOV $768, X7 + JMP callbackasm1(SB) + MOV $769, X7 + JMP callbackasm1(SB) + MOV $770, X7 + JMP callbackasm1(SB) + MOV $771, X7 + JMP callbackasm1(SB) + MOV $772, X7 + JMP callbackasm1(SB) + MOV $773, X7 + JMP callbackasm1(SB) + MOV $774, X7 + JMP callbackasm1(SB) + MOV $775, X7 + JMP callbackasm1(SB) + MOV $776, X7 + JMP callbackasm1(SB) + MOV $777, X7 + JMP callbackasm1(SB) + MOV $778, X7 + JMP callbackasm1(SB) + MOV $779, X7 + JMP callbackasm1(SB) + MOV $780, X7 + JMP callbackasm1(SB) + MOV $781, X7 + JMP callbackasm1(SB) + MOV $782, X7 + JMP callbackasm1(SB) + MOV $783, X7 + JMP callbackasm1(SB) + MOV $784, X7 + JMP callbackasm1(SB) + MOV $785, X7 + JMP callbackasm1(SB) + MOV $786, X7 + JMP callbackasm1(SB) + MOV $787, X7 + JMP callbackasm1(SB) + MOV $788, X7 + JMP callbackasm1(SB) + MOV $789, X7 + JMP callbackasm1(SB) + MOV $790, X7 + JMP callbackasm1(SB) + MOV $791, X7 + JMP callbackasm1(SB) + MOV $792, X7 + JMP callbackasm1(SB) + MOV $793, X7 + JMP callbackasm1(SB) + MOV $794, X7 + JMP callbackasm1(SB) + MOV $795, X7 + JMP callbackasm1(SB) + MOV $796, X7 + JMP callbackasm1(SB) + MOV $797, X7 + JMP callbackasm1(SB) + MOV $798, X7 + JMP callbackasm1(SB) + MOV $799, X7 + JMP callbackasm1(SB) + MOV $800, X7 + JMP callbackasm1(SB) + MOV $801, X7 + JMP callbackasm1(SB) + MOV $802, X7 + JMP callbackasm1(SB) + MOV $803, X7 + JMP callbackasm1(SB) + MOV $804, X7 + JMP callbackasm1(SB) + MOV $805, X7 + JMP callbackasm1(SB) + MOV $806, X7 + JMP callbackasm1(SB) + MOV $807, X7 + JMP callbackasm1(SB) + MOV $808, X7 + JMP callbackasm1(SB) + MOV $809, X7 + JMP callbackasm1(SB) + MOV $810, X7 + JMP callbackasm1(SB) + MOV $811, X7 + JMP callbackasm1(SB) + MOV $812, X7 + JMP callbackasm1(SB) + MOV $813, X7 + JMP callbackasm1(SB) + MOV $814, X7 + JMP callbackasm1(SB) + MOV $815, X7 + JMP callbackasm1(SB) + MOV $816, X7 + JMP callbackasm1(SB) + MOV $817, X7 + JMP callbackasm1(SB) + MOV $818, X7 + JMP callbackasm1(SB) + MOV $819, X7 + JMP callbackasm1(SB) + MOV $820, X7 + JMP callbackasm1(SB) + MOV $821, X7 + JMP callbackasm1(SB) + MOV $822, X7 + JMP callbackasm1(SB) + MOV $823, X7 + JMP callbackasm1(SB) + MOV $824, X7 + JMP callbackasm1(SB) + MOV $825, X7 + JMP callbackasm1(SB) + MOV $826, X7 + JMP callbackasm1(SB) + MOV $827, X7 + JMP callbackasm1(SB) + MOV $828, X7 + JMP callbackasm1(SB) + MOV $829, X7 + JMP callbackasm1(SB) + MOV $830, X7 + JMP callbackasm1(SB) + MOV $831, X7 + JMP callbackasm1(SB) + MOV $832, X7 + JMP callbackasm1(SB) + MOV $833, X7 + JMP callbackasm1(SB) + MOV $834, X7 + JMP callbackasm1(SB) + MOV $835, X7 + JMP callbackasm1(SB) + MOV $836, X7 + JMP callbackasm1(SB) + MOV $837, X7 + JMP callbackasm1(SB) + MOV $838, X7 + JMP callbackasm1(SB) + MOV $839, X7 + JMP callbackasm1(SB) + MOV $840, X7 + JMP callbackasm1(SB) + MOV $841, X7 + JMP callbackasm1(SB) + MOV $842, X7 + JMP callbackasm1(SB) + MOV $843, X7 + JMP callbackasm1(SB) + MOV $844, X7 + JMP callbackasm1(SB) + MOV $845, X7 + JMP callbackasm1(SB) + MOV $846, X7 + JMP callbackasm1(SB) + MOV $847, X7 + JMP callbackasm1(SB) + MOV $848, X7 + JMP callbackasm1(SB) + MOV $849, X7 + JMP callbackasm1(SB) + MOV $850, X7 + JMP callbackasm1(SB) + MOV $851, X7 + JMP callbackasm1(SB) + MOV $852, X7 + JMP callbackasm1(SB) + MOV $853, X7 + JMP callbackasm1(SB) + MOV $854, X7 + JMP callbackasm1(SB) + MOV $855, X7 + JMP callbackasm1(SB) + MOV $856, X7 + JMP callbackasm1(SB) + MOV $857, X7 + JMP callbackasm1(SB) + MOV $858, X7 + JMP callbackasm1(SB) + MOV $859, X7 + JMP callbackasm1(SB) + MOV $860, X7 + JMP callbackasm1(SB) + MOV $861, X7 + JMP callbackasm1(SB) + MOV $862, X7 + JMP callbackasm1(SB) + MOV $863, X7 + JMP callbackasm1(SB) + MOV $864, X7 + JMP callbackasm1(SB) + MOV $865, X7 + JMP callbackasm1(SB) + MOV $866, X7 + JMP callbackasm1(SB) + MOV $867, X7 + JMP callbackasm1(SB) + MOV $868, X7 + JMP callbackasm1(SB) + MOV $869, X7 + JMP callbackasm1(SB) + MOV $870, X7 + JMP callbackasm1(SB) + MOV $871, X7 + JMP callbackasm1(SB) + MOV $872, X7 + JMP callbackasm1(SB) + MOV $873, X7 + JMP callbackasm1(SB) + MOV $874, X7 + JMP callbackasm1(SB) + MOV $875, X7 + JMP callbackasm1(SB) + MOV $876, X7 + JMP callbackasm1(SB) + MOV $877, X7 + JMP callbackasm1(SB) + MOV $878, X7 + JMP callbackasm1(SB) + MOV $879, X7 + JMP callbackasm1(SB) + MOV $880, X7 + JMP callbackasm1(SB) + MOV $881, X7 + JMP callbackasm1(SB) + MOV $882, X7 + JMP callbackasm1(SB) + MOV $883, X7 + JMP callbackasm1(SB) + MOV $884, X7 + JMP callbackasm1(SB) + MOV $885, X7 + JMP callbackasm1(SB) + MOV $886, X7 + JMP callbackasm1(SB) + MOV $887, X7 + JMP callbackasm1(SB) + MOV $888, X7 + JMP callbackasm1(SB) + MOV $889, X7 + JMP callbackasm1(SB) + MOV $890, X7 + JMP callbackasm1(SB) + MOV $891, X7 + JMP callbackasm1(SB) + MOV $892, X7 + JMP callbackasm1(SB) + MOV $893, X7 + JMP callbackasm1(SB) + MOV $894, X7 + JMP callbackasm1(SB) + MOV $895, X7 + JMP callbackasm1(SB) + MOV $896, X7 + JMP callbackasm1(SB) + MOV $897, X7 + JMP callbackasm1(SB) + MOV $898, X7 + JMP callbackasm1(SB) + MOV $899, X7 + JMP callbackasm1(SB) + MOV $900, X7 + JMP callbackasm1(SB) + MOV $901, X7 + JMP callbackasm1(SB) + MOV $902, X7 + JMP callbackasm1(SB) + MOV $903, X7 + JMP callbackasm1(SB) + MOV $904, X7 + JMP callbackasm1(SB) + MOV $905, X7 + JMP callbackasm1(SB) + MOV $906, X7 + JMP callbackasm1(SB) + MOV $907, X7 + JMP callbackasm1(SB) + MOV $908, X7 + JMP callbackasm1(SB) + MOV $909, X7 + JMP callbackasm1(SB) + MOV $910, X7 + JMP callbackasm1(SB) + MOV $911, X7 + JMP callbackasm1(SB) + MOV $912, X7 + JMP callbackasm1(SB) + MOV $913, X7 + JMP callbackasm1(SB) + MOV $914, X7 + JMP callbackasm1(SB) + MOV $915, X7 + JMP callbackasm1(SB) + MOV $916, X7 + JMP callbackasm1(SB) + MOV $917, X7 + JMP callbackasm1(SB) + MOV $918, X7 + JMP callbackasm1(SB) + MOV $919, X7 + JMP callbackasm1(SB) + MOV $920, X7 + JMP callbackasm1(SB) + MOV $921, X7 + JMP callbackasm1(SB) + MOV $922, X7 + JMP callbackasm1(SB) + MOV $923, X7 + JMP callbackasm1(SB) + MOV $924, X7 + JMP callbackasm1(SB) + MOV $925, X7 + JMP callbackasm1(SB) + MOV $926, X7 + JMP callbackasm1(SB) + MOV $927, X7 + JMP callbackasm1(SB) + MOV $928, X7 + JMP callbackasm1(SB) + MOV $929, X7 + JMP callbackasm1(SB) + MOV $930, X7 + JMP callbackasm1(SB) + MOV $931, X7 + JMP callbackasm1(SB) + MOV $932, X7 + JMP callbackasm1(SB) + MOV $933, X7 + JMP callbackasm1(SB) + MOV $934, X7 + JMP callbackasm1(SB) + MOV $935, X7 + JMP callbackasm1(SB) + MOV $936, X7 + JMP callbackasm1(SB) + MOV $937, X7 + JMP callbackasm1(SB) + MOV $938, X7 + JMP callbackasm1(SB) + MOV $939, X7 + JMP callbackasm1(SB) + MOV $940, X7 + JMP callbackasm1(SB) + MOV $941, X7 + JMP callbackasm1(SB) + MOV $942, X7 + JMP callbackasm1(SB) + MOV $943, X7 + JMP callbackasm1(SB) + MOV $944, X7 + JMP callbackasm1(SB) + MOV $945, X7 + JMP callbackasm1(SB) + MOV $946, X7 + JMP callbackasm1(SB) + MOV $947, X7 + JMP callbackasm1(SB) + MOV $948, X7 + JMP callbackasm1(SB) + MOV $949, X7 + JMP callbackasm1(SB) + MOV $950, X7 + JMP callbackasm1(SB) + MOV $951, X7 + JMP callbackasm1(SB) + MOV $952, X7 + JMP callbackasm1(SB) + MOV $953, X7 + JMP callbackasm1(SB) + MOV $954, X7 + JMP callbackasm1(SB) + MOV $955, X7 + JMP callbackasm1(SB) + MOV $956, X7 + JMP callbackasm1(SB) + MOV $957, X7 + JMP callbackasm1(SB) + MOV $958, X7 + JMP callbackasm1(SB) + MOV $959, X7 + JMP callbackasm1(SB) + MOV $960, X7 + JMP callbackasm1(SB) + MOV $961, X7 + JMP callbackasm1(SB) + MOV $962, X7 + JMP callbackasm1(SB) + MOV $963, X7 + JMP callbackasm1(SB) + MOV $964, X7 + JMP callbackasm1(SB) + MOV $965, X7 + JMP callbackasm1(SB) + MOV $966, X7 + JMP callbackasm1(SB) + MOV $967, X7 + JMP callbackasm1(SB) + MOV $968, X7 + JMP callbackasm1(SB) + MOV $969, X7 + JMP callbackasm1(SB) + MOV $970, X7 + JMP callbackasm1(SB) + MOV $971, X7 + JMP callbackasm1(SB) + MOV $972, X7 + JMP callbackasm1(SB) + MOV $973, X7 + JMP callbackasm1(SB) + MOV $974, X7 + JMP callbackasm1(SB) + MOV $975, X7 + JMP callbackasm1(SB) + MOV $976, X7 + JMP callbackasm1(SB) + MOV $977, X7 + JMP callbackasm1(SB) + MOV $978, X7 + JMP callbackasm1(SB) + MOV $979, X7 + JMP callbackasm1(SB) + MOV $980, X7 + JMP callbackasm1(SB) + MOV $981, X7 + JMP callbackasm1(SB) + MOV $982, X7 + JMP callbackasm1(SB) + MOV $983, X7 + JMP callbackasm1(SB) + MOV $984, X7 + JMP callbackasm1(SB) + MOV $985, X7 + JMP callbackasm1(SB) + MOV $986, X7 + JMP callbackasm1(SB) + MOV $987, X7 + JMP callbackasm1(SB) + MOV $988, X7 + JMP callbackasm1(SB) + MOV $989, X7 + JMP callbackasm1(SB) + MOV $990, X7 + JMP callbackasm1(SB) + MOV $991, X7 + JMP callbackasm1(SB) + MOV $992, X7 + JMP callbackasm1(SB) + MOV $993, X7 + JMP callbackasm1(SB) + MOV $994, X7 + JMP callbackasm1(SB) + MOV $995, X7 + JMP callbackasm1(SB) + MOV $996, X7 + JMP callbackasm1(SB) + MOV $997, X7 + JMP callbackasm1(SB) + MOV $998, X7 + JMP callbackasm1(SB) + MOV $999, X7 + JMP callbackasm1(SB) + MOV $1000, X7 + JMP callbackasm1(SB) + MOV $1001, X7 + JMP callbackasm1(SB) + MOV $1002, X7 + JMP callbackasm1(SB) + MOV $1003, X7 + JMP callbackasm1(SB) + MOV $1004, X7 + JMP callbackasm1(SB) + MOV $1005, X7 + JMP callbackasm1(SB) + MOV $1006, X7 + JMP callbackasm1(SB) + MOV $1007, X7 + JMP callbackasm1(SB) + MOV $1008, X7 + JMP callbackasm1(SB) + MOV $1009, X7 + JMP callbackasm1(SB) + MOV $1010, X7 + JMP callbackasm1(SB) + MOV $1011, X7 + JMP callbackasm1(SB) + MOV $1012, X7 + JMP callbackasm1(SB) + MOV $1013, X7 + JMP callbackasm1(SB) + MOV $1014, X7 + JMP callbackasm1(SB) + MOV $1015, X7 + JMP callbackasm1(SB) + MOV $1016, X7 + JMP callbackasm1(SB) + MOV $1017, X7 + JMP callbackasm1(SB) + MOV $1018, X7 + JMP callbackasm1(SB) + MOV $1019, X7 + JMP callbackasm1(SB) + MOV $1020, X7 + JMP callbackasm1(SB) + MOV $1021, X7 + JMP callbackasm1(SB) + MOV $1022, X7 + JMP callbackasm1(SB) + MOV $1023, X7 + JMP callbackasm1(SB) + MOV $1024, X7 + JMP callbackasm1(SB) + MOV $1025, X7 + JMP callbackasm1(SB) + MOV $1026, X7 + JMP callbackasm1(SB) + MOV $1027, X7 + JMP callbackasm1(SB) + MOV $1028, X7 + JMP callbackasm1(SB) + MOV $1029, X7 + JMP callbackasm1(SB) + MOV $1030, X7 + JMP callbackasm1(SB) + MOV $1031, X7 + JMP callbackasm1(SB) + MOV $1032, X7 + JMP callbackasm1(SB) + MOV $1033, X7 + JMP callbackasm1(SB) + MOV $1034, X7 + JMP callbackasm1(SB) + MOV $1035, X7 + JMP callbackasm1(SB) + MOV $1036, X7 + JMP callbackasm1(SB) + MOV $1037, X7 + JMP callbackasm1(SB) + MOV $1038, X7 + JMP callbackasm1(SB) + MOV $1039, X7 + JMP callbackasm1(SB) + MOV $1040, X7 + JMP callbackasm1(SB) + MOV $1041, X7 + JMP callbackasm1(SB) + MOV $1042, X7 + JMP callbackasm1(SB) + MOV $1043, X7 + JMP callbackasm1(SB) + MOV $1044, X7 + JMP callbackasm1(SB) + MOV $1045, X7 + JMP callbackasm1(SB) + MOV $1046, X7 + JMP callbackasm1(SB) + MOV $1047, X7 + JMP callbackasm1(SB) + MOV $1048, X7 + JMP callbackasm1(SB) + MOV $1049, X7 + JMP callbackasm1(SB) + MOV $1050, X7 + JMP callbackasm1(SB) + MOV $1051, X7 + JMP callbackasm1(SB) + MOV $1052, X7 + JMP callbackasm1(SB) + MOV $1053, X7 + JMP callbackasm1(SB) + MOV $1054, X7 + JMP callbackasm1(SB) + MOV $1055, X7 + JMP callbackasm1(SB) + MOV $1056, X7 + JMP callbackasm1(SB) + MOV $1057, X7 + JMP callbackasm1(SB) + MOV $1058, X7 + JMP callbackasm1(SB) + MOV $1059, X7 + JMP callbackasm1(SB) + MOV $1060, X7 + JMP callbackasm1(SB) + MOV $1061, X7 + JMP callbackasm1(SB) + MOV $1062, X7 + JMP callbackasm1(SB) + MOV $1063, X7 + JMP callbackasm1(SB) + MOV $1064, X7 + JMP callbackasm1(SB) + MOV $1065, X7 + JMP callbackasm1(SB) + MOV $1066, X7 + JMP callbackasm1(SB) + MOV $1067, X7 + JMP callbackasm1(SB) + MOV $1068, X7 + JMP callbackasm1(SB) + MOV $1069, X7 + JMP callbackasm1(SB) + MOV $1070, X7 + JMP callbackasm1(SB) + MOV $1071, X7 + JMP callbackasm1(SB) + MOV $1072, X7 + JMP callbackasm1(SB) + MOV $1073, X7 + JMP callbackasm1(SB) + MOV $1074, X7 + JMP callbackasm1(SB) + MOV $1075, X7 + JMP callbackasm1(SB) + MOV $1076, X7 + JMP callbackasm1(SB) + MOV $1077, X7 + JMP callbackasm1(SB) + MOV $1078, X7 + JMP callbackasm1(SB) + MOV $1079, X7 + JMP callbackasm1(SB) + MOV $1080, X7 + JMP callbackasm1(SB) + MOV $1081, X7 + JMP callbackasm1(SB) + MOV $1082, X7 + JMP callbackasm1(SB) + MOV $1083, X7 + JMP callbackasm1(SB) + MOV $1084, X7 + JMP callbackasm1(SB) + MOV $1085, X7 + JMP callbackasm1(SB) + MOV $1086, X7 + JMP callbackasm1(SB) + MOV $1087, X7 + JMP callbackasm1(SB) + MOV $1088, X7 + JMP callbackasm1(SB) + MOV $1089, X7 + JMP callbackasm1(SB) + MOV $1090, X7 + JMP callbackasm1(SB) + MOV $1091, X7 + JMP callbackasm1(SB) + MOV $1092, X7 + JMP callbackasm1(SB) + MOV $1093, X7 + JMP callbackasm1(SB) + MOV $1094, X7 + JMP callbackasm1(SB) + MOV $1095, X7 + JMP callbackasm1(SB) + MOV $1096, X7 + JMP callbackasm1(SB) + MOV $1097, X7 + JMP callbackasm1(SB) + MOV $1098, X7 + JMP callbackasm1(SB) + MOV $1099, X7 + JMP callbackasm1(SB) + MOV $1100, X7 + JMP callbackasm1(SB) + MOV $1101, X7 + JMP callbackasm1(SB) + MOV $1102, X7 + JMP callbackasm1(SB) + MOV $1103, X7 + JMP callbackasm1(SB) + MOV $1104, X7 + JMP callbackasm1(SB) + MOV $1105, X7 + JMP callbackasm1(SB) + MOV $1106, X7 + JMP callbackasm1(SB) + MOV $1107, X7 + JMP callbackasm1(SB) + MOV $1108, X7 + JMP callbackasm1(SB) + MOV $1109, X7 + JMP callbackasm1(SB) + MOV $1110, X7 + JMP callbackasm1(SB) + MOV $1111, X7 + JMP callbackasm1(SB) + MOV $1112, X7 + JMP callbackasm1(SB) + MOV $1113, X7 + JMP callbackasm1(SB) + MOV $1114, X7 + JMP callbackasm1(SB) + MOV $1115, X7 + JMP callbackasm1(SB) + MOV $1116, X7 + JMP callbackasm1(SB) + MOV $1117, X7 + JMP callbackasm1(SB) + MOV $1118, X7 + JMP callbackasm1(SB) + MOV $1119, X7 + JMP callbackasm1(SB) + MOV $1120, X7 + JMP callbackasm1(SB) + MOV $1121, X7 + JMP callbackasm1(SB) + MOV $1122, X7 + JMP callbackasm1(SB) + MOV $1123, X7 + JMP callbackasm1(SB) + MOV $1124, X7 + JMP callbackasm1(SB) + MOV $1125, X7 + JMP callbackasm1(SB) + MOV $1126, X7 + JMP callbackasm1(SB) + MOV $1127, X7 + JMP callbackasm1(SB) + MOV $1128, X7 + JMP callbackasm1(SB) + MOV $1129, X7 + JMP callbackasm1(SB) + MOV $1130, X7 + JMP callbackasm1(SB) + MOV $1131, X7 + JMP callbackasm1(SB) + MOV $1132, X7 + JMP callbackasm1(SB) + MOV $1133, X7 + JMP callbackasm1(SB) + MOV $1134, X7 + JMP callbackasm1(SB) + MOV $1135, X7 + JMP callbackasm1(SB) + MOV $1136, X7 + JMP callbackasm1(SB) + MOV $1137, X7 + JMP callbackasm1(SB) + MOV $1138, X7 + JMP callbackasm1(SB) + MOV $1139, X7 + JMP callbackasm1(SB) + MOV $1140, X7 + JMP callbackasm1(SB) + MOV $1141, X7 + JMP callbackasm1(SB) + MOV $1142, X7 + JMP callbackasm1(SB) + MOV $1143, X7 + JMP callbackasm1(SB) + MOV $1144, X7 + JMP callbackasm1(SB) + MOV $1145, X7 + JMP callbackasm1(SB) + MOV $1146, X7 + JMP callbackasm1(SB) + MOV $1147, X7 + JMP callbackasm1(SB) + MOV $1148, X7 + JMP callbackasm1(SB) + MOV $1149, X7 + JMP callbackasm1(SB) + MOV $1150, X7 + JMP callbackasm1(SB) + MOV $1151, X7 + JMP callbackasm1(SB) + MOV $1152, X7 + JMP callbackasm1(SB) + MOV $1153, X7 + JMP callbackasm1(SB) + MOV $1154, X7 + JMP callbackasm1(SB) + MOV $1155, X7 + JMP callbackasm1(SB) + MOV $1156, X7 + JMP callbackasm1(SB) + MOV $1157, X7 + JMP callbackasm1(SB) + MOV $1158, X7 + JMP callbackasm1(SB) + MOV $1159, X7 + JMP callbackasm1(SB) + MOV $1160, X7 + JMP callbackasm1(SB) + MOV $1161, X7 + JMP callbackasm1(SB) + MOV $1162, X7 + JMP callbackasm1(SB) + MOV $1163, X7 + JMP callbackasm1(SB) + MOV $1164, X7 + JMP callbackasm1(SB) + MOV $1165, X7 + JMP callbackasm1(SB) + MOV $1166, X7 + JMP callbackasm1(SB) + MOV $1167, X7 + JMP callbackasm1(SB) + MOV $1168, X7 + JMP callbackasm1(SB) + MOV $1169, X7 + JMP callbackasm1(SB) + MOV $1170, X7 + JMP callbackasm1(SB) + MOV $1171, X7 + JMP callbackasm1(SB) + MOV $1172, X7 + JMP callbackasm1(SB) + MOV $1173, X7 + JMP callbackasm1(SB) + MOV $1174, X7 + JMP callbackasm1(SB) + MOV $1175, X7 + JMP callbackasm1(SB) + MOV $1176, X7 + JMP callbackasm1(SB) + MOV $1177, X7 + JMP callbackasm1(SB) + MOV $1178, X7 + JMP callbackasm1(SB) + MOV $1179, X7 + JMP callbackasm1(SB) + MOV $1180, X7 + JMP callbackasm1(SB) + MOV $1181, X7 + JMP callbackasm1(SB) + MOV $1182, X7 + JMP callbackasm1(SB) + MOV $1183, X7 + JMP callbackasm1(SB) + MOV $1184, X7 + JMP callbackasm1(SB) + MOV $1185, X7 + JMP callbackasm1(SB) + MOV $1186, X7 + JMP callbackasm1(SB) + MOV $1187, X7 + JMP callbackasm1(SB) + MOV $1188, X7 + JMP callbackasm1(SB) + MOV $1189, X7 + JMP callbackasm1(SB) + MOV $1190, X7 + JMP callbackasm1(SB) + MOV $1191, X7 + JMP callbackasm1(SB) + MOV $1192, X7 + JMP callbackasm1(SB) + MOV $1193, X7 + JMP callbackasm1(SB) + MOV $1194, X7 + JMP callbackasm1(SB) + MOV $1195, X7 + JMP callbackasm1(SB) + MOV $1196, X7 + JMP callbackasm1(SB) + MOV $1197, X7 + JMP callbackasm1(SB) + MOV $1198, X7 + JMP callbackasm1(SB) + MOV $1199, X7 + JMP callbackasm1(SB) + MOV $1200, X7 + JMP callbackasm1(SB) + MOV $1201, X7 + JMP callbackasm1(SB) + MOV $1202, X7 + JMP callbackasm1(SB) + MOV $1203, X7 + JMP callbackasm1(SB) + MOV $1204, X7 + JMP callbackasm1(SB) + MOV $1205, X7 + JMP callbackasm1(SB) + MOV $1206, X7 + JMP callbackasm1(SB) + MOV $1207, X7 + JMP callbackasm1(SB) + MOV $1208, X7 + JMP callbackasm1(SB) + MOV $1209, X7 + JMP callbackasm1(SB) + MOV $1210, X7 + JMP callbackasm1(SB) + MOV $1211, X7 + JMP callbackasm1(SB) + MOV $1212, X7 + JMP callbackasm1(SB) + MOV $1213, X7 + JMP callbackasm1(SB) + MOV $1214, X7 + JMP callbackasm1(SB) + MOV $1215, X7 + JMP callbackasm1(SB) + MOV $1216, X7 + JMP callbackasm1(SB) + MOV $1217, X7 + JMP callbackasm1(SB) + MOV $1218, X7 + JMP callbackasm1(SB) + MOV $1219, X7 + JMP callbackasm1(SB) + MOV $1220, X7 + JMP callbackasm1(SB) + MOV $1221, X7 + JMP callbackasm1(SB) + MOV $1222, X7 + JMP callbackasm1(SB) + MOV $1223, X7 + JMP callbackasm1(SB) + MOV $1224, X7 + JMP callbackasm1(SB) + MOV $1225, X7 + JMP callbackasm1(SB) + MOV $1226, X7 + JMP callbackasm1(SB) + MOV $1227, X7 + JMP callbackasm1(SB) + MOV $1228, X7 + JMP callbackasm1(SB) + MOV $1229, X7 + JMP callbackasm1(SB) + MOV $1230, X7 + JMP callbackasm1(SB) + MOV $1231, X7 + JMP callbackasm1(SB) + MOV $1232, X7 + JMP callbackasm1(SB) + MOV $1233, X7 + JMP callbackasm1(SB) + MOV $1234, X7 + JMP callbackasm1(SB) + MOV $1235, X7 + JMP callbackasm1(SB) + MOV $1236, X7 + JMP callbackasm1(SB) + MOV $1237, X7 + JMP callbackasm1(SB) + MOV $1238, X7 + JMP callbackasm1(SB) + MOV $1239, X7 + JMP callbackasm1(SB) + MOV $1240, X7 + JMP callbackasm1(SB) + MOV $1241, X7 + JMP callbackasm1(SB) + MOV $1242, X7 + JMP callbackasm1(SB) + MOV $1243, X7 + JMP callbackasm1(SB) + MOV $1244, X7 + JMP callbackasm1(SB) + MOV $1245, X7 + JMP callbackasm1(SB) + MOV $1246, X7 + JMP callbackasm1(SB) + MOV $1247, X7 + JMP callbackasm1(SB) + MOV $1248, X7 + JMP callbackasm1(SB) + MOV $1249, X7 + JMP callbackasm1(SB) + MOV $1250, X7 + JMP callbackasm1(SB) + MOV $1251, X7 + JMP callbackasm1(SB) + MOV $1252, X7 + JMP callbackasm1(SB) + MOV $1253, X7 + JMP callbackasm1(SB) + MOV $1254, X7 + JMP callbackasm1(SB) + MOV $1255, X7 + JMP callbackasm1(SB) + MOV $1256, X7 + JMP callbackasm1(SB) + MOV $1257, X7 + JMP callbackasm1(SB) + MOV $1258, X7 + JMP callbackasm1(SB) + MOV $1259, X7 + JMP callbackasm1(SB) + MOV $1260, X7 + JMP callbackasm1(SB) + MOV $1261, X7 + JMP callbackasm1(SB) + MOV $1262, X7 + JMP callbackasm1(SB) + MOV $1263, X7 + JMP callbackasm1(SB) + MOV $1264, X7 + JMP callbackasm1(SB) + MOV $1265, X7 + JMP callbackasm1(SB) + MOV $1266, X7 + JMP callbackasm1(SB) + MOV $1267, X7 + JMP callbackasm1(SB) + MOV $1268, X7 + JMP callbackasm1(SB) + MOV $1269, X7 + JMP callbackasm1(SB) + MOV $1270, X7 + JMP callbackasm1(SB) + MOV $1271, X7 + JMP callbackasm1(SB) + MOV $1272, X7 + JMP callbackasm1(SB) + MOV $1273, X7 + JMP callbackasm1(SB) + MOV $1274, X7 + JMP callbackasm1(SB) + MOV $1275, X7 + JMP callbackasm1(SB) + MOV $1276, X7 + JMP callbackasm1(SB) + MOV $1277, X7 + JMP callbackasm1(SB) + MOV $1278, X7 + JMP callbackasm1(SB) + MOV $1279, X7 + JMP callbackasm1(SB) + MOV $1280, X7 + JMP callbackasm1(SB) + MOV $1281, X7 + JMP callbackasm1(SB) + MOV $1282, X7 + JMP callbackasm1(SB) + MOV $1283, X7 + JMP callbackasm1(SB) + MOV $1284, X7 + JMP callbackasm1(SB) + MOV $1285, X7 + JMP callbackasm1(SB) + MOV $1286, X7 + JMP callbackasm1(SB) + MOV $1287, X7 + JMP callbackasm1(SB) + MOV $1288, X7 + JMP callbackasm1(SB) + MOV $1289, X7 + JMP callbackasm1(SB) + MOV $1290, X7 + JMP callbackasm1(SB) + MOV $1291, X7 + JMP callbackasm1(SB) + MOV $1292, X7 + JMP callbackasm1(SB) + MOV $1293, X7 + JMP callbackasm1(SB) + MOV $1294, X7 + JMP callbackasm1(SB) + MOV $1295, X7 + JMP callbackasm1(SB) + MOV $1296, X7 + JMP callbackasm1(SB) + MOV $1297, X7 + JMP callbackasm1(SB) + MOV $1298, X7 + JMP callbackasm1(SB) + MOV $1299, X7 + JMP callbackasm1(SB) + MOV $1300, X7 + JMP callbackasm1(SB) + MOV $1301, X7 + JMP callbackasm1(SB) + MOV $1302, X7 + JMP callbackasm1(SB) + MOV $1303, X7 + JMP callbackasm1(SB) + MOV $1304, X7 + JMP callbackasm1(SB) + MOV $1305, X7 + JMP callbackasm1(SB) + MOV $1306, X7 + JMP callbackasm1(SB) + MOV $1307, X7 + JMP callbackasm1(SB) + MOV $1308, X7 + JMP callbackasm1(SB) + MOV $1309, X7 + JMP callbackasm1(SB) + MOV $1310, X7 + JMP callbackasm1(SB) + MOV $1311, X7 + JMP callbackasm1(SB) + MOV $1312, X7 + JMP callbackasm1(SB) + MOV $1313, X7 + JMP callbackasm1(SB) + MOV $1314, X7 + JMP callbackasm1(SB) + MOV $1315, X7 + JMP callbackasm1(SB) + MOV $1316, X7 + JMP callbackasm1(SB) + MOV $1317, X7 + JMP callbackasm1(SB) + MOV $1318, X7 + JMP callbackasm1(SB) + MOV $1319, X7 + JMP callbackasm1(SB) + MOV $1320, X7 + JMP callbackasm1(SB) + MOV $1321, X7 + JMP callbackasm1(SB) + MOV $1322, X7 + JMP callbackasm1(SB) + MOV $1323, X7 + JMP callbackasm1(SB) + MOV $1324, X7 + JMP callbackasm1(SB) + MOV $1325, X7 + JMP callbackasm1(SB) + MOV $1326, X7 + JMP callbackasm1(SB) + MOV $1327, X7 + JMP callbackasm1(SB) + MOV $1328, X7 + JMP callbackasm1(SB) + MOV $1329, X7 + JMP callbackasm1(SB) + MOV $1330, X7 + JMP callbackasm1(SB) + MOV $1331, X7 + JMP callbackasm1(SB) + MOV $1332, X7 + JMP callbackasm1(SB) + MOV $1333, X7 + JMP callbackasm1(SB) + MOV $1334, X7 + JMP callbackasm1(SB) + MOV $1335, X7 + JMP callbackasm1(SB) + MOV $1336, X7 + JMP callbackasm1(SB) + MOV $1337, X7 + JMP callbackasm1(SB) + MOV $1338, X7 + JMP callbackasm1(SB) + MOV $1339, X7 + JMP callbackasm1(SB) + MOV $1340, X7 + JMP callbackasm1(SB) + MOV $1341, X7 + JMP callbackasm1(SB) + MOV $1342, X7 + JMP callbackasm1(SB) + MOV $1343, X7 + JMP callbackasm1(SB) + MOV $1344, X7 + JMP callbackasm1(SB) + MOV $1345, X7 + JMP callbackasm1(SB) + MOV $1346, X7 + JMP callbackasm1(SB) + MOV $1347, X7 + JMP callbackasm1(SB) + MOV $1348, X7 + JMP callbackasm1(SB) + MOV $1349, X7 + JMP callbackasm1(SB) + MOV $1350, X7 + JMP callbackasm1(SB) + MOV $1351, X7 + JMP callbackasm1(SB) + MOV $1352, X7 + JMP callbackasm1(SB) + MOV $1353, X7 + JMP callbackasm1(SB) + MOV $1354, X7 + JMP callbackasm1(SB) + MOV $1355, X7 + JMP callbackasm1(SB) + MOV $1356, X7 + JMP callbackasm1(SB) + MOV $1357, X7 + JMP callbackasm1(SB) + MOV $1358, X7 + JMP callbackasm1(SB) + MOV $1359, X7 + JMP callbackasm1(SB) + MOV $1360, X7 + JMP callbackasm1(SB) + MOV $1361, X7 + JMP callbackasm1(SB) + MOV $1362, X7 + JMP callbackasm1(SB) + MOV $1363, X7 + JMP callbackasm1(SB) + MOV $1364, X7 + JMP callbackasm1(SB) + MOV $1365, X7 + JMP callbackasm1(SB) + MOV $1366, X7 + JMP callbackasm1(SB) + MOV $1367, X7 + JMP callbackasm1(SB) + MOV $1368, X7 + JMP callbackasm1(SB) + MOV $1369, X7 + JMP callbackasm1(SB) + MOV $1370, X7 + JMP callbackasm1(SB) + MOV $1371, X7 + JMP callbackasm1(SB) + MOV $1372, X7 + JMP callbackasm1(SB) + MOV $1373, X7 + JMP callbackasm1(SB) + MOV $1374, X7 + JMP callbackasm1(SB) + MOV $1375, X7 + JMP callbackasm1(SB) + MOV $1376, X7 + JMP callbackasm1(SB) + MOV $1377, X7 + JMP callbackasm1(SB) + MOV $1378, X7 + JMP callbackasm1(SB) + MOV $1379, X7 + JMP callbackasm1(SB) + MOV $1380, X7 + JMP callbackasm1(SB) + MOV $1381, X7 + JMP callbackasm1(SB) + MOV $1382, X7 + JMP callbackasm1(SB) + MOV $1383, X7 + JMP callbackasm1(SB) + MOV $1384, X7 + JMP callbackasm1(SB) + MOV $1385, X7 + JMP callbackasm1(SB) + MOV $1386, X7 + JMP callbackasm1(SB) + MOV $1387, X7 + JMP callbackasm1(SB) + MOV $1388, X7 + JMP callbackasm1(SB) + MOV $1389, X7 + JMP callbackasm1(SB) + MOV $1390, X7 + JMP callbackasm1(SB) + MOV $1391, X7 + JMP callbackasm1(SB) + MOV $1392, X7 + JMP callbackasm1(SB) + MOV $1393, X7 + JMP callbackasm1(SB) + MOV $1394, X7 + JMP callbackasm1(SB) + MOV $1395, X7 + JMP callbackasm1(SB) + MOV $1396, X7 + JMP callbackasm1(SB) + MOV $1397, X7 + JMP callbackasm1(SB) + MOV $1398, X7 + JMP callbackasm1(SB) + MOV $1399, X7 + JMP callbackasm1(SB) + MOV $1400, X7 + JMP callbackasm1(SB) + MOV $1401, X7 + JMP callbackasm1(SB) + MOV $1402, X7 + JMP callbackasm1(SB) + MOV $1403, X7 + JMP callbackasm1(SB) + MOV $1404, X7 + JMP callbackasm1(SB) + MOV $1405, X7 + JMP callbackasm1(SB) + MOV $1406, X7 + JMP callbackasm1(SB) + MOV $1407, X7 + JMP callbackasm1(SB) + MOV $1408, X7 + JMP callbackasm1(SB) + MOV $1409, X7 + JMP callbackasm1(SB) + MOV $1410, X7 + JMP callbackasm1(SB) + MOV $1411, X7 + JMP callbackasm1(SB) + MOV $1412, X7 + JMP callbackasm1(SB) + MOV $1413, X7 + JMP callbackasm1(SB) + MOV $1414, X7 + JMP callbackasm1(SB) + MOV $1415, X7 + JMP callbackasm1(SB) + MOV $1416, X7 + JMP callbackasm1(SB) + MOV $1417, X7 + JMP callbackasm1(SB) + MOV $1418, X7 + JMP callbackasm1(SB) + MOV $1419, X7 + JMP callbackasm1(SB) + MOV $1420, X7 + JMP callbackasm1(SB) + MOV $1421, X7 + JMP callbackasm1(SB) + MOV $1422, X7 + JMP callbackasm1(SB) + MOV $1423, X7 + JMP callbackasm1(SB) + MOV $1424, X7 + JMP callbackasm1(SB) + MOV $1425, X7 + JMP callbackasm1(SB) + MOV $1426, X7 + JMP callbackasm1(SB) + MOV $1427, X7 + JMP callbackasm1(SB) + MOV $1428, X7 + JMP callbackasm1(SB) + MOV $1429, X7 + JMP callbackasm1(SB) + MOV $1430, X7 + JMP callbackasm1(SB) + MOV $1431, X7 + JMP callbackasm1(SB) + MOV $1432, X7 + JMP callbackasm1(SB) + MOV $1433, X7 + JMP callbackasm1(SB) + MOV $1434, X7 + JMP callbackasm1(SB) + MOV $1435, X7 + JMP callbackasm1(SB) + MOV $1436, X7 + JMP callbackasm1(SB) + MOV $1437, X7 + JMP callbackasm1(SB) + MOV $1438, X7 + JMP callbackasm1(SB) + MOV $1439, X7 + JMP callbackasm1(SB) + MOV $1440, X7 + JMP callbackasm1(SB) + MOV $1441, X7 + JMP callbackasm1(SB) + MOV $1442, X7 + JMP callbackasm1(SB) + MOV $1443, X7 + JMP callbackasm1(SB) + MOV $1444, X7 + JMP callbackasm1(SB) + MOV $1445, X7 + JMP callbackasm1(SB) + MOV $1446, X7 + JMP callbackasm1(SB) + MOV $1447, X7 + JMP callbackasm1(SB) + MOV $1448, X7 + JMP callbackasm1(SB) + MOV $1449, X7 + JMP callbackasm1(SB) + MOV $1450, X7 + JMP callbackasm1(SB) + MOV $1451, X7 + JMP callbackasm1(SB) + MOV $1452, X7 + JMP callbackasm1(SB) + MOV $1453, X7 + JMP callbackasm1(SB) + MOV $1454, X7 + JMP callbackasm1(SB) + MOV $1455, X7 + JMP callbackasm1(SB) + MOV $1456, X7 + JMP callbackasm1(SB) + MOV $1457, X7 + JMP callbackasm1(SB) + MOV $1458, X7 + JMP callbackasm1(SB) + MOV $1459, X7 + JMP callbackasm1(SB) + MOV $1460, X7 + JMP callbackasm1(SB) + MOV $1461, X7 + JMP callbackasm1(SB) + MOV $1462, X7 + JMP callbackasm1(SB) + MOV $1463, X7 + JMP callbackasm1(SB) + MOV $1464, X7 + JMP callbackasm1(SB) + MOV $1465, X7 + JMP callbackasm1(SB) + MOV $1466, X7 + JMP callbackasm1(SB) + MOV $1467, X7 + JMP callbackasm1(SB) + MOV $1468, X7 + JMP callbackasm1(SB) + MOV $1469, X7 + JMP callbackasm1(SB) + MOV $1470, X7 + JMP callbackasm1(SB) + MOV $1471, X7 + JMP callbackasm1(SB) + MOV $1472, X7 + JMP callbackasm1(SB) + MOV $1473, X7 + JMP callbackasm1(SB) + MOV $1474, X7 + JMP callbackasm1(SB) + MOV $1475, X7 + JMP callbackasm1(SB) + MOV $1476, X7 + JMP callbackasm1(SB) + MOV $1477, X7 + JMP callbackasm1(SB) + MOV $1478, X7 + JMP callbackasm1(SB) + MOV $1479, X7 + JMP callbackasm1(SB) + MOV $1480, X7 + JMP callbackasm1(SB) + MOV $1481, X7 + JMP callbackasm1(SB) + MOV $1482, X7 + JMP callbackasm1(SB) + MOV $1483, X7 + JMP callbackasm1(SB) + MOV $1484, X7 + JMP callbackasm1(SB) + MOV $1485, X7 + JMP callbackasm1(SB) + MOV $1486, X7 + JMP callbackasm1(SB) + MOV $1487, X7 + JMP callbackasm1(SB) + MOV $1488, X7 + JMP callbackasm1(SB) + MOV $1489, X7 + JMP callbackasm1(SB) + MOV $1490, X7 + JMP callbackasm1(SB) + MOV $1491, X7 + JMP callbackasm1(SB) + MOV $1492, X7 + JMP callbackasm1(SB) + MOV $1493, X7 + JMP callbackasm1(SB) + MOV $1494, X7 + JMP callbackasm1(SB) + MOV $1495, X7 + JMP callbackasm1(SB) + MOV $1496, X7 + JMP callbackasm1(SB) + MOV $1497, X7 + JMP callbackasm1(SB) + MOV $1498, X7 + JMP callbackasm1(SB) + MOV $1499, X7 + JMP callbackasm1(SB) + MOV $1500, X7 + JMP callbackasm1(SB) + MOV $1501, X7 + JMP callbackasm1(SB) + MOV $1502, X7 + JMP callbackasm1(SB) + MOV $1503, X7 + JMP callbackasm1(SB) + MOV $1504, X7 + JMP callbackasm1(SB) + MOV $1505, X7 + JMP callbackasm1(SB) + MOV $1506, X7 + JMP callbackasm1(SB) + MOV $1507, X7 + JMP callbackasm1(SB) + MOV $1508, X7 + JMP callbackasm1(SB) + MOV $1509, X7 + JMP callbackasm1(SB) + MOV $1510, X7 + JMP callbackasm1(SB) + MOV $1511, X7 + JMP callbackasm1(SB) + MOV $1512, X7 + JMP callbackasm1(SB) + MOV $1513, X7 + JMP callbackasm1(SB) + MOV $1514, X7 + JMP callbackasm1(SB) + MOV $1515, X7 + JMP callbackasm1(SB) + MOV $1516, X7 + JMP callbackasm1(SB) + MOV $1517, X7 + JMP callbackasm1(SB) + MOV $1518, X7 + JMP callbackasm1(SB) + MOV $1519, X7 + JMP callbackasm1(SB) + MOV $1520, X7 + JMP callbackasm1(SB) + MOV $1521, X7 + JMP callbackasm1(SB) + MOV $1522, X7 + JMP callbackasm1(SB) + MOV $1523, X7 + JMP callbackasm1(SB) + MOV $1524, X7 + JMP callbackasm1(SB) + MOV $1525, X7 + JMP callbackasm1(SB) + MOV $1526, X7 + JMP callbackasm1(SB) + MOV $1527, X7 + JMP callbackasm1(SB) + MOV $1528, X7 + JMP callbackasm1(SB) + MOV $1529, X7 + JMP callbackasm1(SB) + MOV $1530, X7 + JMP callbackasm1(SB) + MOV $1531, X7 + JMP callbackasm1(SB) + MOV $1532, X7 + JMP callbackasm1(SB) + MOV $1533, X7 + JMP callbackasm1(SB) + MOV $1534, X7 + JMP callbackasm1(SB) + MOV $1535, X7 + JMP callbackasm1(SB) + MOV $1536, X7 + JMP callbackasm1(SB) + MOV $1537, X7 + JMP callbackasm1(SB) + MOV $1538, X7 + JMP callbackasm1(SB) + MOV $1539, X7 + JMP callbackasm1(SB) + MOV $1540, X7 + JMP callbackasm1(SB) + MOV $1541, X7 + JMP callbackasm1(SB) + MOV $1542, X7 + JMP callbackasm1(SB) + MOV $1543, X7 + JMP callbackasm1(SB) + MOV $1544, X7 + JMP callbackasm1(SB) + MOV $1545, X7 + JMP callbackasm1(SB) + MOV $1546, X7 + JMP callbackasm1(SB) + MOV $1547, X7 + JMP callbackasm1(SB) + MOV $1548, X7 + JMP callbackasm1(SB) + MOV $1549, X7 + JMP callbackasm1(SB) + MOV $1550, X7 + JMP callbackasm1(SB) + MOV $1551, X7 + JMP callbackasm1(SB) + MOV $1552, X7 + JMP callbackasm1(SB) + MOV $1553, X7 + JMP callbackasm1(SB) + MOV $1554, X7 + JMP callbackasm1(SB) + MOV $1555, X7 + JMP callbackasm1(SB) + MOV $1556, X7 + JMP callbackasm1(SB) + MOV $1557, X7 + JMP callbackasm1(SB) + MOV $1558, X7 + JMP callbackasm1(SB) + MOV $1559, X7 + JMP callbackasm1(SB) + MOV $1560, X7 + JMP callbackasm1(SB) + MOV $1561, X7 + JMP callbackasm1(SB) + MOV $1562, X7 + JMP callbackasm1(SB) + MOV $1563, X7 + JMP callbackasm1(SB) + MOV $1564, X7 + JMP callbackasm1(SB) + MOV $1565, X7 + JMP callbackasm1(SB) + MOV $1566, X7 + JMP callbackasm1(SB) + MOV $1567, X7 + JMP callbackasm1(SB) + MOV $1568, X7 + JMP callbackasm1(SB) + MOV $1569, X7 + JMP callbackasm1(SB) + MOV $1570, X7 + JMP callbackasm1(SB) + MOV $1571, X7 + JMP callbackasm1(SB) + MOV $1572, X7 + JMP callbackasm1(SB) + MOV $1573, X7 + JMP callbackasm1(SB) + MOV $1574, X7 + JMP callbackasm1(SB) + MOV $1575, X7 + JMP callbackasm1(SB) + MOV $1576, X7 + JMP callbackasm1(SB) + MOV $1577, X7 + JMP callbackasm1(SB) + MOV $1578, X7 + JMP callbackasm1(SB) + MOV $1579, X7 + JMP callbackasm1(SB) + MOV $1580, X7 + JMP callbackasm1(SB) + MOV $1581, X7 + JMP callbackasm1(SB) + MOV $1582, X7 + JMP callbackasm1(SB) + MOV $1583, X7 + JMP callbackasm1(SB) + MOV $1584, X7 + JMP callbackasm1(SB) + MOV $1585, X7 + JMP callbackasm1(SB) + MOV $1586, X7 + JMP callbackasm1(SB) + MOV $1587, X7 + JMP callbackasm1(SB) + MOV $1588, X7 + JMP callbackasm1(SB) + MOV $1589, X7 + JMP callbackasm1(SB) + MOV $1590, X7 + JMP callbackasm1(SB) + MOV $1591, X7 + JMP callbackasm1(SB) + MOV $1592, X7 + JMP callbackasm1(SB) + MOV $1593, X7 + JMP callbackasm1(SB) + MOV $1594, X7 + JMP callbackasm1(SB) + MOV $1595, X7 + JMP callbackasm1(SB) + MOV $1596, X7 + JMP callbackasm1(SB) + MOV $1597, X7 + JMP callbackasm1(SB) + MOV $1598, X7 + JMP callbackasm1(SB) + MOV $1599, X7 + JMP callbackasm1(SB) + MOV $1600, X7 + JMP callbackasm1(SB) + MOV $1601, X7 + JMP callbackasm1(SB) + MOV $1602, X7 + JMP callbackasm1(SB) + MOV $1603, X7 + JMP callbackasm1(SB) + MOV $1604, X7 + JMP callbackasm1(SB) + MOV $1605, X7 + JMP callbackasm1(SB) + MOV $1606, X7 + JMP callbackasm1(SB) + MOV $1607, X7 + JMP callbackasm1(SB) + MOV $1608, X7 + JMP callbackasm1(SB) + MOV $1609, X7 + JMP callbackasm1(SB) + MOV $1610, X7 + JMP callbackasm1(SB) + MOV $1611, X7 + JMP callbackasm1(SB) + MOV $1612, X7 + JMP callbackasm1(SB) + MOV $1613, X7 + JMP callbackasm1(SB) + MOV $1614, X7 + JMP callbackasm1(SB) + MOV $1615, X7 + JMP callbackasm1(SB) + MOV $1616, X7 + JMP callbackasm1(SB) + MOV $1617, X7 + JMP callbackasm1(SB) + MOV $1618, X7 + JMP callbackasm1(SB) + MOV $1619, X7 + JMP callbackasm1(SB) + MOV $1620, X7 + JMP callbackasm1(SB) + MOV $1621, X7 + JMP callbackasm1(SB) + MOV $1622, X7 + JMP callbackasm1(SB) + MOV $1623, X7 + JMP callbackasm1(SB) + MOV $1624, X7 + JMP callbackasm1(SB) + MOV $1625, X7 + JMP callbackasm1(SB) + MOV $1626, X7 + JMP callbackasm1(SB) + MOV $1627, X7 + JMP callbackasm1(SB) + MOV $1628, X7 + JMP callbackasm1(SB) + MOV $1629, X7 + JMP callbackasm1(SB) + MOV $1630, X7 + JMP callbackasm1(SB) + MOV $1631, X7 + JMP callbackasm1(SB) + MOV $1632, X7 + JMP callbackasm1(SB) + MOV $1633, X7 + JMP callbackasm1(SB) + MOV $1634, X7 + JMP callbackasm1(SB) + MOV $1635, X7 + JMP callbackasm1(SB) + MOV $1636, X7 + JMP callbackasm1(SB) + MOV $1637, X7 + JMP callbackasm1(SB) + MOV $1638, X7 + JMP callbackasm1(SB) + MOV $1639, X7 + JMP callbackasm1(SB) + MOV $1640, X7 + JMP callbackasm1(SB) + MOV $1641, X7 + JMP callbackasm1(SB) + MOV $1642, X7 + JMP callbackasm1(SB) + MOV $1643, X7 + JMP callbackasm1(SB) + MOV $1644, X7 + JMP callbackasm1(SB) + MOV $1645, X7 + JMP callbackasm1(SB) + MOV $1646, X7 + JMP callbackasm1(SB) + MOV $1647, X7 + JMP callbackasm1(SB) + MOV $1648, X7 + JMP callbackasm1(SB) + MOV $1649, X7 + JMP callbackasm1(SB) + MOV $1650, X7 + JMP callbackasm1(SB) + MOV $1651, X7 + JMP callbackasm1(SB) + MOV $1652, X7 + JMP callbackasm1(SB) + MOV $1653, X7 + JMP callbackasm1(SB) + MOV $1654, X7 + JMP callbackasm1(SB) + MOV $1655, X7 + JMP callbackasm1(SB) + MOV $1656, X7 + JMP callbackasm1(SB) + MOV $1657, X7 + JMP callbackasm1(SB) + MOV $1658, X7 + JMP callbackasm1(SB) + MOV $1659, X7 + JMP callbackasm1(SB) + MOV $1660, X7 + JMP callbackasm1(SB) + MOV $1661, X7 + JMP callbackasm1(SB) + MOV $1662, X7 + JMP callbackasm1(SB) + MOV $1663, X7 + JMP callbackasm1(SB) + MOV $1664, X7 + JMP callbackasm1(SB) + MOV $1665, X7 + JMP callbackasm1(SB) + MOV $1666, X7 + JMP callbackasm1(SB) + MOV $1667, X7 + JMP callbackasm1(SB) + MOV $1668, X7 + JMP callbackasm1(SB) + MOV $1669, X7 + JMP callbackasm1(SB) + MOV $1670, X7 + JMP callbackasm1(SB) + MOV $1671, X7 + JMP callbackasm1(SB) + MOV $1672, X7 + JMP callbackasm1(SB) + MOV $1673, X7 + JMP callbackasm1(SB) + MOV $1674, X7 + JMP callbackasm1(SB) + MOV $1675, X7 + JMP callbackasm1(SB) + MOV $1676, X7 + JMP callbackasm1(SB) + MOV $1677, X7 + JMP callbackasm1(SB) + MOV $1678, X7 + JMP callbackasm1(SB) + MOV $1679, X7 + JMP callbackasm1(SB) + MOV $1680, X7 + JMP callbackasm1(SB) + MOV $1681, X7 + JMP callbackasm1(SB) + MOV $1682, X7 + JMP callbackasm1(SB) + MOV $1683, X7 + JMP callbackasm1(SB) + MOV $1684, X7 + JMP callbackasm1(SB) + MOV $1685, X7 + JMP callbackasm1(SB) + MOV $1686, X7 + JMP callbackasm1(SB) + MOV $1687, X7 + JMP callbackasm1(SB) + MOV $1688, X7 + JMP callbackasm1(SB) + MOV $1689, X7 + JMP callbackasm1(SB) + MOV $1690, X7 + JMP callbackasm1(SB) + MOV $1691, X7 + JMP callbackasm1(SB) + MOV $1692, X7 + JMP callbackasm1(SB) + MOV $1693, X7 + JMP callbackasm1(SB) + MOV $1694, X7 + JMP callbackasm1(SB) + MOV $1695, X7 + JMP callbackasm1(SB) + MOV $1696, X7 + JMP callbackasm1(SB) + MOV $1697, X7 + JMP callbackasm1(SB) + MOV $1698, X7 + JMP callbackasm1(SB) + MOV $1699, X7 + JMP callbackasm1(SB) + MOV $1700, X7 + JMP callbackasm1(SB) + MOV $1701, X7 + JMP callbackasm1(SB) + MOV $1702, X7 + JMP callbackasm1(SB) + MOV $1703, X7 + JMP callbackasm1(SB) + MOV $1704, X7 + JMP callbackasm1(SB) + MOV $1705, X7 + JMP callbackasm1(SB) + MOV $1706, X7 + JMP callbackasm1(SB) + MOV $1707, X7 + JMP callbackasm1(SB) + MOV $1708, X7 + JMP callbackasm1(SB) + MOV $1709, X7 + JMP callbackasm1(SB) + MOV $1710, X7 + JMP callbackasm1(SB) + MOV $1711, X7 + JMP callbackasm1(SB) + MOV $1712, X7 + JMP callbackasm1(SB) + MOV $1713, X7 + JMP callbackasm1(SB) + MOV $1714, X7 + JMP callbackasm1(SB) + MOV $1715, X7 + JMP callbackasm1(SB) + MOV $1716, X7 + JMP callbackasm1(SB) + MOV $1717, X7 + JMP callbackasm1(SB) + MOV $1718, X7 + JMP callbackasm1(SB) + MOV $1719, X7 + JMP callbackasm1(SB) + MOV $1720, X7 + JMP callbackasm1(SB) + MOV $1721, X7 + JMP callbackasm1(SB) + MOV $1722, X7 + JMP callbackasm1(SB) + MOV $1723, X7 + JMP callbackasm1(SB) + MOV $1724, X7 + JMP callbackasm1(SB) + MOV $1725, X7 + JMP callbackasm1(SB) + MOV $1726, X7 + JMP callbackasm1(SB) + MOV $1727, X7 + JMP callbackasm1(SB) + MOV $1728, X7 + JMP callbackasm1(SB) + MOV $1729, X7 + JMP callbackasm1(SB) + MOV $1730, X7 + JMP callbackasm1(SB) + MOV $1731, X7 + JMP callbackasm1(SB) + MOV $1732, X7 + JMP callbackasm1(SB) + MOV $1733, X7 + JMP callbackasm1(SB) + MOV $1734, X7 + JMP callbackasm1(SB) + MOV $1735, X7 + JMP callbackasm1(SB) + MOV $1736, X7 + JMP callbackasm1(SB) + MOV $1737, X7 + JMP callbackasm1(SB) + MOV $1738, X7 + JMP callbackasm1(SB) + MOV $1739, X7 + JMP callbackasm1(SB) + MOV $1740, X7 + JMP callbackasm1(SB) + MOV $1741, X7 + JMP callbackasm1(SB) + MOV $1742, X7 + JMP callbackasm1(SB) + MOV $1743, X7 + JMP callbackasm1(SB) + MOV $1744, X7 + JMP callbackasm1(SB) + MOV $1745, X7 + JMP callbackasm1(SB) + MOV $1746, X7 + JMP callbackasm1(SB) + MOV $1747, X7 + JMP callbackasm1(SB) + MOV $1748, X7 + JMP callbackasm1(SB) + MOV $1749, X7 + JMP callbackasm1(SB) + MOV $1750, X7 + JMP callbackasm1(SB) + MOV $1751, X7 + JMP callbackasm1(SB) + MOV $1752, X7 + JMP callbackasm1(SB) + MOV $1753, X7 + JMP callbackasm1(SB) + MOV $1754, X7 + JMP callbackasm1(SB) + MOV $1755, X7 + JMP callbackasm1(SB) + MOV $1756, X7 + JMP callbackasm1(SB) + MOV $1757, X7 + JMP callbackasm1(SB) + MOV $1758, X7 + JMP callbackasm1(SB) + MOV $1759, X7 + JMP callbackasm1(SB) + MOV $1760, X7 + JMP callbackasm1(SB) + MOV $1761, X7 + JMP callbackasm1(SB) + MOV $1762, X7 + JMP callbackasm1(SB) + MOV $1763, X7 + JMP callbackasm1(SB) + MOV $1764, X7 + JMP callbackasm1(SB) + MOV $1765, X7 + JMP callbackasm1(SB) + MOV $1766, X7 + JMP callbackasm1(SB) + MOV $1767, X7 + JMP callbackasm1(SB) + MOV $1768, X7 + JMP callbackasm1(SB) + MOV $1769, X7 + JMP callbackasm1(SB) + MOV $1770, X7 + JMP callbackasm1(SB) + MOV $1771, X7 + JMP callbackasm1(SB) + MOV $1772, X7 + JMP callbackasm1(SB) + MOV $1773, X7 + JMP callbackasm1(SB) + MOV $1774, X7 + JMP callbackasm1(SB) + MOV $1775, X7 + JMP callbackasm1(SB) + MOV $1776, X7 + JMP callbackasm1(SB) + MOV $1777, X7 + JMP callbackasm1(SB) + MOV $1778, X7 + JMP callbackasm1(SB) + MOV $1779, X7 + JMP callbackasm1(SB) + MOV $1780, X7 + JMP callbackasm1(SB) + MOV $1781, X7 + JMP callbackasm1(SB) + MOV $1782, X7 + JMP callbackasm1(SB) + MOV $1783, X7 + JMP callbackasm1(SB) + MOV $1784, X7 + JMP callbackasm1(SB) + MOV $1785, X7 + JMP callbackasm1(SB) + MOV $1786, X7 + JMP callbackasm1(SB) + MOV $1787, X7 + JMP callbackasm1(SB) + MOV $1788, X7 + JMP callbackasm1(SB) + MOV $1789, X7 + JMP callbackasm1(SB) + MOV $1790, X7 + JMP callbackasm1(SB) + MOV $1791, X7 + JMP callbackasm1(SB) + MOV $1792, X7 + JMP callbackasm1(SB) + MOV $1793, X7 + JMP callbackasm1(SB) + MOV $1794, X7 + JMP callbackasm1(SB) + MOV $1795, X7 + JMP callbackasm1(SB) + MOV $1796, X7 + JMP callbackasm1(SB) + MOV $1797, X7 + JMP callbackasm1(SB) + MOV $1798, X7 + JMP callbackasm1(SB) + MOV $1799, X7 + JMP callbackasm1(SB) + MOV $1800, X7 + JMP callbackasm1(SB) + MOV $1801, X7 + JMP callbackasm1(SB) + MOV $1802, X7 + JMP callbackasm1(SB) + MOV $1803, X7 + JMP callbackasm1(SB) + MOV $1804, X7 + JMP callbackasm1(SB) + MOV $1805, X7 + JMP callbackasm1(SB) + MOV $1806, X7 + JMP callbackasm1(SB) + MOV $1807, X7 + JMP callbackasm1(SB) + MOV $1808, X7 + JMP callbackasm1(SB) + MOV $1809, X7 + JMP callbackasm1(SB) + MOV $1810, X7 + JMP callbackasm1(SB) + MOV $1811, X7 + JMP callbackasm1(SB) + MOV $1812, X7 + JMP callbackasm1(SB) + MOV $1813, X7 + JMP callbackasm1(SB) + MOV $1814, X7 + JMP callbackasm1(SB) + MOV $1815, X7 + JMP callbackasm1(SB) + MOV $1816, X7 + JMP callbackasm1(SB) + MOV $1817, X7 + JMP callbackasm1(SB) + MOV $1818, X7 + JMP callbackasm1(SB) + MOV $1819, X7 + JMP callbackasm1(SB) + MOV $1820, X7 + JMP callbackasm1(SB) + MOV $1821, X7 + JMP callbackasm1(SB) + MOV $1822, X7 + JMP callbackasm1(SB) + MOV $1823, X7 + JMP callbackasm1(SB) + MOV $1824, X7 + JMP callbackasm1(SB) + MOV $1825, X7 + JMP callbackasm1(SB) + MOV $1826, X7 + JMP callbackasm1(SB) + MOV $1827, X7 + JMP callbackasm1(SB) + MOV $1828, X7 + JMP callbackasm1(SB) + MOV $1829, X7 + JMP callbackasm1(SB) + MOV $1830, X7 + JMP callbackasm1(SB) + MOV $1831, X7 + JMP callbackasm1(SB) + MOV $1832, X7 + JMP callbackasm1(SB) + MOV $1833, X7 + JMP callbackasm1(SB) + MOV $1834, X7 + JMP callbackasm1(SB) + MOV $1835, X7 + JMP callbackasm1(SB) + MOV $1836, X7 + JMP callbackasm1(SB) + MOV $1837, X7 + JMP callbackasm1(SB) + MOV $1838, X7 + JMP callbackasm1(SB) + MOV $1839, X7 + JMP callbackasm1(SB) + MOV $1840, X7 + JMP callbackasm1(SB) + MOV $1841, X7 + JMP callbackasm1(SB) + MOV $1842, X7 + JMP callbackasm1(SB) + MOV $1843, X7 + JMP callbackasm1(SB) + MOV $1844, X7 + JMP callbackasm1(SB) + MOV $1845, X7 + JMP callbackasm1(SB) + MOV $1846, X7 + JMP callbackasm1(SB) + MOV $1847, X7 + JMP callbackasm1(SB) + MOV $1848, X7 + JMP callbackasm1(SB) + MOV $1849, X7 + JMP callbackasm1(SB) + MOV $1850, X7 + JMP callbackasm1(SB) + MOV $1851, X7 + JMP callbackasm1(SB) + MOV $1852, X7 + JMP callbackasm1(SB) + MOV $1853, X7 + JMP callbackasm1(SB) + MOV $1854, X7 + JMP callbackasm1(SB) + MOV $1855, X7 + JMP callbackasm1(SB) + MOV $1856, X7 + JMP callbackasm1(SB) + MOV $1857, X7 + JMP callbackasm1(SB) + MOV $1858, X7 + JMP callbackasm1(SB) + MOV $1859, X7 + JMP callbackasm1(SB) + MOV $1860, X7 + JMP callbackasm1(SB) + MOV $1861, X7 + JMP callbackasm1(SB) + MOV $1862, X7 + JMP callbackasm1(SB) + MOV $1863, X7 + JMP callbackasm1(SB) + MOV $1864, X7 + JMP callbackasm1(SB) + MOV $1865, X7 + JMP callbackasm1(SB) + MOV $1866, X7 + JMP callbackasm1(SB) + MOV $1867, X7 + JMP callbackasm1(SB) + MOV $1868, X7 + JMP callbackasm1(SB) + MOV $1869, X7 + JMP callbackasm1(SB) + MOV $1870, X7 + JMP callbackasm1(SB) + MOV $1871, X7 + JMP callbackasm1(SB) + MOV $1872, X7 + JMP callbackasm1(SB) + MOV $1873, X7 + JMP callbackasm1(SB) + MOV $1874, X7 + JMP callbackasm1(SB) + MOV $1875, X7 + JMP callbackasm1(SB) + MOV $1876, X7 + JMP callbackasm1(SB) + MOV $1877, X7 + JMP callbackasm1(SB) + MOV $1878, X7 + JMP callbackasm1(SB) + MOV $1879, X7 + JMP callbackasm1(SB) + MOV $1880, X7 + JMP callbackasm1(SB) + MOV $1881, X7 + JMP callbackasm1(SB) + MOV $1882, X7 + JMP callbackasm1(SB) + MOV $1883, X7 + JMP callbackasm1(SB) + MOV $1884, X7 + JMP callbackasm1(SB) + MOV $1885, X7 + JMP callbackasm1(SB) + MOV $1886, X7 + JMP callbackasm1(SB) + MOV $1887, X7 + JMP callbackasm1(SB) + MOV $1888, X7 + JMP callbackasm1(SB) + MOV $1889, X7 + JMP callbackasm1(SB) + MOV $1890, X7 + JMP callbackasm1(SB) + MOV $1891, X7 + JMP callbackasm1(SB) + MOV $1892, X7 + JMP callbackasm1(SB) + MOV $1893, X7 + JMP callbackasm1(SB) + MOV $1894, X7 + JMP callbackasm1(SB) + MOV $1895, X7 + JMP callbackasm1(SB) + MOV $1896, X7 + JMP callbackasm1(SB) + MOV $1897, X7 + JMP callbackasm1(SB) + MOV $1898, X7 + JMP callbackasm1(SB) + MOV $1899, X7 + JMP callbackasm1(SB) + MOV $1900, X7 + JMP callbackasm1(SB) + MOV $1901, X7 + JMP callbackasm1(SB) + MOV $1902, X7 + JMP callbackasm1(SB) + MOV $1903, X7 + JMP callbackasm1(SB) + MOV $1904, X7 + JMP callbackasm1(SB) + MOV $1905, X7 + JMP callbackasm1(SB) + MOV $1906, X7 + JMP callbackasm1(SB) + MOV $1907, X7 + JMP callbackasm1(SB) + MOV $1908, X7 + JMP callbackasm1(SB) + MOV $1909, X7 + JMP callbackasm1(SB) + MOV $1910, X7 + JMP callbackasm1(SB) + MOV $1911, X7 + JMP callbackasm1(SB) + MOV $1912, X7 + JMP callbackasm1(SB) + MOV $1913, X7 + JMP callbackasm1(SB) + MOV $1914, X7 + JMP callbackasm1(SB) + MOV $1915, X7 + JMP callbackasm1(SB) + MOV $1916, X7 + JMP callbackasm1(SB) + MOV $1917, X7 + JMP callbackasm1(SB) + MOV $1918, X7 + JMP callbackasm1(SB) + MOV $1919, X7 + JMP callbackasm1(SB) + MOV $1920, X7 + JMP callbackasm1(SB) + MOV $1921, X7 + JMP callbackasm1(SB) + MOV $1922, X7 + JMP callbackasm1(SB) + MOV $1923, X7 + JMP callbackasm1(SB) + MOV $1924, X7 + JMP callbackasm1(SB) + MOV $1925, X7 + JMP callbackasm1(SB) + MOV $1926, X7 + JMP callbackasm1(SB) + MOV $1927, X7 + JMP callbackasm1(SB) + MOV $1928, X7 + JMP callbackasm1(SB) + MOV $1929, X7 + JMP callbackasm1(SB) + MOV $1930, X7 + JMP callbackasm1(SB) + MOV $1931, X7 + JMP callbackasm1(SB) + MOV $1932, X7 + JMP callbackasm1(SB) + MOV $1933, X7 + JMP callbackasm1(SB) + MOV $1934, X7 + JMP callbackasm1(SB) + MOV $1935, X7 + JMP callbackasm1(SB) + MOV $1936, X7 + JMP callbackasm1(SB) + MOV $1937, X7 + JMP callbackasm1(SB) + MOV $1938, X7 + JMP callbackasm1(SB) + MOV $1939, X7 + JMP callbackasm1(SB) + MOV $1940, X7 + JMP callbackasm1(SB) + MOV $1941, X7 + JMP callbackasm1(SB) + MOV $1942, X7 + JMP callbackasm1(SB) + MOV $1943, X7 + JMP callbackasm1(SB) + MOV $1944, X7 + JMP callbackasm1(SB) + MOV $1945, X7 + JMP callbackasm1(SB) + MOV $1946, X7 + JMP callbackasm1(SB) + MOV $1947, X7 + JMP callbackasm1(SB) + MOV $1948, X7 + JMP callbackasm1(SB) + MOV $1949, X7 + JMP callbackasm1(SB) + MOV $1950, X7 + JMP callbackasm1(SB) + MOV $1951, X7 + JMP callbackasm1(SB) + MOV $1952, X7 + JMP callbackasm1(SB) + MOV $1953, X7 + JMP callbackasm1(SB) + MOV $1954, X7 + JMP callbackasm1(SB) + MOV $1955, X7 + JMP callbackasm1(SB) + MOV $1956, X7 + JMP callbackasm1(SB) + MOV $1957, X7 + JMP callbackasm1(SB) + MOV $1958, X7 + JMP callbackasm1(SB) + MOV $1959, X7 + JMP callbackasm1(SB) + MOV $1960, X7 + JMP callbackasm1(SB) + MOV $1961, X7 + JMP callbackasm1(SB) + MOV $1962, X7 + JMP callbackasm1(SB) + MOV $1963, X7 + JMP callbackasm1(SB) + MOV $1964, X7 + JMP callbackasm1(SB) + MOV $1965, X7 + JMP callbackasm1(SB) + MOV $1966, X7 + JMP callbackasm1(SB) + MOV $1967, X7 + JMP callbackasm1(SB) + MOV $1968, X7 + JMP callbackasm1(SB) + MOV $1969, X7 + JMP callbackasm1(SB) + MOV $1970, X7 + JMP callbackasm1(SB) + MOV $1971, X7 + JMP callbackasm1(SB) + MOV $1972, X7 + JMP callbackasm1(SB) + MOV $1973, X7 + JMP callbackasm1(SB) + MOV $1974, X7 + JMP callbackasm1(SB) + MOV $1975, X7 + JMP callbackasm1(SB) + MOV $1976, X7 + JMP callbackasm1(SB) + MOV $1977, X7 + JMP callbackasm1(SB) + MOV $1978, X7 + JMP callbackasm1(SB) + MOV $1979, X7 + JMP callbackasm1(SB) + MOV $1980, X7 + JMP callbackasm1(SB) + MOV $1981, X7 + JMP callbackasm1(SB) + MOV $1982, X7 + JMP callbackasm1(SB) + MOV $1983, X7 + JMP callbackasm1(SB) + MOV $1984, X7 + JMP callbackasm1(SB) + MOV $1985, X7 + JMP callbackasm1(SB) + MOV $1986, X7 + JMP callbackasm1(SB) + MOV $1987, X7 + JMP callbackasm1(SB) + MOV $1988, X7 + JMP callbackasm1(SB) + MOV $1989, X7 + JMP callbackasm1(SB) + MOV $1990, X7 + JMP callbackasm1(SB) + MOV $1991, X7 + JMP callbackasm1(SB) + MOV $1992, X7 + JMP callbackasm1(SB) + MOV $1993, X7 + JMP callbackasm1(SB) + MOV $1994, X7 + JMP callbackasm1(SB) + MOV $1995, X7 + JMP callbackasm1(SB) + MOV $1996, X7 + JMP callbackasm1(SB) + MOV $1997, X7 + JMP callbackasm1(SB) + MOV $1998, X7 + JMP callbackasm1(SB) + MOV $1999, X7 + JMP callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_s390x.s b/vendor/github.com/ebitengine/purego/zcallback_s390x.s new file mode 100644 index 00000000..6b5e2b03 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_s390x.s @@ -0,0 +1,4015 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build linux + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOVD and BR instructions. +// The MOVD instruction loads R0 with the callback index, and the +// BR instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R0 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +// NOTE: We use R0 instead of R11 because R11 is callee-saved on S390X. +#include "textflag.h" + +TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 + MOVD $0, R0 + BR callbackasm1(SB) + MOVD $1, R0 + BR callbackasm1(SB) + MOVD $2, R0 + BR callbackasm1(SB) + MOVD $3, R0 + BR callbackasm1(SB) + MOVD $4, R0 + BR callbackasm1(SB) + MOVD $5, R0 + BR callbackasm1(SB) + MOVD $6, R0 + BR callbackasm1(SB) + MOVD $7, R0 + BR callbackasm1(SB) + MOVD $8, R0 + BR callbackasm1(SB) + MOVD $9, R0 + BR callbackasm1(SB) + MOVD $10, R0 + BR callbackasm1(SB) + MOVD $11, R0 + BR callbackasm1(SB) + MOVD $12, R0 + BR callbackasm1(SB) + MOVD $13, R0 + BR callbackasm1(SB) + MOVD $14, R0 + BR callbackasm1(SB) + MOVD $15, R0 + BR callbackasm1(SB) + MOVD $16, R0 + BR callbackasm1(SB) + MOVD $17, R0 + BR callbackasm1(SB) + MOVD $18, R0 + BR callbackasm1(SB) + MOVD $19, R0 + BR callbackasm1(SB) + MOVD $20, R0 + BR callbackasm1(SB) + MOVD $21, R0 + BR callbackasm1(SB) + MOVD $22, R0 + BR callbackasm1(SB) + MOVD $23, R0 + BR callbackasm1(SB) + MOVD $24, R0 + BR callbackasm1(SB) + MOVD $25, R0 + BR callbackasm1(SB) + MOVD $26, R0 + BR callbackasm1(SB) + MOVD $27, R0 + BR callbackasm1(SB) + MOVD $28, R0 + BR callbackasm1(SB) + MOVD $29, R0 + BR callbackasm1(SB) + MOVD $30, R0 + BR callbackasm1(SB) + MOVD $31, R0 + BR callbackasm1(SB) + MOVD $32, R0 + BR callbackasm1(SB) + MOVD $33, R0 + BR callbackasm1(SB) + MOVD $34, R0 + BR callbackasm1(SB) + MOVD $35, R0 + BR callbackasm1(SB) + MOVD $36, R0 + BR callbackasm1(SB) + MOVD $37, R0 + BR callbackasm1(SB) + MOVD $38, R0 + BR callbackasm1(SB) + MOVD $39, R0 + BR callbackasm1(SB) + MOVD $40, R0 + BR callbackasm1(SB) + MOVD $41, R0 + BR callbackasm1(SB) + MOVD $42, R0 + BR callbackasm1(SB) + MOVD $43, R0 + BR callbackasm1(SB) + MOVD $44, R0 + BR callbackasm1(SB) + MOVD $45, R0 + BR callbackasm1(SB) + MOVD $46, R0 + BR callbackasm1(SB) + MOVD $47, R0 + BR callbackasm1(SB) + MOVD $48, R0 + BR callbackasm1(SB) + MOVD $49, R0 + BR callbackasm1(SB) + MOVD $50, R0 + BR callbackasm1(SB) + MOVD $51, R0 + BR callbackasm1(SB) + MOVD $52, R0 + BR callbackasm1(SB) + MOVD $53, R0 + BR callbackasm1(SB) + MOVD $54, R0 + BR callbackasm1(SB) + MOVD $55, R0 + BR callbackasm1(SB) + MOVD $56, R0 + BR callbackasm1(SB) + MOVD $57, R0 + BR callbackasm1(SB) + MOVD $58, R0 + BR callbackasm1(SB) + MOVD $59, R0 + BR callbackasm1(SB) + MOVD $60, R0 + BR callbackasm1(SB) + MOVD $61, R0 + BR callbackasm1(SB) + MOVD $62, R0 + BR callbackasm1(SB) + MOVD $63, R0 + BR callbackasm1(SB) + MOVD $64, R0 + BR callbackasm1(SB) + MOVD $65, R0 + BR callbackasm1(SB) + MOVD $66, R0 + BR callbackasm1(SB) + MOVD $67, R0 + BR callbackasm1(SB) + MOVD $68, R0 + BR callbackasm1(SB) + MOVD $69, R0 + BR callbackasm1(SB) + MOVD $70, R0 + BR callbackasm1(SB) + MOVD $71, R0 + BR callbackasm1(SB) + MOVD $72, R0 + BR callbackasm1(SB) + MOVD $73, R0 + BR callbackasm1(SB) + MOVD $74, R0 + BR callbackasm1(SB) + MOVD $75, R0 + BR callbackasm1(SB) + MOVD $76, R0 + BR callbackasm1(SB) + MOVD $77, R0 + BR callbackasm1(SB) + MOVD $78, R0 + BR callbackasm1(SB) + MOVD $79, R0 + BR callbackasm1(SB) + MOVD $80, R0 + BR callbackasm1(SB) + MOVD $81, R0 + BR callbackasm1(SB) + MOVD $82, R0 + BR callbackasm1(SB) + MOVD $83, R0 + BR callbackasm1(SB) + MOVD $84, R0 + BR callbackasm1(SB) + MOVD $85, R0 + BR callbackasm1(SB) + MOVD $86, R0 + BR callbackasm1(SB) + MOVD $87, R0 + BR callbackasm1(SB) + MOVD $88, R0 + BR callbackasm1(SB) + MOVD $89, R0 + BR callbackasm1(SB) + MOVD $90, R0 + BR callbackasm1(SB) + MOVD $91, R0 + BR callbackasm1(SB) + MOVD $92, R0 + BR callbackasm1(SB) + MOVD $93, R0 + BR callbackasm1(SB) + MOVD $94, R0 + BR callbackasm1(SB) + MOVD $95, R0 + BR callbackasm1(SB) + MOVD $96, R0 + BR callbackasm1(SB) + MOVD $97, R0 + BR callbackasm1(SB) + MOVD $98, R0 + BR callbackasm1(SB) + MOVD $99, R0 + BR callbackasm1(SB) + MOVD $100, R0 + BR callbackasm1(SB) + MOVD $101, R0 + BR callbackasm1(SB) + MOVD $102, R0 + BR callbackasm1(SB) + MOVD $103, R0 + BR callbackasm1(SB) + MOVD $104, R0 + BR callbackasm1(SB) + MOVD $105, R0 + BR callbackasm1(SB) + MOVD $106, R0 + BR callbackasm1(SB) + MOVD $107, R0 + BR callbackasm1(SB) + MOVD $108, R0 + BR callbackasm1(SB) + MOVD $109, R0 + BR callbackasm1(SB) + MOVD $110, R0 + BR callbackasm1(SB) + MOVD $111, R0 + BR callbackasm1(SB) + MOVD $112, R0 + BR callbackasm1(SB) + MOVD $113, R0 + BR callbackasm1(SB) + MOVD $114, R0 + BR callbackasm1(SB) + MOVD $115, R0 + BR callbackasm1(SB) + MOVD $116, R0 + BR callbackasm1(SB) + MOVD $117, R0 + BR callbackasm1(SB) + MOVD $118, R0 + BR callbackasm1(SB) + MOVD $119, R0 + BR callbackasm1(SB) + MOVD $120, R0 + BR callbackasm1(SB) + MOVD $121, R0 + BR callbackasm1(SB) + MOVD $122, R0 + BR callbackasm1(SB) + MOVD $123, R0 + BR callbackasm1(SB) + MOVD $124, R0 + BR callbackasm1(SB) + MOVD $125, R0 + BR callbackasm1(SB) + MOVD $126, R0 + BR callbackasm1(SB) + MOVD $127, R0 + BR callbackasm1(SB) + MOVD $128, R0 + BR callbackasm1(SB) + MOVD $129, R0 + BR callbackasm1(SB) + MOVD $130, R0 + BR callbackasm1(SB) + MOVD $131, R0 + BR callbackasm1(SB) + MOVD $132, R0 + BR callbackasm1(SB) + MOVD $133, R0 + BR callbackasm1(SB) + MOVD $134, R0 + BR callbackasm1(SB) + MOVD $135, R0 + BR callbackasm1(SB) + MOVD $136, R0 + BR callbackasm1(SB) + MOVD $137, R0 + BR callbackasm1(SB) + MOVD $138, R0 + BR callbackasm1(SB) + MOVD $139, R0 + BR callbackasm1(SB) + MOVD $140, R0 + BR callbackasm1(SB) + MOVD $141, R0 + BR callbackasm1(SB) + MOVD $142, R0 + BR callbackasm1(SB) + MOVD $143, R0 + BR callbackasm1(SB) + MOVD $144, R0 + BR callbackasm1(SB) + MOVD $145, R0 + BR callbackasm1(SB) + MOVD $146, R0 + BR callbackasm1(SB) + MOVD $147, R0 + BR callbackasm1(SB) + MOVD $148, R0 + BR callbackasm1(SB) + MOVD $149, R0 + BR callbackasm1(SB) + MOVD $150, R0 + BR callbackasm1(SB) + MOVD $151, R0 + BR callbackasm1(SB) + MOVD $152, R0 + BR callbackasm1(SB) + MOVD $153, R0 + BR callbackasm1(SB) + MOVD $154, R0 + BR callbackasm1(SB) + MOVD $155, R0 + BR callbackasm1(SB) + MOVD $156, R0 + BR callbackasm1(SB) + MOVD $157, R0 + BR callbackasm1(SB) + MOVD $158, R0 + BR callbackasm1(SB) + MOVD $159, R0 + BR callbackasm1(SB) + MOVD $160, R0 + BR callbackasm1(SB) + MOVD $161, R0 + BR callbackasm1(SB) + MOVD $162, R0 + BR callbackasm1(SB) + MOVD $163, R0 + BR callbackasm1(SB) + MOVD $164, R0 + BR callbackasm1(SB) + MOVD $165, R0 + BR callbackasm1(SB) + MOVD $166, R0 + BR callbackasm1(SB) + MOVD $167, R0 + BR callbackasm1(SB) + MOVD $168, R0 + BR callbackasm1(SB) + MOVD $169, R0 + BR callbackasm1(SB) + MOVD $170, R0 + BR callbackasm1(SB) + MOVD $171, R0 + BR callbackasm1(SB) + MOVD $172, R0 + BR callbackasm1(SB) + MOVD $173, R0 + BR callbackasm1(SB) + MOVD $174, R0 + BR callbackasm1(SB) + MOVD $175, R0 + BR callbackasm1(SB) + MOVD $176, R0 + BR callbackasm1(SB) + MOVD $177, R0 + BR callbackasm1(SB) + MOVD $178, R0 + BR callbackasm1(SB) + MOVD $179, R0 + BR callbackasm1(SB) + MOVD $180, R0 + BR callbackasm1(SB) + MOVD $181, R0 + BR callbackasm1(SB) + MOVD $182, R0 + BR callbackasm1(SB) + MOVD $183, R0 + BR callbackasm1(SB) + MOVD $184, R0 + BR callbackasm1(SB) + MOVD $185, R0 + BR callbackasm1(SB) + MOVD $186, R0 + BR callbackasm1(SB) + MOVD $187, R0 + BR callbackasm1(SB) + MOVD $188, R0 + BR callbackasm1(SB) + MOVD $189, R0 + BR callbackasm1(SB) + MOVD $190, R0 + BR callbackasm1(SB) + MOVD $191, R0 + BR callbackasm1(SB) + MOVD $192, R0 + BR callbackasm1(SB) + MOVD $193, R0 + BR callbackasm1(SB) + MOVD $194, R0 + BR callbackasm1(SB) + MOVD $195, R0 + BR callbackasm1(SB) + MOVD $196, R0 + BR callbackasm1(SB) + MOVD $197, R0 + BR callbackasm1(SB) + MOVD $198, R0 + BR callbackasm1(SB) + MOVD $199, R0 + BR callbackasm1(SB) + MOVD $200, R0 + BR callbackasm1(SB) + MOVD $201, R0 + BR callbackasm1(SB) + MOVD $202, R0 + BR callbackasm1(SB) + MOVD $203, R0 + BR callbackasm1(SB) + MOVD $204, R0 + BR callbackasm1(SB) + MOVD $205, R0 + BR callbackasm1(SB) + MOVD $206, R0 + BR callbackasm1(SB) + MOVD $207, R0 + BR callbackasm1(SB) + MOVD $208, R0 + BR callbackasm1(SB) + MOVD $209, R0 + BR callbackasm1(SB) + MOVD $210, R0 + BR callbackasm1(SB) + MOVD $211, R0 + BR callbackasm1(SB) + MOVD $212, R0 + BR callbackasm1(SB) + MOVD $213, R0 + BR callbackasm1(SB) + MOVD $214, R0 + BR callbackasm1(SB) + MOVD $215, R0 + BR callbackasm1(SB) + MOVD $216, R0 + BR callbackasm1(SB) + MOVD $217, R0 + BR callbackasm1(SB) + MOVD $218, R0 + BR callbackasm1(SB) + MOVD $219, R0 + BR callbackasm1(SB) + MOVD $220, R0 + BR callbackasm1(SB) + MOVD $221, R0 + BR callbackasm1(SB) + MOVD $222, R0 + BR callbackasm1(SB) + MOVD $223, R0 + BR callbackasm1(SB) + MOVD $224, R0 + BR callbackasm1(SB) + MOVD $225, R0 + BR callbackasm1(SB) + MOVD $226, R0 + BR callbackasm1(SB) + MOVD $227, R0 + BR callbackasm1(SB) + MOVD $228, R0 + BR callbackasm1(SB) + MOVD $229, R0 + BR callbackasm1(SB) + MOVD $230, R0 + BR callbackasm1(SB) + MOVD $231, R0 + BR callbackasm1(SB) + MOVD $232, R0 + BR callbackasm1(SB) + MOVD $233, R0 + BR callbackasm1(SB) + MOVD $234, R0 + BR callbackasm1(SB) + MOVD $235, R0 + BR callbackasm1(SB) + MOVD $236, R0 + BR callbackasm1(SB) + MOVD $237, R0 + BR callbackasm1(SB) + MOVD $238, R0 + BR callbackasm1(SB) + MOVD $239, R0 + BR callbackasm1(SB) + MOVD $240, R0 + BR callbackasm1(SB) + MOVD $241, R0 + BR callbackasm1(SB) + MOVD $242, R0 + BR callbackasm1(SB) + MOVD $243, R0 + BR callbackasm1(SB) + MOVD $244, R0 + BR callbackasm1(SB) + MOVD $245, R0 + BR callbackasm1(SB) + MOVD $246, R0 + BR callbackasm1(SB) + MOVD $247, R0 + BR callbackasm1(SB) + MOVD $248, R0 + BR callbackasm1(SB) + MOVD $249, R0 + BR callbackasm1(SB) + MOVD $250, R0 + BR callbackasm1(SB) + MOVD $251, R0 + BR callbackasm1(SB) + MOVD $252, R0 + BR callbackasm1(SB) + MOVD $253, R0 + BR callbackasm1(SB) + MOVD $254, R0 + BR callbackasm1(SB) + MOVD $255, R0 + BR callbackasm1(SB) + MOVD $256, R0 + BR callbackasm1(SB) + MOVD $257, R0 + BR callbackasm1(SB) + MOVD $258, R0 + BR callbackasm1(SB) + MOVD $259, R0 + BR callbackasm1(SB) + MOVD $260, R0 + BR callbackasm1(SB) + MOVD $261, R0 + BR callbackasm1(SB) + MOVD $262, R0 + BR callbackasm1(SB) + MOVD $263, R0 + BR callbackasm1(SB) + MOVD $264, R0 + BR callbackasm1(SB) + MOVD $265, R0 + BR callbackasm1(SB) + MOVD $266, R0 + BR callbackasm1(SB) + MOVD $267, R0 + BR callbackasm1(SB) + MOVD $268, R0 + BR callbackasm1(SB) + MOVD $269, R0 + BR callbackasm1(SB) + MOVD $270, R0 + BR callbackasm1(SB) + MOVD $271, R0 + BR callbackasm1(SB) + MOVD $272, R0 + BR callbackasm1(SB) + MOVD $273, R0 + BR callbackasm1(SB) + MOVD $274, R0 + BR callbackasm1(SB) + MOVD $275, R0 + BR callbackasm1(SB) + MOVD $276, R0 + BR callbackasm1(SB) + MOVD $277, R0 + BR callbackasm1(SB) + MOVD $278, R0 + BR callbackasm1(SB) + MOVD $279, R0 + BR callbackasm1(SB) + MOVD $280, R0 + BR callbackasm1(SB) + MOVD $281, R0 + BR callbackasm1(SB) + MOVD $282, R0 + BR callbackasm1(SB) + MOVD $283, R0 + BR callbackasm1(SB) + MOVD $284, R0 + BR callbackasm1(SB) + MOVD $285, R0 + BR callbackasm1(SB) + MOVD $286, R0 + BR callbackasm1(SB) + MOVD $287, R0 + BR callbackasm1(SB) + MOVD $288, R0 + BR callbackasm1(SB) + MOVD $289, R0 + BR callbackasm1(SB) + MOVD $290, R0 + BR callbackasm1(SB) + MOVD $291, R0 + BR callbackasm1(SB) + MOVD $292, R0 + BR callbackasm1(SB) + MOVD $293, R0 + BR callbackasm1(SB) + MOVD $294, R0 + BR callbackasm1(SB) + MOVD $295, R0 + BR callbackasm1(SB) + MOVD $296, R0 + BR callbackasm1(SB) + MOVD $297, R0 + BR callbackasm1(SB) + MOVD $298, R0 + BR callbackasm1(SB) + MOVD $299, R0 + BR callbackasm1(SB) + MOVD $300, R0 + BR callbackasm1(SB) + MOVD $301, R0 + BR callbackasm1(SB) + MOVD $302, R0 + BR callbackasm1(SB) + MOVD $303, R0 + BR callbackasm1(SB) + MOVD $304, R0 + BR callbackasm1(SB) + MOVD $305, R0 + BR callbackasm1(SB) + MOVD $306, R0 + BR callbackasm1(SB) + MOVD $307, R0 + BR callbackasm1(SB) + MOVD $308, R0 + BR callbackasm1(SB) + MOVD $309, R0 + BR callbackasm1(SB) + MOVD $310, R0 + BR callbackasm1(SB) + MOVD $311, R0 + BR callbackasm1(SB) + MOVD $312, R0 + BR callbackasm1(SB) + MOVD $313, R0 + BR callbackasm1(SB) + MOVD $314, R0 + BR callbackasm1(SB) + MOVD $315, R0 + BR callbackasm1(SB) + MOVD $316, R0 + BR callbackasm1(SB) + MOVD $317, R0 + BR callbackasm1(SB) + MOVD $318, R0 + BR callbackasm1(SB) + MOVD $319, R0 + BR callbackasm1(SB) + MOVD $320, R0 + BR callbackasm1(SB) + MOVD $321, R0 + BR callbackasm1(SB) + MOVD $322, R0 + BR callbackasm1(SB) + MOVD $323, R0 + BR callbackasm1(SB) + MOVD $324, R0 + BR callbackasm1(SB) + MOVD $325, R0 + BR callbackasm1(SB) + MOVD $326, R0 + BR callbackasm1(SB) + MOVD $327, R0 + BR callbackasm1(SB) + MOVD $328, R0 + BR callbackasm1(SB) + MOVD $329, R0 + BR callbackasm1(SB) + MOVD $330, R0 + BR callbackasm1(SB) + MOVD $331, R0 + BR callbackasm1(SB) + MOVD $332, R0 + BR callbackasm1(SB) + MOVD $333, R0 + BR callbackasm1(SB) + MOVD $334, R0 + BR callbackasm1(SB) + MOVD $335, R0 + BR callbackasm1(SB) + MOVD $336, R0 + BR callbackasm1(SB) + MOVD $337, R0 + BR callbackasm1(SB) + MOVD $338, R0 + BR callbackasm1(SB) + MOVD $339, R0 + BR callbackasm1(SB) + MOVD $340, R0 + BR callbackasm1(SB) + MOVD $341, R0 + BR callbackasm1(SB) + MOVD $342, R0 + BR callbackasm1(SB) + MOVD $343, R0 + BR callbackasm1(SB) + MOVD $344, R0 + BR callbackasm1(SB) + MOVD $345, R0 + BR callbackasm1(SB) + MOVD $346, R0 + BR callbackasm1(SB) + MOVD $347, R0 + BR callbackasm1(SB) + MOVD $348, R0 + BR callbackasm1(SB) + MOVD $349, R0 + BR callbackasm1(SB) + MOVD $350, R0 + BR callbackasm1(SB) + MOVD $351, R0 + BR callbackasm1(SB) + MOVD $352, R0 + BR callbackasm1(SB) + MOVD $353, R0 + BR callbackasm1(SB) + MOVD $354, R0 + BR callbackasm1(SB) + MOVD $355, R0 + BR callbackasm1(SB) + MOVD $356, R0 + BR callbackasm1(SB) + MOVD $357, R0 + BR callbackasm1(SB) + MOVD $358, R0 + BR callbackasm1(SB) + MOVD $359, R0 + BR callbackasm1(SB) + MOVD $360, R0 + BR callbackasm1(SB) + MOVD $361, R0 + BR callbackasm1(SB) + MOVD $362, R0 + BR callbackasm1(SB) + MOVD $363, R0 + BR callbackasm1(SB) + MOVD $364, R0 + BR callbackasm1(SB) + MOVD $365, R0 + BR callbackasm1(SB) + MOVD $366, R0 + BR callbackasm1(SB) + MOVD $367, R0 + BR callbackasm1(SB) + MOVD $368, R0 + BR callbackasm1(SB) + MOVD $369, R0 + BR callbackasm1(SB) + MOVD $370, R0 + BR callbackasm1(SB) + MOVD $371, R0 + BR callbackasm1(SB) + MOVD $372, R0 + BR callbackasm1(SB) + MOVD $373, R0 + BR callbackasm1(SB) + MOVD $374, R0 + BR callbackasm1(SB) + MOVD $375, R0 + BR callbackasm1(SB) + MOVD $376, R0 + BR callbackasm1(SB) + MOVD $377, R0 + BR callbackasm1(SB) + MOVD $378, R0 + BR callbackasm1(SB) + MOVD $379, R0 + BR callbackasm1(SB) + MOVD $380, R0 + BR callbackasm1(SB) + MOVD $381, R0 + BR callbackasm1(SB) + MOVD $382, R0 + BR callbackasm1(SB) + MOVD $383, R0 + BR callbackasm1(SB) + MOVD $384, R0 + BR callbackasm1(SB) + MOVD $385, R0 + BR callbackasm1(SB) + MOVD $386, R0 + BR callbackasm1(SB) + MOVD $387, R0 + BR callbackasm1(SB) + MOVD $388, R0 + BR callbackasm1(SB) + MOVD $389, R0 + BR callbackasm1(SB) + MOVD $390, R0 + BR callbackasm1(SB) + MOVD $391, R0 + BR callbackasm1(SB) + MOVD $392, R0 + BR callbackasm1(SB) + MOVD $393, R0 + BR callbackasm1(SB) + MOVD $394, R0 + BR callbackasm1(SB) + MOVD $395, R0 + BR callbackasm1(SB) + MOVD $396, R0 + BR callbackasm1(SB) + MOVD $397, R0 + BR callbackasm1(SB) + MOVD $398, R0 + BR callbackasm1(SB) + MOVD $399, R0 + BR callbackasm1(SB) + MOVD $400, R0 + BR callbackasm1(SB) + MOVD $401, R0 + BR callbackasm1(SB) + MOVD $402, R0 + BR callbackasm1(SB) + MOVD $403, R0 + BR callbackasm1(SB) + MOVD $404, R0 + BR callbackasm1(SB) + MOVD $405, R0 + BR callbackasm1(SB) + MOVD $406, R0 + BR callbackasm1(SB) + MOVD $407, R0 + BR callbackasm1(SB) + MOVD $408, R0 + BR callbackasm1(SB) + MOVD $409, R0 + BR callbackasm1(SB) + MOVD $410, R0 + BR callbackasm1(SB) + MOVD $411, R0 + BR callbackasm1(SB) + MOVD $412, R0 + BR callbackasm1(SB) + MOVD $413, R0 + BR callbackasm1(SB) + MOVD $414, R0 + BR callbackasm1(SB) + MOVD $415, R0 + BR callbackasm1(SB) + MOVD $416, R0 + BR callbackasm1(SB) + MOVD $417, R0 + BR callbackasm1(SB) + MOVD $418, R0 + BR callbackasm1(SB) + MOVD $419, R0 + BR callbackasm1(SB) + MOVD $420, R0 + BR callbackasm1(SB) + MOVD $421, R0 + BR callbackasm1(SB) + MOVD $422, R0 + BR callbackasm1(SB) + MOVD $423, R0 + BR callbackasm1(SB) + MOVD $424, R0 + BR callbackasm1(SB) + MOVD $425, R0 + BR callbackasm1(SB) + MOVD $426, R0 + BR callbackasm1(SB) + MOVD $427, R0 + BR callbackasm1(SB) + MOVD $428, R0 + BR callbackasm1(SB) + MOVD $429, R0 + BR callbackasm1(SB) + MOVD $430, R0 + BR callbackasm1(SB) + MOVD $431, R0 + BR callbackasm1(SB) + MOVD $432, R0 + BR callbackasm1(SB) + MOVD $433, R0 + BR callbackasm1(SB) + MOVD $434, R0 + BR callbackasm1(SB) + MOVD $435, R0 + BR callbackasm1(SB) + MOVD $436, R0 + BR callbackasm1(SB) + MOVD $437, R0 + BR callbackasm1(SB) + MOVD $438, R0 + BR callbackasm1(SB) + MOVD $439, R0 + BR callbackasm1(SB) + MOVD $440, R0 + BR callbackasm1(SB) + MOVD $441, R0 + BR callbackasm1(SB) + MOVD $442, R0 + BR callbackasm1(SB) + MOVD $443, R0 + BR callbackasm1(SB) + MOVD $444, R0 + BR callbackasm1(SB) + MOVD $445, R0 + BR callbackasm1(SB) + MOVD $446, R0 + BR callbackasm1(SB) + MOVD $447, R0 + BR callbackasm1(SB) + MOVD $448, R0 + BR callbackasm1(SB) + MOVD $449, R0 + BR callbackasm1(SB) + MOVD $450, R0 + BR callbackasm1(SB) + MOVD $451, R0 + BR callbackasm1(SB) + MOVD $452, R0 + BR callbackasm1(SB) + MOVD $453, R0 + BR callbackasm1(SB) + MOVD $454, R0 + BR callbackasm1(SB) + MOVD $455, R0 + BR callbackasm1(SB) + MOVD $456, R0 + BR callbackasm1(SB) + MOVD $457, R0 + BR callbackasm1(SB) + MOVD $458, R0 + BR callbackasm1(SB) + MOVD $459, R0 + BR callbackasm1(SB) + MOVD $460, R0 + BR callbackasm1(SB) + MOVD $461, R0 + BR callbackasm1(SB) + MOVD $462, R0 + BR callbackasm1(SB) + MOVD $463, R0 + BR callbackasm1(SB) + MOVD $464, R0 + BR callbackasm1(SB) + MOVD $465, R0 + BR callbackasm1(SB) + MOVD $466, R0 + BR callbackasm1(SB) + MOVD $467, R0 + BR callbackasm1(SB) + MOVD $468, R0 + BR callbackasm1(SB) + MOVD $469, R0 + BR callbackasm1(SB) + MOVD $470, R0 + BR callbackasm1(SB) + MOVD $471, R0 + BR callbackasm1(SB) + MOVD $472, R0 + BR callbackasm1(SB) + MOVD $473, R0 + BR callbackasm1(SB) + MOVD $474, R0 + BR callbackasm1(SB) + MOVD $475, R0 + BR callbackasm1(SB) + MOVD $476, R0 + BR callbackasm1(SB) + MOVD $477, R0 + BR callbackasm1(SB) + MOVD $478, R0 + BR callbackasm1(SB) + MOVD $479, R0 + BR callbackasm1(SB) + MOVD $480, R0 + BR callbackasm1(SB) + MOVD $481, R0 + BR callbackasm1(SB) + MOVD $482, R0 + BR callbackasm1(SB) + MOVD $483, R0 + BR callbackasm1(SB) + MOVD $484, R0 + BR callbackasm1(SB) + MOVD $485, R0 + BR callbackasm1(SB) + MOVD $486, R0 + BR callbackasm1(SB) + MOVD $487, R0 + BR callbackasm1(SB) + MOVD $488, R0 + BR callbackasm1(SB) + MOVD $489, R0 + BR callbackasm1(SB) + MOVD $490, R0 + BR callbackasm1(SB) + MOVD $491, R0 + BR callbackasm1(SB) + MOVD $492, R0 + BR callbackasm1(SB) + MOVD $493, R0 + BR callbackasm1(SB) + MOVD $494, R0 + BR callbackasm1(SB) + MOVD $495, R0 + BR callbackasm1(SB) + MOVD $496, R0 + BR callbackasm1(SB) + MOVD $497, R0 + BR callbackasm1(SB) + MOVD $498, R0 + BR callbackasm1(SB) + MOVD $499, R0 + BR callbackasm1(SB) + MOVD $500, R0 + BR callbackasm1(SB) + MOVD $501, R0 + BR callbackasm1(SB) + MOVD $502, R0 + BR callbackasm1(SB) + MOVD $503, R0 + BR callbackasm1(SB) + MOVD $504, R0 + BR callbackasm1(SB) + MOVD $505, R0 + BR callbackasm1(SB) + MOVD $506, R0 + BR callbackasm1(SB) + MOVD $507, R0 + BR callbackasm1(SB) + MOVD $508, R0 + BR callbackasm1(SB) + MOVD $509, R0 + BR callbackasm1(SB) + MOVD $510, R0 + BR callbackasm1(SB) + MOVD $511, R0 + BR callbackasm1(SB) + MOVD $512, R0 + BR callbackasm1(SB) + MOVD $513, R0 + BR callbackasm1(SB) + MOVD $514, R0 + BR callbackasm1(SB) + MOVD $515, R0 + BR callbackasm1(SB) + MOVD $516, R0 + BR callbackasm1(SB) + MOVD $517, R0 + BR callbackasm1(SB) + MOVD $518, R0 + BR callbackasm1(SB) + MOVD $519, R0 + BR callbackasm1(SB) + MOVD $520, R0 + BR callbackasm1(SB) + MOVD $521, R0 + BR callbackasm1(SB) + MOVD $522, R0 + BR callbackasm1(SB) + MOVD $523, R0 + BR callbackasm1(SB) + MOVD $524, R0 + BR callbackasm1(SB) + MOVD $525, R0 + BR callbackasm1(SB) + MOVD $526, R0 + BR callbackasm1(SB) + MOVD $527, R0 + BR callbackasm1(SB) + MOVD $528, R0 + BR callbackasm1(SB) + MOVD $529, R0 + BR callbackasm1(SB) + MOVD $530, R0 + BR callbackasm1(SB) + MOVD $531, R0 + BR callbackasm1(SB) + MOVD $532, R0 + BR callbackasm1(SB) + MOVD $533, R0 + BR callbackasm1(SB) + MOVD $534, R0 + BR callbackasm1(SB) + MOVD $535, R0 + BR callbackasm1(SB) + MOVD $536, R0 + BR callbackasm1(SB) + MOVD $537, R0 + BR callbackasm1(SB) + MOVD $538, R0 + BR callbackasm1(SB) + MOVD $539, R0 + BR callbackasm1(SB) + MOVD $540, R0 + BR callbackasm1(SB) + MOVD $541, R0 + BR callbackasm1(SB) + MOVD $542, R0 + BR callbackasm1(SB) + MOVD $543, R0 + BR callbackasm1(SB) + MOVD $544, R0 + BR callbackasm1(SB) + MOVD $545, R0 + BR callbackasm1(SB) + MOVD $546, R0 + BR callbackasm1(SB) + MOVD $547, R0 + BR callbackasm1(SB) + MOVD $548, R0 + BR callbackasm1(SB) + MOVD $549, R0 + BR callbackasm1(SB) + MOVD $550, R0 + BR callbackasm1(SB) + MOVD $551, R0 + BR callbackasm1(SB) + MOVD $552, R0 + BR callbackasm1(SB) + MOVD $553, R0 + BR callbackasm1(SB) + MOVD $554, R0 + BR callbackasm1(SB) + MOVD $555, R0 + BR callbackasm1(SB) + MOVD $556, R0 + BR callbackasm1(SB) + MOVD $557, R0 + BR callbackasm1(SB) + MOVD $558, R0 + BR callbackasm1(SB) + MOVD $559, R0 + BR callbackasm1(SB) + MOVD $560, R0 + BR callbackasm1(SB) + MOVD $561, R0 + BR callbackasm1(SB) + MOVD $562, R0 + BR callbackasm1(SB) + MOVD $563, R0 + BR callbackasm1(SB) + MOVD $564, R0 + BR callbackasm1(SB) + MOVD $565, R0 + BR callbackasm1(SB) + MOVD $566, R0 + BR callbackasm1(SB) + MOVD $567, R0 + BR callbackasm1(SB) + MOVD $568, R0 + BR callbackasm1(SB) + MOVD $569, R0 + BR callbackasm1(SB) + MOVD $570, R0 + BR callbackasm1(SB) + MOVD $571, R0 + BR callbackasm1(SB) + MOVD $572, R0 + BR callbackasm1(SB) + MOVD $573, R0 + BR callbackasm1(SB) + MOVD $574, R0 + BR callbackasm1(SB) + MOVD $575, R0 + BR callbackasm1(SB) + MOVD $576, R0 + BR callbackasm1(SB) + MOVD $577, R0 + BR callbackasm1(SB) + MOVD $578, R0 + BR callbackasm1(SB) + MOVD $579, R0 + BR callbackasm1(SB) + MOVD $580, R0 + BR callbackasm1(SB) + MOVD $581, R0 + BR callbackasm1(SB) + MOVD $582, R0 + BR callbackasm1(SB) + MOVD $583, R0 + BR callbackasm1(SB) + MOVD $584, R0 + BR callbackasm1(SB) + MOVD $585, R0 + BR callbackasm1(SB) + MOVD $586, R0 + BR callbackasm1(SB) + MOVD $587, R0 + BR callbackasm1(SB) + MOVD $588, R0 + BR callbackasm1(SB) + MOVD $589, R0 + BR callbackasm1(SB) + MOVD $590, R0 + BR callbackasm1(SB) + MOVD $591, R0 + BR callbackasm1(SB) + MOVD $592, R0 + BR callbackasm1(SB) + MOVD $593, R0 + BR callbackasm1(SB) + MOVD $594, R0 + BR callbackasm1(SB) + MOVD $595, R0 + BR callbackasm1(SB) + MOVD $596, R0 + BR callbackasm1(SB) + MOVD $597, R0 + BR callbackasm1(SB) + MOVD $598, R0 + BR callbackasm1(SB) + MOVD $599, R0 + BR callbackasm1(SB) + MOVD $600, R0 + BR callbackasm1(SB) + MOVD $601, R0 + BR callbackasm1(SB) + MOVD $602, R0 + BR callbackasm1(SB) + MOVD $603, R0 + BR callbackasm1(SB) + MOVD $604, R0 + BR callbackasm1(SB) + MOVD $605, R0 + BR callbackasm1(SB) + MOVD $606, R0 + BR callbackasm1(SB) + MOVD $607, R0 + BR callbackasm1(SB) + MOVD $608, R0 + BR callbackasm1(SB) + MOVD $609, R0 + BR callbackasm1(SB) + MOVD $610, R0 + BR callbackasm1(SB) + MOVD $611, R0 + BR callbackasm1(SB) + MOVD $612, R0 + BR callbackasm1(SB) + MOVD $613, R0 + BR callbackasm1(SB) + MOVD $614, R0 + BR callbackasm1(SB) + MOVD $615, R0 + BR callbackasm1(SB) + MOVD $616, R0 + BR callbackasm1(SB) + MOVD $617, R0 + BR callbackasm1(SB) + MOVD $618, R0 + BR callbackasm1(SB) + MOVD $619, R0 + BR callbackasm1(SB) + MOVD $620, R0 + BR callbackasm1(SB) + MOVD $621, R0 + BR callbackasm1(SB) + MOVD $622, R0 + BR callbackasm1(SB) + MOVD $623, R0 + BR callbackasm1(SB) + MOVD $624, R0 + BR callbackasm1(SB) + MOVD $625, R0 + BR callbackasm1(SB) + MOVD $626, R0 + BR callbackasm1(SB) + MOVD $627, R0 + BR callbackasm1(SB) + MOVD $628, R0 + BR callbackasm1(SB) + MOVD $629, R0 + BR callbackasm1(SB) + MOVD $630, R0 + BR callbackasm1(SB) + MOVD $631, R0 + BR callbackasm1(SB) + MOVD $632, R0 + BR callbackasm1(SB) + MOVD $633, R0 + BR callbackasm1(SB) + MOVD $634, R0 + BR callbackasm1(SB) + MOVD $635, R0 + BR callbackasm1(SB) + MOVD $636, R0 + BR callbackasm1(SB) + MOVD $637, R0 + BR callbackasm1(SB) + MOVD $638, R0 + BR callbackasm1(SB) + MOVD $639, R0 + BR callbackasm1(SB) + MOVD $640, R0 + BR callbackasm1(SB) + MOVD $641, R0 + BR callbackasm1(SB) + MOVD $642, R0 + BR callbackasm1(SB) + MOVD $643, R0 + BR callbackasm1(SB) + MOVD $644, R0 + BR callbackasm1(SB) + MOVD $645, R0 + BR callbackasm1(SB) + MOVD $646, R0 + BR callbackasm1(SB) + MOVD $647, R0 + BR callbackasm1(SB) + MOVD $648, R0 + BR callbackasm1(SB) + MOVD $649, R0 + BR callbackasm1(SB) + MOVD $650, R0 + BR callbackasm1(SB) + MOVD $651, R0 + BR callbackasm1(SB) + MOVD $652, R0 + BR callbackasm1(SB) + MOVD $653, R0 + BR callbackasm1(SB) + MOVD $654, R0 + BR callbackasm1(SB) + MOVD $655, R0 + BR callbackasm1(SB) + MOVD $656, R0 + BR callbackasm1(SB) + MOVD $657, R0 + BR callbackasm1(SB) + MOVD $658, R0 + BR callbackasm1(SB) + MOVD $659, R0 + BR callbackasm1(SB) + MOVD $660, R0 + BR callbackasm1(SB) + MOVD $661, R0 + BR callbackasm1(SB) + MOVD $662, R0 + BR callbackasm1(SB) + MOVD $663, R0 + BR callbackasm1(SB) + MOVD $664, R0 + BR callbackasm1(SB) + MOVD $665, R0 + BR callbackasm1(SB) + MOVD $666, R0 + BR callbackasm1(SB) + MOVD $667, R0 + BR callbackasm1(SB) + MOVD $668, R0 + BR callbackasm1(SB) + MOVD $669, R0 + BR callbackasm1(SB) + MOVD $670, R0 + BR callbackasm1(SB) + MOVD $671, R0 + BR callbackasm1(SB) + MOVD $672, R0 + BR callbackasm1(SB) + MOVD $673, R0 + BR callbackasm1(SB) + MOVD $674, R0 + BR callbackasm1(SB) + MOVD $675, R0 + BR callbackasm1(SB) + MOVD $676, R0 + BR callbackasm1(SB) + MOVD $677, R0 + BR callbackasm1(SB) + MOVD $678, R0 + BR callbackasm1(SB) + MOVD $679, R0 + BR callbackasm1(SB) + MOVD $680, R0 + BR callbackasm1(SB) + MOVD $681, R0 + BR callbackasm1(SB) + MOVD $682, R0 + BR callbackasm1(SB) + MOVD $683, R0 + BR callbackasm1(SB) + MOVD $684, R0 + BR callbackasm1(SB) + MOVD $685, R0 + BR callbackasm1(SB) + MOVD $686, R0 + BR callbackasm1(SB) + MOVD $687, R0 + BR callbackasm1(SB) + MOVD $688, R0 + BR callbackasm1(SB) + MOVD $689, R0 + BR callbackasm1(SB) + MOVD $690, R0 + BR callbackasm1(SB) + MOVD $691, R0 + BR callbackasm1(SB) + MOVD $692, R0 + BR callbackasm1(SB) + MOVD $693, R0 + BR callbackasm1(SB) + MOVD $694, R0 + BR callbackasm1(SB) + MOVD $695, R0 + BR callbackasm1(SB) + MOVD $696, R0 + BR callbackasm1(SB) + MOVD $697, R0 + BR callbackasm1(SB) + MOVD $698, R0 + BR callbackasm1(SB) + MOVD $699, R0 + BR callbackasm1(SB) + MOVD $700, R0 + BR callbackasm1(SB) + MOVD $701, R0 + BR callbackasm1(SB) + MOVD $702, R0 + BR callbackasm1(SB) + MOVD $703, R0 + BR callbackasm1(SB) + MOVD $704, R0 + BR callbackasm1(SB) + MOVD $705, R0 + BR callbackasm1(SB) + MOVD $706, R0 + BR callbackasm1(SB) + MOVD $707, R0 + BR callbackasm1(SB) + MOVD $708, R0 + BR callbackasm1(SB) + MOVD $709, R0 + BR callbackasm1(SB) + MOVD $710, R0 + BR callbackasm1(SB) + MOVD $711, R0 + BR callbackasm1(SB) + MOVD $712, R0 + BR callbackasm1(SB) + MOVD $713, R0 + BR callbackasm1(SB) + MOVD $714, R0 + BR callbackasm1(SB) + MOVD $715, R0 + BR callbackasm1(SB) + MOVD $716, R0 + BR callbackasm1(SB) + MOVD $717, R0 + BR callbackasm1(SB) + MOVD $718, R0 + BR callbackasm1(SB) + MOVD $719, R0 + BR callbackasm1(SB) + MOVD $720, R0 + BR callbackasm1(SB) + MOVD $721, R0 + BR callbackasm1(SB) + MOVD $722, R0 + BR callbackasm1(SB) + MOVD $723, R0 + BR callbackasm1(SB) + MOVD $724, R0 + BR callbackasm1(SB) + MOVD $725, R0 + BR callbackasm1(SB) + MOVD $726, R0 + BR callbackasm1(SB) + MOVD $727, R0 + BR callbackasm1(SB) + MOVD $728, R0 + BR callbackasm1(SB) + MOVD $729, R0 + BR callbackasm1(SB) + MOVD $730, R0 + BR callbackasm1(SB) + MOVD $731, R0 + BR callbackasm1(SB) + MOVD $732, R0 + BR callbackasm1(SB) + MOVD $733, R0 + BR callbackasm1(SB) + MOVD $734, R0 + BR callbackasm1(SB) + MOVD $735, R0 + BR callbackasm1(SB) + MOVD $736, R0 + BR callbackasm1(SB) + MOVD $737, R0 + BR callbackasm1(SB) + MOVD $738, R0 + BR callbackasm1(SB) + MOVD $739, R0 + BR callbackasm1(SB) + MOVD $740, R0 + BR callbackasm1(SB) + MOVD $741, R0 + BR callbackasm1(SB) + MOVD $742, R0 + BR callbackasm1(SB) + MOVD $743, R0 + BR callbackasm1(SB) + MOVD $744, R0 + BR callbackasm1(SB) + MOVD $745, R0 + BR callbackasm1(SB) + MOVD $746, R0 + BR callbackasm1(SB) + MOVD $747, R0 + BR callbackasm1(SB) + MOVD $748, R0 + BR callbackasm1(SB) + MOVD $749, R0 + BR callbackasm1(SB) + MOVD $750, R0 + BR callbackasm1(SB) + MOVD $751, R0 + BR callbackasm1(SB) + MOVD $752, R0 + BR callbackasm1(SB) + MOVD $753, R0 + BR callbackasm1(SB) + MOVD $754, R0 + BR callbackasm1(SB) + MOVD $755, R0 + BR callbackasm1(SB) + MOVD $756, R0 + BR callbackasm1(SB) + MOVD $757, R0 + BR callbackasm1(SB) + MOVD $758, R0 + BR callbackasm1(SB) + MOVD $759, R0 + BR callbackasm1(SB) + MOVD $760, R0 + BR callbackasm1(SB) + MOVD $761, R0 + BR callbackasm1(SB) + MOVD $762, R0 + BR callbackasm1(SB) + MOVD $763, R0 + BR callbackasm1(SB) + MOVD $764, R0 + BR callbackasm1(SB) + MOVD $765, R0 + BR callbackasm1(SB) + MOVD $766, R0 + BR callbackasm1(SB) + MOVD $767, R0 + BR callbackasm1(SB) + MOVD $768, R0 + BR callbackasm1(SB) + MOVD $769, R0 + BR callbackasm1(SB) + MOVD $770, R0 + BR callbackasm1(SB) + MOVD $771, R0 + BR callbackasm1(SB) + MOVD $772, R0 + BR callbackasm1(SB) + MOVD $773, R0 + BR callbackasm1(SB) + MOVD $774, R0 + BR callbackasm1(SB) + MOVD $775, R0 + BR callbackasm1(SB) + MOVD $776, R0 + BR callbackasm1(SB) + MOVD $777, R0 + BR callbackasm1(SB) + MOVD $778, R0 + BR callbackasm1(SB) + MOVD $779, R0 + BR callbackasm1(SB) + MOVD $780, R0 + BR callbackasm1(SB) + MOVD $781, R0 + BR callbackasm1(SB) + MOVD $782, R0 + BR callbackasm1(SB) + MOVD $783, R0 + BR callbackasm1(SB) + MOVD $784, R0 + BR callbackasm1(SB) + MOVD $785, R0 + BR callbackasm1(SB) + MOVD $786, R0 + BR callbackasm1(SB) + MOVD $787, R0 + BR callbackasm1(SB) + MOVD $788, R0 + BR callbackasm1(SB) + MOVD $789, R0 + BR callbackasm1(SB) + MOVD $790, R0 + BR callbackasm1(SB) + MOVD $791, R0 + BR callbackasm1(SB) + MOVD $792, R0 + BR callbackasm1(SB) + MOVD $793, R0 + BR callbackasm1(SB) + MOVD $794, R0 + BR callbackasm1(SB) + MOVD $795, R0 + BR callbackasm1(SB) + MOVD $796, R0 + BR callbackasm1(SB) + MOVD $797, R0 + BR callbackasm1(SB) + MOVD $798, R0 + BR callbackasm1(SB) + MOVD $799, R0 + BR callbackasm1(SB) + MOVD $800, R0 + BR callbackasm1(SB) + MOVD $801, R0 + BR callbackasm1(SB) + MOVD $802, R0 + BR callbackasm1(SB) + MOVD $803, R0 + BR callbackasm1(SB) + MOVD $804, R0 + BR callbackasm1(SB) + MOVD $805, R0 + BR callbackasm1(SB) + MOVD $806, R0 + BR callbackasm1(SB) + MOVD $807, R0 + BR callbackasm1(SB) + MOVD $808, R0 + BR callbackasm1(SB) + MOVD $809, R0 + BR callbackasm1(SB) + MOVD $810, R0 + BR callbackasm1(SB) + MOVD $811, R0 + BR callbackasm1(SB) + MOVD $812, R0 + BR callbackasm1(SB) + MOVD $813, R0 + BR callbackasm1(SB) + MOVD $814, R0 + BR callbackasm1(SB) + MOVD $815, R0 + BR callbackasm1(SB) + MOVD $816, R0 + BR callbackasm1(SB) + MOVD $817, R0 + BR callbackasm1(SB) + MOVD $818, R0 + BR callbackasm1(SB) + MOVD $819, R0 + BR callbackasm1(SB) + MOVD $820, R0 + BR callbackasm1(SB) + MOVD $821, R0 + BR callbackasm1(SB) + MOVD $822, R0 + BR callbackasm1(SB) + MOVD $823, R0 + BR callbackasm1(SB) + MOVD $824, R0 + BR callbackasm1(SB) + MOVD $825, R0 + BR callbackasm1(SB) + MOVD $826, R0 + BR callbackasm1(SB) + MOVD $827, R0 + BR callbackasm1(SB) + MOVD $828, R0 + BR callbackasm1(SB) + MOVD $829, R0 + BR callbackasm1(SB) + MOVD $830, R0 + BR callbackasm1(SB) + MOVD $831, R0 + BR callbackasm1(SB) + MOVD $832, R0 + BR callbackasm1(SB) + MOVD $833, R0 + BR callbackasm1(SB) + MOVD $834, R0 + BR callbackasm1(SB) + MOVD $835, R0 + BR callbackasm1(SB) + MOVD $836, R0 + BR callbackasm1(SB) + MOVD $837, R0 + BR callbackasm1(SB) + MOVD $838, R0 + BR callbackasm1(SB) + MOVD $839, R0 + BR callbackasm1(SB) + MOVD $840, R0 + BR callbackasm1(SB) + MOVD $841, R0 + BR callbackasm1(SB) + MOVD $842, R0 + BR callbackasm1(SB) + MOVD $843, R0 + BR callbackasm1(SB) + MOVD $844, R0 + BR callbackasm1(SB) + MOVD $845, R0 + BR callbackasm1(SB) + MOVD $846, R0 + BR callbackasm1(SB) + MOVD $847, R0 + BR callbackasm1(SB) + MOVD $848, R0 + BR callbackasm1(SB) + MOVD $849, R0 + BR callbackasm1(SB) + MOVD $850, R0 + BR callbackasm1(SB) + MOVD $851, R0 + BR callbackasm1(SB) + MOVD $852, R0 + BR callbackasm1(SB) + MOVD $853, R0 + BR callbackasm1(SB) + MOVD $854, R0 + BR callbackasm1(SB) + MOVD $855, R0 + BR callbackasm1(SB) + MOVD $856, R0 + BR callbackasm1(SB) + MOVD $857, R0 + BR callbackasm1(SB) + MOVD $858, R0 + BR callbackasm1(SB) + MOVD $859, R0 + BR callbackasm1(SB) + MOVD $860, R0 + BR callbackasm1(SB) + MOVD $861, R0 + BR callbackasm1(SB) + MOVD $862, R0 + BR callbackasm1(SB) + MOVD $863, R0 + BR callbackasm1(SB) + MOVD $864, R0 + BR callbackasm1(SB) + MOVD $865, R0 + BR callbackasm1(SB) + MOVD $866, R0 + BR callbackasm1(SB) + MOVD $867, R0 + BR callbackasm1(SB) + MOVD $868, R0 + BR callbackasm1(SB) + MOVD $869, R0 + BR callbackasm1(SB) + MOVD $870, R0 + BR callbackasm1(SB) + MOVD $871, R0 + BR callbackasm1(SB) + MOVD $872, R0 + BR callbackasm1(SB) + MOVD $873, R0 + BR callbackasm1(SB) + MOVD $874, R0 + BR callbackasm1(SB) + MOVD $875, R0 + BR callbackasm1(SB) + MOVD $876, R0 + BR callbackasm1(SB) + MOVD $877, R0 + BR callbackasm1(SB) + MOVD $878, R0 + BR callbackasm1(SB) + MOVD $879, R0 + BR callbackasm1(SB) + MOVD $880, R0 + BR callbackasm1(SB) + MOVD $881, R0 + BR callbackasm1(SB) + MOVD $882, R0 + BR callbackasm1(SB) + MOVD $883, R0 + BR callbackasm1(SB) + MOVD $884, R0 + BR callbackasm1(SB) + MOVD $885, R0 + BR callbackasm1(SB) + MOVD $886, R0 + BR callbackasm1(SB) + MOVD $887, R0 + BR callbackasm1(SB) + MOVD $888, R0 + BR callbackasm1(SB) + MOVD $889, R0 + BR callbackasm1(SB) + MOVD $890, R0 + BR callbackasm1(SB) + MOVD $891, R0 + BR callbackasm1(SB) + MOVD $892, R0 + BR callbackasm1(SB) + MOVD $893, R0 + BR callbackasm1(SB) + MOVD $894, R0 + BR callbackasm1(SB) + MOVD $895, R0 + BR callbackasm1(SB) + MOVD $896, R0 + BR callbackasm1(SB) + MOVD $897, R0 + BR callbackasm1(SB) + MOVD $898, R0 + BR callbackasm1(SB) + MOVD $899, R0 + BR callbackasm1(SB) + MOVD $900, R0 + BR callbackasm1(SB) + MOVD $901, R0 + BR callbackasm1(SB) + MOVD $902, R0 + BR callbackasm1(SB) + MOVD $903, R0 + BR callbackasm1(SB) + MOVD $904, R0 + BR callbackasm1(SB) + MOVD $905, R0 + BR callbackasm1(SB) + MOVD $906, R0 + BR callbackasm1(SB) + MOVD $907, R0 + BR callbackasm1(SB) + MOVD $908, R0 + BR callbackasm1(SB) + MOVD $909, R0 + BR callbackasm1(SB) + MOVD $910, R0 + BR callbackasm1(SB) + MOVD $911, R0 + BR callbackasm1(SB) + MOVD $912, R0 + BR callbackasm1(SB) + MOVD $913, R0 + BR callbackasm1(SB) + MOVD $914, R0 + BR callbackasm1(SB) + MOVD $915, R0 + BR callbackasm1(SB) + MOVD $916, R0 + BR callbackasm1(SB) + MOVD $917, R0 + BR callbackasm1(SB) + MOVD $918, R0 + BR callbackasm1(SB) + MOVD $919, R0 + BR callbackasm1(SB) + MOVD $920, R0 + BR callbackasm1(SB) + MOVD $921, R0 + BR callbackasm1(SB) + MOVD $922, R0 + BR callbackasm1(SB) + MOVD $923, R0 + BR callbackasm1(SB) + MOVD $924, R0 + BR callbackasm1(SB) + MOVD $925, R0 + BR callbackasm1(SB) + MOVD $926, R0 + BR callbackasm1(SB) + MOVD $927, R0 + BR callbackasm1(SB) + MOVD $928, R0 + BR callbackasm1(SB) + MOVD $929, R0 + BR callbackasm1(SB) + MOVD $930, R0 + BR callbackasm1(SB) + MOVD $931, R0 + BR callbackasm1(SB) + MOVD $932, R0 + BR callbackasm1(SB) + MOVD $933, R0 + BR callbackasm1(SB) + MOVD $934, R0 + BR callbackasm1(SB) + MOVD $935, R0 + BR callbackasm1(SB) + MOVD $936, R0 + BR callbackasm1(SB) + MOVD $937, R0 + BR callbackasm1(SB) + MOVD $938, R0 + BR callbackasm1(SB) + MOVD $939, R0 + BR callbackasm1(SB) + MOVD $940, R0 + BR callbackasm1(SB) + MOVD $941, R0 + BR callbackasm1(SB) + MOVD $942, R0 + BR callbackasm1(SB) + MOVD $943, R0 + BR callbackasm1(SB) + MOVD $944, R0 + BR callbackasm1(SB) + MOVD $945, R0 + BR callbackasm1(SB) + MOVD $946, R0 + BR callbackasm1(SB) + MOVD $947, R0 + BR callbackasm1(SB) + MOVD $948, R0 + BR callbackasm1(SB) + MOVD $949, R0 + BR callbackasm1(SB) + MOVD $950, R0 + BR callbackasm1(SB) + MOVD $951, R0 + BR callbackasm1(SB) + MOVD $952, R0 + BR callbackasm1(SB) + MOVD $953, R0 + BR callbackasm1(SB) + MOVD $954, R0 + BR callbackasm1(SB) + MOVD $955, R0 + BR callbackasm1(SB) + MOVD $956, R0 + BR callbackasm1(SB) + MOVD $957, R0 + BR callbackasm1(SB) + MOVD $958, R0 + BR callbackasm1(SB) + MOVD $959, R0 + BR callbackasm1(SB) + MOVD $960, R0 + BR callbackasm1(SB) + MOVD $961, R0 + BR callbackasm1(SB) + MOVD $962, R0 + BR callbackasm1(SB) + MOVD $963, R0 + BR callbackasm1(SB) + MOVD $964, R0 + BR callbackasm1(SB) + MOVD $965, R0 + BR callbackasm1(SB) + MOVD $966, R0 + BR callbackasm1(SB) + MOVD $967, R0 + BR callbackasm1(SB) + MOVD $968, R0 + BR callbackasm1(SB) + MOVD $969, R0 + BR callbackasm1(SB) + MOVD $970, R0 + BR callbackasm1(SB) + MOVD $971, R0 + BR callbackasm1(SB) + MOVD $972, R0 + BR callbackasm1(SB) + MOVD $973, R0 + BR callbackasm1(SB) + MOVD $974, R0 + BR callbackasm1(SB) + MOVD $975, R0 + BR callbackasm1(SB) + MOVD $976, R0 + BR callbackasm1(SB) + MOVD $977, R0 + BR callbackasm1(SB) + MOVD $978, R0 + BR callbackasm1(SB) + MOVD $979, R0 + BR callbackasm1(SB) + MOVD $980, R0 + BR callbackasm1(SB) + MOVD $981, R0 + BR callbackasm1(SB) + MOVD $982, R0 + BR callbackasm1(SB) + MOVD $983, R0 + BR callbackasm1(SB) + MOVD $984, R0 + BR callbackasm1(SB) + MOVD $985, R0 + BR callbackasm1(SB) + MOVD $986, R0 + BR callbackasm1(SB) + MOVD $987, R0 + BR callbackasm1(SB) + MOVD $988, R0 + BR callbackasm1(SB) + MOVD $989, R0 + BR callbackasm1(SB) + MOVD $990, R0 + BR callbackasm1(SB) + MOVD $991, R0 + BR callbackasm1(SB) + MOVD $992, R0 + BR callbackasm1(SB) + MOVD $993, R0 + BR callbackasm1(SB) + MOVD $994, R0 + BR callbackasm1(SB) + MOVD $995, R0 + BR callbackasm1(SB) + MOVD $996, R0 + BR callbackasm1(SB) + MOVD $997, R0 + BR callbackasm1(SB) + MOVD $998, R0 + BR callbackasm1(SB) + MOVD $999, R0 + BR callbackasm1(SB) + MOVD $1000, R0 + BR callbackasm1(SB) + MOVD $1001, R0 + BR callbackasm1(SB) + MOVD $1002, R0 + BR callbackasm1(SB) + MOVD $1003, R0 + BR callbackasm1(SB) + MOVD $1004, R0 + BR callbackasm1(SB) + MOVD $1005, R0 + BR callbackasm1(SB) + MOVD $1006, R0 + BR callbackasm1(SB) + MOVD $1007, R0 + BR callbackasm1(SB) + MOVD $1008, R0 + BR callbackasm1(SB) + MOVD $1009, R0 + BR callbackasm1(SB) + MOVD $1010, R0 + BR callbackasm1(SB) + MOVD $1011, R0 + BR callbackasm1(SB) + MOVD $1012, R0 + BR callbackasm1(SB) + MOVD $1013, R0 + BR callbackasm1(SB) + MOVD $1014, R0 + BR callbackasm1(SB) + MOVD $1015, R0 + BR callbackasm1(SB) + MOVD $1016, R0 + BR callbackasm1(SB) + MOVD $1017, R0 + BR callbackasm1(SB) + MOVD $1018, R0 + BR callbackasm1(SB) + MOVD $1019, R0 + BR callbackasm1(SB) + MOVD $1020, R0 + BR callbackasm1(SB) + MOVD $1021, R0 + BR callbackasm1(SB) + MOVD $1022, R0 + BR callbackasm1(SB) + MOVD $1023, R0 + BR callbackasm1(SB) + MOVD $1024, R0 + BR callbackasm1(SB) + MOVD $1025, R0 + BR callbackasm1(SB) + MOVD $1026, R0 + BR callbackasm1(SB) + MOVD $1027, R0 + BR callbackasm1(SB) + MOVD $1028, R0 + BR callbackasm1(SB) + MOVD $1029, R0 + BR callbackasm1(SB) + MOVD $1030, R0 + BR callbackasm1(SB) + MOVD $1031, R0 + BR callbackasm1(SB) + MOVD $1032, R0 + BR callbackasm1(SB) + MOVD $1033, R0 + BR callbackasm1(SB) + MOVD $1034, R0 + BR callbackasm1(SB) + MOVD $1035, R0 + BR callbackasm1(SB) + MOVD $1036, R0 + BR callbackasm1(SB) + MOVD $1037, R0 + BR callbackasm1(SB) + MOVD $1038, R0 + BR callbackasm1(SB) + MOVD $1039, R0 + BR callbackasm1(SB) + MOVD $1040, R0 + BR callbackasm1(SB) + MOVD $1041, R0 + BR callbackasm1(SB) + MOVD $1042, R0 + BR callbackasm1(SB) + MOVD $1043, R0 + BR callbackasm1(SB) + MOVD $1044, R0 + BR callbackasm1(SB) + MOVD $1045, R0 + BR callbackasm1(SB) + MOVD $1046, R0 + BR callbackasm1(SB) + MOVD $1047, R0 + BR callbackasm1(SB) + MOVD $1048, R0 + BR callbackasm1(SB) + MOVD $1049, R0 + BR callbackasm1(SB) + MOVD $1050, R0 + BR callbackasm1(SB) + MOVD $1051, R0 + BR callbackasm1(SB) + MOVD $1052, R0 + BR callbackasm1(SB) + MOVD $1053, R0 + BR callbackasm1(SB) + MOVD $1054, R0 + BR callbackasm1(SB) + MOVD $1055, R0 + BR callbackasm1(SB) + MOVD $1056, R0 + BR callbackasm1(SB) + MOVD $1057, R0 + BR callbackasm1(SB) + MOVD $1058, R0 + BR callbackasm1(SB) + MOVD $1059, R0 + BR callbackasm1(SB) + MOVD $1060, R0 + BR callbackasm1(SB) + MOVD $1061, R0 + BR callbackasm1(SB) + MOVD $1062, R0 + BR callbackasm1(SB) + MOVD $1063, R0 + BR callbackasm1(SB) + MOVD $1064, R0 + BR callbackasm1(SB) + MOVD $1065, R0 + BR callbackasm1(SB) + MOVD $1066, R0 + BR callbackasm1(SB) + MOVD $1067, R0 + BR callbackasm1(SB) + MOVD $1068, R0 + BR callbackasm1(SB) + MOVD $1069, R0 + BR callbackasm1(SB) + MOVD $1070, R0 + BR callbackasm1(SB) + MOVD $1071, R0 + BR callbackasm1(SB) + MOVD $1072, R0 + BR callbackasm1(SB) + MOVD $1073, R0 + BR callbackasm1(SB) + MOVD $1074, R0 + BR callbackasm1(SB) + MOVD $1075, R0 + BR callbackasm1(SB) + MOVD $1076, R0 + BR callbackasm1(SB) + MOVD $1077, R0 + BR callbackasm1(SB) + MOVD $1078, R0 + BR callbackasm1(SB) + MOVD $1079, R0 + BR callbackasm1(SB) + MOVD $1080, R0 + BR callbackasm1(SB) + MOVD $1081, R0 + BR callbackasm1(SB) + MOVD $1082, R0 + BR callbackasm1(SB) + MOVD $1083, R0 + BR callbackasm1(SB) + MOVD $1084, R0 + BR callbackasm1(SB) + MOVD $1085, R0 + BR callbackasm1(SB) + MOVD $1086, R0 + BR callbackasm1(SB) + MOVD $1087, R0 + BR callbackasm1(SB) + MOVD $1088, R0 + BR callbackasm1(SB) + MOVD $1089, R0 + BR callbackasm1(SB) + MOVD $1090, R0 + BR callbackasm1(SB) + MOVD $1091, R0 + BR callbackasm1(SB) + MOVD $1092, R0 + BR callbackasm1(SB) + MOVD $1093, R0 + BR callbackasm1(SB) + MOVD $1094, R0 + BR callbackasm1(SB) + MOVD $1095, R0 + BR callbackasm1(SB) + MOVD $1096, R0 + BR callbackasm1(SB) + MOVD $1097, R0 + BR callbackasm1(SB) + MOVD $1098, R0 + BR callbackasm1(SB) + MOVD $1099, R0 + BR callbackasm1(SB) + MOVD $1100, R0 + BR callbackasm1(SB) + MOVD $1101, R0 + BR callbackasm1(SB) + MOVD $1102, R0 + BR callbackasm1(SB) + MOVD $1103, R0 + BR callbackasm1(SB) + MOVD $1104, R0 + BR callbackasm1(SB) + MOVD $1105, R0 + BR callbackasm1(SB) + MOVD $1106, R0 + BR callbackasm1(SB) + MOVD $1107, R0 + BR callbackasm1(SB) + MOVD $1108, R0 + BR callbackasm1(SB) + MOVD $1109, R0 + BR callbackasm1(SB) + MOVD $1110, R0 + BR callbackasm1(SB) + MOVD $1111, R0 + BR callbackasm1(SB) + MOVD $1112, R0 + BR callbackasm1(SB) + MOVD $1113, R0 + BR callbackasm1(SB) + MOVD $1114, R0 + BR callbackasm1(SB) + MOVD $1115, R0 + BR callbackasm1(SB) + MOVD $1116, R0 + BR callbackasm1(SB) + MOVD $1117, R0 + BR callbackasm1(SB) + MOVD $1118, R0 + BR callbackasm1(SB) + MOVD $1119, R0 + BR callbackasm1(SB) + MOVD $1120, R0 + BR callbackasm1(SB) + MOVD $1121, R0 + BR callbackasm1(SB) + MOVD $1122, R0 + BR callbackasm1(SB) + MOVD $1123, R0 + BR callbackasm1(SB) + MOVD $1124, R0 + BR callbackasm1(SB) + MOVD $1125, R0 + BR callbackasm1(SB) + MOVD $1126, R0 + BR callbackasm1(SB) + MOVD $1127, R0 + BR callbackasm1(SB) + MOVD $1128, R0 + BR callbackasm1(SB) + MOVD $1129, R0 + BR callbackasm1(SB) + MOVD $1130, R0 + BR callbackasm1(SB) + MOVD $1131, R0 + BR callbackasm1(SB) + MOVD $1132, R0 + BR callbackasm1(SB) + MOVD $1133, R0 + BR callbackasm1(SB) + MOVD $1134, R0 + BR callbackasm1(SB) + MOVD $1135, R0 + BR callbackasm1(SB) + MOVD $1136, R0 + BR callbackasm1(SB) + MOVD $1137, R0 + BR callbackasm1(SB) + MOVD $1138, R0 + BR callbackasm1(SB) + MOVD $1139, R0 + BR callbackasm1(SB) + MOVD $1140, R0 + BR callbackasm1(SB) + MOVD $1141, R0 + BR callbackasm1(SB) + MOVD $1142, R0 + BR callbackasm1(SB) + MOVD $1143, R0 + BR callbackasm1(SB) + MOVD $1144, R0 + BR callbackasm1(SB) + MOVD $1145, R0 + BR callbackasm1(SB) + MOVD $1146, R0 + BR callbackasm1(SB) + MOVD $1147, R0 + BR callbackasm1(SB) + MOVD $1148, R0 + BR callbackasm1(SB) + MOVD $1149, R0 + BR callbackasm1(SB) + MOVD $1150, R0 + BR callbackasm1(SB) + MOVD $1151, R0 + BR callbackasm1(SB) + MOVD $1152, R0 + BR callbackasm1(SB) + MOVD $1153, R0 + BR callbackasm1(SB) + MOVD $1154, R0 + BR callbackasm1(SB) + MOVD $1155, R0 + BR callbackasm1(SB) + MOVD $1156, R0 + BR callbackasm1(SB) + MOVD $1157, R0 + BR callbackasm1(SB) + MOVD $1158, R0 + BR callbackasm1(SB) + MOVD $1159, R0 + BR callbackasm1(SB) + MOVD $1160, R0 + BR callbackasm1(SB) + MOVD $1161, R0 + BR callbackasm1(SB) + MOVD $1162, R0 + BR callbackasm1(SB) + MOVD $1163, R0 + BR callbackasm1(SB) + MOVD $1164, R0 + BR callbackasm1(SB) + MOVD $1165, R0 + BR callbackasm1(SB) + MOVD $1166, R0 + BR callbackasm1(SB) + MOVD $1167, R0 + BR callbackasm1(SB) + MOVD $1168, R0 + BR callbackasm1(SB) + MOVD $1169, R0 + BR callbackasm1(SB) + MOVD $1170, R0 + BR callbackasm1(SB) + MOVD $1171, R0 + BR callbackasm1(SB) + MOVD $1172, R0 + BR callbackasm1(SB) + MOVD $1173, R0 + BR callbackasm1(SB) + MOVD $1174, R0 + BR callbackasm1(SB) + MOVD $1175, R0 + BR callbackasm1(SB) + MOVD $1176, R0 + BR callbackasm1(SB) + MOVD $1177, R0 + BR callbackasm1(SB) + MOVD $1178, R0 + BR callbackasm1(SB) + MOVD $1179, R0 + BR callbackasm1(SB) + MOVD $1180, R0 + BR callbackasm1(SB) + MOVD $1181, R0 + BR callbackasm1(SB) + MOVD $1182, R0 + BR callbackasm1(SB) + MOVD $1183, R0 + BR callbackasm1(SB) + MOVD $1184, R0 + BR callbackasm1(SB) + MOVD $1185, R0 + BR callbackasm1(SB) + MOVD $1186, R0 + BR callbackasm1(SB) + MOVD $1187, R0 + BR callbackasm1(SB) + MOVD $1188, R0 + BR callbackasm1(SB) + MOVD $1189, R0 + BR callbackasm1(SB) + MOVD $1190, R0 + BR callbackasm1(SB) + MOVD $1191, R0 + BR callbackasm1(SB) + MOVD $1192, R0 + BR callbackasm1(SB) + MOVD $1193, R0 + BR callbackasm1(SB) + MOVD $1194, R0 + BR callbackasm1(SB) + MOVD $1195, R0 + BR callbackasm1(SB) + MOVD $1196, R0 + BR callbackasm1(SB) + MOVD $1197, R0 + BR callbackasm1(SB) + MOVD $1198, R0 + BR callbackasm1(SB) + MOVD $1199, R0 + BR callbackasm1(SB) + MOVD $1200, R0 + BR callbackasm1(SB) + MOVD $1201, R0 + BR callbackasm1(SB) + MOVD $1202, R0 + BR callbackasm1(SB) + MOVD $1203, R0 + BR callbackasm1(SB) + MOVD $1204, R0 + BR callbackasm1(SB) + MOVD $1205, R0 + BR callbackasm1(SB) + MOVD $1206, R0 + BR callbackasm1(SB) + MOVD $1207, R0 + BR callbackasm1(SB) + MOVD $1208, R0 + BR callbackasm1(SB) + MOVD $1209, R0 + BR callbackasm1(SB) + MOVD $1210, R0 + BR callbackasm1(SB) + MOVD $1211, R0 + BR callbackasm1(SB) + MOVD $1212, R0 + BR callbackasm1(SB) + MOVD $1213, R0 + BR callbackasm1(SB) + MOVD $1214, R0 + BR callbackasm1(SB) + MOVD $1215, R0 + BR callbackasm1(SB) + MOVD $1216, R0 + BR callbackasm1(SB) + MOVD $1217, R0 + BR callbackasm1(SB) + MOVD $1218, R0 + BR callbackasm1(SB) + MOVD $1219, R0 + BR callbackasm1(SB) + MOVD $1220, R0 + BR callbackasm1(SB) + MOVD $1221, R0 + BR callbackasm1(SB) + MOVD $1222, R0 + BR callbackasm1(SB) + MOVD $1223, R0 + BR callbackasm1(SB) + MOVD $1224, R0 + BR callbackasm1(SB) + MOVD $1225, R0 + BR callbackasm1(SB) + MOVD $1226, R0 + BR callbackasm1(SB) + MOVD $1227, R0 + BR callbackasm1(SB) + MOVD $1228, R0 + BR callbackasm1(SB) + MOVD $1229, R0 + BR callbackasm1(SB) + MOVD $1230, R0 + BR callbackasm1(SB) + MOVD $1231, R0 + BR callbackasm1(SB) + MOVD $1232, R0 + BR callbackasm1(SB) + MOVD $1233, R0 + BR callbackasm1(SB) + MOVD $1234, R0 + BR callbackasm1(SB) + MOVD $1235, R0 + BR callbackasm1(SB) + MOVD $1236, R0 + BR callbackasm1(SB) + MOVD $1237, R0 + BR callbackasm1(SB) + MOVD $1238, R0 + BR callbackasm1(SB) + MOVD $1239, R0 + BR callbackasm1(SB) + MOVD $1240, R0 + BR callbackasm1(SB) + MOVD $1241, R0 + BR callbackasm1(SB) + MOVD $1242, R0 + BR callbackasm1(SB) + MOVD $1243, R0 + BR callbackasm1(SB) + MOVD $1244, R0 + BR callbackasm1(SB) + MOVD $1245, R0 + BR callbackasm1(SB) + MOVD $1246, R0 + BR callbackasm1(SB) + MOVD $1247, R0 + BR callbackasm1(SB) + MOVD $1248, R0 + BR callbackasm1(SB) + MOVD $1249, R0 + BR callbackasm1(SB) + MOVD $1250, R0 + BR callbackasm1(SB) + MOVD $1251, R0 + BR callbackasm1(SB) + MOVD $1252, R0 + BR callbackasm1(SB) + MOVD $1253, R0 + BR callbackasm1(SB) + MOVD $1254, R0 + BR callbackasm1(SB) + MOVD $1255, R0 + BR callbackasm1(SB) + MOVD $1256, R0 + BR callbackasm1(SB) + MOVD $1257, R0 + BR callbackasm1(SB) + MOVD $1258, R0 + BR callbackasm1(SB) + MOVD $1259, R0 + BR callbackasm1(SB) + MOVD $1260, R0 + BR callbackasm1(SB) + MOVD $1261, R0 + BR callbackasm1(SB) + MOVD $1262, R0 + BR callbackasm1(SB) + MOVD $1263, R0 + BR callbackasm1(SB) + MOVD $1264, R0 + BR callbackasm1(SB) + MOVD $1265, R0 + BR callbackasm1(SB) + MOVD $1266, R0 + BR callbackasm1(SB) + MOVD $1267, R0 + BR callbackasm1(SB) + MOVD $1268, R0 + BR callbackasm1(SB) + MOVD $1269, R0 + BR callbackasm1(SB) + MOVD $1270, R0 + BR callbackasm1(SB) + MOVD $1271, R0 + BR callbackasm1(SB) + MOVD $1272, R0 + BR callbackasm1(SB) + MOVD $1273, R0 + BR callbackasm1(SB) + MOVD $1274, R0 + BR callbackasm1(SB) + MOVD $1275, R0 + BR callbackasm1(SB) + MOVD $1276, R0 + BR callbackasm1(SB) + MOVD $1277, R0 + BR callbackasm1(SB) + MOVD $1278, R0 + BR callbackasm1(SB) + MOVD $1279, R0 + BR callbackasm1(SB) + MOVD $1280, R0 + BR callbackasm1(SB) + MOVD $1281, R0 + BR callbackasm1(SB) + MOVD $1282, R0 + BR callbackasm1(SB) + MOVD $1283, R0 + BR callbackasm1(SB) + MOVD $1284, R0 + BR callbackasm1(SB) + MOVD $1285, R0 + BR callbackasm1(SB) + MOVD $1286, R0 + BR callbackasm1(SB) + MOVD $1287, R0 + BR callbackasm1(SB) + MOVD $1288, R0 + BR callbackasm1(SB) + MOVD $1289, R0 + BR callbackasm1(SB) + MOVD $1290, R0 + BR callbackasm1(SB) + MOVD $1291, R0 + BR callbackasm1(SB) + MOVD $1292, R0 + BR callbackasm1(SB) + MOVD $1293, R0 + BR callbackasm1(SB) + MOVD $1294, R0 + BR callbackasm1(SB) + MOVD $1295, R0 + BR callbackasm1(SB) + MOVD $1296, R0 + BR callbackasm1(SB) + MOVD $1297, R0 + BR callbackasm1(SB) + MOVD $1298, R0 + BR callbackasm1(SB) + MOVD $1299, R0 + BR callbackasm1(SB) + MOVD $1300, R0 + BR callbackasm1(SB) + MOVD $1301, R0 + BR callbackasm1(SB) + MOVD $1302, R0 + BR callbackasm1(SB) + MOVD $1303, R0 + BR callbackasm1(SB) + MOVD $1304, R0 + BR callbackasm1(SB) + MOVD $1305, R0 + BR callbackasm1(SB) + MOVD $1306, R0 + BR callbackasm1(SB) + MOVD $1307, R0 + BR callbackasm1(SB) + MOVD $1308, R0 + BR callbackasm1(SB) + MOVD $1309, R0 + BR callbackasm1(SB) + MOVD $1310, R0 + BR callbackasm1(SB) + MOVD $1311, R0 + BR callbackasm1(SB) + MOVD $1312, R0 + BR callbackasm1(SB) + MOVD $1313, R0 + BR callbackasm1(SB) + MOVD $1314, R0 + BR callbackasm1(SB) + MOVD $1315, R0 + BR callbackasm1(SB) + MOVD $1316, R0 + BR callbackasm1(SB) + MOVD $1317, R0 + BR callbackasm1(SB) + MOVD $1318, R0 + BR callbackasm1(SB) + MOVD $1319, R0 + BR callbackasm1(SB) + MOVD $1320, R0 + BR callbackasm1(SB) + MOVD $1321, R0 + BR callbackasm1(SB) + MOVD $1322, R0 + BR callbackasm1(SB) + MOVD $1323, R0 + BR callbackasm1(SB) + MOVD $1324, R0 + BR callbackasm1(SB) + MOVD $1325, R0 + BR callbackasm1(SB) + MOVD $1326, R0 + BR callbackasm1(SB) + MOVD $1327, R0 + BR callbackasm1(SB) + MOVD $1328, R0 + BR callbackasm1(SB) + MOVD $1329, R0 + BR callbackasm1(SB) + MOVD $1330, R0 + BR callbackasm1(SB) + MOVD $1331, R0 + BR callbackasm1(SB) + MOVD $1332, R0 + BR callbackasm1(SB) + MOVD $1333, R0 + BR callbackasm1(SB) + MOVD $1334, R0 + BR callbackasm1(SB) + MOVD $1335, R0 + BR callbackasm1(SB) + MOVD $1336, R0 + BR callbackasm1(SB) + MOVD $1337, R0 + BR callbackasm1(SB) + MOVD $1338, R0 + BR callbackasm1(SB) + MOVD $1339, R0 + BR callbackasm1(SB) + MOVD $1340, R0 + BR callbackasm1(SB) + MOVD $1341, R0 + BR callbackasm1(SB) + MOVD $1342, R0 + BR callbackasm1(SB) + MOVD $1343, R0 + BR callbackasm1(SB) + MOVD $1344, R0 + BR callbackasm1(SB) + MOVD $1345, R0 + BR callbackasm1(SB) + MOVD $1346, R0 + BR callbackasm1(SB) + MOVD $1347, R0 + BR callbackasm1(SB) + MOVD $1348, R0 + BR callbackasm1(SB) + MOVD $1349, R0 + BR callbackasm1(SB) + MOVD $1350, R0 + BR callbackasm1(SB) + MOVD $1351, R0 + BR callbackasm1(SB) + MOVD $1352, R0 + BR callbackasm1(SB) + MOVD $1353, R0 + BR callbackasm1(SB) + MOVD $1354, R0 + BR callbackasm1(SB) + MOVD $1355, R0 + BR callbackasm1(SB) + MOVD $1356, R0 + BR callbackasm1(SB) + MOVD $1357, R0 + BR callbackasm1(SB) + MOVD $1358, R0 + BR callbackasm1(SB) + MOVD $1359, R0 + BR callbackasm1(SB) + MOVD $1360, R0 + BR callbackasm1(SB) + MOVD $1361, R0 + BR callbackasm1(SB) + MOVD $1362, R0 + BR callbackasm1(SB) + MOVD $1363, R0 + BR callbackasm1(SB) + MOVD $1364, R0 + BR callbackasm1(SB) + MOVD $1365, R0 + BR callbackasm1(SB) + MOVD $1366, R0 + BR callbackasm1(SB) + MOVD $1367, R0 + BR callbackasm1(SB) + MOVD $1368, R0 + BR callbackasm1(SB) + MOVD $1369, R0 + BR callbackasm1(SB) + MOVD $1370, R0 + BR callbackasm1(SB) + MOVD $1371, R0 + BR callbackasm1(SB) + MOVD $1372, R0 + BR callbackasm1(SB) + MOVD $1373, R0 + BR callbackasm1(SB) + MOVD $1374, R0 + BR callbackasm1(SB) + MOVD $1375, R0 + BR callbackasm1(SB) + MOVD $1376, R0 + BR callbackasm1(SB) + MOVD $1377, R0 + BR callbackasm1(SB) + MOVD $1378, R0 + BR callbackasm1(SB) + MOVD $1379, R0 + BR callbackasm1(SB) + MOVD $1380, R0 + BR callbackasm1(SB) + MOVD $1381, R0 + BR callbackasm1(SB) + MOVD $1382, R0 + BR callbackasm1(SB) + MOVD $1383, R0 + BR callbackasm1(SB) + MOVD $1384, R0 + BR callbackasm1(SB) + MOVD $1385, R0 + BR callbackasm1(SB) + MOVD $1386, R0 + BR callbackasm1(SB) + MOVD $1387, R0 + BR callbackasm1(SB) + MOVD $1388, R0 + BR callbackasm1(SB) + MOVD $1389, R0 + BR callbackasm1(SB) + MOVD $1390, R0 + BR callbackasm1(SB) + MOVD $1391, R0 + BR callbackasm1(SB) + MOVD $1392, R0 + BR callbackasm1(SB) + MOVD $1393, R0 + BR callbackasm1(SB) + MOVD $1394, R0 + BR callbackasm1(SB) + MOVD $1395, R0 + BR callbackasm1(SB) + MOVD $1396, R0 + BR callbackasm1(SB) + MOVD $1397, R0 + BR callbackasm1(SB) + MOVD $1398, R0 + BR callbackasm1(SB) + MOVD $1399, R0 + BR callbackasm1(SB) + MOVD $1400, R0 + BR callbackasm1(SB) + MOVD $1401, R0 + BR callbackasm1(SB) + MOVD $1402, R0 + BR callbackasm1(SB) + MOVD $1403, R0 + BR callbackasm1(SB) + MOVD $1404, R0 + BR callbackasm1(SB) + MOVD $1405, R0 + BR callbackasm1(SB) + MOVD $1406, R0 + BR callbackasm1(SB) + MOVD $1407, R0 + BR callbackasm1(SB) + MOVD $1408, R0 + BR callbackasm1(SB) + MOVD $1409, R0 + BR callbackasm1(SB) + MOVD $1410, R0 + BR callbackasm1(SB) + MOVD $1411, R0 + BR callbackasm1(SB) + MOVD $1412, R0 + BR callbackasm1(SB) + MOVD $1413, R0 + BR callbackasm1(SB) + MOVD $1414, R0 + BR callbackasm1(SB) + MOVD $1415, R0 + BR callbackasm1(SB) + MOVD $1416, R0 + BR callbackasm1(SB) + MOVD $1417, R0 + BR callbackasm1(SB) + MOVD $1418, R0 + BR callbackasm1(SB) + MOVD $1419, R0 + BR callbackasm1(SB) + MOVD $1420, R0 + BR callbackasm1(SB) + MOVD $1421, R0 + BR callbackasm1(SB) + MOVD $1422, R0 + BR callbackasm1(SB) + MOVD $1423, R0 + BR callbackasm1(SB) + MOVD $1424, R0 + BR callbackasm1(SB) + MOVD $1425, R0 + BR callbackasm1(SB) + MOVD $1426, R0 + BR callbackasm1(SB) + MOVD $1427, R0 + BR callbackasm1(SB) + MOVD $1428, R0 + BR callbackasm1(SB) + MOVD $1429, R0 + BR callbackasm1(SB) + MOVD $1430, R0 + BR callbackasm1(SB) + MOVD $1431, R0 + BR callbackasm1(SB) + MOVD $1432, R0 + BR callbackasm1(SB) + MOVD $1433, R0 + BR callbackasm1(SB) + MOVD $1434, R0 + BR callbackasm1(SB) + MOVD $1435, R0 + BR callbackasm1(SB) + MOVD $1436, R0 + BR callbackasm1(SB) + MOVD $1437, R0 + BR callbackasm1(SB) + MOVD $1438, R0 + BR callbackasm1(SB) + MOVD $1439, R0 + BR callbackasm1(SB) + MOVD $1440, R0 + BR callbackasm1(SB) + MOVD $1441, R0 + BR callbackasm1(SB) + MOVD $1442, R0 + BR callbackasm1(SB) + MOVD $1443, R0 + BR callbackasm1(SB) + MOVD $1444, R0 + BR callbackasm1(SB) + MOVD $1445, R0 + BR callbackasm1(SB) + MOVD $1446, R0 + BR callbackasm1(SB) + MOVD $1447, R0 + BR callbackasm1(SB) + MOVD $1448, R0 + BR callbackasm1(SB) + MOVD $1449, R0 + BR callbackasm1(SB) + MOVD $1450, R0 + BR callbackasm1(SB) + MOVD $1451, R0 + BR callbackasm1(SB) + MOVD $1452, R0 + BR callbackasm1(SB) + MOVD $1453, R0 + BR callbackasm1(SB) + MOVD $1454, R0 + BR callbackasm1(SB) + MOVD $1455, R0 + BR callbackasm1(SB) + MOVD $1456, R0 + BR callbackasm1(SB) + MOVD $1457, R0 + BR callbackasm1(SB) + MOVD $1458, R0 + BR callbackasm1(SB) + MOVD $1459, R0 + BR callbackasm1(SB) + MOVD $1460, R0 + BR callbackasm1(SB) + MOVD $1461, R0 + BR callbackasm1(SB) + MOVD $1462, R0 + BR callbackasm1(SB) + MOVD $1463, R0 + BR callbackasm1(SB) + MOVD $1464, R0 + BR callbackasm1(SB) + MOVD $1465, R0 + BR callbackasm1(SB) + MOVD $1466, R0 + BR callbackasm1(SB) + MOVD $1467, R0 + BR callbackasm1(SB) + MOVD $1468, R0 + BR callbackasm1(SB) + MOVD $1469, R0 + BR callbackasm1(SB) + MOVD $1470, R0 + BR callbackasm1(SB) + MOVD $1471, R0 + BR callbackasm1(SB) + MOVD $1472, R0 + BR callbackasm1(SB) + MOVD $1473, R0 + BR callbackasm1(SB) + MOVD $1474, R0 + BR callbackasm1(SB) + MOVD $1475, R0 + BR callbackasm1(SB) + MOVD $1476, R0 + BR callbackasm1(SB) + MOVD $1477, R0 + BR callbackasm1(SB) + MOVD $1478, R0 + BR callbackasm1(SB) + MOVD $1479, R0 + BR callbackasm1(SB) + MOVD $1480, R0 + BR callbackasm1(SB) + MOVD $1481, R0 + BR callbackasm1(SB) + MOVD $1482, R0 + BR callbackasm1(SB) + MOVD $1483, R0 + BR callbackasm1(SB) + MOVD $1484, R0 + BR callbackasm1(SB) + MOVD $1485, R0 + BR callbackasm1(SB) + MOVD $1486, R0 + BR callbackasm1(SB) + MOVD $1487, R0 + BR callbackasm1(SB) + MOVD $1488, R0 + BR callbackasm1(SB) + MOVD $1489, R0 + BR callbackasm1(SB) + MOVD $1490, R0 + BR callbackasm1(SB) + MOVD $1491, R0 + BR callbackasm1(SB) + MOVD $1492, R0 + BR callbackasm1(SB) + MOVD $1493, R0 + BR callbackasm1(SB) + MOVD $1494, R0 + BR callbackasm1(SB) + MOVD $1495, R0 + BR callbackasm1(SB) + MOVD $1496, R0 + BR callbackasm1(SB) + MOVD $1497, R0 + BR callbackasm1(SB) + MOVD $1498, R0 + BR callbackasm1(SB) + MOVD $1499, R0 + BR callbackasm1(SB) + MOVD $1500, R0 + BR callbackasm1(SB) + MOVD $1501, R0 + BR callbackasm1(SB) + MOVD $1502, R0 + BR callbackasm1(SB) + MOVD $1503, R0 + BR callbackasm1(SB) + MOVD $1504, R0 + BR callbackasm1(SB) + MOVD $1505, R0 + BR callbackasm1(SB) + MOVD $1506, R0 + BR callbackasm1(SB) + MOVD $1507, R0 + BR callbackasm1(SB) + MOVD $1508, R0 + BR callbackasm1(SB) + MOVD $1509, R0 + BR callbackasm1(SB) + MOVD $1510, R0 + BR callbackasm1(SB) + MOVD $1511, R0 + BR callbackasm1(SB) + MOVD $1512, R0 + BR callbackasm1(SB) + MOVD $1513, R0 + BR callbackasm1(SB) + MOVD $1514, R0 + BR callbackasm1(SB) + MOVD $1515, R0 + BR callbackasm1(SB) + MOVD $1516, R0 + BR callbackasm1(SB) + MOVD $1517, R0 + BR callbackasm1(SB) + MOVD $1518, R0 + BR callbackasm1(SB) + MOVD $1519, R0 + BR callbackasm1(SB) + MOVD $1520, R0 + BR callbackasm1(SB) + MOVD $1521, R0 + BR callbackasm1(SB) + MOVD $1522, R0 + BR callbackasm1(SB) + MOVD $1523, R0 + BR callbackasm1(SB) + MOVD $1524, R0 + BR callbackasm1(SB) + MOVD $1525, R0 + BR callbackasm1(SB) + MOVD $1526, R0 + BR callbackasm1(SB) + MOVD $1527, R0 + BR callbackasm1(SB) + MOVD $1528, R0 + BR callbackasm1(SB) + MOVD $1529, R0 + BR callbackasm1(SB) + MOVD $1530, R0 + BR callbackasm1(SB) + MOVD $1531, R0 + BR callbackasm1(SB) + MOVD $1532, R0 + BR callbackasm1(SB) + MOVD $1533, R0 + BR callbackasm1(SB) + MOVD $1534, R0 + BR callbackasm1(SB) + MOVD $1535, R0 + BR callbackasm1(SB) + MOVD $1536, R0 + BR callbackasm1(SB) + MOVD $1537, R0 + BR callbackasm1(SB) + MOVD $1538, R0 + BR callbackasm1(SB) + MOVD $1539, R0 + BR callbackasm1(SB) + MOVD $1540, R0 + BR callbackasm1(SB) + MOVD $1541, R0 + BR callbackasm1(SB) + MOVD $1542, R0 + BR callbackasm1(SB) + MOVD $1543, R0 + BR callbackasm1(SB) + MOVD $1544, R0 + BR callbackasm1(SB) + MOVD $1545, R0 + BR callbackasm1(SB) + MOVD $1546, R0 + BR callbackasm1(SB) + MOVD $1547, R0 + BR callbackasm1(SB) + MOVD $1548, R0 + BR callbackasm1(SB) + MOVD $1549, R0 + BR callbackasm1(SB) + MOVD $1550, R0 + BR callbackasm1(SB) + MOVD $1551, R0 + BR callbackasm1(SB) + MOVD $1552, R0 + BR callbackasm1(SB) + MOVD $1553, R0 + BR callbackasm1(SB) + MOVD $1554, R0 + BR callbackasm1(SB) + MOVD $1555, R0 + BR callbackasm1(SB) + MOVD $1556, R0 + BR callbackasm1(SB) + MOVD $1557, R0 + BR callbackasm1(SB) + MOVD $1558, R0 + BR callbackasm1(SB) + MOVD $1559, R0 + BR callbackasm1(SB) + MOVD $1560, R0 + BR callbackasm1(SB) + MOVD $1561, R0 + BR callbackasm1(SB) + MOVD $1562, R0 + BR callbackasm1(SB) + MOVD $1563, R0 + BR callbackasm1(SB) + MOVD $1564, R0 + BR callbackasm1(SB) + MOVD $1565, R0 + BR callbackasm1(SB) + MOVD $1566, R0 + BR callbackasm1(SB) + MOVD $1567, R0 + BR callbackasm1(SB) + MOVD $1568, R0 + BR callbackasm1(SB) + MOVD $1569, R0 + BR callbackasm1(SB) + MOVD $1570, R0 + BR callbackasm1(SB) + MOVD $1571, R0 + BR callbackasm1(SB) + MOVD $1572, R0 + BR callbackasm1(SB) + MOVD $1573, R0 + BR callbackasm1(SB) + MOVD $1574, R0 + BR callbackasm1(SB) + MOVD $1575, R0 + BR callbackasm1(SB) + MOVD $1576, R0 + BR callbackasm1(SB) + MOVD $1577, R0 + BR callbackasm1(SB) + MOVD $1578, R0 + BR callbackasm1(SB) + MOVD $1579, R0 + BR callbackasm1(SB) + MOVD $1580, R0 + BR callbackasm1(SB) + MOVD $1581, R0 + BR callbackasm1(SB) + MOVD $1582, R0 + BR callbackasm1(SB) + MOVD $1583, R0 + BR callbackasm1(SB) + MOVD $1584, R0 + BR callbackasm1(SB) + MOVD $1585, R0 + BR callbackasm1(SB) + MOVD $1586, R0 + BR callbackasm1(SB) + MOVD $1587, R0 + BR callbackasm1(SB) + MOVD $1588, R0 + BR callbackasm1(SB) + MOVD $1589, R0 + BR callbackasm1(SB) + MOVD $1590, R0 + BR callbackasm1(SB) + MOVD $1591, R0 + BR callbackasm1(SB) + MOVD $1592, R0 + BR callbackasm1(SB) + MOVD $1593, R0 + BR callbackasm1(SB) + MOVD $1594, R0 + BR callbackasm1(SB) + MOVD $1595, R0 + BR callbackasm1(SB) + MOVD $1596, R0 + BR callbackasm1(SB) + MOVD $1597, R0 + BR callbackasm1(SB) + MOVD $1598, R0 + BR callbackasm1(SB) + MOVD $1599, R0 + BR callbackasm1(SB) + MOVD $1600, R0 + BR callbackasm1(SB) + MOVD $1601, R0 + BR callbackasm1(SB) + MOVD $1602, R0 + BR callbackasm1(SB) + MOVD $1603, R0 + BR callbackasm1(SB) + MOVD $1604, R0 + BR callbackasm1(SB) + MOVD $1605, R0 + BR callbackasm1(SB) + MOVD $1606, R0 + BR callbackasm1(SB) + MOVD $1607, R0 + BR callbackasm1(SB) + MOVD $1608, R0 + BR callbackasm1(SB) + MOVD $1609, R0 + BR callbackasm1(SB) + MOVD $1610, R0 + BR callbackasm1(SB) + MOVD $1611, R0 + BR callbackasm1(SB) + MOVD $1612, R0 + BR callbackasm1(SB) + MOVD $1613, R0 + BR callbackasm1(SB) + MOVD $1614, R0 + BR callbackasm1(SB) + MOVD $1615, R0 + BR callbackasm1(SB) + MOVD $1616, R0 + BR callbackasm1(SB) + MOVD $1617, R0 + BR callbackasm1(SB) + MOVD $1618, R0 + BR callbackasm1(SB) + MOVD $1619, R0 + BR callbackasm1(SB) + MOVD $1620, R0 + BR callbackasm1(SB) + MOVD $1621, R0 + BR callbackasm1(SB) + MOVD $1622, R0 + BR callbackasm1(SB) + MOVD $1623, R0 + BR callbackasm1(SB) + MOVD $1624, R0 + BR callbackasm1(SB) + MOVD $1625, R0 + BR callbackasm1(SB) + MOVD $1626, R0 + BR callbackasm1(SB) + MOVD $1627, R0 + BR callbackasm1(SB) + MOVD $1628, R0 + BR callbackasm1(SB) + MOVD $1629, R0 + BR callbackasm1(SB) + MOVD $1630, R0 + BR callbackasm1(SB) + MOVD $1631, R0 + BR callbackasm1(SB) + MOVD $1632, R0 + BR callbackasm1(SB) + MOVD $1633, R0 + BR callbackasm1(SB) + MOVD $1634, R0 + BR callbackasm1(SB) + MOVD $1635, R0 + BR callbackasm1(SB) + MOVD $1636, R0 + BR callbackasm1(SB) + MOVD $1637, R0 + BR callbackasm1(SB) + MOVD $1638, R0 + BR callbackasm1(SB) + MOVD $1639, R0 + BR callbackasm1(SB) + MOVD $1640, R0 + BR callbackasm1(SB) + MOVD $1641, R0 + BR callbackasm1(SB) + MOVD $1642, R0 + BR callbackasm1(SB) + MOVD $1643, R0 + BR callbackasm1(SB) + MOVD $1644, R0 + BR callbackasm1(SB) + MOVD $1645, R0 + BR callbackasm1(SB) + MOVD $1646, R0 + BR callbackasm1(SB) + MOVD $1647, R0 + BR callbackasm1(SB) + MOVD $1648, R0 + BR callbackasm1(SB) + MOVD $1649, R0 + BR callbackasm1(SB) + MOVD $1650, R0 + BR callbackasm1(SB) + MOVD $1651, R0 + BR callbackasm1(SB) + MOVD $1652, R0 + BR callbackasm1(SB) + MOVD $1653, R0 + BR callbackasm1(SB) + MOVD $1654, R0 + BR callbackasm1(SB) + MOVD $1655, R0 + BR callbackasm1(SB) + MOVD $1656, R0 + BR callbackasm1(SB) + MOVD $1657, R0 + BR callbackasm1(SB) + MOVD $1658, R0 + BR callbackasm1(SB) + MOVD $1659, R0 + BR callbackasm1(SB) + MOVD $1660, R0 + BR callbackasm1(SB) + MOVD $1661, R0 + BR callbackasm1(SB) + MOVD $1662, R0 + BR callbackasm1(SB) + MOVD $1663, R0 + BR callbackasm1(SB) + MOVD $1664, R0 + BR callbackasm1(SB) + MOVD $1665, R0 + BR callbackasm1(SB) + MOVD $1666, R0 + BR callbackasm1(SB) + MOVD $1667, R0 + BR callbackasm1(SB) + MOVD $1668, R0 + BR callbackasm1(SB) + MOVD $1669, R0 + BR callbackasm1(SB) + MOVD $1670, R0 + BR callbackasm1(SB) + MOVD $1671, R0 + BR callbackasm1(SB) + MOVD $1672, R0 + BR callbackasm1(SB) + MOVD $1673, R0 + BR callbackasm1(SB) + MOVD $1674, R0 + BR callbackasm1(SB) + MOVD $1675, R0 + BR callbackasm1(SB) + MOVD $1676, R0 + BR callbackasm1(SB) + MOVD $1677, R0 + BR callbackasm1(SB) + MOVD $1678, R0 + BR callbackasm1(SB) + MOVD $1679, R0 + BR callbackasm1(SB) + MOVD $1680, R0 + BR callbackasm1(SB) + MOVD $1681, R0 + BR callbackasm1(SB) + MOVD $1682, R0 + BR callbackasm1(SB) + MOVD $1683, R0 + BR callbackasm1(SB) + MOVD $1684, R0 + BR callbackasm1(SB) + MOVD $1685, R0 + BR callbackasm1(SB) + MOVD $1686, R0 + BR callbackasm1(SB) + MOVD $1687, R0 + BR callbackasm1(SB) + MOVD $1688, R0 + BR callbackasm1(SB) + MOVD $1689, R0 + BR callbackasm1(SB) + MOVD $1690, R0 + BR callbackasm1(SB) + MOVD $1691, R0 + BR callbackasm1(SB) + MOVD $1692, R0 + BR callbackasm1(SB) + MOVD $1693, R0 + BR callbackasm1(SB) + MOVD $1694, R0 + BR callbackasm1(SB) + MOVD $1695, R0 + BR callbackasm1(SB) + MOVD $1696, R0 + BR callbackasm1(SB) + MOVD $1697, R0 + BR callbackasm1(SB) + MOVD $1698, R0 + BR callbackasm1(SB) + MOVD $1699, R0 + BR callbackasm1(SB) + MOVD $1700, R0 + BR callbackasm1(SB) + MOVD $1701, R0 + BR callbackasm1(SB) + MOVD $1702, R0 + BR callbackasm1(SB) + MOVD $1703, R0 + BR callbackasm1(SB) + MOVD $1704, R0 + BR callbackasm1(SB) + MOVD $1705, R0 + BR callbackasm1(SB) + MOVD $1706, R0 + BR callbackasm1(SB) + MOVD $1707, R0 + BR callbackasm1(SB) + MOVD $1708, R0 + BR callbackasm1(SB) + MOVD $1709, R0 + BR callbackasm1(SB) + MOVD $1710, R0 + BR callbackasm1(SB) + MOVD $1711, R0 + BR callbackasm1(SB) + MOVD $1712, R0 + BR callbackasm1(SB) + MOVD $1713, R0 + BR callbackasm1(SB) + MOVD $1714, R0 + BR callbackasm1(SB) + MOVD $1715, R0 + BR callbackasm1(SB) + MOVD $1716, R0 + BR callbackasm1(SB) + MOVD $1717, R0 + BR callbackasm1(SB) + MOVD $1718, R0 + BR callbackasm1(SB) + MOVD $1719, R0 + BR callbackasm1(SB) + MOVD $1720, R0 + BR callbackasm1(SB) + MOVD $1721, R0 + BR callbackasm1(SB) + MOVD $1722, R0 + BR callbackasm1(SB) + MOVD $1723, R0 + BR callbackasm1(SB) + MOVD $1724, R0 + BR callbackasm1(SB) + MOVD $1725, R0 + BR callbackasm1(SB) + MOVD $1726, R0 + BR callbackasm1(SB) + MOVD $1727, R0 + BR callbackasm1(SB) + MOVD $1728, R0 + BR callbackasm1(SB) + MOVD $1729, R0 + BR callbackasm1(SB) + MOVD $1730, R0 + BR callbackasm1(SB) + MOVD $1731, R0 + BR callbackasm1(SB) + MOVD $1732, R0 + BR callbackasm1(SB) + MOVD $1733, R0 + BR callbackasm1(SB) + MOVD $1734, R0 + BR callbackasm1(SB) + MOVD $1735, R0 + BR callbackasm1(SB) + MOVD $1736, R0 + BR callbackasm1(SB) + MOVD $1737, R0 + BR callbackasm1(SB) + MOVD $1738, R0 + BR callbackasm1(SB) + MOVD $1739, R0 + BR callbackasm1(SB) + MOVD $1740, R0 + BR callbackasm1(SB) + MOVD $1741, R0 + BR callbackasm1(SB) + MOVD $1742, R0 + BR callbackasm1(SB) + MOVD $1743, R0 + BR callbackasm1(SB) + MOVD $1744, R0 + BR callbackasm1(SB) + MOVD $1745, R0 + BR callbackasm1(SB) + MOVD $1746, R0 + BR callbackasm1(SB) + MOVD $1747, R0 + BR callbackasm1(SB) + MOVD $1748, R0 + BR callbackasm1(SB) + MOVD $1749, R0 + BR callbackasm1(SB) + MOVD $1750, R0 + BR callbackasm1(SB) + MOVD $1751, R0 + BR callbackasm1(SB) + MOVD $1752, R0 + BR callbackasm1(SB) + MOVD $1753, R0 + BR callbackasm1(SB) + MOVD $1754, R0 + BR callbackasm1(SB) + MOVD $1755, R0 + BR callbackasm1(SB) + MOVD $1756, R0 + BR callbackasm1(SB) + MOVD $1757, R0 + BR callbackasm1(SB) + MOVD $1758, R0 + BR callbackasm1(SB) + MOVD $1759, R0 + BR callbackasm1(SB) + MOVD $1760, R0 + BR callbackasm1(SB) + MOVD $1761, R0 + BR callbackasm1(SB) + MOVD $1762, R0 + BR callbackasm1(SB) + MOVD $1763, R0 + BR callbackasm1(SB) + MOVD $1764, R0 + BR callbackasm1(SB) + MOVD $1765, R0 + BR callbackasm1(SB) + MOVD $1766, R0 + BR callbackasm1(SB) + MOVD $1767, R0 + BR callbackasm1(SB) + MOVD $1768, R0 + BR callbackasm1(SB) + MOVD $1769, R0 + BR callbackasm1(SB) + MOVD $1770, R0 + BR callbackasm1(SB) + MOVD $1771, R0 + BR callbackasm1(SB) + MOVD $1772, R0 + BR callbackasm1(SB) + MOVD $1773, R0 + BR callbackasm1(SB) + MOVD $1774, R0 + BR callbackasm1(SB) + MOVD $1775, R0 + BR callbackasm1(SB) + MOVD $1776, R0 + BR callbackasm1(SB) + MOVD $1777, R0 + BR callbackasm1(SB) + MOVD $1778, R0 + BR callbackasm1(SB) + MOVD $1779, R0 + BR callbackasm1(SB) + MOVD $1780, R0 + BR callbackasm1(SB) + MOVD $1781, R0 + BR callbackasm1(SB) + MOVD $1782, R0 + BR callbackasm1(SB) + MOVD $1783, R0 + BR callbackasm1(SB) + MOVD $1784, R0 + BR callbackasm1(SB) + MOVD $1785, R0 + BR callbackasm1(SB) + MOVD $1786, R0 + BR callbackasm1(SB) + MOVD $1787, R0 + BR callbackasm1(SB) + MOVD $1788, R0 + BR callbackasm1(SB) + MOVD $1789, R0 + BR callbackasm1(SB) + MOVD $1790, R0 + BR callbackasm1(SB) + MOVD $1791, R0 + BR callbackasm1(SB) + MOVD $1792, R0 + BR callbackasm1(SB) + MOVD $1793, R0 + BR callbackasm1(SB) + MOVD $1794, R0 + BR callbackasm1(SB) + MOVD $1795, R0 + BR callbackasm1(SB) + MOVD $1796, R0 + BR callbackasm1(SB) + MOVD $1797, R0 + BR callbackasm1(SB) + MOVD $1798, R0 + BR callbackasm1(SB) + MOVD $1799, R0 + BR callbackasm1(SB) + MOVD $1800, R0 + BR callbackasm1(SB) + MOVD $1801, R0 + BR callbackasm1(SB) + MOVD $1802, R0 + BR callbackasm1(SB) + MOVD $1803, R0 + BR callbackasm1(SB) + MOVD $1804, R0 + BR callbackasm1(SB) + MOVD $1805, R0 + BR callbackasm1(SB) + MOVD $1806, R0 + BR callbackasm1(SB) + MOVD $1807, R0 + BR callbackasm1(SB) + MOVD $1808, R0 + BR callbackasm1(SB) + MOVD $1809, R0 + BR callbackasm1(SB) + MOVD $1810, R0 + BR callbackasm1(SB) + MOVD $1811, R0 + BR callbackasm1(SB) + MOVD $1812, R0 + BR callbackasm1(SB) + MOVD $1813, R0 + BR callbackasm1(SB) + MOVD $1814, R0 + BR callbackasm1(SB) + MOVD $1815, R0 + BR callbackasm1(SB) + MOVD $1816, R0 + BR callbackasm1(SB) + MOVD $1817, R0 + BR callbackasm1(SB) + MOVD $1818, R0 + BR callbackasm1(SB) + MOVD $1819, R0 + BR callbackasm1(SB) + MOVD $1820, R0 + BR callbackasm1(SB) + MOVD $1821, R0 + BR callbackasm1(SB) + MOVD $1822, R0 + BR callbackasm1(SB) + MOVD $1823, R0 + BR callbackasm1(SB) + MOVD $1824, R0 + BR callbackasm1(SB) + MOVD $1825, R0 + BR callbackasm1(SB) + MOVD $1826, R0 + BR callbackasm1(SB) + MOVD $1827, R0 + BR callbackasm1(SB) + MOVD $1828, R0 + BR callbackasm1(SB) + MOVD $1829, R0 + BR callbackasm1(SB) + MOVD $1830, R0 + BR callbackasm1(SB) + MOVD $1831, R0 + BR callbackasm1(SB) + MOVD $1832, R0 + BR callbackasm1(SB) + MOVD $1833, R0 + BR callbackasm1(SB) + MOVD $1834, R0 + BR callbackasm1(SB) + MOVD $1835, R0 + BR callbackasm1(SB) + MOVD $1836, R0 + BR callbackasm1(SB) + MOVD $1837, R0 + BR callbackasm1(SB) + MOVD $1838, R0 + BR callbackasm1(SB) + MOVD $1839, R0 + BR callbackasm1(SB) + MOVD $1840, R0 + BR callbackasm1(SB) + MOVD $1841, R0 + BR callbackasm1(SB) + MOVD $1842, R0 + BR callbackasm1(SB) + MOVD $1843, R0 + BR callbackasm1(SB) + MOVD $1844, R0 + BR callbackasm1(SB) + MOVD $1845, R0 + BR callbackasm1(SB) + MOVD $1846, R0 + BR callbackasm1(SB) + MOVD $1847, R0 + BR callbackasm1(SB) + MOVD $1848, R0 + BR callbackasm1(SB) + MOVD $1849, R0 + BR callbackasm1(SB) + MOVD $1850, R0 + BR callbackasm1(SB) + MOVD $1851, R0 + BR callbackasm1(SB) + MOVD $1852, R0 + BR callbackasm1(SB) + MOVD $1853, R0 + BR callbackasm1(SB) + MOVD $1854, R0 + BR callbackasm1(SB) + MOVD $1855, R0 + BR callbackasm1(SB) + MOVD $1856, R0 + BR callbackasm1(SB) + MOVD $1857, R0 + BR callbackasm1(SB) + MOVD $1858, R0 + BR callbackasm1(SB) + MOVD $1859, R0 + BR callbackasm1(SB) + MOVD $1860, R0 + BR callbackasm1(SB) + MOVD $1861, R0 + BR callbackasm1(SB) + MOVD $1862, R0 + BR callbackasm1(SB) + MOVD $1863, R0 + BR callbackasm1(SB) + MOVD $1864, R0 + BR callbackasm1(SB) + MOVD $1865, R0 + BR callbackasm1(SB) + MOVD $1866, R0 + BR callbackasm1(SB) + MOVD $1867, R0 + BR callbackasm1(SB) + MOVD $1868, R0 + BR callbackasm1(SB) + MOVD $1869, R0 + BR callbackasm1(SB) + MOVD $1870, R0 + BR callbackasm1(SB) + MOVD $1871, R0 + BR callbackasm1(SB) + MOVD $1872, R0 + BR callbackasm1(SB) + MOVD $1873, R0 + BR callbackasm1(SB) + MOVD $1874, R0 + BR callbackasm1(SB) + MOVD $1875, R0 + BR callbackasm1(SB) + MOVD $1876, R0 + BR callbackasm1(SB) + MOVD $1877, R0 + BR callbackasm1(SB) + MOVD $1878, R0 + BR callbackasm1(SB) + MOVD $1879, R0 + BR callbackasm1(SB) + MOVD $1880, R0 + BR callbackasm1(SB) + MOVD $1881, R0 + BR callbackasm1(SB) + MOVD $1882, R0 + BR callbackasm1(SB) + MOVD $1883, R0 + BR callbackasm1(SB) + MOVD $1884, R0 + BR callbackasm1(SB) + MOVD $1885, R0 + BR callbackasm1(SB) + MOVD $1886, R0 + BR callbackasm1(SB) + MOVD $1887, R0 + BR callbackasm1(SB) + MOVD $1888, R0 + BR callbackasm1(SB) + MOVD $1889, R0 + BR callbackasm1(SB) + MOVD $1890, R0 + BR callbackasm1(SB) + MOVD $1891, R0 + BR callbackasm1(SB) + MOVD $1892, R0 + BR callbackasm1(SB) + MOVD $1893, R0 + BR callbackasm1(SB) + MOVD $1894, R0 + BR callbackasm1(SB) + MOVD $1895, R0 + BR callbackasm1(SB) + MOVD $1896, R0 + BR callbackasm1(SB) + MOVD $1897, R0 + BR callbackasm1(SB) + MOVD $1898, R0 + BR callbackasm1(SB) + MOVD $1899, R0 + BR callbackasm1(SB) + MOVD $1900, R0 + BR callbackasm1(SB) + MOVD $1901, R0 + BR callbackasm1(SB) + MOVD $1902, R0 + BR callbackasm1(SB) + MOVD $1903, R0 + BR callbackasm1(SB) + MOVD $1904, R0 + BR callbackasm1(SB) + MOVD $1905, R0 + BR callbackasm1(SB) + MOVD $1906, R0 + BR callbackasm1(SB) + MOVD $1907, R0 + BR callbackasm1(SB) + MOVD $1908, R0 + BR callbackasm1(SB) + MOVD $1909, R0 + BR callbackasm1(SB) + MOVD $1910, R0 + BR callbackasm1(SB) + MOVD $1911, R0 + BR callbackasm1(SB) + MOVD $1912, R0 + BR callbackasm1(SB) + MOVD $1913, R0 + BR callbackasm1(SB) + MOVD $1914, R0 + BR callbackasm1(SB) + MOVD $1915, R0 + BR callbackasm1(SB) + MOVD $1916, R0 + BR callbackasm1(SB) + MOVD $1917, R0 + BR callbackasm1(SB) + MOVD $1918, R0 + BR callbackasm1(SB) + MOVD $1919, R0 + BR callbackasm1(SB) + MOVD $1920, R0 + BR callbackasm1(SB) + MOVD $1921, R0 + BR callbackasm1(SB) + MOVD $1922, R0 + BR callbackasm1(SB) + MOVD $1923, R0 + BR callbackasm1(SB) + MOVD $1924, R0 + BR callbackasm1(SB) + MOVD $1925, R0 + BR callbackasm1(SB) + MOVD $1926, R0 + BR callbackasm1(SB) + MOVD $1927, R0 + BR callbackasm1(SB) + MOVD $1928, R0 + BR callbackasm1(SB) + MOVD $1929, R0 + BR callbackasm1(SB) + MOVD $1930, R0 + BR callbackasm1(SB) + MOVD $1931, R0 + BR callbackasm1(SB) + MOVD $1932, R0 + BR callbackasm1(SB) + MOVD $1933, R0 + BR callbackasm1(SB) + MOVD $1934, R0 + BR callbackasm1(SB) + MOVD $1935, R0 + BR callbackasm1(SB) + MOVD $1936, R0 + BR callbackasm1(SB) + MOVD $1937, R0 + BR callbackasm1(SB) + MOVD $1938, R0 + BR callbackasm1(SB) + MOVD $1939, R0 + BR callbackasm1(SB) + MOVD $1940, R0 + BR callbackasm1(SB) + MOVD $1941, R0 + BR callbackasm1(SB) + MOVD $1942, R0 + BR callbackasm1(SB) + MOVD $1943, R0 + BR callbackasm1(SB) + MOVD $1944, R0 + BR callbackasm1(SB) + MOVD $1945, R0 + BR callbackasm1(SB) + MOVD $1946, R0 + BR callbackasm1(SB) + MOVD $1947, R0 + BR callbackasm1(SB) + MOVD $1948, R0 + BR callbackasm1(SB) + MOVD $1949, R0 + BR callbackasm1(SB) + MOVD $1950, R0 + BR callbackasm1(SB) + MOVD $1951, R0 + BR callbackasm1(SB) + MOVD $1952, R0 + BR callbackasm1(SB) + MOVD $1953, R0 + BR callbackasm1(SB) + MOVD $1954, R0 + BR callbackasm1(SB) + MOVD $1955, R0 + BR callbackasm1(SB) + MOVD $1956, R0 + BR callbackasm1(SB) + MOVD $1957, R0 + BR callbackasm1(SB) + MOVD $1958, R0 + BR callbackasm1(SB) + MOVD $1959, R0 + BR callbackasm1(SB) + MOVD $1960, R0 + BR callbackasm1(SB) + MOVD $1961, R0 + BR callbackasm1(SB) + MOVD $1962, R0 + BR callbackasm1(SB) + MOVD $1963, R0 + BR callbackasm1(SB) + MOVD $1964, R0 + BR callbackasm1(SB) + MOVD $1965, R0 + BR callbackasm1(SB) + MOVD $1966, R0 + BR callbackasm1(SB) + MOVD $1967, R0 + BR callbackasm1(SB) + MOVD $1968, R0 + BR callbackasm1(SB) + MOVD $1969, R0 + BR callbackasm1(SB) + MOVD $1970, R0 + BR callbackasm1(SB) + MOVD $1971, R0 + BR callbackasm1(SB) + MOVD $1972, R0 + BR callbackasm1(SB) + MOVD $1973, R0 + BR callbackasm1(SB) + MOVD $1974, R0 + BR callbackasm1(SB) + MOVD $1975, R0 + BR callbackasm1(SB) + MOVD $1976, R0 + BR callbackasm1(SB) + MOVD $1977, R0 + BR callbackasm1(SB) + MOVD $1978, R0 + BR callbackasm1(SB) + MOVD $1979, R0 + BR callbackasm1(SB) + MOVD $1980, R0 + BR callbackasm1(SB) + MOVD $1981, R0 + BR callbackasm1(SB) + MOVD $1982, R0 + BR callbackasm1(SB) + MOVD $1983, R0 + BR callbackasm1(SB) + MOVD $1984, R0 + BR callbackasm1(SB) + MOVD $1985, R0 + BR callbackasm1(SB) + MOVD $1986, R0 + BR callbackasm1(SB) + MOVD $1987, R0 + BR callbackasm1(SB) + MOVD $1988, R0 + BR callbackasm1(SB) + MOVD $1989, R0 + BR callbackasm1(SB) + MOVD $1990, R0 + BR callbackasm1(SB) + MOVD $1991, R0 + BR callbackasm1(SB) + MOVD $1992, R0 + BR callbackasm1(SB) + MOVD $1993, R0 + BR callbackasm1(SB) + MOVD $1994, R0 + BR callbackasm1(SB) + MOVD $1995, R0 + BR callbackasm1(SB) + MOVD $1996, R0 + BR callbackasm1(SB) + MOVD $1997, R0 + BR callbackasm1(SB) + MOVD $1998, R0 + BR callbackasm1(SB) + MOVD $1999, R0 + BR callbackasm1(SB) diff --git a/vendor/github.com/go-ole/go-ole/.travis.yml b/vendor/github.com/go-ole/go-ole/.travis.yml new file mode 100644 index 00000000..28f740cd --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/.travis.yml @@ -0,0 +1,8 @@ +language: go +sudo: false + +go: + - 1.9.x + - 1.10.x + - 1.11.x + - tip diff --git a/vendor/github.com/go-ole/go-ole/ChangeLog.md b/vendor/github.com/go-ole/go-ole/ChangeLog.md new file mode 100644 index 00000000..4ba6a8c6 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ChangeLog.md @@ -0,0 +1,49 @@ +# Version 1.x.x + +* **Add more test cases and reference new test COM server project.** (Placeholder for future additions) + +# Version 1.2.0-alphaX + +**Minimum supported version is now Go 1.4. Go 1.1 support is deprecated, but should still build.** + + * Added CI configuration for Travis-CI and AppVeyor. + * Added test InterfaceID and ClassID for the COM Test Server project. + * Added more inline documentation (#83). + * Added IEnumVARIANT implementation (#88). + * Added IEnumVARIANT test cases (#99, #100, #101). + * Added support for retrieving `time.Time` from VARIANT (#92). + * Added test case for IUnknown (#64). + * Added test case for IDispatch (#64). + * Added test cases for scalar variants (#64, #76). + +# Version 1.1.1 + + * Fixes for Linux build. + * Fixes for Windows build. + +# Version 1.1.0 + +The change to provide building on all platforms is a new feature. The increase in minor version reflects that and allows those who wish to stay on 1.0.x to continue to do so. Support for 1.0.x will be limited to bug fixes. + + * Move GUID out of variables.go into its own file to make new documentation available. + * Move OleError out of ole.go into its own file to make new documentation available. + * Add documentation to utility functions. + * Add documentation to variant receiver functions. + * Add documentation to ole structures. + * Make variant available to other systems outside of Windows. + * Make OLE structures available to other systems outside of Windows. + +## New Features + + * Library should now be built on all platforms supported by Go. Library will NOOP on any platform that is not Windows. + * More functions are now documented and available on godoc.org. + +# Version 1.0.1 + + 1. Fix package references from repository location change. + +# Version 1.0.0 + +This version is stable enough for use. The COM API is still incomplete, but provides enough functionality for accessing COM servers using IDispatch interface. + +There is no changelog for this version. Check commits for history. diff --git a/vendor/github.com/go-ole/go-ole/LICENSE b/vendor/github.com/go-ole/go-ole/LICENSE new file mode 100644 index 00000000..623ec06f --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2013-2017 Yasuhiro Matsumoto, + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/go-ole/go-ole/README.md b/vendor/github.com/go-ole/go-ole/README.md new file mode 100644 index 00000000..7b577558 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/README.md @@ -0,0 +1,46 @@ +# Go OLE + +[![Build status](https://ci.appveyor.com/api/projects/status/qr0u2sf7q43us9fj?svg=true)](https://ci.appveyor.com/project/jacobsantos/go-ole-jgs28) +[![Build Status](https://travis-ci.org/go-ole/go-ole.svg?branch=master)](https://travis-ci.org/go-ole/go-ole) +[![GoDoc](https://godoc.org/github.com/go-ole/go-ole?status.svg)](https://godoc.org/github.com/go-ole/go-ole) + +Go bindings for Windows COM using shared libraries instead of cgo. + +By Yasuhiro Matsumoto. + +## Install + +To experiment with go-ole, you can just compile and run the example program: + +``` +go get github.com/go-ole/go-ole +cd /path/to/go-ole/ +go test + +cd /path/to/go-ole/example/excel +go run excel.go +``` + +## Continuous Integration + +Continuous integration configuration has been added for both Travis-CI and AppVeyor. You will have to add these to your own account for your fork in order for it to run. + +**Travis-CI** + +Travis-CI was added to check builds on Linux to ensure that `go get` works when cross building. Currently, Travis-CI is not used to test cross-building, but this may be changed in the future. It is also not currently possible to test the library on Linux, since COM API is specific to Windows and it is not currently possible to run a COM server on Linux or even connect to a remote COM server. + +**AppVeyor** + +AppVeyor is used to build on Windows using the (in-development) test COM server. It is currently only used to test the build and ensure that the code works on Windows. It will be used to register a COM server and then run the test cases based on the test COM server. + +The tests currently do run and do pass and this should be maintained with commits. + +## Versioning + +Go OLE uses [semantic versioning](http://semver.org) for version numbers, which is similar to the version contract of the Go language. Which means that the major version will always maintain backwards compatibility with minor versions. Minor versions will only add new additions and changes. Fixes will always be in patch. + +This contract should allow you to upgrade to new minor and patch versions without breakage or modifications to your existing code. Leave a ticket, if there is breakage, so that it could be fixed. + +## LICENSE + +Under the MIT License: http://mattn.mit-license.org/2013 diff --git a/vendor/github.com/go-ole/go-ole/appveyor.yml b/vendor/github.com/go-ole/go-ole/appveyor.yml new file mode 100644 index 00000000..0d557ac2 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/appveyor.yml @@ -0,0 +1,54 @@ +# Notes: +# - Minimal appveyor.yml file is an empty file. All sections are optional. +# - Indent each level of configuration with 2 spaces. Do not use tabs! +# - All section names are case-sensitive. +# - Section names should be unique on each level. + +version: "1.3.0.{build}-alpha-{branch}" + +os: Windows Server 2012 R2 + +branches: + only: + - master + - v1.2 + - v1.1 + - v1.0 + +skip_tags: true + +clone_folder: c:\gopath\src\github.com\go-ole\go-ole + +environment: + GOPATH: c:\gopath + matrix: + - GOARCH: amd64 + GOVERSION: 1.5 + GOROOT: c:\go + DOWNLOADPLATFORM: "x64" + +install: + - choco install mingw + - SET PATH=c:\tools\mingw64\bin;%PATH% + # - Download COM Server + - ps: Start-FileDownload "https://github.com/go-ole/test-com-server/releases/download/v1.0.2/test-com-server-${env:DOWNLOADPLATFORM}.zip" + - 7z e test-com-server-%DOWNLOADPLATFORM%.zip -oc:\gopath\src\github.com\go-ole\go-ole > NUL + - c:\gopath\src\github.com\go-ole\go-ole\build\register-assembly.bat + # - set + - go version + - go env + - go get -u golang.org/x/tools/cmd/cover + - go get -u golang.org/x/tools/cmd/godoc + - go get -u golang.org/x/tools/cmd/stringer + +build_script: + - cd c:\gopath\src\github.com\go-ole\go-ole + - go get -v -t ./... + - go build + - go test -v -cover ./... + +# disable automatic tests +test: off + +# disable deployment +deploy: off diff --git a/vendor/github.com/go-ole/go-ole/com.go b/vendor/github.com/go-ole/go-ole/com.go new file mode 100644 index 00000000..a9bef150 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/com.go @@ -0,0 +1,344 @@ +// +build windows + +package ole + +import ( + "syscall" + "unicode/utf16" + "unsafe" +) + +var ( + procCoInitialize = modole32.NewProc("CoInitialize") + procCoInitializeEx = modole32.NewProc("CoInitializeEx") + procCoUninitialize = modole32.NewProc("CoUninitialize") + procCoCreateInstance = modole32.NewProc("CoCreateInstance") + procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") + procCLSIDFromProgID = modole32.NewProc("CLSIDFromProgID") + procCLSIDFromString = modole32.NewProc("CLSIDFromString") + procStringFromCLSID = modole32.NewProc("StringFromCLSID") + procStringFromIID = modole32.NewProc("StringFromIID") + procIIDFromString = modole32.NewProc("IIDFromString") + procCoGetObject = modole32.NewProc("CoGetObject") + procGetUserDefaultLCID = modkernel32.NewProc("GetUserDefaultLCID") + procCopyMemory = modkernel32.NewProc("RtlMoveMemory") + procVariantInit = modoleaut32.NewProc("VariantInit") + procVariantClear = modoleaut32.NewProc("VariantClear") + procVariantTimeToSystemTime = modoleaut32.NewProc("VariantTimeToSystemTime") + procSysAllocString = modoleaut32.NewProc("SysAllocString") + procSysAllocStringLen = modoleaut32.NewProc("SysAllocStringLen") + procSysFreeString = modoleaut32.NewProc("SysFreeString") + procSysStringLen = modoleaut32.NewProc("SysStringLen") + procCreateDispTypeInfo = modoleaut32.NewProc("CreateDispTypeInfo") + procCreateStdDispatch = modoleaut32.NewProc("CreateStdDispatch") + procGetActiveObject = modoleaut32.NewProc("GetActiveObject") + + procGetMessageW = moduser32.NewProc("GetMessageW") + procDispatchMessageW = moduser32.NewProc("DispatchMessageW") +) + +// coInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func coInitialize() (err error) { + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms678543(v=vs.85).aspx + // Suggests that no value should be passed to CoInitialized. + // Could just be Call() since the parameter is optional. <-- Needs testing to be sure. + hr, _, _ := procCoInitialize.Call(uintptr(0)) + if hr != 0 { + err = NewError(hr) + } + return +} + +// coInitializeEx initializes COM library with concurrency model. +func coInitializeEx(coinit uint32) (err error) { + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms695279(v=vs.85).aspx + // Suggests that the first parameter is not only optional but should always be NULL. + hr, _, _ := procCoInitializeEx.Call(uintptr(0), uintptr(coinit)) + if hr != 0 { + err = NewError(hr) + } + return +} + +// CoInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func CoInitialize(p uintptr) (err error) { + // p is ignored and won't be used. + // Avoid any variable not used errors. + p = uintptr(0) + return coInitialize() +} + +// CoInitializeEx initializes COM library with concurrency model. +func CoInitializeEx(p uintptr, coinit uint32) (err error) { + // Avoid any variable not used errors. + p = uintptr(0) + return coInitializeEx(coinit) +} + +// CoUninitialize uninitializes COM Library. +func CoUninitialize() { + procCoUninitialize.Call() +} + +// CoTaskMemFree frees memory pointer. +func CoTaskMemFree(memptr uintptr) { + procCoTaskMemFree.Call(memptr) +} + +// CLSIDFromProgID retrieves Class Identifier with the given Program Identifier. +// +// The Programmatic Identifier must be registered, because it will be looked up +// in the Windows Registry. The registry entry has the following keys: CLSID, +// Insertable, Protocol and Shell +// (https://msdn.microsoft.com/en-us/library/dd542719(v=vs.85).aspx). +// +// programID identifies the class id with less precision and is not guaranteed +// to be unique. These are usually found in the registry under +// HKEY_LOCAL_MACHINE\SOFTWARE\Classes, usually with the format of +// "Program.Component.Version" with version being optional. +// +// CLSIDFromProgID in Windows API. +func CLSIDFromProgID(progId string) (clsid *GUID, err error) { + var guid GUID + lpszProgID := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(progId))) + hr, _, _ := procCLSIDFromProgID.Call(lpszProgID, uintptr(unsafe.Pointer(&guid))) + if hr != 0 { + err = NewError(hr) + } + clsid = &guid + return +} + +// CLSIDFromString retrieves Class ID from string representation. +// +// This is technically the string version of the GUID and will convert the +// string to object. +// +// CLSIDFromString in Windows API. +func CLSIDFromString(str string) (clsid *GUID, err error) { + var guid GUID + lpsz := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(str))) + hr, _, _ := procCLSIDFromString.Call(lpsz, uintptr(unsafe.Pointer(&guid))) + if hr != 0 { + err = NewError(hr) + } + clsid = &guid + return +} + +// StringFromCLSID returns GUID formated string from GUID object. +func StringFromCLSID(clsid *GUID) (str string, err error) { + var p *uint16 + hr, _, _ := procStringFromCLSID.Call(uintptr(unsafe.Pointer(clsid)), uintptr(unsafe.Pointer(&p))) + if hr != 0 { + err = NewError(hr) + } + str = LpOleStrToString(p) + return +} + +// IIDFromString returns GUID from program ID. +func IIDFromString(progId string) (clsid *GUID, err error) { + var guid GUID + lpsz := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(progId))) + hr, _, _ := procIIDFromString.Call(lpsz, uintptr(unsafe.Pointer(&guid))) + if hr != 0 { + err = NewError(hr) + } + clsid = &guid + return +} + +// StringFromIID returns GUID formatted string from GUID object. +func StringFromIID(iid *GUID) (str string, err error) { + var p *uint16 + hr, _, _ := procStringFromIID.Call(uintptr(unsafe.Pointer(iid)), uintptr(unsafe.Pointer(&p))) + if hr != 0 { + err = NewError(hr) + } + str = LpOleStrToString(p) + return +} + +// CreateInstance of single uninitialized object with GUID. +func CreateInstance(clsid *GUID, iid *GUID) (unk *IUnknown, err error) { + if iid == nil { + iid = IID_IUnknown + } + hr, _, _ := procCoCreateInstance.Call( + uintptr(unsafe.Pointer(clsid)), + 0, + CLSCTX_SERVER, + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&unk))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// GetActiveObject retrieves pointer to active object. +func GetActiveObject(clsid *GUID, iid *GUID) (unk *IUnknown, err error) { + if iid == nil { + iid = IID_IUnknown + } + hr, _, _ := procGetActiveObject.Call( + uintptr(unsafe.Pointer(clsid)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&unk))) + if hr != 0 { + err = NewError(hr) + } + return +} + +type BindOpts struct { + CbStruct uint32 + GrfFlags uint32 + GrfMode uint32 + TickCountDeadline uint32 +} + +// GetObject retrieves pointer to active object. +func GetObject(programID string, bindOpts *BindOpts, iid *GUID) (unk *IUnknown, err error) { + if bindOpts != nil { + bindOpts.CbStruct = uint32(unsafe.Sizeof(BindOpts{})) + } + if iid == nil { + iid = IID_IUnknown + } + hr, _, _ := procCoGetObject.Call( + uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(programID))), + uintptr(unsafe.Pointer(bindOpts)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&unk))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// VariantInit initializes variant. +func VariantInit(v *VARIANT) (err error) { + hr, _, _ := procVariantInit.Call(uintptr(unsafe.Pointer(v))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// VariantClear clears value in Variant settings to VT_EMPTY. +func VariantClear(v *VARIANT) (err error) { + hr, _, _ := procVariantClear.Call(uintptr(unsafe.Pointer(v))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// SysAllocString allocates memory for string and copies string into memory. +func SysAllocString(v string) (ss *int16) { + pss, _, _ := procSysAllocString.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(v)))) + ss = (*int16)(unsafe.Pointer(pss)) + return +} + +// SysAllocStringLen copies up to length of given string returning pointer. +func SysAllocStringLen(v string) (ss *int16) { + utf16 := utf16.Encode([]rune(v + "\x00")) + ptr := &utf16[0] + + pss, _, _ := procSysAllocStringLen.Call(uintptr(unsafe.Pointer(ptr)), uintptr(len(utf16)-1)) + ss = (*int16)(unsafe.Pointer(pss)) + return +} + +// SysFreeString frees string system memory. This must be called with SysAllocString. +func SysFreeString(v *int16) (err error) { + hr, _, _ := procSysFreeString.Call(uintptr(unsafe.Pointer(v))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// SysStringLen is the length of the system allocated string. +func SysStringLen(v *int16) uint32 { + l, _, _ := procSysStringLen.Call(uintptr(unsafe.Pointer(v))) + return uint32(l) +} + +// CreateStdDispatch provides default IDispatch implementation for IUnknown. +// +// This handles default IDispatch implementation for objects. It haves a few +// limitations with only supporting one language. It will also only return +// default exception codes. +func CreateStdDispatch(unk *IUnknown, v uintptr, ptinfo *IUnknown) (disp *IDispatch, err error) { + hr, _, _ := procCreateStdDispatch.Call( + uintptr(unsafe.Pointer(unk)), + v, + uintptr(unsafe.Pointer(ptinfo)), + uintptr(unsafe.Pointer(&disp))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// CreateDispTypeInfo provides default ITypeInfo implementation for IDispatch. +// +// This will not handle the full implementation of the interface. +func CreateDispTypeInfo(idata *INTERFACEDATA) (pptinfo *IUnknown, err error) { + hr, _, _ := procCreateDispTypeInfo.Call( + uintptr(unsafe.Pointer(idata)), + uintptr(GetUserDefaultLCID()), + uintptr(unsafe.Pointer(&pptinfo))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// copyMemory moves location of a block of memory. +func copyMemory(dest unsafe.Pointer, src unsafe.Pointer, length uint32) { + procCopyMemory.Call(uintptr(dest), uintptr(src), uintptr(length)) +} + +// GetUserDefaultLCID retrieves current user default locale. +func GetUserDefaultLCID() (lcid uint32) { + ret, _, _ := procGetUserDefaultLCID.Call() + lcid = uint32(ret) + return +} + +// GetMessage in message queue from runtime. +// +// This function appears to block. PeekMessage does not block. +func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, err error) { + r0, _, err := procGetMessageW.Call(uintptr(unsafe.Pointer(msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax)) + ret = int32(r0) + return +} + +// DispatchMessage to window procedure. +func DispatchMessage(msg *Msg) (ret int32) { + r0, _, _ := procDispatchMessageW.Call(uintptr(unsafe.Pointer(msg))) + ret = int32(r0) + return +} diff --git a/vendor/github.com/go-ole/go-ole/com_func.go b/vendor/github.com/go-ole/go-ole/com_func.go new file mode 100644 index 00000000..cef539d9 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/com_func.go @@ -0,0 +1,174 @@ +// +build !windows + +package ole + +import ( + "time" + "unsafe" +) + +// coInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func coInitialize() error { + return NewError(E_NOTIMPL) +} + +// coInitializeEx initializes COM library with concurrency model. +func coInitializeEx(coinit uint32) error { + return NewError(E_NOTIMPL) +} + +// CoInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func CoInitialize(p uintptr) error { + return NewError(E_NOTIMPL) +} + +// CoInitializeEx initializes COM library with concurrency model. +func CoInitializeEx(p uintptr, coinit uint32) error { + return NewError(E_NOTIMPL) +} + +// CoUninitialize uninitializes COM Library. +func CoUninitialize() {} + +// CoTaskMemFree frees memory pointer. +func CoTaskMemFree(memptr uintptr) {} + +// CLSIDFromProgID retrieves Class Identifier with the given Program Identifier. +// +// The Programmatic Identifier must be registered, because it will be looked up +// in the Windows Registry. The registry entry has the following keys: CLSID, +// Insertable, Protocol and Shell +// (https://msdn.microsoft.com/en-us/library/dd542719(v=vs.85).aspx). +// +// programID identifies the class id with less precision and is not guaranteed +// to be unique. These are usually found in the registry under +// HKEY_LOCAL_MACHINE\SOFTWARE\Classes, usually with the format of +// "Program.Component.Version" with version being optional. +// +// CLSIDFromProgID in Windows API. +func CLSIDFromProgID(progId string) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// CLSIDFromString retrieves Class ID from string representation. +// +// This is technically the string version of the GUID and will convert the +// string to object. +// +// CLSIDFromString in Windows API. +func CLSIDFromString(str string) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// StringFromCLSID returns GUID formated string from GUID object. +func StringFromCLSID(clsid *GUID) (string, error) { + return "", NewError(E_NOTIMPL) +} + +// IIDFromString returns GUID from program ID. +func IIDFromString(progId string) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// StringFromIID returns GUID formatted string from GUID object. +func StringFromIID(iid *GUID) (string, error) { + return "", NewError(E_NOTIMPL) +} + +// CreateInstance of single uninitialized object with GUID. +func CreateInstance(clsid *GUID, iid *GUID) (*IUnknown, error) { + return nil, NewError(E_NOTIMPL) +} + +// GetActiveObject retrieves pointer to active object. +func GetActiveObject(clsid *GUID, iid *GUID) (*IUnknown, error) { + return nil, NewError(E_NOTIMPL) +} + +// VariantInit initializes variant. +func VariantInit(v *VARIANT) error { + return NewError(E_NOTIMPL) +} + +// VariantClear clears value in Variant settings to VT_EMPTY. +func VariantClear(v *VARIANT) error { + return NewError(E_NOTIMPL) +} + +// SysAllocString allocates memory for string and copies string into memory. +func SysAllocString(v string) *int16 { + u := int16(0) + return &u +} + +// SysAllocStringLen copies up to length of given string returning pointer. +func SysAllocStringLen(v string) *int16 { + u := int16(0) + return &u +} + +// SysFreeString frees string system memory. This must be called with SysAllocString. +func SysFreeString(v *int16) error { + return NewError(E_NOTIMPL) +} + +// SysStringLen is the length of the system allocated string. +func SysStringLen(v *int16) uint32 { + return uint32(0) +} + +// CreateStdDispatch provides default IDispatch implementation for IUnknown. +// +// This handles default IDispatch implementation for objects. It haves a few +// limitations with only supporting one language. It will also only return +// default exception codes. +func CreateStdDispatch(unk *IUnknown, v uintptr, ptinfo *IUnknown) (*IDispatch, error) { + return nil, NewError(E_NOTIMPL) +} + +// CreateDispTypeInfo provides default ITypeInfo implementation for IDispatch. +// +// This will not handle the full implementation of the interface. +func CreateDispTypeInfo(idata *INTERFACEDATA) (*IUnknown, error) { + return nil, NewError(E_NOTIMPL) +} + +// copyMemory moves location of a block of memory. +func copyMemory(dest unsafe.Pointer, src unsafe.Pointer, length uint32) {} + +// GetUserDefaultLCID retrieves current user default locale. +func GetUserDefaultLCID() uint32 { + return uint32(0) +} + +// GetMessage in message queue from runtime. +// +// This function appears to block. PeekMessage does not block. +func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (int32, error) { + return int32(0), NewError(E_NOTIMPL) +} + +// DispatchMessage to window procedure. +func DispatchMessage(msg *Msg) int32 { + return int32(0) +} + +func GetVariantDate(value uint64) (time.Time, error) { + return time.Now(), NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/connect.go b/vendor/github.com/go-ole/go-ole/connect.go new file mode 100644 index 00000000..b2ac2ec6 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/connect.go @@ -0,0 +1,192 @@ +package ole + +// Connection contains IUnknown for fluent interface interaction. +// +// Deprecated. Use oleutil package instead. +type Connection struct { + Object *IUnknown // Access COM +} + +// Initialize COM. +func (*Connection) Initialize() (err error) { + return coInitialize() +} + +// Uninitialize COM. +func (*Connection) Uninitialize() { + CoUninitialize() +} + +// Create IUnknown object based first on ProgId and then from String. +func (c *Connection) Create(progId string) (err error) { + var clsid *GUID + clsid, err = CLSIDFromProgID(progId) + if err != nil { + clsid, err = CLSIDFromString(progId) + if err != nil { + return + } + } + + unknown, err := CreateInstance(clsid, IID_IUnknown) + if err != nil { + return + } + c.Object = unknown + + return +} + +// Release IUnknown object. +func (c *Connection) Release() { + c.Object.Release() +} + +// Load COM object from list of programIDs or strings. +func (c *Connection) Load(names ...string) (errors []error) { + var tempErrors []error = make([]error, len(names)) + var numErrors int = 0 + for _, name := range names { + err := c.Create(name) + if err != nil { + tempErrors = append(tempErrors, err) + numErrors += 1 + continue + } + break + } + + copy(errors, tempErrors[0:numErrors]) + return +} + +// Dispatch returns Dispatch object. +func (c *Connection) Dispatch() (object *Dispatch, err error) { + dispatch, err := c.Object.QueryInterface(IID_IDispatch) + if err != nil { + return + } + object = &Dispatch{dispatch} + return +} + +// Dispatch stores IDispatch object. +type Dispatch struct { + Object *IDispatch // Dispatch object. +} + +// Call method on IDispatch with parameters. +func (d *Dispatch) Call(method string, params ...interface{}) (result *VARIANT, err error) { + id, err := d.GetId(method) + if err != nil { + return + } + + result, err = d.Invoke(id, DISPATCH_METHOD, params) + return +} + +// MustCall method on IDispatch with parameters. +func (d *Dispatch) MustCall(method string, params ...interface{}) (result *VARIANT) { + id, err := d.GetId(method) + if err != nil { + panic(err) + } + + result, err = d.Invoke(id, DISPATCH_METHOD, params) + if err != nil { + panic(err) + } + + return +} + +// Get property on IDispatch with parameters. +func (d *Dispatch) Get(name string, params ...interface{}) (result *VARIANT, err error) { + id, err := d.GetId(name) + if err != nil { + return + } + result, err = d.Invoke(id, DISPATCH_PROPERTYGET, params) + return +} + +// MustGet property on IDispatch with parameters. +func (d *Dispatch) MustGet(name string, params ...interface{}) (result *VARIANT) { + id, err := d.GetId(name) + if err != nil { + panic(err) + } + + result, err = d.Invoke(id, DISPATCH_PROPERTYGET, params) + if err != nil { + panic(err) + } + return +} + +// Set property on IDispatch with parameters. +func (d *Dispatch) Set(name string, params ...interface{}) (result *VARIANT, err error) { + id, err := d.GetId(name) + if err != nil { + return + } + result, err = d.Invoke(id, DISPATCH_PROPERTYPUT, params) + return +} + +// MustSet property on IDispatch with parameters. +func (d *Dispatch) MustSet(name string, params ...interface{}) (result *VARIANT) { + id, err := d.GetId(name) + if err != nil { + panic(err) + } + + result, err = d.Invoke(id, DISPATCH_PROPERTYPUT, params) + if err != nil { + panic(err) + } + return +} + +// GetId retrieves ID of name on IDispatch. +func (d *Dispatch) GetId(name string) (id int32, err error) { + var dispid []int32 + dispid, err = d.Object.GetIDsOfName([]string{name}) + if err != nil { + return + } + id = dispid[0] + return +} + +// GetIds retrieves all IDs of names on IDispatch. +func (d *Dispatch) GetIds(names ...string) (dispid []int32, err error) { + dispid, err = d.Object.GetIDsOfName(names) + return +} + +// Invoke IDispatch on DisplayID of dispatch type with parameters. +// +// There have been problems where if send cascading params..., it would error +// out because the parameters would be empty. +func (d *Dispatch) Invoke(id int32, dispatch int16, params []interface{}) (result *VARIANT, err error) { + if len(params) < 1 { + result, err = d.Object.Invoke(id, dispatch) + } else { + result, err = d.Object.Invoke(id, dispatch, params...) + } + return +} + +// Release IDispatch object. +func (d *Dispatch) Release() { + d.Object.Release() +} + +// Connect initializes COM and attempts to load IUnknown based on given names. +func Connect(names ...string) (connection *Connection) { + connection.Initialize() + connection.Load(names...) + return +} diff --git a/vendor/github.com/go-ole/go-ole/constants.go b/vendor/github.com/go-ole/go-ole/constants.go new file mode 100644 index 00000000..fd0c6d74 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/constants.go @@ -0,0 +1,153 @@ +package ole + +const ( + CLSCTX_INPROC_SERVER = 1 + CLSCTX_INPROC_HANDLER = 2 + CLSCTX_LOCAL_SERVER = 4 + CLSCTX_INPROC_SERVER16 = 8 + CLSCTX_REMOTE_SERVER = 16 + CLSCTX_ALL = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER + CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER + CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER +) + +const ( + COINIT_APARTMENTTHREADED = 0x2 + COINIT_MULTITHREADED = 0x0 + COINIT_DISABLE_OLE1DDE = 0x4 + COINIT_SPEED_OVER_MEMORY = 0x8 +) + +const ( + DISPATCH_METHOD = 1 + DISPATCH_PROPERTYGET = 2 + DISPATCH_PROPERTYPUT = 4 + DISPATCH_PROPERTYPUTREF = 8 +) + +const ( + S_OK = 0x00000000 + E_UNEXPECTED = 0x8000FFFF + E_NOTIMPL = 0x80004001 + E_OUTOFMEMORY = 0x8007000E + E_INVALIDARG = 0x80070057 + E_NOINTERFACE = 0x80004002 + E_POINTER = 0x80004003 + E_HANDLE = 0x80070006 + E_ABORT = 0x80004004 + E_FAIL = 0x80004005 + E_ACCESSDENIED = 0x80070005 + E_PENDING = 0x8000000A + + CO_E_CLASSSTRING = 0x800401F3 +) + +const ( + CC_FASTCALL = iota + CC_CDECL + CC_MSCPASCAL + CC_PASCAL = CC_MSCPASCAL + CC_MACPASCAL + CC_STDCALL + CC_FPFASTCALL + CC_SYSCALL + CC_MPWCDECL + CC_MPWPASCAL + CC_MAX = CC_MPWPASCAL +) + +type VT uint16 + +const ( + VT_EMPTY VT = 0x0 + VT_NULL VT = 0x1 + VT_I2 VT = 0x2 + VT_I4 VT = 0x3 + VT_R4 VT = 0x4 + VT_R8 VT = 0x5 + VT_CY VT = 0x6 + VT_DATE VT = 0x7 + VT_BSTR VT = 0x8 + VT_DISPATCH VT = 0x9 + VT_ERROR VT = 0xa + VT_BOOL VT = 0xb + VT_VARIANT VT = 0xc + VT_UNKNOWN VT = 0xd + VT_DECIMAL VT = 0xe + VT_I1 VT = 0x10 + VT_UI1 VT = 0x11 + VT_UI2 VT = 0x12 + VT_UI4 VT = 0x13 + VT_I8 VT = 0x14 + VT_UI8 VT = 0x15 + VT_INT VT = 0x16 + VT_UINT VT = 0x17 + VT_VOID VT = 0x18 + VT_HRESULT VT = 0x19 + VT_PTR VT = 0x1a + VT_SAFEARRAY VT = 0x1b + VT_CARRAY VT = 0x1c + VT_USERDEFINED VT = 0x1d + VT_LPSTR VT = 0x1e + VT_LPWSTR VT = 0x1f + VT_RECORD VT = 0x24 + VT_INT_PTR VT = 0x25 + VT_UINT_PTR VT = 0x26 + VT_FILETIME VT = 0x40 + VT_BLOB VT = 0x41 + VT_STREAM VT = 0x42 + VT_STORAGE VT = 0x43 + VT_STREAMED_OBJECT VT = 0x44 + VT_STORED_OBJECT VT = 0x45 + VT_BLOB_OBJECT VT = 0x46 + VT_CF VT = 0x47 + VT_CLSID VT = 0x48 + VT_BSTR_BLOB VT = 0xfff + VT_VECTOR VT = 0x1000 + VT_ARRAY VT = 0x2000 + VT_BYREF VT = 0x4000 + VT_RESERVED VT = 0x8000 + VT_ILLEGAL VT = 0xffff + VT_ILLEGALMASKED VT = 0xfff + VT_TYPEMASK VT = 0xfff +) + +const ( + DISPID_UNKNOWN = -1 + DISPID_VALUE = 0 + DISPID_PROPERTYPUT = -3 + DISPID_NEWENUM = -4 + DISPID_EVALUATE = -5 + DISPID_CONSTRUCTOR = -6 + DISPID_DESTRUCTOR = -7 + DISPID_COLLECT = -8 +) + +const ( + TKIND_ENUM = 1 + TKIND_RECORD = 2 + TKIND_MODULE = 3 + TKIND_INTERFACE = 4 + TKIND_DISPATCH = 5 + TKIND_COCLASS = 6 + TKIND_ALIAS = 7 + TKIND_UNION = 8 + TKIND_MAX = 9 +) + +// Safe Array Feature Flags + +const ( + FADF_AUTO = 0x0001 + FADF_STATIC = 0x0002 + FADF_EMBEDDED = 0x0004 + FADF_FIXEDSIZE = 0x0010 + FADF_RECORD = 0x0020 + FADF_HAVEIID = 0x0040 + FADF_HAVEVARTYPE = 0x0080 + FADF_BSTR = 0x0100 + FADF_UNKNOWN = 0x0200 + FADF_DISPATCH = 0x0400 + FADF_VARIANT = 0x0800 + FADF_RESERVED = 0xF008 +) diff --git a/vendor/github.com/go-ole/go-ole/error.go b/vendor/github.com/go-ole/go-ole/error.go new file mode 100644 index 00000000..096b456d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/error.go @@ -0,0 +1,51 @@ +package ole + +// OleError stores COM errors. +type OleError struct { + hr uintptr + description string + subError error +} + +// NewError creates new error with HResult. +func NewError(hr uintptr) *OleError { + return &OleError{hr: hr} +} + +// NewErrorWithDescription creates new COM error with HResult and description. +func NewErrorWithDescription(hr uintptr, description string) *OleError { + return &OleError{hr: hr, description: description} +} + +// NewErrorWithSubError creates new COM error with parent error. +func NewErrorWithSubError(hr uintptr, description string, err error) *OleError { + return &OleError{hr: hr, description: description, subError: err} +} + +// Code is the HResult. +func (v *OleError) Code() uintptr { + return uintptr(v.hr) +} + +// String description, either manually set or format message with error code. +func (v *OleError) String() string { + if v.description != "" { + return errstr(int(v.hr)) + " (" + v.description + ")" + } + return errstr(int(v.hr)) +} + +// Error implements error interface. +func (v *OleError) Error() string { + return v.String() +} + +// Description retrieves error summary, if there is one. +func (v *OleError) Description() string { + return v.description +} + +// SubError returns parent error, if there is one. +func (v *OleError) SubError() error { + return v.subError +} diff --git a/vendor/github.com/go-ole/go-ole/error_func.go b/vendor/github.com/go-ole/go-ole/error_func.go new file mode 100644 index 00000000..8a2ffaa2 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/error_func.go @@ -0,0 +1,8 @@ +// +build !windows + +package ole + +// errstr converts error code to string. +func errstr(errno int) string { + return "" +} diff --git a/vendor/github.com/go-ole/go-ole/error_windows.go b/vendor/github.com/go-ole/go-ole/error_windows.go new file mode 100644 index 00000000..d0e8e685 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/error_windows.go @@ -0,0 +1,24 @@ +// +build windows + +package ole + +import ( + "fmt" + "syscall" + "unicode/utf16" +) + +// errstr converts error code to string. +func errstr(errno int) string { + // ask windows for the remaining errors + var flags uint32 = syscall.FORMAT_MESSAGE_FROM_SYSTEM | syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY | syscall.FORMAT_MESSAGE_IGNORE_INSERTS + b := make([]uint16, 300) + n, err := syscall.FormatMessage(flags, 0, uint32(errno), 0, b, nil) + if err != nil { + return fmt.Sprintf("error %d (FormatMessage failed with: %v)", errno, err) + } + // trim terminating \r and \n + for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- { + } + return string(utf16.Decode(b[:n])) +} diff --git a/vendor/github.com/go-ole/go-ole/guid.go b/vendor/github.com/go-ole/go-ole/guid.go new file mode 100644 index 00000000..8d20f68f --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/guid.go @@ -0,0 +1,284 @@ +package ole + +var ( + // IID_NULL is null Interface ID, used when no other Interface ID is known. + IID_NULL = NewGUID("{00000000-0000-0000-0000-000000000000}") + + // IID_IUnknown is for IUnknown interfaces. + IID_IUnknown = NewGUID("{00000000-0000-0000-C000-000000000046}") + + // IID_IDispatch is for IDispatch interfaces. + IID_IDispatch = NewGUID("{00020400-0000-0000-C000-000000000046}") + + // IID_IEnumVariant is for IEnumVariant interfaces + IID_IEnumVariant = NewGUID("{00020404-0000-0000-C000-000000000046}") + + // IID_IConnectionPointContainer is for IConnectionPointContainer interfaces. + IID_IConnectionPointContainer = NewGUID("{B196B284-BAB4-101A-B69C-00AA00341D07}") + + // IID_IConnectionPoint is for IConnectionPoint interfaces. + IID_IConnectionPoint = NewGUID("{B196B286-BAB4-101A-B69C-00AA00341D07}") + + // IID_IInspectable is for IInspectable interfaces. + IID_IInspectable = NewGUID("{AF86E2E0-B12D-4C6A-9C5A-D7AA65101E90}") + + // IID_IProvideClassInfo is for IProvideClassInfo interfaces. + IID_IProvideClassInfo = NewGUID("{B196B283-BAB4-101A-B69C-00AA00341D07}") +) + +// These are for testing and not part of any library. +var ( + // IID_ICOMTestString is for ICOMTestString interfaces. + // + // {E0133EB4-C36F-469A-9D3D-C66B84BE19ED} + IID_ICOMTestString = NewGUID("{E0133EB4-C36F-469A-9D3D-C66B84BE19ED}") + + // IID_ICOMTestInt8 is for ICOMTestInt8 interfaces. + // + // {BEB06610-EB84-4155-AF58-E2BFF53680B4} + IID_ICOMTestInt8 = NewGUID("{BEB06610-EB84-4155-AF58-E2BFF53680B4}") + + // IID_ICOMTestInt16 is for ICOMTestInt16 interfaces. + // + // {DAA3F9FA-761E-4976-A860-8364CE55F6FC} + IID_ICOMTestInt16 = NewGUID("{DAA3F9FA-761E-4976-A860-8364CE55F6FC}") + + // IID_ICOMTestInt32 is for ICOMTestInt32 interfaces. + // + // {E3DEDEE7-38A2-4540-91D1-2EEF1D8891B0} + IID_ICOMTestInt32 = NewGUID("{E3DEDEE7-38A2-4540-91D1-2EEF1D8891B0}") + + // IID_ICOMTestInt64 is for ICOMTestInt64 interfaces. + // + // {8D437CBC-B3ED-485C-BC32-C336432A1623} + IID_ICOMTestInt64 = NewGUID("{8D437CBC-B3ED-485C-BC32-C336432A1623}") + + // IID_ICOMTestFloat is for ICOMTestFloat interfaces. + // + // {BF1ED004-EA02-456A-AA55-2AC8AC6B054C} + IID_ICOMTestFloat = NewGUID("{BF1ED004-EA02-456A-AA55-2AC8AC6B054C}") + + // IID_ICOMTestDouble is for ICOMTestDouble interfaces. + // + // {BF908A81-8687-4E93-999F-D86FAB284BA0} + IID_ICOMTestDouble = NewGUID("{BF908A81-8687-4E93-999F-D86FAB284BA0}") + + // IID_ICOMTestBoolean is for ICOMTestBoolean interfaces. + // + // {D530E7A6-4EE8-40D1-8931-3D63B8605010} + IID_ICOMTestBoolean = NewGUID("{D530E7A6-4EE8-40D1-8931-3D63B8605010}") + + // IID_ICOMEchoTestObject is for ICOMEchoTestObject interfaces. + // + // {6485B1EF-D780-4834-A4FE-1EBB51746CA3} + IID_ICOMEchoTestObject = NewGUID("{6485B1EF-D780-4834-A4FE-1EBB51746CA3}") + + // IID_ICOMTestTypes is for ICOMTestTypes interfaces. + // + // {CCA8D7AE-91C0-4277-A8B3-FF4EDF28D3C0} + IID_ICOMTestTypes = NewGUID("{CCA8D7AE-91C0-4277-A8B3-FF4EDF28D3C0}") + + // CLSID_COMEchoTestObject is for COMEchoTestObject class. + // + // {3C24506A-AE9E-4D50-9157-EF317281F1B0} + CLSID_COMEchoTestObject = NewGUID("{3C24506A-AE9E-4D50-9157-EF317281F1B0}") + + // CLSID_COMTestScalarClass is for COMTestScalarClass class. + // + // {865B85C5-0334-4AC6-9EF6-AACEC8FC5E86} + CLSID_COMTestScalarClass = NewGUID("{865B85C5-0334-4AC6-9EF6-AACEC8FC5E86}") +) + +const hextable = "0123456789ABCDEF" +const emptyGUID = "{00000000-0000-0000-0000-000000000000}" + +// GUID is Windows API specific GUID type. +// +// This exists to match Windows GUID type for direct passing for COM. +// Format is in xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx. +type GUID struct { + Data1 uint32 + Data2 uint16 + Data3 uint16 + Data4 [8]byte +} + +// NewGUID converts the given string into a globally unique identifier that is +// compliant with the Windows API. +// +// The supplied string may be in any of these formats: +// +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +// XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +// +// The conversion of the supplied string is not case-sensitive. +func NewGUID(guid string) *GUID { + d := []byte(guid) + var d1, d2, d3, d4a, d4b []byte + + switch len(d) { + case 38: + if d[0] != '{' || d[37] != '}' { + return nil + } + d = d[1:37] + fallthrough + case 36: + if d[8] != '-' || d[13] != '-' || d[18] != '-' || d[23] != '-' { + return nil + } + d1 = d[0:8] + d2 = d[9:13] + d3 = d[14:18] + d4a = d[19:23] + d4b = d[24:36] + case 32: + d1 = d[0:8] + d2 = d[8:12] + d3 = d[12:16] + d4a = d[16:20] + d4b = d[20:32] + default: + return nil + } + + var g GUID + var ok1, ok2, ok3, ok4 bool + g.Data1, ok1 = decodeHexUint32(d1) + g.Data2, ok2 = decodeHexUint16(d2) + g.Data3, ok3 = decodeHexUint16(d3) + g.Data4, ok4 = decodeHexByte64(d4a, d4b) + if ok1 && ok2 && ok3 && ok4 { + return &g + } + return nil +} + +func decodeHexUint32(src []byte) (value uint32, ok bool) { + var b1, b2, b3, b4 byte + var ok1, ok2, ok3, ok4 bool + b1, ok1 = decodeHexByte(src[0], src[1]) + b2, ok2 = decodeHexByte(src[2], src[3]) + b3, ok3 = decodeHexByte(src[4], src[5]) + b4, ok4 = decodeHexByte(src[6], src[7]) + value = (uint32(b1) << 24) | (uint32(b2) << 16) | (uint32(b3) << 8) | uint32(b4) + ok = ok1 && ok2 && ok3 && ok4 + return +} + +func decodeHexUint16(src []byte) (value uint16, ok bool) { + var b1, b2 byte + var ok1, ok2 bool + b1, ok1 = decodeHexByte(src[0], src[1]) + b2, ok2 = decodeHexByte(src[2], src[3]) + value = (uint16(b1) << 8) | uint16(b2) + ok = ok1 && ok2 + return +} + +func decodeHexByte64(s1 []byte, s2 []byte) (value [8]byte, ok bool) { + var ok1, ok2, ok3, ok4, ok5, ok6, ok7, ok8 bool + value[0], ok1 = decodeHexByte(s1[0], s1[1]) + value[1], ok2 = decodeHexByte(s1[2], s1[3]) + value[2], ok3 = decodeHexByte(s2[0], s2[1]) + value[3], ok4 = decodeHexByte(s2[2], s2[3]) + value[4], ok5 = decodeHexByte(s2[4], s2[5]) + value[5], ok6 = decodeHexByte(s2[6], s2[7]) + value[6], ok7 = decodeHexByte(s2[8], s2[9]) + value[7], ok8 = decodeHexByte(s2[10], s2[11]) + ok = ok1 && ok2 && ok3 && ok4 && ok5 && ok6 && ok7 && ok8 + return +} + +func decodeHexByte(c1, c2 byte) (value byte, ok bool) { + var n1, n2 byte + var ok1, ok2 bool + n1, ok1 = decodeHexChar(c1) + n2, ok2 = decodeHexChar(c2) + value = (n1 << 4) | n2 + ok = ok1 && ok2 + return +} + +func decodeHexChar(c byte) (byte, bool) { + switch { + case '0' <= c && c <= '9': + return c - '0', true + case 'a' <= c && c <= 'f': + return c - 'a' + 10, true + case 'A' <= c && c <= 'F': + return c - 'A' + 10, true + } + + return 0, false +} + +// String converts the GUID to string form. It will adhere to this pattern: +// +// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +// +// If the GUID is nil, the string representation of an empty GUID is returned: +// +// {00000000-0000-0000-0000-000000000000} +func (guid *GUID) String() string { + if guid == nil { + return emptyGUID + } + + var c [38]byte + c[0] = '{' + putUint32Hex(c[1:9], guid.Data1) + c[9] = '-' + putUint16Hex(c[10:14], guid.Data2) + c[14] = '-' + putUint16Hex(c[15:19], guid.Data3) + c[19] = '-' + putByteHex(c[20:24], guid.Data4[0:2]) + c[24] = '-' + putByteHex(c[25:37], guid.Data4[2:8]) + c[37] = '}' + return string(c[:]) +} + +func putUint32Hex(b []byte, v uint32) { + b[0] = hextable[byte(v>>24)>>4] + b[1] = hextable[byte(v>>24)&0x0f] + b[2] = hextable[byte(v>>16)>>4] + b[3] = hextable[byte(v>>16)&0x0f] + b[4] = hextable[byte(v>>8)>>4] + b[5] = hextable[byte(v>>8)&0x0f] + b[6] = hextable[byte(v)>>4] + b[7] = hextable[byte(v)&0x0f] +} + +func putUint16Hex(b []byte, v uint16) { + b[0] = hextable[byte(v>>8)>>4] + b[1] = hextable[byte(v>>8)&0x0f] + b[2] = hextable[byte(v)>>4] + b[3] = hextable[byte(v)&0x0f] +} + +func putByteHex(dst, src []byte) { + for i := 0; i < len(src); i++ { + dst[i*2] = hextable[src[i]>>4] + dst[i*2+1] = hextable[src[i]&0x0f] + } +} + +// IsEqualGUID compares two GUID. +// +// Not constant time comparison. +func IsEqualGUID(guid1 *GUID, guid2 *GUID) bool { + return guid1.Data1 == guid2.Data1 && + guid1.Data2 == guid2.Data2 && + guid1.Data3 == guid2.Data3 && + guid1.Data4[0] == guid2.Data4[0] && + guid1.Data4[1] == guid2.Data4[1] && + guid1.Data4[2] == guid2.Data4[2] && + guid1.Data4[3] == guid2.Data4[3] && + guid1.Data4[4] == guid2.Data4[4] && + guid1.Data4[5] == guid2.Data4[5] && + guid1.Data4[6] == guid2.Data4[6] && + guid1.Data4[7] == guid2.Data4[7] +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpoint.go b/vendor/github.com/go-ole/go-ole/iconnectionpoint.go new file mode 100644 index 00000000..9e6c49f4 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpoint.go @@ -0,0 +1,20 @@ +package ole + +import "unsafe" + +type IConnectionPoint struct { + IUnknown +} + +type IConnectionPointVtbl struct { + IUnknownVtbl + GetConnectionInterface uintptr + GetConnectionPointContainer uintptr + Advise uintptr + Unadvise uintptr + EnumConnections uintptr +} + +func (v *IConnectionPoint) VTable() *IConnectionPointVtbl { + return (*IConnectionPointVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go b/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go new file mode 100644 index 00000000..5414dc3c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go @@ -0,0 +1,21 @@ +// +build !windows + +package ole + +import "unsafe" + +func (v *IConnectionPoint) GetConnectionInterface(piid **GUID) int32 { + return int32(0) +} + +func (v *IConnectionPoint) Advise(unknown *IUnknown) (uint32, error) { + return uint32(0), NewError(E_NOTIMPL) +} + +func (v *IConnectionPoint) Unadvise(cookie uint32) error { + return NewError(E_NOTIMPL) +} + +func (v *IConnectionPoint) EnumConnections(p *unsafe.Pointer) (err error) { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go b/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go new file mode 100644 index 00000000..32bc1832 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go @@ -0,0 +1,43 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (v *IConnectionPoint) GetConnectionInterface(piid **GUID) int32 { + // XXX: This doesn't look like it does what it's supposed to + return release((*IUnknown)(unsafe.Pointer(v))) +} + +func (v *IConnectionPoint) Advise(unknown *IUnknown) (cookie uint32, err error) { + hr, _, _ := syscall.Syscall( + v.VTable().Advise, + 3, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(unknown)), + uintptr(unsafe.Pointer(&cookie))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (v *IConnectionPoint) Unadvise(cookie uint32) (err error) { + hr, _, _ := syscall.Syscall( + v.VTable().Unadvise, + 2, + uintptr(unsafe.Pointer(v)), + uintptr(cookie), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (v *IConnectionPoint) EnumConnections(p *unsafe.Pointer) error { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer.go b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer.go new file mode 100644 index 00000000..165860d1 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer.go @@ -0,0 +1,17 @@ +package ole + +import "unsafe" + +type IConnectionPointContainer struct { + IUnknown +} + +type IConnectionPointContainerVtbl struct { + IUnknownVtbl + EnumConnectionPoints uintptr + FindConnectionPoint uintptr +} + +func (v *IConnectionPointContainer) VTable() *IConnectionPointContainerVtbl { + return (*IConnectionPointContainerVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go new file mode 100644 index 00000000..5dfa42aa --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go @@ -0,0 +1,11 @@ +// +build !windows + +package ole + +func (v *IConnectionPointContainer) EnumConnectionPoints(points interface{}) error { + return NewError(E_NOTIMPL) +} + +func (v *IConnectionPointContainer) FindConnectionPoint(iid *GUID, point **IConnectionPoint) error { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go new file mode 100644 index 00000000..ad30d79e --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go @@ -0,0 +1,25 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (v *IConnectionPointContainer) EnumConnectionPoints(points interface{}) error { + return NewError(E_NOTIMPL) +} + +func (v *IConnectionPointContainer) FindConnectionPoint(iid *GUID, point **IConnectionPoint) (err error) { + hr, _, _ := syscall.Syscall( + v.VTable().FindConnectionPoint, + 3, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(point))) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/idispatch.go b/vendor/github.com/go-ole/go-ole/idispatch.go new file mode 100644 index 00000000..d4af1240 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/idispatch.go @@ -0,0 +1,94 @@ +package ole + +import "unsafe" + +type IDispatch struct { + IUnknown +} + +type IDispatchVtbl struct { + IUnknownVtbl + GetTypeInfoCount uintptr + GetTypeInfo uintptr + GetIDsOfNames uintptr + Invoke uintptr +} + +func (v *IDispatch) VTable() *IDispatchVtbl { + return (*IDispatchVtbl)(unsafe.Pointer(v.RawVTable)) +} + +func (v *IDispatch) GetIDsOfName(names []string) (dispid []int32, err error) { + dispid, err = getIDsOfName(v, names) + return +} + +func (v *IDispatch) Invoke(dispid int32, dispatch int16, params ...interface{}) (result *VARIANT, err error) { + result, err = invoke(v, dispid, dispatch, params...) + return +} + +func (v *IDispatch) GetTypeInfoCount() (c uint32, err error) { + c, err = getTypeInfoCount(v) + return +} + +func (v *IDispatch) GetTypeInfo() (tinfo *ITypeInfo, err error) { + tinfo, err = getTypeInfo(v) + return +} + +// GetSingleIDOfName is a helper that returns single display ID for IDispatch name. +// +// This replaces the common pattern of attempting to get a single name from the list of available +// IDs. It gives the first ID, if it is available. +func (v *IDispatch) GetSingleIDOfName(name string) (displayID int32, err error) { + var displayIDs []int32 + displayIDs, err = v.GetIDsOfName([]string{name}) + if err != nil { + return + } + displayID = displayIDs[0] + return +} + +// InvokeWithOptionalArgs accepts arguments as an array, works like Invoke. +// +// Accepts name and will attempt to retrieve Display ID to pass to Invoke. +// +// Passing params as an array is a workaround that could be fixed in later versions of Go that +// prevent passing empty params. During testing it was discovered that this is an acceptable way of +// getting around not being able to pass params normally. +func (v *IDispatch) InvokeWithOptionalArgs(name string, dispatch int16, params []interface{}) (result *VARIANT, err error) { + displayID, err := v.GetSingleIDOfName(name) + if err != nil { + return + } + + if len(params) < 1 { + result, err = v.Invoke(displayID, dispatch) + } else { + result, err = v.Invoke(displayID, dispatch, params...) + } + + return +} + +// CallMethod invokes named function with arguments on object. +func (v *IDispatch) CallMethod(name string, params ...interface{}) (*VARIANT, error) { + return v.InvokeWithOptionalArgs(name, DISPATCH_METHOD, params) +} + +// GetProperty retrieves the property with the name with the ability to pass arguments. +// +// Most of the time you will not need to pass arguments as most objects do not allow for this +// feature. Or at least, should not allow for this feature. Some servers don't follow best practices +// and this is provided for those edge cases. +func (v *IDispatch) GetProperty(name string, params ...interface{}) (*VARIANT, error) { + return v.InvokeWithOptionalArgs(name, DISPATCH_PROPERTYGET, params) +} + +// PutProperty attempts to mutate a property in the object. +func (v *IDispatch) PutProperty(name string, params ...interface{}) (*VARIANT, error) { + return v.InvokeWithOptionalArgs(name, DISPATCH_PROPERTYPUT, params) +} diff --git a/vendor/github.com/go-ole/go-ole/idispatch_func.go b/vendor/github.com/go-ole/go-ole/idispatch_func.go new file mode 100644 index 00000000..b8fbbe31 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/idispatch_func.go @@ -0,0 +1,19 @@ +// +build !windows + +package ole + +func getIDsOfName(disp *IDispatch, names []string) ([]int32, error) { + return []int32{}, NewError(E_NOTIMPL) +} + +func getTypeInfoCount(disp *IDispatch) (uint32, error) { + return uint32(0), NewError(E_NOTIMPL) +} + +func getTypeInfo(disp *IDispatch) (*ITypeInfo, error) { + return nil, NewError(E_NOTIMPL) +} + +func invoke(disp *IDispatch, dispid int32, dispatch int16, params ...interface{}) (*VARIANT, error) { + return nil, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/idispatch_windows.go b/vendor/github.com/go-ole/go-ole/idispatch_windows.go new file mode 100644 index 00000000..b399f047 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/idispatch_windows.go @@ -0,0 +1,202 @@ +// +build windows + +package ole + +import ( + "math/big" + "syscall" + "time" + "unsafe" +) + +func getIDsOfName(disp *IDispatch, names []string) (dispid []int32, err error) { + wnames := make([]*uint16, len(names)) + for i := 0; i < len(names); i++ { + wnames[i] = syscall.StringToUTF16Ptr(names[i]) + } + dispid = make([]int32, len(names)) + namelen := uint32(len(names)) + hr, _, _ := syscall.Syscall6( + disp.VTable().GetIDsOfNames, + 6, + uintptr(unsafe.Pointer(disp)), + uintptr(unsafe.Pointer(IID_NULL)), + uintptr(unsafe.Pointer(&wnames[0])), + uintptr(namelen), + uintptr(GetUserDefaultLCID()), + uintptr(unsafe.Pointer(&dispid[0]))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func getTypeInfoCount(disp *IDispatch) (c uint32, err error) { + hr, _, _ := syscall.Syscall( + disp.VTable().GetTypeInfoCount, + 2, + uintptr(unsafe.Pointer(disp)), + uintptr(unsafe.Pointer(&c)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func getTypeInfo(disp *IDispatch) (tinfo *ITypeInfo, err error) { + hr, _, _ := syscall.Syscall( + disp.VTable().GetTypeInfo, + 3, + uintptr(unsafe.Pointer(disp)), + uintptr(GetUserDefaultLCID()), + uintptr(unsafe.Pointer(&tinfo))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func invoke(disp *IDispatch, dispid int32, dispatch int16, params ...interface{}) (result *VARIANT, err error) { + var dispparams DISPPARAMS + + if dispatch&DISPATCH_PROPERTYPUT != 0 { + dispnames := [1]int32{DISPID_PROPERTYPUT} + dispparams.rgdispidNamedArgs = uintptr(unsafe.Pointer(&dispnames[0])) + dispparams.cNamedArgs = 1 + } else if dispatch&DISPATCH_PROPERTYPUTREF != 0 { + dispnames := [1]int32{DISPID_PROPERTYPUT} + dispparams.rgdispidNamedArgs = uintptr(unsafe.Pointer(&dispnames[0])) + dispparams.cNamedArgs = 1 + } + var vargs []VARIANT + if len(params) > 0 { + vargs = make([]VARIANT, len(params)) + for i, v := range params { + //n := len(params)-i-1 + n := len(params) - i - 1 + VariantInit(&vargs[n]) + switch vv := v.(type) { + case bool: + if vv { + vargs[n] = NewVariant(VT_BOOL, 0xffff) + } else { + vargs[n] = NewVariant(VT_BOOL, 0) + } + case *bool: + vargs[n] = NewVariant(VT_BOOL|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*bool))))) + case uint8: + vargs[n] = NewVariant(VT_I1, int64(v.(uint8))) + case *uint8: + vargs[n] = NewVariant(VT_I1|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint8))))) + case int8: + vargs[n] = NewVariant(VT_I1, int64(v.(int8))) + case *int8: + vargs[n] = NewVariant(VT_I1|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint8))))) + case int16: + vargs[n] = NewVariant(VT_I2, int64(v.(int16))) + case *int16: + vargs[n] = NewVariant(VT_I2|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int16))))) + case uint16: + vargs[n] = NewVariant(VT_UI2, int64(v.(uint16))) + case *uint16: + vargs[n] = NewVariant(VT_UI2|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint16))))) + case int32: + vargs[n] = NewVariant(VT_I4, int64(v.(int32))) + case *int32: + vargs[n] = NewVariant(VT_I4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int32))))) + case uint32: + vargs[n] = NewVariant(VT_UI4, int64(v.(uint32))) + case *uint32: + vargs[n] = NewVariant(VT_UI4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint32))))) + case int64: + vargs[n] = NewVariant(VT_I8, int64(v.(int64))) + case *int64: + vargs[n] = NewVariant(VT_I8|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int64))))) + case uint64: + vargs[n] = NewVariant(VT_UI8, int64(uintptr(v.(uint64)))) + case *uint64: + vargs[n] = NewVariant(VT_UI8|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint64))))) + case int: + vargs[n] = NewVariant(VT_I4, int64(v.(int))) + case *int: + vargs[n] = NewVariant(VT_I4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int))))) + case uint: + vargs[n] = NewVariant(VT_UI4, int64(v.(uint))) + case *uint: + vargs[n] = NewVariant(VT_UI4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint))))) + case float32: + vargs[n] = NewVariant(VT_R4, *(*int64)(unsafe.Pointer(&vv))) + case *float32: + vargs[n] = NewVariant(VT_R4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*float32))))) + case float64: + vargs[n] = NewVariant(VT_R8, *(*int64)(unsafe.Pointer(&vv))) + case *float64: + vargs[n] = NewVariant(VT_R8|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*float64))))) + case *big.Int: + vargs[n] = NewVariant(VT_DECIMAL, v.(*big.Int).Int64()) + case string: + vargs[n] = NewVariant(VT_BSTR, int64(uintptr(unsafe.Pointer(SysAllocStringLen(v.(string)))))) + case *string: + vargs[n] = NewVariant(VT_BSTR|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*string))))) + case time.Time: + s := vv.Format("2006-01-02 15:04:05") + vargs[n] = NewVariant(VT_BSTR, int64(uintptr(unsafe.Pointer(SysAllocStringLen(s))))) + case *time.Time: + s := vv.Format("2006-01-02 15:04:05") + vargs[n] = NewVariant(VT_BSTR|VT_BYREF, int64(uintptr(unsafe.Pointer(&s)))) + case *IDispatch: + vargs[n] = NewVariant(VT_DISPATCH, int64(uintptr(unsafe.Pointer(v.(*IDispatch))))) + case **IDispatch: + vargs[n] = NewVariant(VT_DISPATCH|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(**IDispatch))))) + case nil: + vargs[n] = NewVariant(VT_NULL, 0) + case *VARIANT: + vargs[n] = NewVariant(VT_VARIANT|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*VARIANT))))) + case []byte: + safeByteArray := safeArrayFromByteSlice(v.([]byte)) + vargs[n] = NewVariant(VT_ARRAY|VT_UI1, int64(uintptr(unsafe.Pointer(safeByteArray)))) + defer VariantClear(&vargs[n]) + case []string: + safeByteArray := safeArrayFromStringSlice(v.([]string)) + vargs[n] = NewVariant(VT_ARRAY|VT_BSTR, int64(uintptr(unsafe.Pointer(safeByteArray)))) + defer VariantClear(&vargs[n]) + default: + panic("unknown type") + } + } + dispparams.rgvarg = uintptr(unsafe.Pointer(&vargs[0])) + dispparams.cArgs = uint32(len(params)) + } + + result = new(VARIANT) + var excepInfo EXCEPINFO + VariantInit(result) + hr, _, _ := syscall.Syscall9( + disp.VTable().Invoke, + 9, + uintptr(unsafe.Pointer(disp)), + uintptr(dispid), + uintptr(unsafe.Pointer(IID_NULL)), + uintptr(GetUserDefaultLCID()), + uintptr(dispatch), + uintptr(unsafe.Pointer(&dispparams)), + uintptr(unsafe.Pointer(result)), + uintptr(unsafe.Pointer(&excepInfo)), + 0) + if hr != 0 { + excepInfo.renderStrings() + excepInfo.Clear() + err = NewErrorWithSubError(hr, excepInfo.description, excepInfo) + } + for i, varg := range vargs { + n := len(params) - i - 1 + if varg.VT == VT_BSTR && varg.Val != 0 { + SysFreeString(((*int16)(unsafe.Pointer(uintptr(varg.Val))))) + } + if varg.VT == (VT_BSTR|VT_BYREF) && varg.Val != 0 { + *(params[n].(*string)) = LpOleStrToString(*(**uint16)(unsafe.Pointer(uintptr(varg.Val)))) + } + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/ienumvariant.go b/vendor/github.com/go-ole/go-ole/ienumvariant.go new file mode 100644 index 00000000..24338975 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ienumvariant.go @@ -0,0 +1,19 @@ +package ole + +import "unsafe" + +type IEnumVARIANT struct { + IUnknown +} + +type IEnumVARIANTVtbl struct { + IUnknownVtbl + Next uintptr + Skip uintptr + Reset uintptr + Clone uintptr +} + +func (v *IEnumVARIANT) VTable() *IEnumVARIANTVtbl { + return (*IEnumVARIANTVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/ienumvariant_func.go b/vendor/github.com/go-ole/go-ole/ienumvariant_func.go new file mode 100644 index 00000000..c1484819 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ienumvariant_func.go @@ -0,0 +1,19 @@ +// +build !windows + +package ole + +func (enum *IEnumVARIANT) Clone() (*IEnumVARIANT, error) { + return nil, NewError(E_NOTIMPL) +} + +func (enum *IEnumVARIANT) Reset() error { + return NewError(E_NOTIMPL) +} + +func (enum *IEnumVARIANT) Skip(celt uint) error { + return NewError(E_NOTIMPL) +} + +func (enum *IEnumVARIANT) Next(celt uint) (VARIANT, uint, error) { + return NewVariant(VT_NULL, int64(0)), 0, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go b/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go new file mode 100644 index 00000000..4781f3b8 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go @@ -0,0 +1,63 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (enum *IEnumVARIANT) Clone() (cloned *IEnumVARIANT, err error) { + hr, _, _ := syscall.Syscall( + enum.VTable().Clone, + 2, + uintptr(unsafe.Pointer(enum)), + uintptr(unsafe.Pointer(&cloned)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (enum *IEnumVARIANT) Reset() (err error) { + hr, _, _ := syscall.Syscall( + enum.VTable().Reset, + 1, + uintptr(unsafe.Pointer(enum)), + 0, + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (enum *IEnumVARIANT) Skip(celt uint) (err error) { + hr, _, _ := syscall.Syscall( + enum.VTable().Skip, + 2, + uintptr(unsafe.Pointer(enum)), + uintptr(celt), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (enum *IEnumVARIANT) Next(celt uint) (array VARIANT, length uint, err error) { + hr, _, _ := syscall.Syscall6( + enum.VTable().Next, + 4, + uintptr(unsafe.Pointer(enum)), + uintptr(celt), + uintptr(unsafe.Pointer(&array)), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/iinspectable.go b/vendor/github.com/go-ole/go-ole/iinspectable.go new file mode 100644 index 00000000..f4a19e25 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iinspectable.go @@ -0,0 +1,18 @@ +package ole + +import "unsafe" + +type IInspectable struct { + IUnknown +} + +type IInspectableVtbl struct { + IUnknownVtbl + GetIIds uintptr + GetRuntimeClassName uintptr + GetTrustLevel uintptr +} + +func (v *IInspectable) VTable() *IInspectableVtbl { + return (*IInspectableVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/iinspectable_func.go b/vendor/github.com/go-ole/go-ole/iinspectable_func.go new file mode 100644 index 00000000..348829bf --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iinspectable_func.go @@ -0,0 +1,15 @@ +// +build !windows + +package ole + +func (v *IInspectable) GetIids() ([]*GUID, error) { + return []*GUID{}, NewError(E_NOTIMPL) +} + +func (v *IInspectable) GetRuntimeClassName() (string, error) { + return "", NewError(E_NOTIMPL) +} + +func (v *IInspectable) GetTrustLevel() (uint32, error) { + return uint32(0), NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iinspectable_windows.go b/vendor/github.com/go-ole/go-ole/iinspectable_windows.go new file mode 100644 index 00000000..4519a4aa --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iinspectable_windows.go @@ -0,0 +1,72 @@ +// +build windows + +package ole + +import ( + "bytes" + "encoding/binary" + "reflect" + "syscall" + "unsafe" +) + +func (v *IInspectable) GetIids() (iids []*GUID, err error) { + var count uint32 + var array uintptr + hr, _, _ := syscall.Syscall( + v.VTable().GetIIds, + 3, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&count)), + uintptr(unsafe.Pointer(&array))) + if hr != 0 { + err = NewError(hr) + return + } + defer CoTaskMemFree(array) + + iids = make([]*GUID, count) + byteCount := count * uint32(unsafe.Sizeof(GUID{})) + slicehdr := reflect.SliceHeader{Data: array, Len: int(byteCount), Cap: int(byteCount)} + byteSlice := *(*[]byte)(unsafe.Pointer(&slicehdr)) + reader := bytes.NewReader(byteSlice) + for i := range iids { + guid := GUID{} + err = binary.Read(reader, binary.LittleEndian, &guid) + if err != nil { + return + } + iids[i] = &guid + } + return +} + +func (v *IInspectable) GetRuntimeClassName() (s string, err error) { + var hstring HString + hr, _, _ := syscall.Syscall( + v.VTable().GetRuntimeClassName, + 2, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&hstring)), + 0) + if hr != 0 { + err = NewError(hr) + return + } + s = hstring.String() + DeleteHString(hstring) + return +} + +func (v *IInspectable) GetTrustLevel() (level uint32, err error) { + hr, _, _ := syscall.Syscall( + v.VTable().GetTrustLevel, + 2, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&level)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/iprovideclassinfo.go b/vendor/github.com/go-ole/go-ole/iprovideclassinfo.go new file mode 100644 index 00000000..25f3a6f2 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iprovideclassinfo.go @@ -0,0 +1,21 @@ +package ole + +import "unsafe" + +type IProvideClassInfo struct { + IUnknown +} + +type IProvideClassInfoVtbl struct { + IUnknownVtbl + GetClassInfo uintptr +} + +func (v *IProvideClassInfo) VTable() *IProvideClassInfoVtbl { + return (*IProvideClassInfoVtbl)(unsafe.Pointer(v.RawVTable)) +} + +func (v *IProvideClassInfo) GetClassInfo() (cinfo *ITypeInfo, err error) { + cinfo, err = getClassInfo(v) + return +} diff --git a/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go new file mode 100644 index 00000000..7e3cb63e --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go @@ -0,0 +1,7 @@ +// +build !windows + +package ole + +func getClassInfo(disp *IProvideClassInfo) (tinfo *ITypeInfo, err error) { + return nil, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go new file mode 100644 index 00000000..2ad01639 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go @@ -0,0 +1,21 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func getClassInfo(disp *IProvideClassInfo) (tinfo *ITypeInfo, err error) { + hr, _, _ := syscall.Syscall( + disp.VTable().GetClassInfo, + 2, + uintptr(unsafe.Pointer(disp)), + uintptr(unsafe.Pointer(&tinfo)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/itypeinfo.go b/vendor/github.com/go-ole/go-ole/itypeinfo.go new file mode 100644 index 00000000..dd3c5e21 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/itypeinfo.go @@ -0,0 +1,34 @@ +package ole + +import "unsafe" + +type ITypeInfo struct { + IUnknown +} + +type ITypeInfoVtbl struct { + IUnknownVtbl + GetTypeAttr uintptr + GetTypeComp uintptr + GetFuncDesc uintptr + GetVarDesc uintptr + GetNames uintptr + GetRefTypeOfImplType uintptr + GetImplTypeFlags uintptr + GetIDsOfNames uintptr + Invoke uintptr + GetDocumentation uintptr + GetDllEntry uintptr + GetRefTypeInfo uintptr + AddressOfMember uintptr + CreateInstance uintptr + GetMops uintptr + GetContainingTypeLib uintptr + ReleaseTypeAttr uintptr + ReleaseFuncDesc uintptr + ReleaseVarDesc uintptr +} + +func (v *ITypeInfo) VTable() *ITypeInfoVtbl { + return (*ITypeInfoVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/itypeinfo_func.go b/vendor/github.com/go-ole/go-ole/itypeinfo_func.go new file mode 100644 index 00000000..8364a659 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/itypeinfo_func.go @@ -0,0 +1,7 @@ +// +build !windows + +package ole + +func (v *ITypeInfo) GetTypeAttr() (*TYPEATTR, error) { + return nil, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go b/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go new file mode 100644 index 00000000..54782b3d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go @@ -0,0 +1,21 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (v *ITypeInfo) GetTypeAttr() (tattr *TYPEATTR, err error) { + hr, _, _ := syscall.Syscall( + uintptr(v.VTable().GetTypeAttr), + 2, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&tattr)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/iunknown.go b/vendor/github.com/go-ole/go-ole/iunknown.go new file mode 100644 index 00000000..108f28ea --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iunknown.go @@ -0,0 +1,57 @@ +package ole + +import "unsafe" + +type IUnknown struct { + RawVTable *interface{} +} + +type IUnknownVtbl struct { + QueryInterface uintptr + AddRef uintptr + Release uintptr +} + +type UnknownLike interface { + QueryInterface(iid *GUID) (disp *IDispatch, err error) + AddRef() int32 + Release() int32 +} + +func (v *IUnknown) VTable() *IUnknownVtbl { + return (*IUnknownVtbl)(unsafe.Pointer(v.RawVTable)) +} + +func (v *IUnknown) PutQueryInterface(interfaceID *GUID, obj interface{}) error { + return reflectQueryInterface(v, v.VTable().QueryInterface, interfaceID, obj) +} + +func (v *IUnknown) IDispatch(interfaceID *GUID) (dispatch *IDispatch, err error) { + err = v.PutQueryInterface(interfaceID, &dispatch) + return +} + +func (v *IUnknown) IEnumVARIANT(interfaceID *GUID) (enum *IEnumVARIANT, err error) { + err = v.PutQueryInterface(interfaceID, &enum) + return +} + +func (v *IUnknown) QueryInterface(iid *GUID) (*IDispatch, error) { + return queryInterface(v, iid) +} + +func (v *IUnknown) MustQueryInterface(iid *GUID) (disp *IDispatch) { + unk, err := queryInterface(v, iid) + if err != nil { + panic(err) + } + return unk +} + +func (v *IUnknown) AddRef() int32 { + return addRef(v) +} + +func (v *IUnknown) Release() int32 { + return release(v) +} diff --git a/vendor/github.com/go-ole/go-ole/iunknown_func.go b/vendor/github.com/go-ole/go-ole/iunknown_func.go new file mode 100644 index 00000000..d0a62cfd --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iunknown_func.go @@ -0,0 +1,19 @@ +// +build !windows + +package ole + +func reflectQueryInterface(self interface{}, method uintptr, interfaceID *GUID, obj interface{}) (err error) { + return NewError(E_NOTIMPL) +} + +func queryInterface(unk *IUnknown, iid *GUID) (disp *IDispatch, err error) { + return nil, NewError(E_NOTIMPL) +} + +func addRef(unk *IUnknown) int32 { + return 0 +} + +func release(unk *IUnknown) int32 { + return 0 +} diff --git a/vendor/github.com/go-ole/go-ole/iunknown_windows.go b/vendor/github.com/go-ole/go-ole/iunknown_windows.go new file mode 100644 index 00000000..ede5bb8c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iunknown_windows.go @@ -0,0 +1,58 @@ +// +build windows + +package ole + +import ( + "reflect" + "syscall" + "unsafe" +) + +func reflectQueryInterface(self interface{}, method uintptr, interfaceID *GUID, obj interface{}) (err error) { + selfValue := reflect.ValueOf(self).Elem() + objValue := reflect.ValueOf(obj).Elem() + + hr, _, _ := syscall.Syscall( + method, + 3, + selfValue.UnsafeAddr(), + uintptr(unsafe.Pointer(interfaceID)), + objValue.Addr().Pointer()) + if hr != 0 { + err = NewError(hr) + } + return +} + +func queryInterface(unk *IUnknown, iid *GUID) (disp *IDispatch, err error) { + hr, _, _ := syscall.Syscall( + unk.VTable().QueryInterface, + 3, + uintptr(unsafe.Pointer(unk)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&disp))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func addRef(unk *IUnknown) int32 { + ret, _, _ := syscall.Syscall( + unk.VTable().AddRef, + 1, + uintptr(unsafe.Pointer(unk)), + 0, + 0) + return int32(ret) +} + +func release(unk *IUnknown) int32 { + ret, _, _ := syscall.Syscall( + unk.VTable().Release, + 1, + uintptr(unsafe.Pointer(unk)), + 0, + 0) + return int32(ret) +} diff --git a/vendor/github.com/go-ole/go-ole/ole.go b/vendor/github.com/go-ole/go-ole/ole.go new file mode 100644 index 00000000..dbd132bb --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ole.go @@ -0,0 +1,190 @@ +package ole + +import ( + "fmt" + "strings" + "unsafe" +) + +// DISPPARAMS are the arguments that passed to methods or property. +type DISPPARAMS struct { + rgvarg uintptr + rgdispidNamedArgs uintptr + cArgs uint32 + cNamedArgs uint32 +} + +// EXCEPINFO defines exception info. +type EXCEPINFO struct { + wCode uint16 + wReserved uint16 + bstrSource *uint16 + bstrDescription *uint16 + bstrHelpFile *uint16 + dwHelpContext uint32 + pvReserved uintptr + pfnDeferredFillIn uintptr + scode uint32 + + // Go-specific part. Don't move upper cos it'll break structure layout for native code. + rendered bool + source string + description string + helpFile string +} + +// renderStrings translates BSTR strings to Go ones so `.Error` and `.String` +// could be safely called after `.Clear`. We need this when we can't rely on +// a caller to call `.Clear`. +func (e *EXCEPINFO) renderStrings() { + e.rendered = true + if e.bstrSource == nil { + e.source = "" + } else { + e.source = BstrToString(e.bstrSource) + } + if e.bstrDescription == nil { + e.description = "" + } else { + e.description = BstrToString(e.bstrDescription) + } + if e.bstrHelpFile == nil { + e.helpFile = "" + } else { + e.helpFile = BstrToString(e.bstrHelpFile) + } +} + +// Clear frees BSTR strings inside an EXCEPINFO and set it to NULL. +func (e *EXCEPINFO) Clear() { + freeBSTR := func(s *uint16) { + // SysFreeString don't return errors and is safe for call's on NULL. + // https://docs.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-sysfreestring + _ = SysFreeString((*int16)(unsafe.Pointer(s))) + } + + if e.bstrSource != nil { + freeBSTR(e.bstrSource) + e.bstrSource = nil + } + if e.bstrDescription != nil { + freeBSTR(e.bstrDescription) + e.bstrDescription = nil + } + if e.bstrHelpFile != nil { + freeBSTR(e.bstrHelpFile) + e.bstrHelpFile = nil + } +} + +// WCode return wCode in EXCEPINFO. +func (e EXCEPINFO) WCode() uint16 { + return e.wCode +} + +// SCODE return scode in EXCEPINFO. +func (e EXCEPINFO) SCODE() uint32 { + return e.scode +} + +// String convert EXCEPINFO to string. +func (e EXCEPINFO) String() string { + if !e.rendered { + e.renderStrings() + } + return fmt.Sprintf( + "wCode: %#x, bstrSource: %v, bstrDescription: %v, bstrHelpFile: %v, dwHelpContext: %#x, scode: %#x", + e.wCode, e.source, e.description, e.helpFile, e.dwHelpContext, e.scode, + ) +} + +// Error implements error interface and returns error string. +func (e EXCEPINFO) Error() string { + if !e.rendered { + e.renderStrings() + } + + if e.description != "" { + return strings.TrimSpace(e.description) + } + + code := e.scode + if e.wCode != 0 { + code = uint32(e.wCode) + } + return fmt.Sprintf("%v: %#x", e.source, code) +} + +// PARAMDATA defines parameter data type. +type PARAMDATA struct { + Name *int16 + Vt uint16 +} + +// METHODDATA defines method info. +type METHODDATA struct { + Name *uint16 + Data *PARAMDATA + Dispid int32 + Meth uint32 + CC int32 + CArgs uint32 + Flags uint16 + VtReturn uint32 +} + +// INTERFACEDATA defines interface info. +type INTERFACEDATA struct { + MethodData *METHODDATA + CMembers uint32 +} + +// Point is 2D vector type. +type Point struct { + X int32 + Y int32 +} + +// Msg is message between processes. +type Msg struct { + Hwnd uint32 + Message uint32 + Wparam int32 + Lparam int32 + Time uint32 + Pt Point +} + +// TYPEDESC defines data type. +type TYPEDESC struct { + Hreftype uint32 + VT uint16 +} + +// IDLDESC defines IDL info. +type IDLDESC struct { + DwReserved uint32 + WIDLFlags uint16 +} + +// TYPEATTR defines type info. +type TYPEATTR struct { + Guid GUID + Lcid uint32 + dwReserved uint32 + MemidConstructor int32 + MemidDestructor int32 + LpstrSchema *uint16 + CbSizeInstance uint32 + Typekind int32 + CFuncs uint16 + CVars uint16 + CImplTypes uint16 + CbSizeVft uint16 + CbAlignment uint16 + WTypeFlags uint16 + WMajorVerNum uint16 + WMinorVerNum uint16 + TdescAlias TYPEDESC + IdldescType IDLDESC +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/connection.go b/vendor/github.com/go-ole/go-ole/oleutil/connection.go new file mode 100644 index 00000000..60df73cd --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/connection.go @@ -0,0 +1,100 @@ +// +build windows + +package oleutil + +import ( + "reflect" + "unsafe" + + ole "github.com/go-ole/go-ole" +) + +type stdDispatch struct { + lpVtbl *stdDispatchVtbl + ref int32 + iid *ole.GUID + iface interface{} + funcMap map[string]int32 +} + +type stdDispatchVtbl struct { + pQueryInterface uintptr + pAddRef uintptr + pRelease uintptr + pGetTypeInfoCount uintptr + pGetTypeInfo uintptr + pGetIDsOfNames uintptr + pInvoke uintptr +} + +func dispQueryInterface(this *ole.IUnknown, iid *ole.GUID, punk **ole.IUnknown) uint32 { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + *punk = nil + if ole.IsEqualGUID(iid, ole.IID_IUnknown) || + ole.IsEqualGUID(iid, ole.IID_IDispatch) { + dispAddRef(this) + *punk = this + return ole.S_OK + } + if ole.IsEqualGUID(iid, pthis.iid) { + dispAddRef(this) + *punk = this + return ole.S_OK + } + return ole.E_NOINTERFACE +} + +func dispAddRef(this *ole.IUnknown) int32 { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + pthis.ref++ + return pthis.ref +} + +func dispRelease(this *ole.IUnknown) int32 { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + pthis.ref-- + return pthis.ref +} + +func dispGetIDsOfNames(this *ole.IUnknown, iid *ole.GUID, wnames []*uint16, namelen int, lcid int, pdisp []int32) uintptr { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + names := make([]string, len(wnames)) + for i := 0; i < len(names); i++ { + names[i] = ole.LpOleStrToString(wnames[i]) + } + for n := 0; n < namelen; n++ { + if id, ok := pthis.funcMap[names[n]]; ok { + pdisp[n] = id + } + } + return ole.S_OK +} + +func dispGetTypeInfoCount(pcount *int) uintptr { + if pcount != nil { + *pcount = 0 + } + return ole.S_OK +} + +func dispGetTypeInfo(ptypeif *uintptr) uintptr { + return ole.E_NOTIMPL +} + +func dispInvoke(this *ole.IDispatch, dispid int32, riid *ole.GUID, lcid int, flags int16, dispparams *ole.DISPPARAMS, result *ole.VARIANT, pexcepinfo *ole.EXCEPINFO, nerr *uint) uintptr { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + found := "" + for name, id := range pthis.funcMap { + if id == dispid { + found = name + } + } + if found != "" { + rv := reflect.ValueOf(pthis.iface).Elem() + rm := rv.MethodByName(found) + rr := rm.Call([]reflect.Value{}) + println(len(rr)) + return ole.S_OK + } + return ole.E_NOTIMPL +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go b/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go new file mode 100644 index 00000000..8818fb82 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go @@ -0,0 +1,10 @@ +// +build !windows + +package oleutil + +import ole "github.com/go-ole/go-ole" + +// ConnectObject creates a connection point between two services for communication. +func ConnectObject(disp *ole.IDispatch, iid *ole.GUID, idisp interface{}) (uint32, error) { + return 0, ole.NewError(ole.E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go b/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go new file mode 100644 index 00000000..ab9c0d8d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go @@ -0,0 +1,58 @@ +// +build windows + +package oleutil + +import ( + "reflect" + "syscall" + "unsafe" + + ole "github.com/go-ole/go-ole" +) + +// ConnectObject creates a connection point between two services for communication. +func ConnectObject(disp *ole.IDispatch, iid *ole.GUID, idisp interface{}) (cookie uint32, err error) { + unknown, err := disp.QueryInterface(ole.IID_IConnectionPointContainer) + if err != nil { + return + } + + container := (*ole.IConnectionPointContainer)(unsafe.Pointer(unknown)) + var point *ole.IConnectionPoint + err = container.FindConnectionPoint(iid, &point) + if err != nil { + return + } + if edisp, ok := idisp.(*ole.IUnknown); ok { + cookie, err = point.Advise(edisp) + container.Release() + if err != nil { + return + } + } + rv := reflect.ValueOf(disp).Elem() + if rv.Type().Kind() == reflect.Struct { + dest := &stdDispatch{} + dest.lpVtbl = &stdDispatchVtbl{} + dest.lpVtbl.pQueryInterface = syscall.NewCallback(dispQueryInterface) + dest.lpVtbl.pAddRef = syscall.NewCallback(dispAddRef) + dest.lpVtbl.pRelease = syscall.NewCallback(dispRelease) + dest.lpVtbl.pGetTypeInfoCount = syscall.NewCallback(dispGetTypeInfoCount) + dest.lpVtbl.pGetTypeInfo = syscall.NewCallback(dispGetTypeInfo) + dest.lpVtbl.pGetIDsOfNames = syscall.NewCallback(dispGetIDsOfNames) + dest.lpVtbl.pInvoke = syscall.NewCallback(dispInvoke) + dest.iface = disp + dest.iid = iid + cookie, err = point.Advise((*ole.IUnknown)(unsafe.Pointer(dest))) + container.Release() + if err != nil { + point.Release() + return + } + return + } + + container.Release() + + return 0, ole.NewError(ole.E_INVALIDARG) +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/go-get.go b/vendor/github.com/go-ole/go-ole/oleutil/go-get.go new file mode 100644 index 00000000..58347628 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/go-get.go @@ -0,0 +1,6 @@ +// This file is here so go get succeeds as without it errors with: +// no buildable Go source files in ... +// +// +build !windows + +package oleutil diff --git a/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go b/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go new file mode 100644 index 00000000..f7803c1e --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go @@ -0,0 +1,127 @@ +package oleutil + +import ole "github.com/go-ole/go-ole" + +// ClassIDFrom retrieves class ID whether given is program ID or application string. +func ClassIDFrom(programID string) (classID *ole.GUID, err error) { + return ole.ClassIDFrom(programID) +} + +// CreateObject creates object from programID based on interface type. +// +// Only supports IUnknown. +// +// Program ID can be either program ID or application string. +func CreateObject(programID string) (unknown *ole.IUnknown, err error) { + classID, err := ole.ClassIDFrom(programID) + if err != nil { + return + } + + unknown, err = ole.CreateInstance(classID, ole.IID_IUnknown) + if err != nil { + return + } + + return +} + +// GetActiveObject retrieves active object for program ID and interface ID based +// on interface type. +// +// Only supports IUnknown. +// +// Program ID can be either program ID or application string. +func GetActiveObject(programID string) (unknown *ole.IUnknown, err error) { + classID, err := ole.ClassIDFrom(programID) + if err != nil { + return + } + + unknown, err = ole.GetActiveObject(classID, ole.IID_IUnknown) + if err != nil { + return + } + + return +} + +// CallMethod calls method on IDispatch with parameters. +func CallMethod(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_METHOD, params) +} + +// MustCallMethod calls method on IDispatch with parameters or panics. +func MustCallMethod(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := CallMethod(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +// GetProperty retrieves property from IDispatch. +func GetProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYGET, params) +} + +// MustGetProperty retrieves property from IDispatch or panics. +func MustGetProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := GetProperty(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +// PutProperty mutates property. +func PutProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYPUT, params) +} + +// MustPutProperty mutates property or panics. +func MustPutProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := PutProperty(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +// PutPropertyRef mutates property reference. +func PutPropertyRef(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYPUTREF, params) +} + +// MustPutPropertyRef mutates property reference or panics. +func MustPutPropertyRef(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := PutPropertyRef(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +func ForEach(disp *ole.IDispatch, f func(v *ole.VARIANT) error) error { + newEnum, err := disp.GetProperty("_NewEnum") + if err != nil { + return err + } + defer newEnum.Clear() + + enum, err := newEnum.ToIUnknown().IEnumVARIANT(ole.IID_IEnumVariant) + if err != nil { + return err + } + defer enum.Release() + + for item, length, err := enum.Next(1); length > 0; item, length, err = enum.Next(1) { + if err != nil { + return err + } + if ferr := f(&item); ferr != nil { + return ferr + } + } + return nil +} diff --git a/vendor/github.com/go-ole/go-ole/safearray.go b/vendor/github.com/go-ole/go-ole/safearray.go new file mode 100644 index 00000000..a5201b56 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearray.go @@ -0,0 +1,27 @@ +// Package is meant to retrieve and process safe array data returned from COM. + +package ole + +// SafeArrayBound defines the SafeArray boundaries. +type SafeArrayBound struct { + Elements uint32 + LowerBound int32 +} + +// SafeArray is how COM handles arrays. +type SafeArray struct { + Dimensions uint16 + FeaturesFlag uint16 + ElementsSize uint32 + LocksAmount uint32 + Data uint32 + Bounds [16]byte +} + +// SAFEARRAY is obsolete, exists for backwards compatibility. +// Use SafeArray +type SAFEARRAY SafeArray + +// SAFEARRAYBOUND is obsolete, exists for backwards compatibility. +// Use SafeArrayBound +type SAFEARRAYBOUND SafeArrayBound diff --git a/vendor/github.com/go-ole/go-ole/safearray_func.go b/vendor/github.com/go-ole/go-ole/safearray_func.go new file mode 100644 index 00000000..0dee670c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearray_func.go @@ -0,0 +1,211 @@ +// +build !windows + +package ole + +import ( + "unsafe" +) + +// safeArrayAccessData returns raw array pointer. +// +// AKA: SafeArrayAccessData in Windows API. +func safeArrayAccessData(safearray *SafeArray) (uintptr, error) { + return uintptr(0), NewError(E_NOTIMPL) +} + +// safeArrayUnaccessData releases raw array. +// +// AKA: SafeArrayUnaccessData in Windows API. +func safeArrayUnaccessData(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayAllocData allocates SafeArray. +// +// AKA: SafeArrayAllocData in Windows API. +func safeArrayAllocData(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayAllocDescriptor allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptor in Windows API. +func safeArrayAllocDescriptor(dimensions uint32) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayAllocDescriptorEx allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptorEx in Windows API. +func safeArrayAllocDescriptorEx(variantType VT, dimensions uint32) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCopy returns copy of SafeArray. +// +// AKA: SafeArrayCopy in Windows API. +func safeArrayCopy(original *SafeArray) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCopyData duplicates SafeArray into another SafeArray object. +// +// AKA: SafeArrayCopyData in Windows API. +func safeArrayCopyData(original *SafeArray, duplicate *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayCreate creates SafeArray. +// +// AKA: SafeArrayCreate in Windows API. +func safeArrayCreate(variantType VT, dimensions uint32, bounds *SafeArrayBound) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCreateEx creates SafeArray. +// +// AKA: SafeArrayCreateEx in Windows API. +func safeArrayCreateEx(variantType VT, dimensions uint32, bounds *SafeArrayBound, extra uintptr) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCreateVector creates SafeArray. +// +// AKA: SafeArrayCreateVector in Windows API. +func safeArrayCreateVector(variantType VT, lowerBound int32, length uint32) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCreateVectorEx creates SafeArray. +// +// AKA: SafeArrayCreateVectorEx in Windows API. +func safeArrayCreateVectorEx(variantType VT, lowerBound int32, length uint32, extra uintptr) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayDestroy destroys SafeArray object. +// +// AKA: SafeArrayDestroy in Windows API. +func safeArrayDestroy(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayDestroyData destroys SafeArray object. +// +// AKA: SafeArrayDestroyData in Windows API. +func safeArrayDestroyData(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayDestroyDescriptor destroys SafeArray object. +// +// AKA: SafeArrayDestroyDescriptor in Windows API. +func safeArrayDestroyDescriptor(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayGetDim is the amount of dimensions in the SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetDim in Windows API. +func safeArrayGetDim(safearray *SafeArray) (*uint32, error) { + u := uint32(0) + return &u, NewError(E_NOTIMPL) +} + +// safeArrayGetElementSize is the element size in bytes. +// +// AKA: SafeArrayGetElemsize in Windows API. +func safeArrayGetElementSize(safearray *SafeArray) (*uint32, error) { + u := uint32(0) + return &u, NewError(E_NOTIMPL) +} + +// safeArrayGetElement retrieves element at given index. +func safeArrayGetElement(safearray *SafeArray, index int32, pv unsafe.Pointer) error { + return NewError(E_NOTIMPL) +} + +// safeArrayGetElement retrieves element at given index and converts to string. +func safeArrayGetElementString(safearray *SafeArray, index int32) (string, error) { + return "", NewError(E_NOTIMPL) +} + +// safeArrayGetIID is the InterfaceID of the elements in the SafeArray. +// +// AKA: SafeArrayGetIID in Windows API. +func safeArrayGetIID(safearray *SafeArray) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayGetLBound returns lower bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetLBound in Windows API. +func safeArrayGetLBound(safearray *SafeArray, dimension uint32) (int32, error) { + return int32(0), NewError(E_NOTIMPL) +} + +// safeArrayGetUBound returns upper bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetUBound in Windows API. +func safeArrayGetUBound(safearray *SafeArray, dimension uint32) (int32, error) { + return int32(0), NewError(E_NOTIMPL) +} + +// safeArrayGetVartype returns data type of SafeArray. +// +// AKA: SafeArrayGetVartype in Windows API. +func safeArrayGetVartype(safearray *SafeArray) (uint16, error) { + return uint16(0), NewError(E_NOTIMPL) +} + +// safeArrayLock locks SafeArray for reading to modify SafeArray. +// +// This must be called during some calls to ensure that another process does not +// read or write to the SafeArray during editing. +// +// AKA: SafeArrayLock in Windows API. +func safeArrayLock(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayUnlock unlocks SafeArray for reading. +// +// AKA: SafeArrayUnlock in Windows API. +func safeArrayUnlock(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayPutElement stores the data element at the specified location in the +// array. +// +// AKA: SafeArrayPutElement in Windows API. +func safeArrayPutElement(safearray *SafeArray, index int64, element uintptr) error { + return NewError(E_NOTIMPL) +} + +// safeArrayGetRecordInfo accesses IRecordInfo info for custom types. +// +// AKA: SafeArrayGetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArrayGetRecordInfo(safearray *SafeArray) (interface{}, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArraySetRecordInfo mutates IRecordInfo info for custom types. +// +// AKA: SafeArraySetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArraySetRecordInfo(safearray *SafeArray, recordInfo interface{}) error { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/safearray_windows.go b/vendor/github.com/go-ole/go-ole/safearray_windows.go new file mode 100644 index 00000000..0c1b3a10 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearray_windows.go @@ -0,0 +1,337 @@ +// +build windows + +package ole + +import ( + "unsafe" +) + +var ( + procSafeArrayAccessData = modoleaut32.NewProc("SafeArrayAccessData") + procSafeArrayAllocData = modoleaut32.NewProc("SafeArrayAllocData") + procSafeArrayAllocDescriptor = modoleaut32.NewProc("SafeArrayAllocDescriptor") + procSafeArrayAllocDescriptorEx = modoleaut32.NewProc("SafeArrayAllocDescriptorEx") + procSafeArrayCopy = modoleaut32.NewProc("SafeArrayCopy") + procSafeArrayCopyData = modoleaut32.NewProc("SafeArrayCopyData") + procSafeArrayCreate = modoleaut32.NewProc("SafeArrayCreate") + procSafeArrayCreateEx = modoleaut32.NewProc("SafeArrayCreateEx") + procSafeArrayCreateVector = modoleaut32.NewProc("SafeArrayCreateVector") + procSafeArrayCreateVectorEx = modoleaut32.NewProc("SafeArrayCreateVectorEx") + procSafeArrayDestroy = modoleaut32.NewProc("SafeArrayDestroy") + procSafeArrayDestroyData = modoleaut32.NewProc("SafeArrayDestroyData") + procSafeArrayDestroyDescriptor = modoleaut32.NewProc("SafeArrayDestroyDescriptor") + procSafeArrayGetDim = modoleaut32.NewProc("SafeArrayGetDim") + procSafeArrayGetElement = modoleaut32.NewProc("SafeArrayGetElement") + procSafeArrayGetElemsize = modoleaut32.NewProc("SafeArrayGetElemsize") + procSafeArrayGetIID = modoleaut32.NewProc("SafeArrayGetIID") + procSafeArrayGetLBound = modoleaut32.NewProc("SafeArrayGetLBound") + procSafeArrayGetUBound = modoleaut32.NewProc("SafeArrayGetUBound") + procSafeArrayGetVartype = modoleaut32.NewProc("SafeArrayGetVartype") + procSafeArrayLock = modoleaut32.NewProc("SafeArrayLock") + procSafeArrayPtrOfIndex = modoleaut32.NewProc("SafeArrayPtrOfIndex") + procSafeArrayUnaccessData = modoleaut32.NewProc("SafeArrayUnaccessData") + procSafeArrayUnlock = modoleaut32.NewProc("SafeArrayUnlock") + procSafeArrayPutElement = modoleaut32.NewProc("SafeArrayPutElement") + //procSafeArrayRedim = modoleaut32.NewProc("SafeArrayRedim") // TODO + //procSafeArraySetIID = modoleaut32.NewProc("SafeArraySetIID") // TODO + procSafeArrayGetRecordInfo = modoleaut32.NewProc("SafeArrayGetRecordInfo") + procSafeArraySetRecordInfo = modoleaut32.NewProc("SafeArraySetRecordInfo") +) + +// safeArrayAccessData returns raw array pointer. +// +// AKA: SafeArrayAccessData in Windows API. +// Todo: Test +func safeArrayAccessData(safearray *SafeArray) (element uintptr, err error) { + err = convertHresultToError( + procSafeArrayAccessData.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&element)))) + return +} + +// safeArrayUnaccessData releases raw array. +// +// AKA: SafeArrayUnaccessData in Windows API. +func safeArrayUnaccessData(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayUnaccessData.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayAllocData allocates SafeArray. +// +// AKA: SafeArrayAllocData in Windows API. +func safeArrayAllocData(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayAllocData.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayAllocDescriptor allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptor in Windows API. +func safeArrayAllocDescriptor(dimensions uint32) (safearray *SafeArray, err error) { + err = convertHresultToError( + procSafeArrayAllocDescriptor.Call(uintptr(dimensions), uintptr(unsafe.Pointer(&safearray)))) + return +} + +// safeArrayAllocDescriptorEx allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptorEx in Windows API. +func safeArrayAllocDescriptorEx(variantType VT, dimensions uint32) (safearray *SafeArray, err error) { + err = convertHresultToError( + procSafeArrayAllocDescriptorEx.Call( + uintptr(variantType), + uintptr(dimensions), + uintptr(unsafe.Pointer(&safearray)))) + return +} + +// safeArrayCopy returns copy of SafeArray. +// +// AKA: SafeArrayCopy in Windows API. +func safeArrayCopy(original *SafeArray) (safearray *SafeArray, err error) { + err = convertHresultToError( + procSafeArrayCopy.Call( + uintptr(unsafe.Pointer(original)), + uintptr(unsafe.Pointer(&safearray)))) + return +} + +// safeArrayCopyData duplicates SafeArray into another SafeArray object. +// +// AKA: SafeArrayCopyData in Windows API. +func safeArrayCopyData(original *SafeArray, duplicate *SafeArray) (err error) { + err = convertHresultToError( + procSafeArrayCopyData.Call( + uintptr(unsafe.Pointer(original)), + uintptr(unsafe.Pointer(duplicate)))) + return +} + +// safeArrayCreate creates SafeArray. +// +// AKA: SafeArrayCreate in Windows API. +func safeArrayCreate(variantType VT, dimensions uint32, bounds *SafeArrayBound) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreate.Call( + uintptr(variantType), + uintptr(dimensions), + uintptr(unsafe.Pointer(bounds))) + safearray = (*SafeArray)(unsafe.Pointer(&sa)) + return +} + +// safeArrayCreateEx creates SafeArray. +// +// AKA: SafeArrayCreateEx in Windows API. +func safeArrayCreateEx(variantType VT, dimensions uint32, bounds *SafeArrayBound, extra uintptr) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreateEx.Call( + uintptr(variantType), + uintptr(dimensions), + uintptr(unsafe.Pointer(bounds)), + extra) + safearray = (*SafeArray)(unsafe.Pointer(sa)) + return +} + +// safeArrayCreateVector creates SafeArray. +// +// AKA: SafeArrayCreateVector in Windows API. +func safeArrayCreateVector(variantType VT, lowerBound int32, length uint32) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreateVector.Call( + uintptr(variantType), + uintptr(lowerBound), + uintptr(length)) + safearray = (*SafeArray)(unsafe.Pointer(sa)) + return +} + +// safeArrayCreateVectorEx creates SafeArray. +// +// AKA: SafeArrayCreateVectorEx in Windows API. +func safeArrayCreateVectorEx(variantType VT, lowerBound int32, length uint32, extra uintptr) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreateVectorEx.Call( + uintptr(variantType), + uintptr(lowerBound), + uintptr(length), + extra) + safearray = (*SafeArray)(unsafe.Pointer(sa)) + return +} + +// safeArrayDestroy destroys SafeArray object. +// +// AKA: SafeArrayDestroy in Windows API. +func safeArrayDestroy(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayDestroy.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayDestroyData destroys SafeArray object. +// +// AKA: SafeArrayDestroyData in Windows API. +func safeArrayDestroyData(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayDestroyData.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayDestroyDescriptor destroys SafeArray object. +// +// AKA: SafeArrayDestroyDescriptor in Windows API. +func safeArrayDestroyDescriptor(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayDestroyDescriptor.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayGetDim is the amount of dimensions in the SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetDim in Windows API. +func safeArrayGetDim(safearray *SafeArray) (dimensions *uint32, err error) { + l, _, err := procSafeArrayGetDim.Call(uintptr(unsafe.Pointer(safearray))) + dimensions = (*uint32)(unsafe.Pointer(l)) + return +} + +// safeArrayGetElementSize is the element size in bytes. +// +// AKA: SafeArrayGetElemsize in Windows API. +func safeArrayGetElementSize(safearray *SafeArray) (length *uint32, err error) { + l, _, err := procSafeArrayGetElemsize.Call(uintptr(unsafe.Pointer(safearray))) + length = (*uint32)(unsafe.Pointer(l)) + return +} + +// safeArrayGetElement retrieves element at given index. +func safeArrayGetElement(safearray *SafeArray, index int32, pv unsafe.Pointer) error { + return convertHresultToError( + procSafeArrayGetElement.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&index)), + uintptr(pv))) +} + +// safeArrayGetElementString retrieves element at given index and converts to string. +func safeArrayGetElementString(safearray *SafeArray, index int32) (str string, err error) { + var element *int16 + err = convertHresultToError( + procSafeArrayGetElement.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&index)), + uintptr(unsafe.Pointer(&element)))) + str = BstrToString(*(**uint16)(unsafe.Pointer(&element))) + SysFreeString(element) + return +} + +// safeArrayGetIID is the InterfaceID of the elements in the SafeArray. +// +// AKA: SafeArrayGetIID in Windows API. +func safeArrayGetIID(safearray *SafeArray) (guid *GUID, err error) { + err = convertHresultToError( + procSafeArrayGetIID.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&guid)))) + return +} + +// safeArrayGetLBound returns lower bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetLBound in Windows API. +func safeArrayGetLBound(safearray *SafeArray, dimension uint32) (lowerBound int32, err error) { + err = convertHresultToError( + procSafeArrayGetLBound.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(dimension), + uintptr(unsafe.Pointer(&lowerBound)))) + return +} + +// safeArrayGetUBound returns upper bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetUBound in Windows API. +func safeArrayGetUBound(safearray *SafeArray, dimension uint32) (upperBound int32, err error) { + err = convertHresultToError( + procSafeArrayGetUBound.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(dimension), + uintptr(unsafe.Pointer(&upperBound)))) + return +} + +// safeArrayGetVartype returns data type of SafeArray. +// +// AKA: SafeArrayGetVartype in Windows API. +func safeArrayGetVartype(safearray *SafeArray) (varType uint16, err error) { + err = convertHresultToError( + procSafeArrayGetVartype.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&varType)))) + return +} + +// safeArrayLock locks SafeArray for reading to modify SafeArray. +// +// This must be called during some calls to ensure that another process does not +// read or write to the SafeArray during editing. +// +// AKA: SafeArrayLock in Windows API. +func safeArrayLock(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayLock.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayUnlock unlocks SafeArray for reading. +// +// AKA: SafeArrayUnlock in Windows API. +func safeArrayUnlock(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayUnlock.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayPutElement stores the data element at the specified location in the +// array. +// +// AKA: SafeArrayPutElement in Windows API. +func safeArrayPutElement(safearray *SafeArray, index int64, element uintptr) (err error) { + err = convertHresultToError( + procSafeArrayPutElement.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&index)), + uintptr(unsafe.Pointer(element)))) + return +} + +// safeArrayGetRecordInfo accesses IRecordInfo info for custom types. +// +// AKA: SafeArrayGetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArrayGetRecordInfo(safearray *SafeArray) (recordInfo interface{}, err error) { + err = convertHresultToError( + procSafeArrayGetRecordInfo.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&recordInfo)))) + return +} + +// safeArraySetRecordInfo mutates IRecordInfo info for custom types. +// +// AKA: SafeArraySetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArraySetRecordInfo(safearray *SafeArray, recordInfo interface{}) (err error) { + err = convertHresultToError( + procSafeArraySetRecordInfo.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&recordInfo)))) + return +} diff --git a/vendor/github.com/go-ole/go-ole/safearrayconversion.go b/vendor/github.com/go-ole/go-ole/safearrayconversion.go new file mode 100644 index 00000000..da737293 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearrayconversion.go @@ -0,0 +1,140 @@ +// Helper for converting SafeArray to array of objects. + +package ole + +import ( + "unsafe" +) + +type SafeArrayConversion struct { + Array *SafeArray +} + +func (sac *SafeArrayConversion) ToStringArray() (strings []string) { + totalElements, _ := sac.TotalElements(0) + strings = make([]string, totalElements) + + for i := int32(0); i < totalElements; i++ { + strings[int32(i)], _ = safeArrayGetElementString(sac.Array, i) + } + + return +} + +func (sac *SafeArrayConversion) ToByteArray() (bytes []byte) { + totalElements, _ := sac.TotalElements(0) + bytes = make([]byte, totalElements) + + for i := int32(0); i < totalElements; i++ { + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&bytes[int32(i)])) + } + + return +} + +func (sac *SafeArrayConversion) ToValueArray() (values []interface{}) { + totalElements, _ := sac.TotalElements(0) + values = make([]interface{}, totalElements) + vt, _ := safeArrayGetVartype(sac.Array) + + for i := int32(0); i < totalElements; i++ { + switch VT(vt) { + case VT_BOOL: + var v bool + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I1: + var v int8 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I2: + var v int16 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I4: + var v int32 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I8: + var v int64 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI1: + var v uint8 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI2: + var v uint16 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI4: + var v uint32 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI8: + var v uint64 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_R4: + var v float32 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_R8: + var v float64 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_BSTR: + v , _ := safeArrayGetElementString(sac.Array, i) + values[i] = v + case VT_VARIANT: + var v VARIANT + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v.Value() + v.Clear() + default: + // TODO + } + } + + return +} + +func (sac *SafeArrayConversion) GetType() (varType uint16, err error) { + return safeArrayGetVartype(sac.Array) +} + +func (sac *SafeArrayConversion) GetDimensions() (dimensions *uint32, err error) { + return safeArrayGetDim(sac.Array) +} + +func (sac *SafeArrayConversion) GetSize() (length *uint32, err error) { + return safeArrayGetElementSize(sac.Array) +} + +func (sac *SafeArrayConversion) TotalElements(index uint32) (totalElements int32, err error) { + if index < 1 { + index = 1 + } + + // Get array bounds + var LowerBounds int32 + var UpperBounds int32 + + LowerBounds, err = safeArrayGetLBound(sac.Array, index) + if err != nil { + return + } + + UpperBounds, err = safeArrayGetUBound(sac.Array, index) + if err != nil { + return + } + + totalElements = UpperBounds - LowerBounds + 1 + return +} + +// Release Safe Array memory +func (sac *SafeArrayConversion) Release() { + safeArrayDestroy(sac.Array) +} diff --git a/vendor/github.com/go-ole/go-ole/safearrayslices.go b/vendor/github.com/go-ole/go-ole/safearrayslices.go new file mode 100644 index 00000000..a9fa885f --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearrayslices.go @@ -0,0 +1,33 @@ +// +build windows + +package ole + +import ( + "unsafe" +) + +func safeArrayFromByteSlice(slice []byte) *SafeArray { + array, _ := safeArrayCreateVector(VT_UI1, 0, uint32(len(slice))) + + if array == nil { + panic("Could not convert []byte to SAFEARRAY") + } + + for i, v := range slice { + safeArrayPutElement(array, int64(i), uintptr(unsafe.Pointer(&v))) + } + return array +} + +func safeArrayFromStringSlice(slice []string) *SafeArray { + array, _ := safeArrayCreateVector(VT_BSTR, 0, uint32(len(slice))) + + if array == nil { + panic("Could not convert []string to SAFEARRAY") + } + // SysAllocStringLen(s) + for i, v := range slice { + safeArrayPutElement(array, int64(i), uintptr(unsafe.Pointer(SysAllocStringLen(v)))) + } + return array +} diff --git a/vendor/github.com/go-ole/go-ole/utility.go b/vendor/github.com/go-ole/go-ole/utility.go new file mode 100644 index 00000000..99ee82dc --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/utility.go @@ -0,0 +1,101 @@ +package ole + +import ( + "unicode/utf16" + "unsafe" +) + +// ClassIDFrom retrieves class ID whether given is program ID or application string. +// +// Helper that provides check against both Class ID from Program ID and Class ID from string. It is +// faster, if you know which you are using, to use the individual functions, but this will check +// against available functions for you. +func ClassIDFrom(programID string) (classID *GUID, err error) { + classID, err = CLSIDFromProgID(programID) + if err != nil { + classID, err = CLSIDFromString(programID) + if err != nil { + return + } + } + return +} + +// BytePtrToString converts byte pointer to a Go string. +func BytePtrToString(p *byte) string { + a := (*[10000]uint8)(unsafe.Pointer(p)) + i := 0 + for a[i] != 0 { + i++ + } + return string(a[:i]) +} + +// UTF16PtrToString is alias for LpOleStrToString. +// +// Kept for compatibility reasons. +func UTF16PtrToString(p *uint16) string { + return LpOleStrToString(p) +} + +// LpOleStrToString converts COM Unicode to Go string. +func LpOleStrToString(p *uint16) string { + if p == nil { + return "" + } + + length := lpOleStrLen(p) + a := make([]uint16, length) + + ptr := unsafe.Pointer(p) + + for i := 0; i < int(length); i++ { + a[i] = *(*uint16)(ptr) + ptr = unsafe.Pointer(uintptr(ptr) + 2) + } + + return string(utf16.Decode(a)) +} + +// BstrToString converts COM binary string to Go string. +func BstrToString(p *uint16) string { + if p == nil { + return "" + } + length := SysStringLen((*int16)(unsafe.Pointer(p))) + a := make([]uint16, length) + + ptr := unsafe.Pointer(p) + + for i := 0; i < int(length); i++ { + a[i] = *(*uint16)(ptr) + ptr = unsafe.Pointer(uintptr(ptr) + 2) + } + return string(utf16.Decode(a)) +} + +// lpOleStrLen returns the length of Unicode string. +func lpOleStrLen(p *uint16) (length int64) { + if p == nil { + return 0 + } + + ptr := unsafe.Pointer(p) + + for i := 0; ; i++ { + if 0 == *(*uint16)(ptr) { + length = int64(i) + break + } + ptr = unsafe.Pointer(uintptr(ptr) + 2) + } + return +} + +// convertHresultToError converts syscall to error, if call is unsuccessful. +func convertHresultToError(hr uintptr, r2 uintptr, ignore error) (err error) { + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/variables.go b/vendor/github.com/go-ole/go-ole/variables.go new file mode 100644 index 00000000..a6add1b0 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variables.go @@ -0,0 +1,15 @@ +// +build windows + +package ole + +import ( + "golang.org/x/sys/windows" +) + +var ( + modcombase = windows.NewLazySystemDLL("combase.dll") + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + modole32 = windows.NewLazySystemDLL("ole32.dll") + modoleaut32 = windows.NewLazySystemDLL("oleaut32.dll") + moduser32 = windows.NewLazySystemDLL("user32.dll") +) diff --git a/vendor/github.com/go-ole/go-ole/variant.go b/vendor/github.com/go-ole/go-ole/variant.go new file mode 100644 index 00000000..967a23fe --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant.go @@ -0,0 +1,105 @@ +package ole + +import "unsafe" + +// NewVariant returns new variant based on type and value. +func NewVariant(vt VT, val int64) VARIANT { + return VARIANT{VT: vt, Val: val} +} + +// ToIUnknown converts Variant to Unknown object. +func (v *VARIANT) ToIUnknown() *IUnknown { + if v.VT != VT_UNKNOWN { + return nil + } + return (*IUnknown)(unsafe.Pointer(uintptr(v.Val))) +} + +// ToIDispatch converts variant to dispatch object. +func (v *VARIANT) ToIDispatch() *IDispatch { + if v.VT != VT_DISPATCH { + return nil + } + return (*IDispatch)(unsafe.Pointer(uintptr(v.Val))) +} + +// ToArray converts variant to SafeArray helper. +func (v *VARIANT) ToArray() *SafeArrayConversion { + if v.VT != VT_SAFEARRAY { + if v.VT&VT_ARRAY == 0 { + return nil + } + } + var safeArray *SafeArray = (*SafeArray)(unsafe.Pointer(uintptr(v.Val))) + return &SafeArrayConversion{safeArray} +} + +// ToString converts variant to Go string. +func (v *VARIANT) ToString() string { + if v.VT != VT_BSTR { + return "" + } + return BstrToString(*(**uint16)(unsafe.Pointer(&v.Val))) +} + +// Clear the memory of variant object. +func (v *VARIANT) Clear() error { + return VariantClear(v) +} + +// Value returns variant value based on its type. +// +// Currently supported types: 2- and 4-byte integers, strings, bools. +// Note that 64-bit integers, datetimes, and other types are stored as strings +// and will be returned as strings. +// +// Needs to be further converted, because this returns an interface{}. +func (v *VARIANT) Value() interface{} { + switch v.VT { + case VT_I1: + return int8(v.Val) + case VT_UI1: + return uint8(v.Val) + case VT_I2: + return int16(v.Val) + case VT_UI2: + return uint16(v.Val) + case VT_I4: + return int32(v.Val) + case VT_UI4: + return uint32(v.Val) + case VT_I8: + return int64(v.Val) + case VT_UI8: + return uint64(v.Val) + case VT_INT: + return int(v.Val) + case VT_UINT: + return uint(v.Val) + case VT_INT_PTR: + return uintptr(v.Val) // TODO + case VT_UINT_PTR: + return uintptr(v.Val) + case VT_R4: + return *(*float32)(unsafe.Pointer(&v.Val)) + case VT_R8: + return *(*float64)(unsafe.Pointer(&v.Val)) + case VT_BSTR: + return v.ToString() + case VT_DATE: + // VT_DATE type will either return float64 or time.Time. + d := uint64(v.Val) + date, err := GetVariantDate(d) + if err != nil { + return float64(v.Val) + } + return date + case VT_UNKNOWN: + return v.ToIUnknown() + case VT_DISPATCH: + return v.ToIDispatch() + case VT_BOOL: + return v.Val != 0 + } + return nil +} diff --git a/vendor/github.com/go-ole/go-ole/variant_386.go b/vendor/github.com/go-ole/go-ole/variant_386.go new file mode 100644 index 00000000..e73736bf --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_386.go @@ -0,0 +1,11 @@ +// +build 386 + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_amd64.go b/vendor/github.com/go-ole/go-ole/variant_amd64.go new file mode 100644 index 00000000..dccdde13 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_amd64.go @@ -0,0 +1,12 @@ +// +build amd64 + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_arm.go b/vendor/github.com/go-ole/go-ole/variant_arm.go new file mode 100644 index 00000000..d4724544 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_arm.go @@ -0,0 +1,11 @@ +// +build arm + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_arm64.go b/vendor/github.com/go-ole/go-ole/variant_arm64.go new file mode 100644 index 00000000..78473cec --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_arm64.go @@ -0,0 +1,13 @@ +//go:build arm64 +// +build arm64 + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_386.go b/vendor/github.com/go-ole/go-ole/variant_date_386.go new file mode 100644 index 00000000..1b970f63 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_386.go @@ -0,0 +1,22 @@ +// +build windows,386 + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + v1 := uint32(value) + v2 := uint32(value >> 32) + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(v1), uintptr(v2), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_amd64.go b/vendor/github.com/go-ole/go-ole/variant_date_amd64.go new file mode 100644 index 00000000..6952f1f0 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_amd64.go @@ -0,0 +1,20 @@ +// +build windows,amd64 + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(value), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_arm.go b/vendor/github.com/go-ole/go-ole/variant_date_arm.go new file mode 100644 index 00000000..09ec7b5c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_arm.go @@ -0,0 +1,22 @@ +// +build windows,arm + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + v1 := uint32(value) + v2 := uint32(value >> 32) + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(v1), uintptr(v2), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_arm64.go b/vendor/github.com/go-ole/go-ole/variant_date_arm64.go new file mode 100644 index 00000000..02b04a0d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_arm64.go @@ -0,0 +1,23 @@ +//go:build windows && arm64 +// +build windows,arm64 + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + v1 := uint32(value) + v2 := uint32(value >> 32) + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(v1), uintptr(v2), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_ppc64le.go b/vendor/github.com/go-ole/go-ole/variant_ppc64le.go new file mode 100644 index 00000000..326427a7 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_ppc64le.go @@ -0,0 +1,12 @@ +// +build ppc64le + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_s390x.go b/vendor/github.com/go-ole/go-ole/variant_s390x.go new file mode 100644 index 00000000..9874ca66 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_s390x.go @@ -0,0 +1,12 @@ +// +build s390x + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/vt_string.go b/vendor/github.com/go-ole/go-ole/vt_string.go new file mode 100644 index 00000000..729b4a04 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/vt_string.go @@ -0,0 +1,58 @@ +// generated by stringer -output vt_string.go -type VT; DO NOT EDIT + +package ole + +import "fmt" + +const ( + _VT_name_0 = "VT_EMPTYVT_NULLVT_I2VT_I4VT_R4VT_R8VT_CYVT_DATEVT_BSTRVT_DISPATCHVT_ERRORVT_BOOLVT_VARIANTVT_UNKNOWNVT_DECIMAL" + _VT_name_1 = "VT_I1VT_UI1VT_UI2VT_UI4VT_I8VT_UI8VT_INTVT_UINTVT_VOIDVT_HRESULTVT_PTRVT_SAFEARRAYVT_CARRAYVT_USERDEFINEDVT_LPSTRVT_LPWSTR" + _VT_name_2 = "VT_RECORDVT_INT_PTRVT_UINT_PTR" + _VT_name_3 = "VT_FILETIMEVT_BLOBVT_STREAMVT_STORAGEVT_STREAMED_OBJECTVT_STORED_OBJECTVT_BLOB_OBJECTVT_CFVT_CLSID" + _VT_name_4 = "VT_BSTR_BLOBVT_VECTOR" + _VT_name_5 = "VT_ARRAY" + _VT_name_6 = "VT_BYREF" + _VT_name_7 = "VT_RESERVED" + _VT_name_8 = "VT_ILLEGAL" +) + +var ( + _VT_index_0 = [...]uint8{0, 8, 15, 20, 25, 30, 35, 40, 47, 54, 65, 73, 80, 90, 100, 110} + _VT_index_1 = [...]uint8{0, 5, 11, 17, 23, 28, 34, 40, 47, 54, 64, 70, 82, 91, 105, 113, 122} + _VT_index_2 = [...]uint8{0, 9, 19, 30} + _VT_index_3 = [...]uint8{0, 11, 18, 27, 37, 55, 71, 85, 90, 98} + _VT_index_4 = [...]uint8{0, 12, 21} + _VT_index_5 = [...]uint8{0, 8} + _VT_index_6 = [...]uint8{0, 8} + _VT_index_7 = [...]uint8{0, 11} + _VT_index_8 = [...]uint8{0, 10} +) + +func (i VT) String() string { + switch { + case 0 <= i && i <= 14: + return _VT_name_0[_VT_index_0[i]:_VT_index_0[i+1]] + case 16 <= i && i <= 31: + i -= 16 + return _VT_name_1[_VT_index_1[i]:_VT_index_1[i+1]] + case 36 <= i && i <= 38: + i -= 36 + return _VT_name_2[_VT_index_2[i]:_VT_index_2[i+1]] + case 64 <= i && i <= 72: + i -= 64 + return _VT_name_3[_VT_index_3[i]:_VT_index_3[i+1]] + case 4095 <= i && i <= 4096: + i -= 4095 + return _VT_name_4[_VT_index_4[i]:_VT_index_4[i+1]] + case i == 8192: + return _VT_name_5 + case i == 16384: + return _VT_name_6 + case i == 32768: + return _VT_name_7 + case i == 65535: + return _VT_name_8 + default: + return fmt.Sprintf("VT(%d)", i) + } +} diff --git a/vendor/github.com/go-ole/go-ole/winrt.go b/vendor/github.com/go-ole/go-ole/winrt.go new file mode 100644 index 00000000..4e9eca73 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/winrt.go @@ -0,0 +1,99 @@ +// +build windows + +package ole + +import ( + "reflect" + "syscall" + "unicode/utf8" + "unsafe" +) + +var ( + procRoInitialize = modcombase.NewProc("RoInitialize") + procRoActivateInstance = modcombase.NewProc("RoActivateInstance") + procRoGetActivationFactory = modcombase.NewProc("RoGetActivationFactory") + procWindowsCreateString = modcombase.NewProc("WindowsCreateString") + procWindowsDeleteString = modcombase.NewProc("WindowsDeleteString") + procWindowsGetStringRawBuffer = modcombase.NewProc("WindowsGetStringRawBuffer") +) + +func RoInitialize(thread_type uint32) (err error) { + hr, _, _ := procRoInitialize.Call(uintptr(thread_type)) + if hr != 0 { + err = NewError(hr) + } + return +} + +func RoActivateInstance(clsid string) (ins *IInspectable, err error) { + hClsid, err := NewHString(clsid) + if err != nil { + return nil, err + } + defer DeleteHString(hClsid) + + hr, _, _ := procRoActivateInstance.Call( + uintptr(unsafe.Pointer(hClsid)), + uintptr(unsafe.Pointer(&ins))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func RoGetActivationFactory(clsid string, iid *GUID) (ins *IInspectable, err error) { + hClsid, err := NewHString(clsid) + if err != nil { + return nil, err + } + defer DeleteHString(hClsid) + + hr, _, _ := procRoGetActivationFactory.Call( + uintptr(unsafe.Pointer(hClsid)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&ins))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// HString is handle string for pointers. +type HString uintptr + +// NewHString returns a new HString for Go string. +func NewHString(s string) (hstring HString, err error) { + u16 := syscall.StringToUTF16Ptr(s) + len := uint32(utf8.RuneCountInString(s)) + hr, _, _ := procWindowsCreateString.Call( + uintptr(unsafe.Pointer(u16)), + uintptr(len), + uintptr(unsafe.Pointer(&hstring))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// DeleteHString deletes HString. +func DeleteHString(hstring HString) (err error) { + hr, _, _ := procWindowsDeleteString.Call(uintptr(hstring)) + if hr != 0 { + err = NewError(hr) + } + return +} + +// String returns Go string value of HString. +func (h HString) String() string { + var u16buf uintptr + var u16len uint32 + u16buf, _, _ = procWindowsGetStringRawBuffer.Call( + uintptr(h), + uintptr(unsafe.Pointer(&u16len))) + + u16hdr := reflect.SliceHeader{Data: u16buf, Len: int(u16len), Cap: int(u16len)} + u16 := *(*[]uint16)(unsafe.Pointer(&u16hdr)) + return syscall.UTF16ToString(u16) +} diff --git a/vendor/github.com/go-ole/go-ole/winrt_doc.go b/vendor/github.com/go-ole/go-ole/winrt_doc.go new file mode 100644 index 00000000..52e6d74c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/winrt_doc.go @@ -0,0 +1,36 @@ +// +build !windows + +package ole + +// RoInitialize +func RoInitialize(thread_type uint32) (err error) { + return NewError(E_NOTIMPL) +} + +// RoActivateInstance +func RoActivateInstance(clsid string) (ins *IInspectable, err error) { + return nil, NewError(E_NOTIMPL) +} + +// RoGetActivationFactory +func RoGetActivationFactory(clsid string, iid *GUID) (ins *IInspectable, err error) { + return nil, NewError(E_NOTIMPL) +} + +// HString is handle string for pointers. +type HString uintptr + +// NewHString returns a new HString for Go string. +func NewHString(s string) (hstring HString, err error) { + return HString(uintptr(0)), NewError(E_NOTIMPL) +} + +// DeleteHString deletes HString. +func DeleteHString(hstring HString) (err error) { + return NewError(E_NOTIMPL) +} + +// String returns Go string value of HString. +func (h HString) String() string { + return "" +} diff --git a/vendor/github.com/lufia/plan9stats/.gitignore b/vendor/github.com/lufia/plan9stats/.gitignore new file mode 100644 index 00000000..f1c181ec --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/.gitignore @@ -0,0 +1,12 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out diff --git a/vendor/github.com/lufia/plan9stats/LICENSE b/vendor/github.com/lufia/plan9stats/LICENSE new file mode 100644 index 00000000..a6d47e80 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, KADOTA, Kyohei +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/lufia/plan9stats/README.md b/vendor/github.com/lufia/plan9stats/README.md new file mode 100644 index 00000000..a21700c0 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/README.md @@ -0,0 +1,2 @@ +# plan9stats +A module for retrieving statistics of Plan 9 diff --git a/vendor/github.com/lufia/plan9stats/cpu.go b/vendor/github.com/lufia/plan9stats/cpu.go new file mode 100644 index 00000000..a101b911 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/cpu.go @@ -0,0 +1,288 @@ +package stats + +import ( + "bufio" + "bytes" + "context" + "errors" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "sort" + "strconv" + "strings" + "time" +) + +// CPUType represents /dev/cputype. +type CPUType struct { + Name string + Clock int // clock rate in MHz +} + +func ReadCPUType(ctx context.Context, opts ...Option) (*CPUType, error) { + cfg := newConfig(opts...) + var c CPUType + if err := readCPUType(cfg.rootdir, &c); err != nil { + return nil, err + } + return &c, nil +} + +type SysStats struct { + ID int + NumCtxSwitch int64 + NumInterrupt int64 + NumSyscall int64 + NumFault int64 + NumTLBFault int64 + NumTLBPurge int64 + LoadAvg int64 // in units of milli-CPUs and is decayed over time + Idle int // percentage + Interrupt int // percentage +} + +// ReadSysStats reads system statistics from /dev/sysstat. +func ReadSysStats(ctx context.Context, opts ...Option) ([]*SysStats, error) { + cfg := newConfig(opts...) + file := filepath.Join(cfg.rootdir, "/dev/sysstat") + f, err := os.Open(file) + if err != nil { + return nil, err + } + defer f.Close() + + scanner := bufio.NewScanner(f) + var stats []*SysStats + for scanner.Scan() { + a := strings.Fields(scanner.Text()) + if len(a) != 10 { + continue + } + var ( + p intParser + stat SysStats + ) + stat.ID = p.ParseInt(a[0], 10) + stat.NumCtxSwitch = p.ParseInt64(a[1], 10) + stat.NumInterrupt = p.ParseInt64(a[2], 10) + stat.NumSyscall = p.ParseInt64(a[3], 10) + stat.NumFault = p.ParseInt64(a[4], 10) + stat.NumTLBFault = p.ParseInt64(a[5], 10) + stat.NumTLBPurge = p.ParseInt64(a[6], 10) + stat.LoadAvg = p.ParseInt64(a[7], 10) + stat.Idle = p.ParseInt(a[8], 10) + stat.Interrupt = p.ParseInt(a[9], 10) + if err := p.Err(); err != nil { + return nil, err + } + stats = append(stats, &stat) + } + if err := scanner.Err(); err != nil { + return nil, err + } + return stats, nil +} + +func readCPUType(rootdir string, c *CPUType) error { + file := filepath.Join(rootdir, "/dev/cputype") + b, err := ioutil.ReadFile(file) + if err != nil { + return err + } + b = bytes.TrimSpace(b) + i := bytes.LastIndexByte(b, ' ') + if i < 0 { + return fmt.Errorf("%s: invalid format", file) + } + clock, err := strconv.Atoi(string(b[i+1:])) + if err != nil { + return err + } + c.Name = string(b[:i]) + c.Clock = clock + return nil +} + +// Time represents /dev/time. +type Time struct { + Unix time.Duration + UnixNano time.Duration + Ticks int64 // clock ticks + Freq int64 //cloc frequency +} + +// Uptime returns uptime. +func (t *Time) Uptime() time.Duration { + v := float64(t.Ticks) / float64(t.Freq) + return time.Duration(v*1000_000_000) * time.Nanosecond +} + +func ReadTime(ctx context.Context, opts ...Option) (*Time, error) { + cfg := newConfig(opts...) + file := filepath.Join(cfg.rootdir, "/dev/time") + var t Time + if err := readTime(file, &t); err != nil { + return nil, err + } + return &t, nil +} + +// ProcStatus represents a /proc/n/status. +type ProcStatus struct { + Name string + User string + State string + Times CPUTime + MemUsed int64 // in units of 1024 bytes + BasePriority uint32 // 0(low) to 19(high) + Priority uint32 // 0(low) to 19(high) +} + +// CPUTime represents /dev/cputime or a part of /proc/n/status. +type CPUTime struct { + User time.Duration // the time in user mode (millisecconds) + Sys time.Duration + Real time.Duration + ChildUser time.Duration // exited children and descendants time in user mode + ChildSys time.Duration + ChildReal time.Duration +} + +// CPUStats emulates Linux's /proc/stat. +type CPUStats struct { + User time.Duration + Sys time.Duration + Idle time.Duration +} + +func ReadCPUStats(ctx context.Context, opts ...Option) (*CPUStats, error) { + cfg := newConfig(opts...) + a, err := ReadSysStats(ctx, opts...) + if err != nil { + return nil, err + } + + dir := filepath.Join(cfg.rootdir, "/proc") + d, err := os.Open(dir) + if err != nil { + return nil, err + } + defer d.Close() + + names, err := d.Readdirnames(0) + if err != nil { + return nil, err + } + var up uint32parser + pids := make([]uint32, len(names)) + for i, s := range names { + pids[i] = up.Parse(s) + } + if up.err != nil { + return nil, err + } + sort.Slice(pids, func(i, j int) bool { + return pids[i] < pids[j] + }) + + var stat CPUStats + for _, pid := range pids { + s := strconv.FormatUint(uint64(pid), 10) + file := filepath.Join(dir, s, "status") + var p ProcStatus + if err := readProcStatus(file, &p); err != nil { + return nil, err + } + stat.User += p.Times.User + stat.Sys += p.Times.Sys + } + + var t Time + file := filepath.Join(cfg.rootdir, "/dev/time") + if err := readTime(file, &t); err != nil { + return nil, err + } + // In multi-processor host, Idle should multiple by number of cores. + u := t.Uptime() * time.Duration(len(a)) + stat.Idle = u - stat.User - stat.Sys + return &stat, nil +} + +func readProcStatus(file string, p *ProcStatus) error { + b, err := ioutil.ReadFile(file) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return err + } + fields := strings.Fields(string(b)) + if len(fields) != 12 { + return errors.New("invalid format") + } + p.Name = string(fields[0]) + p.User = string(fields[1]) + p.State = string(fields[2]) + var up uint32parser + p.Times.User = time.Duration(up.Parse(fields[3])) * time.Millisecond + p.Times.Sys = time.Duration(up.Parse(fields[4])) * time.Millisecond + p.Times.Real = time.Duration(up.Parse(fields[5])) * time.Millisecond + p.Times.ChildUser = time.Duration(up.Parse(fields[6])) * time.Millisecond + p.Times.ChildSys = time.Duration(up.Parse(fields[7])) * time.Millisecond + p.Times.ChildReal = time.Duration(up.Parse(fields[8])) * time.Millisecond + p.MemUsed, err = strconv.ParseInt(fields[9], 10, 64) + if err != nil { + return err + } + p.BasePriority = up.Parse(fields[10]) + p.Priority = up.Parse(fields[11]) + return up.err +} + +func readTime(file string, t *Time) error { + b, err := ioutil.ReadFile(file) + if err != nil { + return err + } + fields := strings.Fields(string(b)) + if len(fields) != 4 { + return errors.New("invalid format") + } + n, err := strconv.ParseInt(fields[0], 10, 32) + if err != nil { + return err + } + t.Unix = time.Duration(n) * time.Second + v, err := strconv.ParseInt(fields[1], 10, 64) + if err != nil { + return err + } + t.UnixNano = time.Duration(v) * time.Nanosecond + t.Ticks, err = strconv.ParseInt(fields[2], 10, 64) + if err != nil { + return err + } + t.Freq, err = strconv.ParseInt(fields[3], 10, 64) + if err != nil { + return err + } + return nil +} + +type uint32parser struct { + err error +} + +func (p *uint32parser) Parse(s string) uint32 { + if p.err != nil { + return 0 + } + n, err := strconv.ParseUint(s, 10, 32) + if err != nil { + p.err = err + return 0 + } + return uint32(n) +} diff --git a/vendor/github.com/lufia/plan9stats/doc.go b/vendor/github.com/lufia/plan9stats/doc.go new file mode 100644 index 00000000..10e398e7 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/doc.go @@ -0,0 +1,2 @@ +// Package stats provides statistic utilities for Plan 9. +package stats diff --git a/vendor/github.com/lufia/plan9stats/host.go b/vendor/github.com/lufia/plan9stats/host.go new file mode 100644 index 00000000..957e9034 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/host.go @@ -0,0 +1,303 @@ +package stats + +import ( + "bufio" + "bytes" + "context" + "fmt" + "io/ioutil" + "net" + "os" + "path/filepath" + "strconv" + "strings" +) + +var ( + delim = []byte{' '} +) + +// Host represents host status. +type Host struct { + Sysname string + Storages []*Storage + Interfaces []*Interface +} + +// MemStats represents the memory statistics. +type MemStats struct { + Total int64 // total memory in byte + PageSize int64 // a page size in byte + KernelPages int64 + UserPages Gauge + SwapPages Gauge + + Malloced Gauge // kernel malloced data in byte + Graphics Gauge // kernel graphics data in byte +} + +// Gauge is used/available gauge. +type Gauge struct { + Used int64 + Avail int64 +} + +func (g Gauge) Free() int64 { + return g.Avail - g.Used +} + +// ReadMemStats reads memory statistics from /dev/swap. +func ReadMemStats(ctx context.Context, opts ...Option) (*MemStats, error) { + cfg := newConfig(opts...) + swap := filepath.Join(cfg.rootdir, "/dev/swap") + f, err := os.Open(swap) + if err != nil { + return nil, err + } + defer f.Close() + + var stat MemStats + m := map[string]interface{}{ + "memory": &stat.Total, + "pagesize": &stat.PageSize, + "kernel": &stat.KernelPages, + "user": &stat.UserPages, + "swap": &stat.SwapPages, + "kernel malloc": &stat.Malloced, + "kernel draw": &stat.Graphics, + } + scanner := bufio.NewScanner(f) + for scanner.Scan() { + fields := bytes.SplitN(scanner.Bytes(), delim, 2) + if len(fields) < 2 { + continue + } + switch key := string(fields[1]); key { + case "memory", "pagesize", "kernel": + v := m[key].(*int64) + n, err := strconv.ParseInt(string(fields[0]), 10, 64) + if err != nil { + return nil, err + } + *v = n + case "user", "swap", "kernel malloc", "kernel draw": + v := m[key].(*Gauge) + if err := parseGauge(string(fields[0]), v); err != nil { + return nil, err + } + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return &stat, nil +} + +func parseGauge(s string, r *Gauge) error { + a := strings.SplitN(s, "/", 2) + if len(a) != 2 { + return fmt.Errorf("can't parse ratio: %s", s) + } + var p intParser + u := p.ParseInt64(a[0], 10) + n := p.ParseInt64(a[1], 10) + if err := p.Err(); err != nil { + return err + } + r.Used = u + r.Avail = n + return nil +} + +type Storage struct { + Name string + Model string + Capacity int64 +} + +type Interface struct { + Name string + Addr string +} + +const ( + numEther = 8 // see ether(3) + numIpifc = 16 // see ip(3) +) + +// ReadInterfaces reads network interfaces from etherN. +func ReadInterfaces(ctx context.Context, opts ...Option) ([]*Interface, error) { + cfg := newConfig(opts...) + var a []*Interface + for i := 0; i < numEther; i++ { + p, err := readInterface(cfg.rootdir, i) + if os.IsNotExist(err) { + continue + } + if err != nil { + return nil, err + } + a = append(a, p) + } + return a, nil +} + +func readInterface(netroot string, i int) (*Interface, error) { + ether := fmt.Sprintf("ether%d", i) + dir := filepath.Join(netroot, ether) + info, err := os.Stat(dir) + if err != nil { + return nil, err + } + if !info.IsDir() { + return nil, fmt.Errorf("%s: is not directory", dir) + } + + addr, err := ioutil.ReadFile(filepath.Join(dir, "addr")) + if err != nil { + return nil, err + } + return &Interface{ + Name: ether, + Addr: string(addr), + }, nil +} + +var ( + netdirs = []string{"/net", "/net.alt"} +) + +// ReadHost reads host status. +func ReadHost(ctx context.Context, opts ...Option) (*Host, error) { + cfg := newConfig(opts...) + var h Host + name, err := readSysname(cfg.rootdir) + if err != nil { + return nil, err + } + h.Sysname = name + + a, err := readStorages(cfg.rootdir) + if err != nil { + return nil, err + } + h.Storages = a + + for _, s := range netdirs { + netroot := filepath.Join(cfg.rootdir, s) + ifaces, err := ReadInterfaces(ctx, WithRootDir(netroot)) + if err != nil { + return nil, err + } + h.Interfaces = append(h.Interfaces, ifaces...) + } + return &h, nil +} + +func readSysname(rootdir string) (string, error) { + file := filepath.Join(rootdir, "/dev/sysname") + b, err := ioutil.ReadFile(file) + if err != nil { + return "", err + } + return string(bytes.TrimSpace(b)), nil +} + +func readStorages(rootdir string) ([]*Storage, error) { + sdctl := filepath.Join(rootdir, "/dev/sdctl") + f, err := os.Open(sdctl) + if err != nil { + return nil, err + } + defer f.Close() + + var a []*Storage + scanner := bufio.NewScanner(f) + for scanner.Scan() { + fields := bytes.Split(scanner.Bytes(), delim) + if len(fields) == 0 { + continue + } + exp := string(fields[0]) + "*" + if !strings.HasPrefix(exp, "sd") { + continue + } + dir := filepath.Join(rootdir, "/dev", exp) + m, err := filepath.Glob(dir) + if err != nil { + return nil, err + } + for _, dir := range m { + s, err := readStorage(dir) + if err != nil { + return nil, err + } + a = append(a, s) + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return a, nil +} + +func readStorage(dir string) (*Storage, error) { + ctl := filepath.Join(dir, "ctl") + f, err := os.Open(ctl) + if err != nil { + return nil, err + } + defer f.Close() + + var s Storage + s.Name = filepath.Base(dir) + scanner := bufio.NewScanner(f) + for scanner.Scan() { + line := scanner.Bytes() + switch { + case bytes.HasPrefix(line, []byte("inquiry")): + s.Model = string(bytes.TrimSpace(line[7:])) + case bytes.HasPrefix(line, []byte("geometry")): + fields := bytes.Split(line, delim) + if len(fields) < 3 { + continue + } + var p intParser + sec := p.ParseInt64(string(fields[1]), 10) + size := p.ParseInt64(string(fields[2]), 10) + if err := p.Err(); err != nil { + return nil, err + } + s.Capacity = sec * size + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return &s, nil +} + +type IPStats struct { + ID int // number of interface in ipifc dir + Device string // associated physical device + MTU int // max transfer unit + Sendra6 uint8 // on == send router adv + Recvra6 uint8 // on == recv router adv + + Pktin int64 // packets read + Pktout int64 // packets written + Errin int64 // read errors + Errout int64 // write errors +} + +type Iplifc struct { + IP net.IP + Mask net.IPMask + Net net.IP // ip & mask + PerfLifetime int64 // preferred lifetime + ValidLifetime int64 // valid lifetime +} + +type Ipv6rp struct { + // TODO(lufia): see ip(2) +} diff --git a/vendor/github.com/lufia/plan9stats/int.go b/vendor/github.com/lufia/plan9stats/int.go new file mode 100644 index 00000000..db133c43 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/int.go @@ -0,0 +1,31 @@ +package stats + +import ( + "strconv" +) + +type intParser struct { + err error +} + +func (p *intParser) ParseInt(s string, base int) int { + if p.err != nil { + return 0 + } + var n int64 + n, p.err = strconv.ParseInt(s, base, 0) + return int(n) +} + +func (p *intParser) ParseInt64(s string, base int) int64 { + if p.err != nil { + return 0 + } + var n int64 + n, p.err = strconv.ParseInt(s, base, 64) + return n +} + +func (p *intParser) Err() error { + return p.err +} diff --git a/vendor/github.com/lufia/plan9stats/opts.go b/vendor/github.com/lufia/plan9stats/opts.go new file mode 100644 index 00000000..05b7d036 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/opts.go @@ -0,0 +1,21 @@ +package stats + +type Config struct { + rootdir string +} + +type Option func(*Config) + +func newConfig(opts ...Option) *Config { + var cfg Config + for _, opt := range opts { + opt(&cfg) + } + return &cfg +} + +func WithRootDir(dir string) Option { + return func(cfg *Config) { + cfg.rootdir = dir + } +} diff --git a/vendor/github.com/lufia/plan9stats/stats.go b/vendor/github.com/lufia/plan9stats/stats.go new file mode 100644 index 00000000..d4ecdcfa --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/stats.go @@ -0,0 +1,88 @@ +package stats + +import ( + "bufio" + "context" + "os" + "path/filepath" + "strings" +) + +type InterfaceStats struct { + PacketsReceived int64 // in packets + Link int // link status + PacketsSent int64 // out packets + NumCRCErr int // input CRC errors + NumOverflows int // packet overflows + NumSoftOverflows int // software overflow + NumFramingErr int // framing errors + NumBufferingErr int // buffering errors + NumOutputErr int // output errors + Promiscuous int // number of promiscuous opens + Mbps int // megabits per sec + Addr string +} + +func ReadInterfaceStats(ctx context.Context, opts ...Option) (*InterfaceStats, error) { + cfg := newConfig(opts...) + file := filepath.Join(cfg.rootdir, "stats") + f, err := os.Open(file) + if err != nil { + return nil, err + } + defer f.Close() + + var stats InterfaceStats + scanner := bufio.NewScanner(f) + for scanner.Scan() { + s := strings.TrimSpace(scanner.Text()) + a := strings.SplitN(s, ":", 2) + if len(a) != 2 { + continue + } + var p intParser + v := strings.TrimSpace(a[1]) + switch a[0] { + case "in": + stats.PacketsReceived = p.ParseInt64(v, 10) + case "link": + stats.Link = p.ParseInt(v, 10) + case "out": + stats.PacketsSent = p.ParseInt64(v, 10) + case "crc": + stats.NumCRCErr = p.ParseInt(v, 10) + case "overflows": + stats.NumOverflows = p.ParseInt(v, 10) + case "soft overflows": + stats.NumSoftOverflows = p.ParseInt(v, 10) + case "framing errs": + stats.NumFramingErr = p.ParseInt(v, 10) + case "buffer errs": + stats.NumBufferingErr = p.ParseInt(v, 10) + case "output errs": + stats.NumOutputErr = p.ParseInt(v, 10) + case "prom": + stats.Promiscuous = p.ParseInt(v, 10) + case "mbps": + stats.Mbps = p.ParseInt(v, 10) + case "addr": + stats.Addr = v + } + if err := p.Err(); err != nil { + return nil, err + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return &stats, nil +} + +type TCPStats struct { + MaxConn int + MaxSegment int + ActiveOpens int + PassiveOpens int + EstablishedResets int + CurrentEstablished int +} diff --git a/vendor/github.com/power-devops/perfstat/LICENSE b/vendor/github.com/power-devops/perfstat/LICENSE new file mode 100644 index 00000000..ec4e5d39 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/LICENSE @@ -0,0 +1,23 @@ +MIT License + +Copyright (c) 2020 Power DevOps + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/vendor/github.com/power-devops/perfstat/c_helpers.c b/vendor/github.com/power-devops/perfstat/c_helpers.c new file mode 100644 index 00000000..49ba1ad7 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/c_helpers.c @@ -0,0 +1,159 @@ +#include "c_helpers.h" + +GETFUNC(cpu) +GETFUNC(disk) +GETFUNC(diskadapter) +GETFUNC(diskpath) +GETFUNC(fcstat) +GETFUNC(logicalvolume) +GETFUNC(memory_page) +GETFUNC(netadapter) +GETFUNC(netbuffer) +GETFUNC(netinterface) +GETFUNC(pagingspace) +GETFUNC(process) +GETFUNC(thread) +GETFUNC(volumegroup) + +double get_partition_mhz(perfstat_partition_config_t pinfo) { + return pinfo.processorMHz; +} + +char *get_ps_hostname(perfstat_pagingspace_t *ps) { + return ps->u.nfs_paging.hostname; +} + +char *get_ps_filename(perfstat_pagingspace_t *ps) { + return ps->u.nfs_paging.filename; +} + +char *get_ps_vgname(perfstat_pagingspace_t *ps) { + return ps->u.lv_paging.vgname; +} + +time_t boottime() +{ + register struct utmpx *utmp; + + setutxent(); + while ( (utmp = getutxent()) != NULL ) { + if (utmp->ut_type == BOOT_TIME) { + return utmp->ut_tv.tv_sec; + } + } + endutxent(); + return -1; +} + +struct fsinfo *get_filesystem_stat(struct fsinfo *fs_all, int n) { + if (!fs_all) return NULL; + return &(fs_all[n]); +} + +int get_mounts(struct vmount **vmountpp) { + int size; + struct vmount *vm; + int nmounts; + + size = BUFSIZ; + + while (1) { + if ((vm = (struct vmount *)malloc((size_t)size)) == NULL) { + perror("malloc failed"); + exit(-1); + } + if ((nmounts = mntctl(MCTL_QUERY, size, (caddr_t)vm)) > 0) { + *vmountpp = vm; + return nmounts; + } else if (nmounts == 0) { + size = *(int *)vm; + free((void *)vm); + } else { + free((void *)vm); + return -1; + } + } +} + +void fill_fsinfo(struct statfs statbuf, struct fsinfo *fs) { + fsblkcnt_t freeblks, totblks, usedblks; + fsblkcnt_t tinodes, ninodes, ifree; + uint cfactor; + + if (statbuf.f_blocks == -1) { + fs->totalblks = 0; + fs->freeblks = 0; + fs->totalinodes = 0; + fs->freeinodes = 0; + return; + } + + cfactor = statbuf.f_bsize / 512; + fs->freeblks = statbuf.f_bavail * cfactor; + fs->totalblks = statbuf.f_blocks * cfactor; + + fs->freeinodes = statbuf.f_ffree; + fs->totalinodes = statbuf.f_files; + + if (fs->freeblks < 0) + fs->freeblks = 0; +} + +int getfsinfo(char *fsname, char *devname, char *host, char *options, int flags, int fstype, struct fsinfo *fs) { + struct statfs statbuf; + int devname_size = strlen(devname); + int fsname_size = strlen(fsname); + char buf[BUFSIZ]; + char *p; + + if (fs == NULL) { + return 1; + } + + for (p = strtok(options, ","); p != NULL; p = strtok(NULL, ",")) + if (strcmp(p, "ignore") == 0) + return 0; + + if (*host != 0 && strcmp(host, "-") != 0) { + sprintf(buf, "%s:%s", host, devname); + devname = buf; + } + fs->devname = (char *)calloc(devname_size+1, 1); + fs->fsname = (char *)calloc(fsname_size+1, 1); + strncpy(fs->devname, devname, devname_size); + strncpy(fs->fsname, fsname, fsname_size); + fs->flags = flags; + fs->fstype = fstype; + + if (statfs(fsname,&statbuf) < 0) { + return 1; + } + + fill_fsinfo(statbuf, fs); + return 0; +} + +struct fsinfo *get_all_fs(int *rc) { + struct vmount *mnt; + struct fsinfo *fs_all; + int nmounts; + + *rc = -1; + if ((nmounts = get_mounts(&mnt)) <= 0) { + perror("Can't get mount table info"); + return NULL; + } + + fs_all = (struct fsinfo *)calloc(sizeof(struct fsinfo), nmounts); + while ((*rc)++, nmounts--) { + getfsinfo(vmt2dataptr(mnt, VMT_STUB), + vmt2dataptr(mnt, VMT_OBJECT), + vmt2dataptr(mnt, VMT_HOST), + vmt2dataptr(mnt, VMT_ARGS), + mnt->vmt_flags, + mnt->vmt_gfstype, + &fs_all[*rc]); + mnt = (struct vmount *)((char *)mnt + mnt->vmt_length); + } + return fs_all; +} diff --git a/vendor/github.com/power-devops/perfstat/c_helpers.h b/vendor/github.com/power-devops/perfstat/c_helpers.h new file mode 100644 index 00000000..b66bc53c --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/c_helpers.h @@ -0,0 +1,58 @@ +#ifndef C_HELPERS_H +#define C_HELPERS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GETFUNC(TYPE) perfstat_##TYPE##_t *get_##TYPE##_stat(perfstat_##TYPE##_t *b, int n) { \ + if (!b) return NULL; \ + return &(b[n]); \ +} + +#define GETFUNC_EXT(TYPE) extern perfstat_##TYPE##_t *get_##TYPE##_stat(perfstat_##TYPE##_t *, int); + +GETFUNC_EXT(cpu) +GETFUNC_EXT(disk) +GETFUNC_EXT(diskadapter) +GETFUNC_EXT(diskpath) +GETFUNC_EXT(fcstat) +GETFUNC_EXT(logicalvolume) +GETFUNC_EXT(memory_page) +GETFUNC_EXT(netadapter) +GETFUNC_EXT(netbuffer) +GETFUNC_EXT(netinterface) +GETFUNC_EXT(pagingspace) +GETFUNC_EXT(process) +GETFUNC_EXT(thread) +GETFUNC_EXT(volumegroup) + +struct fsinfo { + char *devname; + char *fsname; + int flags; + int fstype; + unsigned long totalblks; + unsigned long freeblks; + unsigned long totalinodes; + unsigned long freeinodes; +}; + +extern double get_partition_mhz(perfstat_partition_config_t); +extern char *get_ps_hostname(perfstat_pagingspace_t *); +extern char *get_ps_filename(perfstat_pagingspace_t *); +extern char *get_ps_vgname(perfstat_pagingspace_t *); +extern time_t boottime(); +struct fsinfo *get_filesystem_stat(struct fsinfo *, int); +int get_mounts(struct vmount **); +void fill_statfs(struct statfs, struct fsinfo *); +int getfsinfo(char *, char *, char *, char *, int, int, struct fsinfo *); +struct fsinfo *get_all_fs(int *); + +#endif diff --git a/vendor/github.com/power-devops/perfstat/config.go b/vendor/github.com/power-devops/perfstat/config.go new file mode 100644 index 00000000..a6df39c6 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/config.go @@ -0,0 +1,19 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +*/ +import "C" + +func EnableLVMStat() { + C.perfstat_config(C.PERFSTAT_ENABLE|C.PERFSTAT_LV|C.PERFSTAT_VG, nil) +} + +func DisableLVMStat() { + C.perfstat_config(C.PERFSTAT_DISABLE|C.PERFSTAT_LV|C.PERFSTAT_VG, nil) +} diff --git a/vendor/github.com/power-devops/perfstat/cpustat.go b/vendor/github.com/power-devops/perfstat/cpustat.go new file mode 100644 index 00000000..10f543fa --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/cpustat.go @@ -0,0 +1,138 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "runtime" + "time" + "unsafe" +) + +var old_cpu_total_stat *C.perfstat_cpu_total_t + +func init() { + old_cpu_total_stat = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + C.perfstat_cpu_total(nil, old_cpu_total_stat, C.sizeof_perfstat_cpu_total_t, 1) +} + +func CpuStat() ([]CPU, error) { + var cpustat *C.perfstat_cpu_t + var cpu C.perfstat_id_t + + ncpu := runtime.NumCPU() + + cpustat_len := C.sizeof_perfstat_cpu_t * C.ulong(ncpu) + cpustat = (*C.perfstat_cpu_t)(C.malloc(cpustat_len)) + defer C.free(unsafe.Pointer(cpustat)) + C.strcpy(&cpu.name[0], C.CString(C.FIRST_CPU)) + r := C.perfstat_cpu(&cpu, cpustat, C.sizeof_perfstat_cpu_t, C.int(ncpu)) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu()") + } + c := make([]CPU, r) + for i := 0; i < int(r); i++ { + n := C.get_cpu_stat(cpustat, C.int(i)) + if n != nil { + c[i] = perfstatcpu2cpu(n) + } + } + return c, nil +} + +func CpuTotalStat() (*CPUTotal, error) { + var cpustat *C.perfstat_cpu_total_t + + cpustat = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + defer C.free(unsafe.Pointer(cpustat)) + r := C.perfstat_cpu_total(nil, cpustat, C.sizeof_perfstat_cpu_total_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_total()") + } + c := perfstatcputotal2cputotal(cpustat) + return &c, nil +} + +func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) { + var cpuutil *C.perfstat_cpu_util_t + var newt *C.perfstat_cpu_total_t + var oldt *C.perfstat_cpu_total_t + var data C.perfstat_rawdata_t + + oldt = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + newt = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + cpuutil = (*C.perfstat_cpu_util_t)(C.malloc(C.sizeof_perfstat_cpu_util_t)) + defer C.free(unsafe.Pointer(oldt)) + defer C.free(unsafe.Pointer(newt)) + defer C.free(unsafe.Pointer(cpuutil)) + + r := C.perfstat_cpu_total(nil, oldt, C.sizeof_perfstat_cpu_total_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_total()") + } + + time.Sleep(intvl) + + r = C.perfstat_cpu_total(nil, newt, C.sizeof_perfstat_cpu_total_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_total()") + } + + data._type = C.UTIL_CPU_TOTAL + data.curstat = unsafe.Pointer(newt) + data.prevstat = unsafe.Pointer(oldt) + data.sizeof_data = C.sizeof_perfstat_cpu_total_t + data.cur_elems = 1 + data.prev_elems = 1 + + r = C.perfstat_cpu_util(&data, cpuutil, C.sizeof_perfstat_cpu_util_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_util()") + } + u := perfstatcpuutil2cpuutil(cpuutil) + return &u, nil +} + +func CpuUtilTotalStat() (*CPUUtil, error) { + var cpuutil *C.perfstat_cpu_util_t + var new_cpu_total_stat *C.perfstat_cpu_total_t + var data C.perfstat_rawdata_t + + new_cpu_total_stat = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + cpuutil = (*C.perfstat_cpu_util_t)(C.malloc(C.sizeof_perfstat_cpu_util_t)) + defer C.free(unsafe.Pointer(cpuutil)) + + r := C.perfstat_cpu_total(nil, new_cpu_total_stat, C.sizeof_perfstat_cpu_total_t, 1) + if r <= 0 { + C.free(unsafe.Pointer(new_cpu_total_stat)) + return nil, fmt.Errorf("error perfstat_cpu_total()") + } + + data._type = C.UTIL_CPU_TOTAL + data.curstat = unsafe.Pointer(new_cpu_total_stat) + data.prevstat = unsafe.Pointer(old_cpu_total_stat) + data.sizeof_data = C.sizeof_perfstat_cpu_total_t + data.cur_elems = 1 + data.prev_elems = 1 + + r = C.perfstat_cpu_util(&data, cpuutil, C.sizeof_perfstat_cpu_util_t, 1) + C.free(unsafe.Pointer(old_cpu_total_stat)) + old_cpu_total_stat = new_cpu_total_stat + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_util()") + } + u := perfstatcpuutil2cpuutil(cpuutil) + return &u, nil +} diff --git a/vendor/github.com/power-devops/perfstat/diskstat.go b/vendor/github.com/power-devops/perfstat/diskstat.go new file mode 100644 index 00000000..06763b4b --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/diskstat.go @@ -0,0 +1,138 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func DiskTotalStat() (*DiskTotal, error) { + var disk C.perfstat_disk_total_t + + rc := C.perfstat_disk_total(nil, &disk, C.sizeof_perfstat_disk_total_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_disk_total() error") + } + d := perfstatdisktotal2disktotal(disk) + return &d, nil +} + +func DiskAdapterStat() ([]DiskAdapter, error) { + var adapter *C.perfstat_diskadapter_t + var adptname C.perfstat_id_t + + numadpt := C.perfstat_diskadapter(nil, nil, C.sizeof_perfstat_diskadapter_t, 0) + if numadpt <= 0 { + return nil, fmt.Errorf("perfstat_diskadapter() error") + } + + adapter_len := C.sizeof_perfstat_diskadapter_t * C.ulong(numadpt) + adapter = (*C.perfstat_diskadapter_t)(C.malloc(adapter_len)) + defer C.free(unsafe.Pointer(adapter)) + C.strcpy(&adptname.name[0], C.CString(C.FIRST_DISKADAPTER)) + r := C.perfstat_diskadapter(&adptname, adapter, C.sizeof_perfstat_diskadapter_t, numadpt) + if r < 0 { + return nil, fmt.Errorf("perfstat_diskadapter() error") + } + da := make([]DiskAdapter, r) + for i := 0; i < int(r); i++ { + d := C.get_diskadapter_stat(adapter, C.int(i)) + if d != nil { + da[i] = perfstatdiskadapter2diskadapter(d) + } + } + return da, nil +} + +func DiskStat() ([]Disk, error) { + var disk *C.perfstat_disk_t + var diskname C.perfstat_id_t + + numdisk := C.perfstat_disk(nil, nil, C.sizeof_perfstat_disk_t, 0) + if numdisk <= 0 { + return nil, fmt.Errorf("perfstat_disk() error") + } + + disk_len := C.sizeof_perfstat_disk_t * C.ulong(numdisk) + disk = (*C.perfstat_disk_t)(C.malloc(disk_len)) + defer C.free(unsafe.Pointer(disk)) + C.strcpy(&diskname.name[0], C.CString(C.FIRST_DISK)) + r := C.perfstat_disk(&diskname, disk, C.sizeof_perfstat_disk_t, numdisk) + if r < 0 { + return nil, fmt.Errorf("perfstat_disk() error") + } + d := make([]Disk, r) + for i := 0; i < int(r); i++ { + ds := C.get_disk_stat(disk, C.int(i)) + if ds != nil { + d[i] = perfstatdisk2disk(ds) + } + } + return d, nil +} + +func DiskPathStat() ([]DiskPath, error) { + var diskpath *C.perfstat_diskpath_t + var pathname C.perfstat_id_t + + numpaths := C.perfstat_diskpath(nil, nil, C.sizeof_perfstat_diskpath_t, 0) + if numpaths <= 0 { + return nil, fmt.Errorf("perfstat_diskpath() error") + } + + path_len := C.sizeof_perfstat_diskpath_t * C.ulong(numpaths) + diskpath = (*C.perfstat_diskpath_t)(C.malloc(path_len)) + defer C.free(unsafe.Pointer(diskpath)) + C.strcpy(&pathname.name[0], C.CString(C.FIRST_DISKPATH)) + r := C.perfstat_diskpath(&pathname, diskpath, C.sizeof_perfstat_diskpath_t, numpaths) + if r < 0 { + return nil, fmt.Errorf("perfstat_diskpath() error") + } + d := make([]DiskPath, r) + for i := 0; i < int(r); i++ { + p := C.get_diskpath_stat(diskpath, C.int(i)) + if p != nil { + d[i] = perfstatdiskpath2diskpath(p) + } + } + return d, nil +} + +func FCAdapterStat() ([]FCAdapter, error) { + var fcstat *C.perfstat_fcstat_t + var fcname C.perfstat_id_t + + numadpt := C.perfstat_fcstat(nil, nil, C.sizeof_perfstat_fcstat_t, 0) + if numadpt <= 0 { + return nil, fmt.Errorf("perfstat_fcstat() error") + } + + fcstat_len := C.sizeof_perfstat_fcstat_t * C.ulong(numadpt) + fcstat = (*C.perfstat_fcstat_t)(C.malloc(fcstat_len)) + defer C.free(unsafe.Pointer(fcstat)) + C.strcpy(&fcname.name[0], C.CString(C.FIRST_NETINTERFACE)) + r := C.perfstat_fcstat(&fcname, fcstat, C.sizeof_perfstat_fcstat_t, numadpt) + if r < 0 { + return nil, fmt.Errorf("perfstat_fcstat() error") + } + fca := make([]FCAdapter, r) + for i := 0; i < int(r); i++ { + f := C.get_fcstat_stat(fcstat, C.int(i)) + if f != nil { + fca[i] = perfstatfcstat2fcadapter(f) + } + } + return fca, nil +} diff --git a/vendor/github.com/power-devops/perfstat/doc.go b/vendor/github.com/power-devops/perfstat/doc.go new file mode 100644 index 00000000..9730a61c --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/doc.go @@ -0,0 +1,316 @@ +//go:build !aix +// +build !aix + +// Copyright 2020 Power-Devops.com. All rights reserved. +// Use of this source code is governed by the license +// that can be found in the LICENSE file. +/* +Package perfstat is Go interface to IBM AIX libperfstat. +To use it you need AIX with installed bos.perf.libperfstat. You can check, if is installed using the following command: + + $ lslpp -L bos.perf.perfstat + +The package is written using Go 1.14.7 and AIX 7.2 TL5. It should work with earlier TLs of AIX 7.2, but I +can't guarantee that perfstat structures in the TLs have all the same fields as the structures in AIX 7.2 TL5. + +For documentation of perfstat on AIX and using it in programs refer to the official IBM documentation: +https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat.html +*/ +package perfstat + +import ( + "fmt" + "time" +) + +// EnableLVMStat() switches on LVM (logical volumes and volume groups) performance statistics. +// With this enabled you can use fields KBReads, KBWrites, and IOCnt +// in LogicalVolume and VolumeGroup data types. +func EnableLVMStat() {} + +// DisableLVMStat() switchess of LVM (logical volumes and volume groups) performance statistics. +// This is the default state. In this case LogicalVolume and VolumeGroup data types are +// populated with informations about LVM structures, but performance statistics fields +// (KBReads, KBWrites, IOCnt) are empty. +func DisableLVMStat() {} + +// CpuStat() returns array of CPU structures with information about +// logical CPUs on the system. +// IBM documentation: +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html +func CpuStat() ([]CPU, error) { + return nil, fmt.Errorf("not implemented") +} + +// CpuTotalStat() returns general information about CPUs on the system. +// IBM documentation: +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html +func CpuTotalStat() (*CPUTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +// CpuUtilStat() calculates CPU utilization. +// IBM documentation: +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html +func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskTotalStat() (*DiskTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskAdapterStat() ([]DiskAdapter, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskStat() ([]Disk, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskPathStat() ([]DiskPath, error) { + return nil, fmt.Errorf("not implemented") +} + +func FCAdapterStat() ([]FCAdapter, error) { + return nil, fmt.Errorf("not implemented") +} + +func PartitionStat() (*PartitionConfig, error) { + return nil, fmt.Errorf("not implemented") +} + +func LogicalVolumeStat() ([]LogicalVolume, error) { + return nil, fmt.Errorf("not implemented") +} + +func VolumeGroupStat() ([]VolumeGroup, error) { + return nil, fmt.Errorf("not implemented") +} + +func MemoryTotalStat() (*MemoryTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +func MemoryPageStat() ([]MemoryPage, error) { + return nil, fmt.Errorf("not implemented") +} + +func PagingSpaceStat() ([]PagingSpace, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetIfaceTotalStat() (*NetIfaceTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetBufferStat() ([]NetBuffer, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetIfaceStat() ([]NetIface, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetAdapterStat() ([]NetAdapter, error) { + return nil, fmt.Errorf("not implemented") +} + +func ProcessStat() ([]Process, error) { + return nil, fmt.Errorf("not implemented") +} + +func ThreadStat() ([]Thread, error) { + return nil, fmt.Errorf("not implemented") +} + +func Sysconf(name int32) (int64, error) { + return 0, fmt.Errorf("not implemented") +} + +func GetCPUImplementation() string { + return "" +} + +func POWER9OrNewer() bool { + return false +} + +func POWER9() bool { + return false +} + +func POWER8OrNewer() bool { + return false +} + +func POWER8() bool { + return false +} + +func POWER7OrNewer() bool { + return false +} + +func POWER7() bool { + return false +} + +func HasTransactionalMemory() bool { + return false +} + +func Is64Bit() bool { + return false +} + +func IsSMP() bool { + return false +} + +func HasVMX() bool { + return false +} + +func HasVSX() bool { + return false +} + +func HasDFP() bool { + return false +} + +func HasNxGzip() bool { + return false +} + +func PksCapable() bool { + return false +} + +func PksEnabled() bool { + return false +} + +func CPUMode() string { + return "" +} + +func KernelBits() int { + return 0 +} + +func IsLPAR() bool { + return false +} + +func CpuAddCapable() bool { + return false +} + +func CpuRemoveCapable() bool { + return false +} + +func MemoryAddCapable() bool { + return false +} + +func MemoryRemoveCapable() bool { + return false +} + +func DLparCapable() bool { + return false +} + +func IsNUMA() bool { + return false +} + +func KernelKeys() bool { + return false +} + +func RecoveryMode() bool { + return false +} + +func EnhancedAffinity() bool { + return false +} + +func VTpmEnabled() bool { + return false +} + +func IsVIOS() bool { + return false +} + +func MLSEnabled() bool { + return false +} + +func SPLparCapable() bool { + return false +} + +func SPLparEnabled() bool { + return false +} + +func DedicatedLpar() bool { + return false +} + +func SPLparCapped() bool { + return false +} + +func SPLparDonating() bool { + return false +} + +func SmtCapable() bool { + return false +} + +func SmtEnabled() bool { + return false +} + +func VrmCapable() bool { + return false +} + +func VrmEnabled() bool { + return false +} + +func AmeEnabled() bool { + return false +} + +func EcoCapable() bool { + return false +} + +func EcoEnabled() bool { + return false +} + +func BootTime() (uint64, error) { + return 0, fmt.Errorf("Not implemented") +} + +func UptimeSeconds() (uint64, error) { + return 0, fmt.Errorf("Not implemented") +} + +func FileSystemStat() ([]FileSystem, error) { + return nil, fmt.Errorf("Not implemented") +} diff --git a/vendor/github.com/power-devops/perfstat/fsstat.go b/vendor/github.com/power-devops/perfstat/fsstat.go new file mode 100644 index 00000000..d3913197 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/fsstat.go @@ -0,0 +1,32 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" +) + +func FileSystemStat() ([]FileSystem, error) { + var fsinfo *C.struct_fsinfo + var nmounts C.int + + fsinfo = C.get_all_fs(&nmounts) + if nmounts <= 0 { + return nil, fmt.Errorf("No mounts found") + } + + fs := make([]FileSystem, nmounts) + for i := 0; i < int(nmounts); i++ { + f := C.get_filesystem_stat(fsinfo, C.int(i)) + if f != nil { + fs[i] = fsinfo2filesystem(f) + } + } + return fs, nil +} diff --git a/vendor/github.com/power-devops/perfstat/helpers.go b/vendor/github.com/power-devops/perfstat/helpers.go new file mode 100644 index 00000000..d5268ab5 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/helpers.go @@ -0,0 +1,819 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +func perfstatcpu2cpu(n *C.perfstat_cpu_t) CPU { + var c CPU + c.Name = C.GoString(&n.name[0]) + c.User = int64(n.user) + c.Sys = int64(n.sys) + c.Idle = int64(n.idle) + c.Wait = int64(n.wait) + c.PSwitch = int64(n.pswitch) + c.Syscall = int64(n.syscall) + c.Sysread = int64(n.sysread) + c.Syswrite = int64(n.syswrite) + c.Sysfork = int64(n.sysfork) + c.Sysexec = int64(n.sysexec) + c.Readch = int64(n.readch) + c.Writech = int64(n.writech) + c.Bread = int64(n.bread) + c.Bwrite = int64(n.bwrite) + c.Lread = int64(n.lread) + c.Lwrite = int64(n.lwrite) + c.Phread = int64(n.phread) + c.Phwrite = int64(n.phwrite) + c.Iget = int64(n.iget) + c.Namei = int64(n.namei) + c.Dirblk = int64(n.dirblk) + c.Msg = int64(n.msg) + c.Sema = int64(n.sema) + c.MinFaults = int64(n.minfaults) + c.MajFaults = int64(n.majfaults) + c.PUser = int64(n.puser) + c.PSys = int64(n.psys) + c.PIdle = int64(n.pidle) + c.PWait = int64(n.pwait) + c.RedispSD0 = int64(n.redisp_sd0) + c.RedispSD1 = int64(n.redisp_sd1) + c.RedispSD2 = int64(n.redisp_sd2) + c.RedispSD3 = int64(n.redisp_sd3) + c.RedispSD4 = int64(n.redisp_sd4) + c.RedispSD5 = int64(n.redisp_sd5) + c.MigrationPush = int64(n.migration_push) + c.MigrationS3grq = int64(n.migration_S3grq) + c.MigrationS3pul = int64(n.migration_S3pul) + c.InvolCSwitch = int64(n.invol_cswitch) + c.VolCSwitch = int64(n.vol_cswitch) + c.RunQueue = int64(n.runque) + c.Bound = int64(n.bound) + c.DecrIntrs = int64(n.decrintrs) + c.MpcRIntrs = int64(n.mpcrintrs) + c.MpcSIntrs = int64(n.mpcsintrs) + c.SoftIntrs = int64(n.softintrs) + c.DevIntrs = int64(n.devintrs) + c.PhantIntrs = int64(n.phantintrs) + c.IdleDonatedPurr = int64(n.idle_donated_purr) + c.IdleDonatedSpurr = int64(n.idle_donated_spurr) + c.BusyDonatedPurr = int64(n.busy_donated_purr) + c.BusyDonatedSpurr = int64(n.busy_donated_spurr) + c.IdleStolenPurr = int64(n.idle_stolen_purr) + c.IdleStolenSpurr = int64(n.idle_stolen_spurr) + c.BusyStolenPurr = int64(n.busy_stolen_purr) + c.BusyStolenSpurr = int64(n.busy_stolen_spurr) + c.Hpi = int64(n.hpi) + c.Hpit = int64(n.hpit) + c.PUserSpurr = int64(n.puser_spurr) + c.PSysSpurr = int64(n.psys_spurr) + c.PIdleSpurr = int64(n.pidle_spurr) + c.PWaitSpurr = int64(n.pwait_spurr) + c.SpurrFlag = int32(n.spurrflag) + c.LocalDispatch = int64(n.localdispatch) + c.NearDispatch = int64(n.neardispatch) + c.FarDispatch = int64(n.fardispatch) + c.CSwitches = int64(n.cswitches) + c.Version = int64(n.version) + c.TbLast = int64(n.tb_last) + c.State = int(n.state) + c.VtbLast = int64(n.vtb_last) + c.ICountLast = int64(n.icount_last) + return c +} + +func perfstatcputotal2cputotal(n *C.perfstat_cpu_total_t) CPUTotal { + var c CPUTotal + c.NCpus = int(n.ncpus) + c.NCpusCfg = int(n.ncpus_cfg) + c.Description = C.GoString(&n.description[0]) + c.ProcessorHz = int64(n.processorHZ) + c.User = int64(n.user) + c.Sys = int64(n.sys) + c.Idle = int64(n.idle) + c.Wait = int64(n.wait) + c.PSwitch = int64(n.pswitch) + c.Syscall = int64(n.syscall) + c.Sysread = int64(n.sysread) + c.Syswrite = int64(n.syswrite) + c.Sysfork = int64(n.sysfork) + c.Sysexec = int64(n.sysexec) + c.Readch = int64(n.readch) + c.Writech = int64(n.writech) + c.DevIntrs = int64(n.devintrs) + c.SoftIntrs = int64(n.softintrs) + c.Lbolt = int64(n.lbolt) + c.LoadAvg1 = (float32(n.loadavg[0]) / (1 << C.SBITS)) + c.LoadAvg5 = (float32(n.loadavg[1]) / (1 << C.SBITS)) + c.LoadAvg15 = (float32(n.loadavg[2]) / (1 << C.SBITS)) + c.RunQueue = int64(n.runque) + c.SwpQueue = int64(n.swpque) + c.Bread = int64(n.bread) + c.Bwrite = int64(n.bwrite) + c.Lread = int64(n.lread) + c.Lwrite = int64(n.lwrite) + c.Phread = int64(n.phread) + c.Phwrite = int64(n.phwrite) + c.RunOcc = int64(n.runocc) + c.SwpOcc = int64(n.swpocc) + c.Iget = int64(n.iget) + c.Namei = int64(n.namei) + c.Dirblk = int64(n.dirblk) + c.Msg = int64(n.msg) + c.Sema = int64(n.sema) + c.RcvInt = int64(n.rcvint) + c.XmtInt = int64(n.xmtint) + c.MdmInt = int64(n.mdmint) + c.TtyRawInch = int64(n.tty_rawinch) + c.TtyCanInch = int64(n.tty_caninch) + c.TtyRawOutch = int64(n.tty_rawoutch) + c.Ksched = int64(n.ksched) + c.Koverf = int64(n.koverf) + c.Kexit = int64(n.kexit) + c.Rbread = int64(n.rbread) + c.Rcread = int64(n.rcread) + c.Rbwrt = int64(n.rbwrt) + c.Rcwrt = int64(n.rcwrt) + c.Traps = int64(n.traps) + c.NCpusHigh = int64(n.ncpus_high) + c.PUser = int64(n.puser) + c.PSys = int64(n.psys) + c.PIdle = int64(n.pidle) + c.PWait = int64(n.pwait) + c.DecrIntrs = int64(n.decrintrs) + c.MpcRIntrs = int64(n.mpcrintrs) + c.MpcSIntrs = int64(n.mpcsintrs) + c.PhantIntrs = int64(n.phantintrs) + c.IdleDonatedPurr = int64(n.idle_donated_purr) + c.IdleDonatedSpurr = int64(n.idle_donated_spurr) + c.BusyDonatedPurr = int64(n.busy_donated_purr) + c.BusyDonatedSpurr = int64(n.busy_donated_spurr) + c.IdleStolenPurr = int64(n.idle_stolen_purr) + c.IdleStolenSpurr = int64(n.idle_stolen_spurr) + c.BusyStolenPurr = int64(n.busy_stolen_purr) + c.BusyStolenSpurr = int64(n.busy_stolen_spurr) + c.IOWait = int32(n.iowait) + c.PhysIO = int32(n.physio) + c.TWait = int64(n.twait) + c.Hpi = int64(n.hpi) + c.Hpit = int64(n.hpit) + c.PUserSpurr = int64(n.puser_spurr) + c.PSysSpurr = int64(n.psys_spurr) + c.PIdleSpurr = int64(n.pidle_spurr) + c.PWaitSpurr = int64(n.pwait_spurr) + c.SpurrFlag = int(n.spurrflag) + c.Version = int64(n.version) + c.TbLast = int64(n.tb_last) + c.PurrCoalescing = int64(n.purr_coalescing) + c.SpurrCoalescing = int64(n.spurr_coalescing) + return c +} + +func perfstatcpuutil2cpuutil(n *C.perfstat_cpu_util_t) CPUUtil { + var c CPUUtil + + c.Version = int64(n.version) + c.CpuID = C.GoString(&n.cpu_id[0]) + c.Entitlement = float32(n.entitlement) + c.UserPct = float32(n.user_pct) + c.KernPct = float32(n.kern_pct) + c.IdlePct = float32(n.idle_pct) + c.WaitPct = float32(n.wait_pct) + c.PhysicalBusy = float32(n.physical_busy) + c.PhysicalConsumed = float32(n.physical_consumed) + c.FreqPct = float32(n.freq_pct) + c.EntitlementPct = float32(n.entitlement_pct) + c.BusyPct = float32(n.busy_pct) + c.IdleDonatedPct = float32(n.idle_donated_pct) + c.BusyDonatedPct = float32(n.busy_donated_pct) + c.IdleStolenPct = float32(n.idle_stolen_pct) + c.BusyStolenPct = float32(n.busy_stolen_pct) + c.LUserPct = float32(n.l_user_pct) + c.LKernPct = float32(n.l_kern_pct) + c.LIdlePct = float32(n.l_idle_pct) + c.LWaitPct = float32(n.l_wait_pct) + c.DeltaTime = int64(n.delta_time) + + return c +} + +func perfstatdisktotal2disktotal(n C.perfstat_disk_total_t) DiskTotal { + var d DiskTotal + + d.Number = int32(n.number) + d.Size = int64(n.size) + d.Free = int64(n.free) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Wblks = int64(n.wblks) + d.Rblks = int64(n.rblks) + d.Time = int64(n.time) + d.Version = int64(n.version) + d.Rserv = int64(n.rserv) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.RTimeOut = int64(n.rtimeout) + d.RFailed = int64(n.rfailed) + d.Wserv = int64(n.wserv) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WTimeOut = int64(n.wtimeout) + d.WFailed = int64(n.wfailed) + d.WqDepth = int64(n.wq_depth) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + + return d +} + +func perfstatdiskadapter2diskadapter(n *C.perfstat_diskadapter_t) DiskAdapter { + var d DiskAdapter + + d.Name = C.GoString(&n.name[0]) + d.Description = C.GoString(&n.description[0]) + d.Number = int32(n.number) + d.Size = int64(n.size) + d.Free = int64(n.free) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Rblks = int64(n.rblks) + d.Wblks = int64(n.wblks) + d.Time = int64(n.time) + d.Version = int64(n.version) + d.AdapterType = int64(n.adapter_type) + d.DkBSize = int64(n.dk_bsize) + d.DkRserv = int64(n.dk_rserv) + d.DkWserv = int64(n.dk_wserv) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WqDepth = int64(n.wq_depth) + d.WqSampled = int64(n.wq_sampled) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + d.QFull = int64(n.q_full) + d.QSampled = int64(n.q_sampled) + + return d +} + +func perfstatpartitionconfig2partitionconfig(n C.perfstat_partition_config_t) PartitionConfig { + var p PartitionConfig + p.Version = int64(n.version) + p.Name = C.GoString(&n.partitionname[0]) + p.Node = C.GoString(&n.nodename[0]) + p.Conf.SmtCapable = (n.conf[0] & (1 << 7)) > 0 + p.Conf.SmtEnabled = (n.conf[0] & (1 << 6)) > 0 + p.Conf.LparCapable = (n.conf[0] & (1 << 5)) > 0 + p.Conf.LparEnabled = (n.conf[0] & (1 << 4)) > 0 + p.Conf.SharedCapable = (n.conf[0] & (1 << 3)) > 0 + p.Conf.SharedEnabled = (n.conf[0] & (1 << 2)) > 0 + p.Conf.DLparCapable = (n.conf[0] & (1 << 1)) > 0 + p.Conf.Capped = (n.conf[0] & (1 << 0)) > 0 + p.Conf.Kernel64bit = (n.conf[1] & (1 << 7)) > 0 + p.Conf.PoolUtilAuthority = (n.conf[1] & (1 << 6)) > 0 + p.Conf.DonateCapable = (n.conf[1] & (1 << 5)) > 0 + p.Conf.DonateEnabled = (n.conf[1] & (1 << 4)) > 0 + p.Conf.AmsCapable = (n.conf[1] & (1 << 3)) > 0 + p.Conf.AmsEnabled = (n.conf[1] & (1 << 2)) > 0 + p.Conf.PowerSave = (n.conf[1] & (1 << 1)) > 0 + p.Conf.AmeEnabled = (n.conf[1] & (1 << 0)) > 0 + p.Conf.SharedExtended = (n.conf[2] & (1 << 7)) > 0 + p.Number = int32(n.partitionnum) + p.GroupID = int32(n.groupid) + p.ProcessorFamily = C.GoString(&n.processorFamily[0]) + p.ProcessorModel = C.GoString(&n.processorModel[0]) + p.MachineID = C.GoString(&n.machineID[0]) + p.ProcessorMhz = float64(C.get_partition_mhz(n)) + p.NumProcessors.Online = int64(n.numProcessors.online) + p.NumProcessors.Max = int64(n.numProcessors.max) + p.NumProcessors.Min = int64(n.numProcessors.min) + p.NumProcessors.Desired = int64(n.numProcessors.desired) + p.OSName = C.GoString(&n.OSName[0]) + p.OSVersion = C.GoString(&n.OSVersion[0]) + p.OSBuild = C.GoString(&n.OSBuild[0]) + p.LCpus = int32(n.lcpus) + p.SmtThreads = int32(n.smtthreads) + p.Drives = int32(n.drives) + p.NetworkAdapters = int32(n.nw_adapters) + p.CpuCap.Online = int64(n.cpucap.online) + p.CpuCap.Max = int64(n.cpucap.max) + p.CpuCap.Min = int64(n.cpucap.min) + p.CpuCap.Desired = int64(n.cpucap.desired) + p.Weightage = int32(n.cpucap_weightage) + p.EntCapacity = int32(n.entitled_proc_capacity) + p.VCpus.Online = int64(n.vcpus.online) + p.VCpus.Max = int64(n.vcpus.max) + p.VCpus.Min = int64(n.vcpus.min) + p.VCpus.Desired = int64(n.vcpus.desired) + p.PoolID = int32(n.processor_poolid) + p.ActiveCpusInPool = int32(n.activecpusinpool) + p.PoolWeightage = int32(n.cpupool_weightage) + p.SharedPCpu = int32(n.sharedpcpu) + p.MaxPoolCap = int32(n.maxpoolcap) + p.EntPoolCap = int32(n.entpoolcap) + p.Mem.Online = int64(n.mem.online) + p.Mem.Max = int64(n.mem.max) + p.Mem.Min = int64(n.mem.min) + p.Mem.Desired = int64(n.mem.desired) + p.MemWeightage = int32(n.mem_weightage) + p.TotalIOMemoryEntitlement = int64(n.totiomement) + p.MemPoolID = int32(n.mempoolid) + p.HyperPgSize = int64(n.hyperpgsize) + p.ExpMem.Online = int64(n.exp_mem.online) + p.ExpMem.Max = int64(n.exp_mem.max) + p.ExpMem.Min = int64(n.exp_mem.min) + p.ExpMem.Desired = int64(n.exp_mem.desired) + p.TargetMemExpFactor = int64(n.targetmemexpfactor) + p.TargetMemExpSize = int64(n.targetmemexpsize) + p.SubProcessorMode = int32(n.subprocessor_mode) + return p +} + +func perfstatmemorytotal2memorytotal(n C.perfstat_memory_total_t) MemoryTotal { + var m MemoryTotal + m.VirtualTotal = int64(n.virt_total) + m.RealTotal = int64(n.real_total) + m.RealFree = int64(n.real_free) + m.RealPinned = int64(n.real_pinned) + m.RealInUse = int64(n.real_inuse) + m.BadPages = int64(n.pgbad) + m.PageFaults = int64(n.pgexct) + m.PageIn = int64(n.pgins) + m.PageOut = int64(n.pgouts) + m.PgSpIn = int64(n.pgspins) + m.PgSpOut = int64(n.pgspouts) + m.Scans = int64(n.scans) + m.Cycles = int64(n.cycles) + m.PgSteals = int64(n.pgsteals) + m.NumPerm = int64(n.numperm) + m.PgSpTotal = int64(n.pgsp_total) + m.PgSpFree = int64(n.pgsp_free) + m.PgSpRsvd = int64(n.pgsp_rsvd) + m.RealSystem = int64(n.real_system) + m.RealUser = int64(n.real_user) + m.RealProcess = int64(n.real_process) + m.VirtualActive = int64(n.virt_active) + m.IOME = int64(n.iome) + m.IOMU = int64(n.iomu) + m.IOHWM = int64(n.iohwm) + m.PMem = int64(n.pmem) + m.CompressedTotal = int64(n.comprsd_total) + m.CompressedWSegPg = int64(n.comprsd_wseg_pgs) + m.CPgIn = int64(n.cpgins) + m.CPgOut = int64(n.cpgouts) + m.TrueSize = int64(n.true_size) + m.ExpandedMemory = int64(n.expanded_memory) + m.CompressedWSegSize = int64(n.comprsd_wseg_size) + m.TargetCPoolSize = int64(n.target_cpool_size) + m.MaxCPoolSize = int64(n.max_cpool_size) + m.MinUCPoolSize = int64(n.min_ucpool_size) + m.CPoolSize = int64(n.cpool_size) + m.UCPoolSize = int64(n.ucpool_size) + m.CPoolInUse = int64(n.cpool_inuse) + m.UCPoolInUse = int64(n.ucpool_inuse) + m.Version = int64(n.version) + m.RealAvailable = int64(n.real_avail) + m.BytesCoalesced = int64(n.bytes_coalesced) + m.BytesCoalescedMemPool = int64(n.bytes_coalesced_mempool) + + return m +} + +func perfstatnetinterfacetotal2netifacetotal(n C.perfstat_netinterface_total_t) NetIfaceTotal { + var i NetIfaceTotal + + i.Number = int32(n.number) + i.IPackets = int64(n.ipackets) + i.IBytes = int64(n.ibytes) + i.IErrors = int64(n.ierrors) + i.OPackets = int64(n.opackets) + i.OBytes = int64(n.obytes) + i.OErrors = int64(n.oerrors) + i.Collisions = int64(n.collisions) + i.XmitDrops = int64(n.xmitdrops) + i.Version = int64(n.version) + + return i +} + +func perfstatdisk2disk(n *C.perfstat_disk_t) Disk { + var d Disk + + d.Name = C.GoString(&n.name[0]) + d.Description = C.GoString(&n.description[0]) + d.VGName = C.GoString(&n.vgname[0]) + d.Size = int64(n.size) + d.Free = int64(n.free) + d.BSize = int64(n.bsize) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Wblks = int64(n.wblks) + d.Rblks = int64(n.rblks) + d.QDepth = int64(n.qdepth) + d.Time = int64(n.time) + d.Adapter = C.GoString(&n.adapter[0]) + d.PathsCount = int32(n.paths_count) + d.QFull = int64(n.q_full) + d.Rserv = int64(n.rserv) + d.RTimeOut = int64(n.rtimeout) + d.Rfailed = int64(n.rfailed) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.Wserv = int64(n.wserv) + d.WTimeOut = int64(n.wtimeout) + d.Wfailed = int64(n.wfailed) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WqDepth = int64(n.wq_depth) + d.WqSampled = int64(n.wq_sampled) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + d.QSampled = int64(n.q_sampled) + d.Version = int64(n.version) + d.PseudoDisk = (n.dk_type[0] & (1 << 7)) > 0 + d.VTDisk = (n.dk_type[0] & (1 << 6)) > 0 + + return d +} + +func perfstatdiskpath2diskpath(n *C.perfstat_diskpath_t) DiskPath { + var d DiskPath + + d.Name = C.GoString(&n.name[0]) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Rblks = int64(n.rblks) + d.Wblks = int64(n.wblks) + d.Time = int64(n.time) + d.Adapter = C.GoString(&n.adapter[0]) + d.QFull = int64(n.q_full) + d.Rserv = int64(n.rserv) + d.RTimeOut = int64(n.rtimeout) + d.Rfailed = int64(n.rfailed) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.Wserv = int64(n.wserv) + d.WTimeOut = int64(n.wtimeout) + d.Wfailed = int64(n.wfailed) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WqDepth = int64(n.wq_depth) + d.WqSampled = int64(n.wq_sampled) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + d.QSampled = int64(n.q_sampled) + d.Version = int64(n.version) + + return d +} + +func perfstatfcstat2fcadapter(n *C.perfstat_fcstat_t) FCAdapter { + var f FCAdapter + + f.Version = int64(n.version) + f.Name = C.GoString(&n.name[0]) + f.State = int32(n.state) + f.InputRequests = int64(n.InputRequests) + f.OutputRequests = int64(n.OutputRequests) + f.InputBytes = int64(n.InputBytes) + f.OutputBytes = int64(n.OutputBytes) + f.EffMaxTransfer = int64(n.EffMaxTransfer) + f.NoDMAResourceCnt = int64(n.NoDMAResourceCnt) + f.NoCmdResourceCnt = int64(n.NoCmdResourceCnt) + f.AttentionType = int32(n.AttentionType) + f.SecondsSinceLastReset = int64(n.SecondsSinceLastReset) + f.TxFrames = int64(n.TxFrames) + f.TxWords = int64(n.TxWords) + f.RxFrames = int64(n.RxFrames) + f.RxWords = int64(n.RxWords) + f.LIPCount = int64(n.LIPCount) + f.NOSCount = int64(n.NOSCount) + f.ErrorFrames = int64(n.ErrorFrames) + f.DumpedFrames = int64(n.DumpedFrames) + f.LinkFailureCount = int64(n.LinkFailureCount) + f.LossofSyncCount = int64(n.LossofSyncCount) + f.LossofSignal = int64(n.LossofSignal) + f.PrimitiveSeqProtocolErrCount = int64(n.PrimitiveSeqProtocolErrCount) + f.InvalidTxWordCount = int64(n.InvalidTxWordCount) + f.InvalidCRCCount = int64(n.InvalidCRCCount) + f.PortFcId = int64(n.PortFcId) + f.PortSpeed = int64(n.PortSpeed) + f.PortType = C.GoString(&n.PortType[0]) + f.PortWWN = int64(n.PortWWN) + f.PortSupportedSpeed = int64(n.PortSupportedSpeed) + f.AdapterType = int(n.adapter_type) + f.VfcName = C.GoString(&n.vfc_name[0]) + f.ClientPartName = C.GoString(&n.client_part_name[0]) + + return f +} + +func perfstatlogicalvolume2logicalvolume(n *C.perfstat_logicalvolume_t) LogicalVolume { + var l LogicalVolume + + l.Name = C.GoString(&n.name[0]) + l.VGName = C.GoString(&n.vgname[0]) + l.OpenClose = int64(n.open_close) + l.State = int64(n.state) + l.MirrorPolicy = int64(n.mirror_policy) + l.MirrorWriteConsistency = int64(n.mirror_write_consistency) + l.WriteVerify = int64(n.write_verify) + l.PPsize = int64(n.ppsize) + l.LogicalPartitions = int64(n.logical_partitions) + l.Mirrors = int32(n.mirrors) + l.IOCnt = int64(n.iocnt) + l.KBReads = int64(n.kbreads) + l.KBWrites = int64(n.kbwrites) + l.Version = int64(n.version) + + return l +} + +func perfstatvolumegroup2volumegroup(n *C.perfstat_volumegroup_t) VolumeGroup { + var v VolumeGroup + + v.Name = C.GoString(&n.name[0]) + v.TotalDisks = int64(n.total_disks) + v.ActiveDisks = int64(n.active_disks) + v.TotalLogicalVolumes = int64(n.total_logical_volumes) + v.OpenedLogicalVolumes = int64(n.opened_logical_volumes) + v.IOCnt = int64(n.iocnt) + v.KBReads = int64(n.kbreads) + v.KBWrites = int64(n.kbwrites) + v.Version = int64(n.version) + v.VariedState = int(n.variedState) + + return v +} + +func perfstatmemorypage2memorypage(n *C.perfstat_memory_page_t) MemoryPage { + var m MemoryPage + + m.PSize = int64(n.psize) + m.RealTotal = int64(n.real_total) + m.RealFree = int64(n.real_free) + m.RealPinned = int64(n.real_pinned) + m.RealInUse = int64(n.real_inuse) + m.PgExct = int64(n.pgexct) + m.PgIns = int64(n.pgins) + m.PgOuts = int64(n.pgouts) + m.PgSpIns = int64(n.pgspins) + m.PgSpOuts = int64(n.pgspouts) + m.Scans = int64(n.scans) + m.Cycles = int64(n.cycles) + m.PgSteals = int64(n.pgsteals) + m.NumPerm = int64(n.numperm) + m.NumPgSp = int64(n.numpgsp) + m.RealSystem = int64(n.real_system) + m.RealUser = int64(n.real_user) + m.RealProcess = int64(n.real_process) + m.VirtActive = int64(n.virt_active) + m.ComprsdTotal = int64(n.comprsd_total) + m.ComprsdWsegPgs = int64(n.comprsd_wseg_pgs) + m.CPgIns = int64(n.cpgins) + m.CPgOuts = int64(n.cpgouts) + m.CPoolInUse = int64(n.cpool_inuse) + m.UCPoolSize = int64(n.ucpool_size) + m.ComprsdWsegSize = int64(n.comprsd_wseg_size) + m.Version = int64(n.version) + m.RealAvail = int64(n.real_avail) + + return m +} + +func perfstatnetbuffer2netbuffer(n *C.perfstat_netbuffer_t) NetBuffer { + var b NetBuffer + + b.Name = C.GoString(&n.name[0]) + b.InUse = int64(n.inuse) + b.Calls = int64(n.calls) + b.Delayed = int64(n.delayed) + b.Free = int64(n.free) + b.Failed = int64(n.failed) + b.HighWatermark = int64(n.highwatermark) + b.Freed = int64(n.freed) + b.Version = int64(n.version) + + return b +} + +func perfstatnetinterface2netiface(n *C.perfstat_netinterface_t) NetIface { + var i NetIface + + i.Name = C.GoString(&n.name[0]) + i.Description = C.GoString(&n.description[0]) + i.Type = uint8(n._type) + i.MTU = int64(n.mtu) + i.IPackets = int64(n.ipackets) + i.IBytes = int64(n.ibytes) + i.IErrors = int64(n.ierrors) + i.OPackets = int64(n.opackets) + i.OBytes = int64(n.obytes) + i.OErrors = int64(n.oerrors) + i.Collisions = int64(n.collisions) + i.Bitrate = int64(n.bitrate) + i.XmitDrops = int64(n.xmitdrops) + i.Version = int64(n.version) + i.IfIqDrops = int64(n.if_iqdrops) + i.IfArpDrops = int64(n.if_arpdrops) + + return i +} + +func perfstatnetadapter2netadapter(n *C.perfstat_netadapter_t) NetAdapter { + var i NetAdapter + + i.Version = int64(n.version) + i.Name = C.GoString(&n.name[0]) + i.TxPackets = int64(n.tx_packets) + i.TxBytes = int64(n.tx_bytes) + i.TxInterrupts = int64(n.tx_interrupts) + i.TxErrors = int64(n.tx_errors) + i.TxPacketsDropped = int64(n.tx_packets_dropped) + i.TxQueueSize = int64(n.tx_queue_size) + i.TxQueueLen = int64(n.tx_queue_len) + i.TxQueueOverflow = int64(n.tx_queue_overflow) + i.TxBroadcastPackets = int64(n.tx_broadcast_packets) + i.TxMulticastPackets = int64(n.tx_multicast_packets) + i.TxCarrierSense = int64(n.tx_carrier_sense) + i.TxDMAUnderrun = int64(n.tx_DMA_underrun) + i.TxLostCTSErrors = int64(n.tx_lost_CTS_errors) + i.TxMaxCollisionErrors = int64(n.tx_max_collision_errors) + i.TxLateCollisionErrors = int64(n.tx_late_collision_errors) + i.TxDeferred = int64(n.tx_deferred) + i.TxTimeoutErrors = int64(n.tx_timeout_errors) + i.TxSingleCollisionCount = int64(n.tx_single_collision_count) + i.TxMultipleCollisionCount = int64(n.tx_multiple_collision_count) + i.RxPackets = int64(n.rx_packets) + i.RxBytes = int64(n.rx_bytes) + i.RxInterrupts = int64(n.rx_interrupts) + i.RxErrors = int64(n.rx_errors) + i.RxPacketsDropped = int64(n.rx_packets_dropped) + i.RxBadPackets = int64(n.rx_bad_packets) + i.RxMulticastPackets = int64(n.rx_multicast_packets) + i.RxBroadcastPackets = int64(n.rx_broadcast_packets) + i.RxCRCErrors = int64(n.rx_CRC_errors) + i.RxDMAOverrun = int64(n.rx_DMA_overrun) + i.RxAlignmentErrors = int64(n.rx_alignment_errors) + i.RxNoResourceErrors = int64(n.rx_noresource_errors) + i.RxCollisionErrors = int64(n.rx_collision_errors) + i.RxPacketTooShortErrors = int64(n.rx_packet_tooshort_errors) + i.RxPacketTooLongErrors = int64(n.rx_packet_toolong_errors) + i.RxPacketDiscardedByAdapter = int64(n.rx_packets_discardedbyadapter) + i.AdapterType = int32(n.adapter_type) + + return i +} + +func perfstatpagingspace2pagingspace(n *C.perfstat_pagingspace_t) PagingSpace { + var i PagingSpace + + i.Name = C.GoString(&n.name[0]) + i.Type = uint8(n._type) + i.VGName = C.GoString(C.get_ps_vgname(n)) + i.Hostname = C.GoString(C.get_ps_hostname(n)) + i.Filename = C.GoString(C.get_ps_filename(n)) + i.LPSize = int64(n.lp_size) + i.MBSize = int64(n.mb_size) + i.MBUsed = int64(n.mb_used) + i.IOPending = int64(n.io_pending) + i.Active = uint8(n.active) + i.Automatic = uint8(n.automatic) + i.Version = int64(n.version) + + return i +} + +func perfstatprocess2process(n *C.perfstat_process_t) Process { + var i Process + + i.Version = int64(n.version) + i.PID = int64(n.pid) + i.ProcessName = C.GoString(&n.proc_name[0]) + i.Priority = int32(n.proc_priority) + i.NumThreads = int64(n.num_threads) + i.UID = int64(n.proc_uid) + i.ClassID = int64(n.proc_classid) + i.Size = int64(n.proc_size) + i.RealMemData = int64(n.proc_real_mem_data) + i.RealMemText = int64(n.proc_real_mem_text) + i.VirtMemData = int64(n.proc_virt_mem_data) + i.VirtMemText = int64(n.proc_virt_mem_text) + i.SharedLibDataSize = int64(n.shared_lib_data_size) + i.HeapSize = int64(n.heap_size) + i.RealInUse = int64(n.real_inuse) + i.VirtInUse = int64(n.virt_inuse) + i.Pinned = int64(n.pinned) + i.PgSpInUse = int64(n.pgsp_inuse) + i.FilePages = int64(n.filepages) + i.RealInUseMap = int64(n.real_inuse_map) + i.VirtInUseMap = int64(n.virt_inuse_map) + i.PinnedInUseMap = int64(n.pinned_inuse_map) + i.UCpuTime = float64(n.ucpu_time) + i.SCpuTime = float64(n.scpu_time) + i.LastTimeBase = int64(n.last_timebase) + i.InBytes = int64(n.inBytes) + i.OutBytes = int64(n.outBytes) + i.InOps = int64(n.inOps) + i.OutOps = int64(n.outOps) + + return i +} + +func perfstatthread2thread(n *C.perfstat_thread_t) Thread { + var i Thread + + i.TID = int64(n.tid) + i.PID = int64(n.pid) + i.CpuID = int64(n.cpuid) + i.UCpuTime = float64(n.ucpu_time) + i.SCpuTime = float64(n.scpu_time) + i.LastTimeBase = int64(n.last_timebase) + i.Version = int64(n.version) + + return i +} + +func fsinfo2filesystem(n *C.struct_fsinfo) FileSystem { + var i FileSystem + + i.Device = C.GoString(n.devname) + i.MountPoint = C.GoString(n.fsname) + i.FSType = int(n.fstype) + i.Flags = uint(n.flags) + i.TotalBlocks = int64(n.totalblks) + i.FreeBlocks = int64(n.freeblks) + i.TotalInodes = int64(n.totalinodes) + i.FreeInodes = int64(n.freeinodes) + + return i +} + +func lparinfo2partinfo(n C.lpar_info_format2_t) PartitionInfo { + var i PartitionInfo + + i.Version = int(n.version) + i.OnlineMemory = uint64(n.online_memory) + i.TotalDispatchTime = uint64(n.tot_dispatch_time) + i.PoolIdleTime = uint64(n.pool_idle_time) + i.DispatchLatency = uint64(n.dispatch_latency) + i.LparFlags = uint(n.lpar_flags) + i.PCpusInSys = uint(n.pcpus_in_sys) + i.OnlineVCpus = uint(n.online_vcpus) + i.OnlineLCpus = uint(n.online_lcpus) + i.PCpusInPool = uint(n.pcpus_in_pool) + i.UnallocCapacity = uint(n.unalloc_capacity) + i.EntitledCapacity = uint(n.entitled_capacity) + i.VariableWeight = uint(n.variable_weight) + i.UnallocWeight = uint(n.unalloc_weight) + i.MinReqVCpuCapacity = uint(n.min_req_vcpu_capacity) + i.GroupId = uint8(n.group_id) + i.PoolId = uint8(n.pool_id) + i.ShCpusInSys = uint(n.shcpus_in_sys) + i.MaxPoolCapacity = uint(n.max_pool_capacity) + i.EntitledPoolCapacity = uint(n.entitled_pool_capacity) + i.PoolMaxTime = uint64(n.pool_max_time) + i.PoolBusyTime = uint64(n.pool_busy_time) + i.PoolScaledBusyTime = uint64(n.pool_scaled_busy_time) + i.ShCpuTotalTime = uint64(n.shcpu_tot_time) + i.ShCpuBusyTime = uint64(n.shcpu_busy_time) + i.ShCpuScaledBusyTime = uint64(n.shcpu_scaled_busy_time) + i.EntMemCapacity = uint64(n.ent_mem_capacity) + i.PhysMem = uint64(n.phys_mem) + i.VrmPoolPhysMem = uint64(n.vrm_pool_physmem) + i.HypPageSize = uint(n.hyp_pagesize) + i.VrmPoolId = int(n.vrm_pool_id) + i.VrmGroupId = int(n.vrm_group_id) + i.VarMemWeight = int(n.var_mem_weight) + i.UnallocVarMemWeight = int(n.unalloc_var_mem_weight) + i.UnallocEntMemCapacity = uint64(n.unalloc_ent_mem_capacity) + i.TrueOnlineMemory = uint64(n.true_online_memory) + i.AmeOnlineMemory = uint64(n.ame_online_memory) + i.AmeType = uint8(n.ame_type) + i.SpecExecMode = uint8(n.spec_exec_mode) + i.AmeFactor = uint(n.ame_factor) + i.EmPartMajorCode = uint(n.em_part_major_code) + i.EmPartMinorCode = uint(n.em_part_minor_code) + i.BytesCoalesced = uint64(n.bytes_coalesced) + i.BytesCoalescedMemPool = uint64(n.bytes_coalesced_mempool) + i.PurrCoalescing = uint64(n.purr_coalescing) + i.SpurrCoalescing = uint64(n.spurr_coalescing) + + return i +} diff --git a/vendor/github.com/power-devops/perfstat/lparstat.go b/vendor/github.com/power-devops/perfstat/lparstat.go new file mode 100644 index 00000000..470a1af2 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/lparstat.go @@ -0,0 +1,40 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func PartitionStat() (*PartitionConfig, error) { + var part C.perfstat_partition_config_t + + rc := C.perfstat_partition_config(nil, &part, C.sizeof_perfstat_partition_config_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_partition_config() error") + } + p := perfstatpartitionconfig2partitionconfig(part) + return &p, nil + +} + +func LparInfo() (*PartitionInfo, error) { + var pinfo C.lpar_info_format2_t + + rc := C.lpar_get_info(C.LPAR_INFO_FORMAT2, unsafe.Pointer(&pinfo), C.sizeof_lpar_info_format2_t) + if rc != 0 { + return nil, fmt.Errorf("lpar_get_info() error") + } + p := lparinfo2partinfo(pinfo) + return &p, nil +} diff --git a/vendor/github.com/power-devops/perfstat/lvmstat.go b/vendor/github.com/power-devops/perfstat/lvmstat.go new file mode 100644 index 00000000..2ce99086 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/lvmstat.go @@ -0,0 +1,73 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func LogicalVolumeStat() ([]LogicalVolume, error) { + var lv *C.perfstat_logicalvolume_t + var lvname C.perfstat_id_t + + numlvs := C.perfstat_logicalvolume(nil, nil, C.sizeof_perfstat_logicalvolume_t, 0) + if numlvs <= 0 { + return nil, fmt.Errorf("perfstat_logicalvolume() error") + } + + lv_len := C.sizeof_perfstat_logicalvolume_t * C.ulong(numlvs) + lv = (*C.perfstat_logicalvolume_t)(C.malloc(lv_len)) + defer C.free(unsafe.Pointer(lv)) + C.strcpy(&lvname.name[0], C.CString("")) + r := C.perfstat_logicalvolume(&lvname, lv, C.sizeof_perfstat_logicalvolume_t, numlvs) + if r < 0 { + return nil, fmt.Errorf("perfstat_logicalvolume() error") + } + lvs := make([]LogicalVolume, r) + for i := 0; i < int(r); i++ { + l := C.get_logicalvolume_stat(lv, C.int(i)) + if l != nil { + lvs[i] = perfstatlogicalvolume2logicalvolume(l) + } + } + return lvs, nil +} + +func VolumeGroupStat() ([]VolumeGroup, error) { + var vg *C.perfstat_volumegroup_t + var vgname C.perfstat_id_t + + numvgs := C.perfstat_volumegroup(nil, nil, C.sizeof_perfstat_volumegroup_t, 0) + if numvgs <= 0 { + return nil, fmt.Errorf("perfstat_volumegroup() error") + } + + vg_len := C.sizeof_perfstat_volumegroup_t * C.ulong(numvgs) + vg = (*C.perfstat_volumegroup_t)(C.malloc(vg_len)) + defer C.free(unsafe.Pointer(vg)) + C.strcpy(&vgname.name[0], C.CString("")) + r := C.perfstat_volumegroup(&vgname, vg, C.sizeof_perfstat_volumegroup_t, numvgs) + if r < 0 { + return nil, fmt.Errorf("perfstat_volumegroup() error") + } + vgs := make([]VolumeGroup, r) + for i := 0; i < int(r); i++ { + v := C.get_volumegroup_stat(vg, C.int(i)) + if v != nil { + vgs[i] = perfstatvolumegroup2volumegroup(v) + } + } + return vgs, nil +} diff --git a/vendor/github.com/power-devops/perfstat/memstat.go b/vendor/github.com/power-devops/perfstat/memstat.go new file mode 100644 index 00000000..52133f0a --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/memstat.go @@ -0,0 +1,85 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func MemoryTotalStat() (*MemoryTotal, error) { + var memory C.perfstat_memory_total_t + + rc := C.perfstat_memory_total(nil, &memory, C.sizeof_perfstat_memory_total_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_memory_total() error") + } + m := perfstatmemorytotal2memorytotal(memory) + return &m, nil +} + +func MemoryPageStat() ([]MemoryPage, error) { + var mempage *C.perfstat_memory_page_t + var fps C.perfstat_psize_t + + numps := C.perfstat_memory_page(nil, nil, C.sizeof_perfstat_memory_page_t, 0) + if numps < 1 { + return nil, fmt.Errorf("perfstat_memory_page() error") + } + + mp_len := C.sizeof_perfstat_memory_page_t * C.ulong(numps) + mempage = (*C.perfstat_memory_page_t)(C.malloc(mp_len)) + defer C.free(unsafe.Pointer(mempage)) + fps.psize = C.FIRST_PSIZE + r := C.perfstat_memory_page(&fps, mempage, C.sizeof_perfstat_memory_page_t, numps) + if r < 1 { + return nil, fmt.Errorf("perfstat_memory_page() error") + } + ps := make([]MemoryPage, r) + for i := 0; i < int(r); i++ { + p := C.get_memory_page_stat(mempage, C.int(i)) + if p != nil { + ps[i] = perfstatmemorypage2memorypage(p) + } + } + return ps, nil +} + +func PagingSpaceStat() ([]PagingSpace, error) { + var pspace *C.perfstat_pagingspace_t + var fps C.perfstat_id_t + + numps := C.perfstat_pagingspace(nil, nil, C.sizeof_perfstat_pagingspace_t, 0) + if numps <= 0 { + return nil, fmt.Errorf("perfstat_pagingspace() error") + } + + ps_len := C.sizeof_perfstat_pagingspace_t * C.ulong(numps) + pspace = (*C.perfstat_pagingspace_t)(C.malloc(ps_len)) + defer C.free(unsafe.Pointer(pspace)) + C.strcpy(&fps.name[0], C.CString(C.FIRST_PAGINGSPACE)) + r := C.perfstat_pagingspace(&fps, pspace, C.sizeof_perfstat_pagingspace_t, numps) + if r < 1 { + return nil, fmt.Errorf("perfstat_pagingspace() error") + } + ps := make([]PagingSpace, r) + for i := 0; i < int(r); i++ { + p := C.get_pagingspace_stat(pspace, C.int(i)) + if p != nil { + ps[i] = perfstatpagingspace2pagingspace(p) + } + } + return ps, nil +} diff --git a/vendor/github.com/power-devops/perfstat/netstat.go b/vendor/github.com/power-devops/perfstat/netstat.go new file mode 100644 index 00000000..847d2946 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/netstat.go @@ -0,0 +1,118 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func NetIfaceTotalStat() (*NetIfaceTotal, error) { + var nif C.perfstat_netinterface_total_t + + rc := C.perfstat_netinterface_total(nil, &nif, C.sizeof_perfstat_netinterface_total_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_netinterface_total() error") + } + n := perfstatnetinterfacetotal2netifacetotal(nif) + return &n, nil +} + +func NetBufferStat() ([]NetBuffer, error) { + var nbuf *C.perfstat_netbuffer_t + var first C.perfstat_id_t + + numbuf := C.perfstat_netbuffer(nil, nil, C.sizeof_perfstat_netbuffer_t, 0) + if numbuf < 1 { + return nil, fmt.Errorf("perfstat_netbuffer() error") + } + + nblen := C.sizeof_perfstat_netbuffer_t * C.ulong(numbuf) + nbuf = (*C.perfstat_netbuffer_t)(C.malloc(nblen)) + defer C.free(unsafe.Pointer(nbuf)) + C.strcpy(&first.name[0], C.CString(C.FIRST_NETBUFFER)) + r := C.perfstat_netbuffer(&first, nbuf, C.sizeof_perfstat_netbuffer_t, numbuf) + if r < 0 { + return nil, fmt.Errorf("perfstat_netbuffer() error") + } + nb := make([]NetBuffer, r) + for i := 0; i < int(r); i++ { + b := C.get_netbuffer_stat(nbuf, C.int(i)) + if b != nil { + nb[i] = perfstatnetbuffer2netbuffer(b) + } + } + return nb, nil +} + +func NetIfaceStat() ([]NetIface, error) { + var nif *C.perfstat_netinterface_t + var first C.perfstat_id_t + + numif := C.perfstat_netinterface(nil, nil, C.sizeof_perfstat_netinterface_t, 0) + if numif < 0 { + return nil, fmt.Errorf("perfstat_netinterface() error") + } + if numif == 0 { + return []NetIface{}, fmt.Errorf("no network interfaces found") + } + + iflen := C.sizeof_perfstat_netinterface_t * C.ulong(numif) + nif = (*C.perfstat_netinterface_t)(C.malloc(iflen)) + defer C.free(unsafe.Pointer(nif)) + C.strcpy(&first.name[0], C.CString(C.FIRST_NETINTERFACE)) + r := C.perfstat_netinterface(&first, nif, C.sizeof_perfstat_netinterface_t, numif) + if r < 0 { + return nil, fmt.Errorf("perfstat_netinterface() error") + } + ifs := make([]NetIface, r) + for i := 0; i < int(r); i++ { + b := C.get_netinterface_stat(nif, C.int(i)) + if b != nil { + ifs[i] = perfstatnetinterface2netiface(b) + } + } + return ifs, nil +} + +func NetAdapterStat() ([]NetAdapter, error) { + var adapters *C.perfstat_netadapter_t + var first C.perfstat_id_t + + numad := C.perfstat_netadapter(nil, nil, C.sizeof_perfstat_netadapter_t, 0) + if numad < 0 { + return nil, fmt.Errorf("perfstat_netadater() error") + } + if numad == 0 { + return []NetAdapter{}, fmt.Errorf("no network adapters found") + } + + adplen := C.sizeof_perfstat_netadapter_t * C.ulong(numad) + adapters = (*C.perfstat_netadapter_t)(C.malloc(adplen)) + defer C.free(unsafe.Pointer(adapters)) + C.strcpy(&first.name[0], C.CString(C.FIRST_NETINTERFACE)) + r := C.perfstat_netadapter(&first, adapters, C.sizeof_perfstat_netadapter_t, numad) + if r < 0 { + return nil, fmt.Errorf("perfstat_netadapter() error") + } + ads := make([]NetAdapter, r) + for i := 0; i < int(r); i++ { + b := C.get_netadapter_stat(adapters, C.int(i)) + if b != nil { + ads[i] = perfstatnetadapter2netadapter(b) + } + } + return ads, nil +} diff --git a/vendor/github.com/power-devops/perfstat/procstat.go b/vendor/github.com/power-devops/perfstat/procstat.go new file mode 100644 index 00000000..957ec2b3 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/procstat.go @@ -0,0 +1,76 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func ProcessStat() ([]Process, error) { + var proc *C.perfstat_process_t + var first C.perfstat_id_t + + numproc := C.perfstat_process(nil, nil, C.sizeof_perfstat_process_t, 0) + if numproc < 1 { + return nil, fmt.Errorf("perfstat_process() error") + } + + plen := C.sizeof_perfstat_process_t * C.ulong(numproc) + proc = (*C.perfstat_process_t)(C.malloc(plen)) + defer C.free(unsafe.Pointer(proc)) + C.strcpy(&first.name[0], C.CString("")) + r := C.perfstat_process(&first, proc, C.sizeof_perfstat_process_t, numproc) + if r < 0 { + return nil, fmt.Errorf("perfstat_process() error") + } + + ps := make([]Process, r) + for i := 0; i < int(r); i++ { + p := C.get_process_stat(proc, C.int(i)) + if p != nil { + ps[i] = perfstatprocess2process(p) + } + } + return ps, nil +} + +func ThreadStat() ([]Thread, error) { + var thread *C.perfstat_thread_t + var first C.perfstat_id_t + + numthr := C.perfstat_thread(nil, nil, C.sizeof_perfstat_thread_t, 0) + if numthr < 1 { + return nil, fmt.Errorf("perfstat_thread() error") + } + + thlen := C.sizeof_perfstat_thread_t * C.ulong(numthr) + thread = (*C.perfstat_thread_t)(C.malloc(thlen)) + defer C.free(unsafe.Pointer(thread)) + C.strcpy(&first.name[0], C.CString("")) + r := C.perfstat_thread(&first, thread, C.sizeof_perfstat_thread_t, numthr) + if r < 0 { + return nil, fmt.Errorf("perfstat_thread() error") + } + + th := make([]Thread, r) + for i := 0; i < int(r); i++ { + t := C.get_thread_stat(thread, C.int(i)) + if t != nil { + th[i] = perfstatthread2thread(t) + } + } + return th, nil +} diff --git a/vendor/github.com/power-devops/perfstat/sysconf.go b/vendor/github.com/power-devops/perfstat/sysconf.go new file mode 100644 index 00000000..b557da0d --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/sysconf.go @@ -0,0 +1,196 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#include +*/ +import "C" + +import "fmt" + +const ( + SC_ARG_MAX = 0 + SC_CHILD_MAX = 1 + SC_CLK_TCK = 2 + SC_NGROUPS_MAX = 3 + SC_OPEN_MAX = 4 + SC_STREAM_MAX = 5 + SC_TZNAME_MAX = 6 + SC_JOB_CONTROL = 7 + SC_SAVED_IDS = 8 + SC_VERSION = 9 + SC_POSIX_ARG_MAX = 10 + SC_POSIX_CHILD_MAX = 11 + SC_POSIX_LINK_MAX = 12 + SC_POSIX_MAX_CANON = 13 + SC_POSIX_MAX_INPUT = 14 + SC_POSIX_NAME_MAX = 15 + SC_POSIX_NGROUPS_MAX = 16 + SC_POSIX_OPEN_MAX = 17 + SC_POSIX_PATH_MAX = 18 + SC_POSIX_PIPE_BUF = 19 + SC_POSIX_SSIZE_MAX = 20 + SC_POSIX_STREAM_MAX = 21 + SC_POSIX_TZNAME_MAX = 22 + SC_BC_BASE_MAX = 23 + SC_BC_DIM_MAX = 24 + SC_BC_SCALE_MAX = 25 + SC_BC_STRING_MAX = 26 + SC_EQUIV_CLASS_MAX = 27 + SC_EXPR_NEST_MAX = 28 + SC_LINE_MAX = 29 + SC_RE_DUP_MAX = 30 + SC_2_VERSION = 31 + SC_2_C_DEV = 32 + SC_2_FORT_DEV = 33 + SC_2_FORT_RUN = 34 + SC_2_LOCALEDEF = 35 + SC_2_SW_DEV = 36 + SC_POSIX2_BC_BASE_MAX = 37 + SC_POSIX2_BC_DIM_MAX = 38 + SC_POSIX2_BC_SCALE_MAX = 39 + SC_POSIX2_BC_STRING_MAX = 40 + SC_POSIX2_BC_EQUIV_CLASS_MAX = 41 + SC_POSIX2_BC_EXPR_NEST_MAX = 42 + SC_POSIX2_BC_LINE_MAX = 43 + SC_POSIX2_BC_RE_DUP_MAX = 44 + SC_PASS_MAX = 45 + SC_XOPEN_VERSION = 46 + SC_ATEXIT_MAX = 47 + SC_PAGE_SIZE = 48 + SC_PAGESIZE = SC_PAGE_SIZE + SC_AES_OS_VERSION = 49 + SC_COLL_WEIGHTS_MAX = 50 + SC_2_C_WIND = 51 + SC_2_C_VERSION = 52 + SC_2_UPE = 53 + SC_2_CHAR_TERM = 54 + SC_XOPEN_SHM = 55 + SC_XOPEN_CRYPT = 56 + SC_XOPEN_ENH_I18N = 57 + SC_IOV_MAX = 58 + SC_THREAD_SAFE_FUNCTIONS = 59 + SC_THREADS = 60 + SC_THREAD_ATTR_STACKADDR = 61 + SC_THREAD_ATTR_STACKSIZE = 62 + SC_THREAD_FORKALL = 63 + SC_THREAD_PRIORITY_SCHEDULING = 64 + SC_THREAD_PRIO_INHERIT = 65 + SC_THREAD_PRIO_PROTECT = 66 + SC_THREAD_PROCESS_SHARED = 67 + SC_THREAD_KEYS_MAX = 68 + SC_THREAD_DATAKEYS_MAX = SC_THREAD_KEYS_MAX + SC_THREAD_STACK_MIN = 69 + SC_THREAD_THREADS_MAX = 70 + SC_NPROCESSORS_CONF = 71 + SC_NPROCESSORS_ONLN = 72 + SC_XOPEN_UNIX = 73 + SC_AIO_LISTIO_MAX = 75 + SC_AIO_MAX = 76 + SC_AIO_PRIO_DELTA_MAX = 77 + SC_ASYNCHRONOUS_IO = 78 + SC_DELAYTIMER_MAX = 79 + SC_FSYNC = 80 + SC_GETGR_R_SIZE_MAX = 81 + SC_GETPW_R_SIZE_MAX = 82 + SC_LOGIN_NAME_MAX = 83 + SC_MAPPED_FILES = 84 + SC_MEMLOCK = 85 + SC_MEMLOCK_RANGE = 86 + SC_MEMORY_PROTECTION = 87 + SC_MESSAGE_PASSING = 88 + SC_MQ_OPEN_MAX = 89 + SC_MQ_PRIO_MAX = 90 + SC_PRIORITIZED_IO = 91 + SC_PRIORITY_SCHEDULING = 92 + SC_REALTIME_SIGNALS = 93 + SC_RTSIG_MAX = 94 + SC_SEMAPHORES = 95 + SC_SEM_NSEMS_MAX = 96 + SC_SEM_VALUE_MAX = 97 + SC_SHARED_MEMORY_OBJECTS = 98 + SC_SIGQUEUE_MAX = 99 + SC_SYNCHRONIZED_IO = 100 + SC_THREAD_DESTRUCTOR_ITERATIONS = 101 + SC_TIMERS = 102 + SC_TIMER_MAX = 103 + SC_TTY_NAME_MAX = 104 + SC_XBS5_ILP32_OFF32 = 105 + SC_XBS5_ILP32_OFFBIG = 106 + SC_XBS5_LP64_OFF64 = 107 + SC_XBS5_LPBIG_OFFBIG = 108 + SC_XOPEN_XCU_VERSION = 109 + SC_XOPEN_REALTIME = 110 + SC_XOPEN_REALTIME_THREADS = 111 + SC_XOPEN_LEGACY = 112 + SC_REENTRANT_FUNCTIONS = SC_THREAD_SAFE_FUNCTIONS + SC_PHYS_PAGES = 113 + SC_AVPHYS_PAGES = 114 + SC_LPAR_ENABLED = 115 + SC_LARGE_PAGESIZE = 116 + SC_AIX_KERNEL_BITMODE = 117 + SC_AIX_REALMEM = 118 + SC_AIX_HARDWARE_BITMODE = 119 + SC_AIX_MP_CAPABLE = 120 + SC_V6_ILP32_OFF32 = 121 + SC_V6_ILP32_OFFBIG = 122 + SC_V6_LP64_OFF64 = 123 + SC_V6_LPBIG_OFFBIG = 124 + SC_XOPEN_STREAMS = 125 + SC_HOST_NAME_MAX = 126 + SC_REGEXP = 127 + SC_SHELL = 128 + SC_SYMLOOP_MAX = 129 + SC_ADVISORY_INFO = 130 + SC_FILE_LOCKING = 131 + SC_2_PBS = 132 + SC_2_PBS_ACCOUNTING = 133 + SC_2_PBS_CHECKPOINT = 134 + SC_2_PBS_LOCATE = 135 + SC_2_PBS_MESSAGE = 136 + SC_2_PBS_TRACK = 137 + SC_BARRIERS = 138 + SC_CLOCK_SELECTION = 139 + SC_CPUTIME = 140 + SC_MONOTONIC_CLOCK = 141 + SC_READER_WRITER_LOCKS = 142 + SC_SPAWN = 143 + SC_SPIN_LOCKS = 144 + SC_SPORADIC_SERVER = 145 + SC_THREAD_CPUTIME = 146 + SC_THREAD_SPORADIC_SERVER = 147 + SC_TIMEOUTS = 148 + SC_TRACE = 149 + SC_TRACE_EVENT_FILTER = 150 + SC_TRACE_INHERIT = 151 + SC_TRACE_LOG = 152 + SC_TYPED_MEMORY_OBJECTS = 153 + SC_IPV6 = 154 + SC_RAW_SOCKETS = 155 + SC_SS_REPL_MAX = 156 + SC_TRACE_EVENT_NAME_MAX = 157 + SC_TRACE_NAME_MAX = 158 + SC_TRACE_SYS_MAX = 159 + SC_TRACE_USER_EVENT_MAX = 160 + SC_AIX_UKEYS = 161 + SC_AIX_ENHANCED_AFFINITY = 162 + SC_V7_ILP32_OFF32 = 163 + SC_V7_ILP32_OFFBIG = 164 + SC_V7_LP64_OFF64 = 165 + SC_V7_LPBIG_OFFBIG = 166 + SC_THREAD_ROBUST_PRIO_INHERIT = 167 + SC_THREAD_ROBUST_PRIO_PROTECT = 168 + SC_XOPEN_UUCP = 169 + SC_XOPEN_ARMOR = 170 +) + +func Sysconf(name int32) (int64, error) { + r := C.sysconf(C.int(name)) + if r == -1 { + return 0, fmt.Errorf("sysconf error") + } else { + return int64(r), nil + } +} diff --git a/vendor/github.com/power-devops/perfstat/systemcfg.go b/vendor/github.com/power-devops/perfstat/systemcfg.go new file mode 100644 index 00000000..b7c7b725 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/systemcfg.go @@ -0,0 +1,662 @@ +//go:build aix +// +build aix + +package perfstat + +import "golang.org/x/sys/unix" + +// function Getsystemcfg() is defined in golang.org/x/sys/unix +// we define here just missing constants for the function and some helpers + +// Calls to getsystemcfg() +const ( + SC_ARCH = 1 /* processor architecture */ + SC_IMPL = 2 /* processor implementation */ + SC_VERS = 3 /* processor version */ + SC_WIDTH = 4 /* width (32 || 64) */ + SC_NCPUS = 5 /* 1 = UP, n = n-way MP */ + SC_L1C_ATTR = 6 /* L1 cache attributes (bit flags) */ + SC_L1C_ISZ = 7 /* size of L1 instruction cache */ + SC_L1C_DSZ = 8 /* size of L1 data cache */ + SC_L1C_ICA = 9 /* L1 instruction cache associativity */ + SC_L1C_DCA = 10 /* L1 data cache associativity */ + SC_L1C_IBS = 11 /* L1 instruction cache block size */ + SC_L1C_DBS = 12 /* L1 data cache block size */ + SC_L1C_ILS = 13 /* L1 instruction cache line size */ + SC_L1C_DLS = 14 /* L1 data cache line size */ + SC_L2C_SZ = 15 /* size of L2 cache, 0 = No L2 cache */ + SC_L2C_AS = 16 /* L2 cache associativity */ + SC_TLB_ATTR = 17 /* TLB attributes (bit flags) */ + SC_ITLB_SZ = 18 /* entries in instruction TLB */ + SC_DTLB_SZ = 19 /* entries in data TLB */ + SC_ITLB_ATT = 20 /* instruction tlb associativity */ + SC_DTLB_ATT = 21 /* data tlb associativity */ + SC_RESRV_SZ = 22 /* size of reservation */ + SC_PRI_LC = 23 /* spin lock count in supevisor mode */ + SC_PRO_LC = 24 /* spin lock count in problem state */ + SC_RTC_TYPE = 25 /* RTC type */ + SC_VIRT_AL = 26 /* 1 if hardware aliasing is supported */ + SC_CAC_CONG = 27 /* number of page bits for cache synonym */ + SC_MOD_ARCH = 28 /* used by system for model determination */ + SC_MOD_IMPL = 29 /* used by system for model determination */ + SC_XINT = 30 /* used by system for time base conversion */ + SC_XFRAC = 31 /* used by system for time base conversion */ + SC_KRN_ATTR = 32 /* kernel attributes, see below */ + SC_PHYSMEM = 33 /* bytes of OS available memory */ + SC_SLB_ATTR = 34 /* SLB attributes */ + SC_SLB_SZ = 35 /* size of slb (0 = no slb) */ + SC_ORIG_NCPUS = 36 /* original number of CPUs */ + SC_MAX_NCPUS = 37 /* max cpus supported by this AIX image */ + SC_MAX_REALADDR = 38 /* max supported real memory address +1 */ + SC_ORIG_ENT_CAP = 39 /* configured entitled processor capacity at boot required by cross-partition LPAR tools. */ + SC_ENT_CAP = 40 /* entitled processor capacity */ + SC_DISP_WHE = 41 /* Dispatch wheel time period (TB units) */ + SC_CAPINC = 42 /* delta by which capacity can change */ + SC_VCAPW = 43 /* priority weight for idle capacity distribution */ + SC_SPLP_STAT = 44 /* State of SPLPAR enablement: 0x1 => 1=SPLPAR capable; 0=not, 0x2 => SPLPAR enabled 0=dedicated, 1=shared */ + SC_SMT_STAT = 45 /* State of SMT enablement: 0x1 = SMT Capable 0=no/1=yes, 0x2 = SMT Enabled 0=no/1=yes, 0x4 = SMT threads bound true 0=no/1=yes */ + SC_SMT_TC = 46 /* Number of SMT Threads per Physical CPU */ + SC_VMX_VER = 47 /* RPA defined VMX version: 0 = VMX not available or disabled, 1 = VMX capable, 2 = VMX and VSX capable */ + SC_LMB_SZ = 48 /* Size of an LMB on this system. */ + SC_MAX_XCPU = 49 /* Number of exclusive cpus on line */ + SC_EC_LVL = 50 /* Kernel error checking level */ + SC_AME_STAT = 51 /* AME status */ + SC_ECO_STAT = 52 /* extended cache options */ + SC_DFP_STAT = 53 /* RPA defined DFP version, 0=none/disabled */ + SC_VRM_STAT = 54 /* VRM Capable/enabled */ + SC_PHYS_IMP = 55 /* physical processor implementation */ + SC_PHYS_VER = 56 /* physical processor version */ + SC_SPCM_STATUS = 57 + SC_SPCM_MAX = 58 + SC_TM_VER = 59 /* Transaction Memory version, 0 - not capable */ + SC_NX_CAP = 60 /* NX GZIP capable */ + SC_PKS_STATE = 61 /* Platform KeyStore */ + SC_MMA_VER = 62 +) + +/* kernel attributes */ +/* bit 0/1 meaning */ +/* -----------------------------------------*/ +/* 31 32-bit kernel / 64-bit kernel */ +/* 30 non-LPAR / LPAR */ +/* 29 old 64bit ABI / 64bit Large ABI */ +/* 28 non-NUMA / NUMA */ +/* 27 UP / MP */ +/* 26 no DR CPU add / DR CPU add support */ +/* 25 no DR CPU rm / DR CPU rm support */ +/* 24 no DR MEM add / DR MEM add support */ +/* 23 no DR MEM rm / DR MEM rm support */ +/* 22 kernel keys disabled / enabled */ +/* 21 no recovery / recovery enabled */ +/* 20 non-MLS / MLS enabled */ +/* 19 enhanced affinity indicator */ +/* 18 non-vTPM / vTPM enabled */ +/* 17 non-VIOS / VIOS */ + +// Values for architecture field +const ( + ARCH_POWER_RS = 0x0001 /* Power Classic architecture */ + ARCH_POWER_PC = 0x0002 /* Power PC architecture */ + ARCH_IA64 = 0x0003 /* Intel IA64 architecture */ +) + +// Values for implementation field for POWER_PC Architectures +const ( + IMPL_POWER_RS1 = 0x00001 /* RS1 class CPU */ + IMPL_POWER_RSC = 0x00002 /* RSC class CPU */ + IMPL_POWER_RS2 = 0x00004 /* RS2 class CPU */ + IMPL_POWER_601 = 0x00008 /* 601 class CPU */ + IMPL_POWER_603 = 0x00020 /* 603 class CPU */ + IMPL_POWER_604 = 0x00010 /* 604 class CPU */ + IMPL_POWER_620 = 0x00040 /* 620 class CPU */ + IMPL_POWER_630 = 0x00080 /* 630 class CPU */ + IMPL_POWER_A35 = 0x00100 /* A35 class CPU */ + IMPL_POWER_RS64II = 0x0200 /* RS64-II class CPU */ + IMPL_POWER_RS64III = 0x0400 /* RS64-III class CPU */ + IMPL_POWER4 = 0x0800 /* 4 class CPU */ + IMPL_POWER_RS64IV = IMPL_POWER4 /* 4 class CPU */ + IMPL_POWER_MPC7450 = 0x1000 /* MPC7450 class CPU */ + IMPL_POWER5 = 0x2000 /* 5 class CPU */ + IMPL_POWER6 = 0x4000 /* 6 class CPU */ + IMPL_POWER7 = 0x8000 /* 7 class CPU */ + IMPL_POWER8 = 0x10000 /* 8 class CPU */ + IMPL_POWER9 = 0x20000 /* 9 class CPU */ + IMPL_POWER10 = 0x20000 /* 10 class CPU */ +) + +// Values for implementation field for IA64 Architectures +const ( + IMPL_IA64_M1 = 0x0001 /* IA64 M1 class CPU (Itanium) */ + IMPL_IA64_M2 = 0x0002 /* IA64 M2 class CPU */ +) + +// Values for the version field +const ( + PV_601 = 0x010001 /* Power PC 601 */ + PV_601A = 0x010002 /* Power PC 601 */ + PV_603 = 0x060000 /* Power PC 603 */ + PV_604 = 0x050000 /* Power PC 604 */ + PV_620 = 0x070000 /* Power PC 620 */ + PV_630 = 0x080000 /* Power PC 630 */ + PV_A35 = 0x090000 /* Power PC A35 */ + PV_RS64II = 0x0A0000 /* Power PC RS64II */ + PV_RS64III = 0x0B0000 /* Power PC RS64III */ + PV_4 = 0x0C0000 /* Power PC 4 */ + PV_RS64IV = PV_4 /* Power PC 4 */ + PV_MPC7450 = 0x0D0000 /* Power PC MPC7450 */ + PV_4_2 = 0x0E0000 /* Power PC 4 */ + PV_4_3 = 0x0E0001 /* Power PC 4 */ + PV_5 = 0x0F0000 /* Power PC 5 */ + PV_5_2 = 0x0F0001 /* Power PC 5 */ + PV_5_3 = 0x0F0002 /* Power PC 5 */ + PV_6 = 0x100000 /* Power PC 6 */ + PV_6_1 = 0x100001 /* Power PC 6 DD1.x */ + PV_7 = 0x200000 /* Power PC 7 */ + PV_8 = 0x300000 /* Power PC 8 */ + PV_9 = 0x400000 /* Power PC 9 */ + PV_10 = 0x500000 /* Power PC 10 */ + PV_5_Compat = 0x0F8000 /* Power PC 5 */ + PV_6_Compat = 0x108000 /* Power PC 6 */ + PV_7_Compat = 0x208000 /* Power PC 7 */ + PV_8_Compat = 0x308000 /* Power PC 8 */ + PV_9_Compat = 0x408000 /* Power PC 9 */ + PV_10_Compat = 0x508000 /* Power PC 10 */ + PV_RESERVED_2 = 0x0A0000 /* source compatability */ + PV_RESERVED_3 = 0x0B0000 /* source compatability */ + PV_RS2 = 0x040000 /* Power RS2 */ + PV_RS1 = 0x020000 /* Power RS1 */ + PV_RSC = 0x030000 /* Power RSC */ + PV_M1 = 0x008000 /* Intel IA64 M1 */ + PV_M2 = 0x008001 /* Intel IA64 M2 */ +) + +// Values for rtc_type +const ( + RTC_POWER = 1 /* rtc as defined by Power Arch. */ + RTC_POWER_PC = 2 /* rtc as defined by Power PC Arch. */ + RTC_IA64 = 3 /* rtc as defined by IA64 Arch. */ +) + +const NX_GZIP_PRESENT = 0x00000001 + +const ( + PKS_STATE_CAPABLE = 1 + PKS_STATE_ENABLED = 2 +) + +// Macros for identifying physical processor +const ( + PPI4_1 = 0x35 + PPI4_2 = 0x38 + PPI4_3 = 0x39 + PPI4_4 = 0x3C + PPI4_5 = 0x44 + PPI5_1 = 0x3A + PPI5_2 = 0x3B + PPI6_1 = 0x3E + PPI7_1 = 0x3F + PPI7_2 = 0x4A + PPI8_1 = 0x4B + PPI8_2 = 0x4D + PPI9 = 0x4E + PPI9_1 = 0x4E + PPI10_1 = 0x80 +) + +// Macros for kernel attributes +const ( + KERN_TYPE = 0x1 + KERN_LPAR = 0x2 + KERN_64BIT_LARGE_ABI = 0x4 + KERN_NUMA = 0x8 + KERN_UPMP = 0x10 + KERN_DR_CPU_ADD = 0x20 + KERN_DR_CPU_RM = 0x40 + KERN_DR_MEM_ADD = 0x80 + KERN_DR_MEM_RM = 0x100 + KERN_KKEY_ENABLED = 0x200 + KERN_RECOVERY = 0x400 + KERN_MLS = 0x800 + KERN_ENH_AFFINITY = 0x1000 + KERN_VTPM = 0x2000 + KERN_VIOS = 0x4000 +) + +// macros for SPLPAR environment. +const ( + SPLPAR_CAPABLE = 0x1 + SPLPAR_ENABLED = 0x2 + SPLPAR_DONATE_CAPABLE = 0x4 +) + +// Macros for SMT status determination +const ( + SMT_CAPABLE = 0x1 + SMT_ENABLE = 0x2 + SMT_BOUND = 0x4 + SMT_ORDER = 0x8 +) + +// Macros for VRM status determination +const ( + VRM_CAPABLE = 0x1 + VRM_ENABLE = 0x2 + CMOX_CAPABLE = 0x4 +) + +// Macros for AME status determination +const AME_ENABLE = 0x1 + +// Macros for extended cache options +const ( + ECO_CAPABLE = 0x1 + ECO_ENABLE = 0x2 +) + +// These define blocks of values for model_arch and model_impl that are reserved for OEM use. +const ( + MODEL_ARCH_RSPC = 2 + MODEL_ARCH_CHRP = 3 + MODEL_ARCH_IA64 = 4 + MODEL_ARCH_OEM_START = 1024 + MODEL_ARCH_OEM_END = 2047 + MODEL_IMPL_RS6K_UP_MCA = 1 + MODEL_IMPL_RS6K_SMP_MCA = 2 + MODEL_IMPL_RSPC_UP_PCI = 3 + MODEL_IMPL_RSPC_SMP_PCI = 4 + MODEL_IMPL_CHRP_UP_PCI = 5 + MODEL_IMPL_CHRP_SMP_PCI = 6 + MODEL_IMPL_IA64_COM = 7 + MODEL_IMPL_IA64_SOFTSDV = 8 + MODEL_IMPL_MAMBO_SIM = 9 + MODEL_IMPL_POWER_KVM = 10 + MODEL_IMPL_OEM_START = 1024 + MODEL_IMPL_OEM_END = 2047 +) + +// example determining processor compatibilty mode on AIX: +// impl := unix.Getsystemcfg(SC_IMPL) +// if impl&IMPL_POWER8 != 0 { +// // we are running on POWER8 +// } +// if impl&IMPL_POWER9 != 0 { +// // we are running on POWER9 +// } + +func GetCPUImplementation() string { + impl := unix.Getsystemcfg(SC_IMPL) + switch { + case impl&IMPL_POWER4 != 0: + return "POWER4" + case impl&IMPL_POWER5 != 0: + return "POWER5" + case impl&IMPL_POWER6 != 0: + return "POWER6" + case impl&IMPL_POWER7 != 0: + return "POWER7" + case impl&IMPL_POWER8 != 0: + return "POWER8" + case impl&IMPL_POWER9 != 0: + return "POWER9" + case impl&IMPL_POWER10 != 0: + return "Power10" + default: + return "Unknown" + } +} + +func POWER10OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER10 != 0 { + return true + } + return false +} + +func POWER10() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER10 != 0 { + return true + } + return false +} + +func POWER9OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 { + return true + } + return false +} + +func POWER9() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER9 != 0 { + return true + } + return false +} + +func POWER8OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 { + return true + } + return false +} + +func POWER8() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER8 != 0 { + return true + } + return false +} + +func POWER7OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 || impl&IMPL_POWER7 != 0 { + return true + } + return false +} + +func POWER7() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER7 != 0 { + return true + } + return false +} + +func HasTransactionalMemory() bool { + impl := unix.Getsystemcfg(SC_TM_VER) + if impl > 0 { + return true + } + return false +} + +func Is64Bit() bool { + impl := unix.Getsystemcfg(SC_WIDTH) + if impl == 64 { + return true + } + return false +} + +func IsSMP() bool { + impl := unix.Getsystemcfg(SC_NCPUS) + if impl > 1 { + return true + } + return false +} + +func HasVMX() bool { + impl := unix.Getsystemcfg(SC_VMX_VER) + if impl > 0 { + return true + } + return false +} + +func HasVSX() bool { + impl := unix.Getsystemcfg(SC_VMX_VER) + if impl > 1 { + return true + } + return false +} + +func HasDFP() bool { + impl := unix.Getsystemcfg(SC_DFP_STAT) + if impl > 1 { + return true + } + return false +} + +func HasNxGzip() bool { + impl := unix.Getsystemcfg(SC_NX_CAP) + if impl&NX_GZIP_PRESENT > 0 { + return true + } + return false +} + +func PksCapable() bool { + impl := unix.Getsystemcfg(SC_PKS_STATE) + if impl&PKS_STATE_CAPABLE > 0 { + return true + } + return false +} + +func PksEnabled() bool { + impl := unix.Getsystemcfg(SC_PKS_STATE) + if impl&PKS_STATE_ENABLED > 0 { + return true + } + return false +} + +func CPUMode() string { + impl := unix.Getsystemcfg(SC_VERS) + switch impl { + case PV_10, PV_10_Compat: + return "Power10" + case PV_9, PV_9_Compat: + return "POWER9" + case PV_8, PV_8_Compat: + return "POWER8" + case PV_7, PV_7_Compat: + return "POWER7" + default: + return "Unknown" + } +} + +func KernelBits() int { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_TYPE == KERN_TYPE { + return 64 + } + return 32 +} + +func IsLPAR() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_LPAR == KERN_LPAR { + return true + } + return false +} + +func CpuAddCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_CPU_ADD == KERN_DR_CPU_ADD { + return true + } + return false +} + +func CpuRemoveCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_CPU_RM == KERN_DR_CPU_RM { + return true + } + return false +} + +func MemoryAddCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_MEM_ADD == KERN_DR_MEM_ADD { + return true + } + return false +} + +func MemoryRemoveCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_MEM_RM == KERN_DR_MEM_RM { + return true + } + return false +} + +func DLparCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&(KERN_DR_CPU_ADD|KERN_DR_CPU_RM|KERN_DR_MEM_ADD|KERN_DR_MEM_RM) > 0 { + return true + } + return false +} + +func IsNUMA() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_NUMA > 0 { + return true + } + return false +} + +func KernelKeys() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_KKEY_ENABLED > 0 { + return true + } + return false +} + +func RecoveryMode() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_RECOVERY > 0 { + return true + } + return false +} + +func EnhancedAffinity() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_ENH_AFFINITY > 0 { + return true + } + return false +} + +func VTpmEnabled() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_VTPM > 0 { + return true + } + return false +} + +func IsVIOS() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_VIOS > 0 { + return true + } + return false +} + +func MLSEnabled() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_MLS > 0 { + return true + } + return false +} + +func SPLparCapable() bool { + impl := unix.Getsystemcfg(SC_SPLP_STAT) + if impl&SPLPAR_CAPABLE > 0 { + return true + } + return false +} + +func SPLparEnabled() bool { + impl := unix.Getsystemcfg(SC_SPLP_STAT) + if impl&SPLPAR_ENABLED > 0 { + return true + } + return false +} + +func DedicatedLpar() bool { + return !SPLparEnabled() +} + +func SPLparCapped() bool { + impl := unix.Getsystemcfg(SC_VCAPW) + if impl == 0 { + return true + } + return false +} + +func SPLparDonating() bool { + impl := unix.Getsystemcfg(SC_SPLP_STAT) + if impl&SPLPAR_DONATE_CAPABLE > 0 { + return true + } + return false +} + +func SmtCapable() bool { + impl := unix.Getsystemcfg(SC_SMT_STAT) + if impl&SMT_CAPABLE > 0 { + return true + } + return false +} + +func SmtEnabled() bool { + impl := unix.Getsystemcfg(SC_SMT_STAT) + if impl&SMT_ENABLE > 0 { + return true + } + return false +} + +func VrmCapable() bool { + impl := unix.Getsystemcfg(SC_VRM_STAT) + if impl&VRM_CAPABLE > 0 { + return true + } + return false +} + +func VrmEnabled() bool { + impl := unix.Getsystemcfg(SC_VRM_STAT) + if impl&VRM_ENABLE > 0 { + return true + } + return false +} + +func AmeEnabled() bool { + impl := unix.Getsystemcfg(SC_AME_STAT) + if impl&AME_ENABLE > 0 { + return true + } + return false +} + +func EcoCapable() bool { + impl := unix.Getsystemcfg(SC_ECO_STAT) + if impl&ECO_CAPABLE > 0 { + return true + } + return false +} + +func EcoEnabled() bool { + impl := unix.Getsystemcfg(SC_ECO_STAT) + if impl&ECO_ENABLE > 0 { + return true + } + return false +} diff --git a/vendor/github.com/power-devops/perfstat/types_cpu.go b/vendor/github.com/power-devops/perfstat/types_cpu.go new file mode 100644 index 00000000..84425e92 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_cpu.go @@ -0,0 +1,186 @@ +package perfstat + +type CPU struct { + Name string /* logical processor name (cpu0, cpu1, ..) */ + User int64 /* raw number of clock ticks spent in user mode */ + Sys int64 /* raw number of clock ticks spent in system mode */ + Idle int64 /* raw number of clock ticks spent idle */ + Wait int64 /* raw number of clock ticks spent waiting for I/O */ + PSwitch int64 /* number of context switches (changes of currently running process) */ + Syscall int64 /* number of system calls executed */ + Sysread int64 /* number of read system calls executed */ + Syswrite int64 /* number of write system calls executed */ + Sysfork int64 /* number of fork system call executed */ + Sysexec int64 /* number of exec system call executed */ + Readch int64 /* number of characters tranferred with read system call */ + Writech int64 /* number of characters tranferred with write system call */ + Bread int64 /* number of block reads */ + Bwrite int64 /* number of block writes */ + Lread int64 /* number of logical read requests */ + Lwrite int64 /* number of logical write requests */ + Phread int64 /* number of physical reads (reads on raw device) */ + Phwrite int64 /* number of physical writes (writes on raw device) */ + Iget int64 /* number of inode lookups */ + Namei int64 /* number of vnode lookup from a path name */ + Dirblk int64 /* number of 512-byte block reads by the directory search routine to locate an entry for a file */ + Msg int64 /* number of IPC message operations */ + Sema int64 /* number of IPC semaphore operations */ + MinFaults int64 /* number of page faults with no I/O */ + MajFaults int64 /* number of page faults with disk I/O */ + PUser int64 /* raw number of physical processor tics in user mode */ + PSys int64 /* raw number of physical processor tics in system mode */ + PIdle int64 /* raw number of physical processor tics idle */ + PWait int64 /* raw number of physical processor tics waiting for I/O */ + RedispSD0 int64 /* number of thread redispatches within the scheduler affinity domain 0 */ + RedispSD1 int64 /* number of thread redispatches within the scheduler affinity domain 1 */ + RedispSD2 int64 /* number of thread redispatches within the scheduler affinity domain 2 */ + RedispSD3 int64 /* number of thread redispatches within the scheduler affinity domain 3 */ + RedispSD4 int64 /* number of thread redispatches within the scheduler affinity domain 4 */ + RedispSD5 int64 /* number of thread redispatches within the scheduler affinity domain 5 */ + MigrationPush int64 /* number of thread migrations from the local runque to another queue due to starvation load balancing */ + MigrationS3grq int64 /* number of thread migrations from the global runque to the local runque resulting in a move accross scheduling domain 3 */ + MigrationS3pul int64 /* number of thread migrations from another processor's runque resulting in a move accross scheduling domain 3 */ + InvolCSwitch int64 /* number of involuntary thread context switches */ + VolCSwitch int64 /* number of voluntary thread context switches */ + RunQueue int64 /* number of threads on the runque */ + Bound int64 /* number of bound threads */ + DecrIntrs int64 /* number of decrementer tics interrupts */ + MpcRIntrs int64 /* number of mpc's received interrupts */ + MpcSIntrs int64 /* number of mpc's sent interrupts */ + DevIntrs int64 /* number of device interrupts */ + SoftIntrs int64 /* number of offlevel handlers called */ + PhantIntrs int64 /* number of phantom interrupts */ + IdleDonatedPurr int64 /* number of idle cycles donated by a dedicated partition enabled for donation */ + IdleDonatedSpurr int64 /* number of idle spurr cycles donated by a dedicated partition enabled for donation */ + BusyDonatedPurr int64 /* number of busy cycles donated by a dedicated partition enabled for donation */ + BusyDonatedSpurr int64 /* number of busy spurr cycles donated by a dedicated partition enabled for donation */ + IdleStolenPurr int64 /* number of idle cycles stolen by the hypervisor from a dedicated partition */ + IdleStolenSpurr int64 /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenPurr int64 /* number of busy cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenSpurr int64 /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */ + Hpi int64 /* number of hypervisor page-ins */ + Hpit int64 /* Time spent in hypervisor page-ins (in nanoseconds)*/ + PUserSpurr int64 /* number of spurr cycles spent in user mode */ + PSysSpurr int64 /* number of spurr cycles spent in kernel mode */ + PIdleSpurr int64 /* number of spurr cycles spent in idle mode */ + PWaitSpurr int64 /* number of spurr cycles spent in wait mode */ + SpurrFlag int32 /* set if running in spurr mode */ + LocalDispatch int64 /* number of local thread dispatches on this logical CPU */ + NearDispatch int64 /* number of near thread dispatches on this logical CPU */ + FarDispatch int64 /* number of far thread dispatches on this logical CPU */ + CSwitches int64 /* Context switches */ + Version int64 /* version number (1, 2, etc.,) */ + TbLast int64 /* timebase counter */ + State int /* Show whether the CPU is offline or online */ + VtbLast int64 /* Last virtual timebase read */ + ICountLast int64 /* Last instruction count read */ +} + +type CPUTotal struct { + NCpus int /* number of active logical processors */ + NCpusCfg int /* number of configured processors */ + Description string /* processor description (type/official name) */ + ProcessorHz int64 /* processor speed in Hz */ + User int64 /* raw total number of clock ticks spent in user mode */ + Sys int64 /* raw total number of clock ticks spent in system mode */ + Idle int64 /* raw total number of clock ticks spent idle */ + Wait int64 /* raw total number of clock ticks spent waiting for I/O */ + PSwitch int64 /* number of process switches (change in currently running process) */ + Syscall int64 /* number of system calls executed */ + Sysread int64 /* number of read system calls executed */ + Syswrite int64 /* number of write system calls executed */ + Sysfork int64 /* number of forks system calls executed */ + Sysexec int64 /* number of execs system calls executed */ + Readch int64 /* number of characters tranferred with read system call */ + Writech int64 /* number of characters tranferred with write system call */ + DevIntrs int64 /* number of device interrupts */ + SoftIntrs int64 /* number of software interrupts */ + Lbolt int64 /* number of ticks since last reboot */ + LoadAvg1 float32 /* times the average number of runnables processes during the last 1, 5 and 15 minutes. */ + LoadAvg5 float32 /* times the average number of runnables processes during the last 1, 5 and 15 minutes. */ + LoadAvg15 float32 /* times the average number of runnables processes during the last 1, 5 and 15 minutes. */ + RunQueue int64 /* length of the run queue (processes ready) */ + SwpQueue int64 /* length of the swap queue (processes waiting to be paged in) */ + Bread int64 /* number of blocks read */ + Bwrite int64 /* number of blocks written */ + Lread int64 /* number of logical read requests */ + Lwrite int64 /* number of logical write requests */ + Phread int64 /* number of physical reads (reads on raw devices) */ + Phwrite int64 /* number of physical writes (writes on raw devices) */ + RunOcc int64 /* updated whenever runque is updated, i.e. the runqueue is occupied. This can be used to compute the simple average of ready processes */ + SwpOcc int64 /* updated whenever swpque is updated. i.e. the swpqueue is occupied. This can be used to compute the simple average processes waiting to be paged in */ + Iget int64 /* number of inode lookups */ + Namei int64 /* number of vnode lookup from a path name */ + Dirblk int64 /* number of 512-byte block reads by the directory search routine to locate an entry for a file */ + Msg int64 /* number of IPC message operations */ + Sema int64 /* number of IPC semaphore operations */ + RcvInt int64 /* number of tty receive interrupts */ + XmtInt int64 /* number of tyy transmit interrupts */ + MdmInt int64 /* number of modem interrupts */ + TtyRawInch int64 /* number of raw input characters */ + TtyCanInch int64 /* number of canonical input characters (always zero) */ + TtyRawOutch int64 /* number of raw output characters */ + Ksched int64 /* number of kernel processes created */ + Koverf int64 /* kernel process creation attempts where: -the user has forked to their maximum limit -the configuration limit of processes has been reached */ + Kexit int64 /* number of kernel processes that became zombies */ + Rbread int64 /* number of remote read requests */ + Rcread int64 /* number of cached remote reads */ + Rbwrt int64 /* number of remote writes */ + Rcwrt int64 /* number of cached remote writes */ + Traps int64 /* number of traps */ + NCpusHigh int64 /* index of highest processor online */ + PUser int64 /* raw number of physical processor tics in user mode */ + PSys int64 /* raw number of physical processor tics in system mode */ + PIdle int64 /* raw number of physical processor tics idle */ + PWait int64 /* raw number of physical processor tics waiting for I/O */ + DecrIntrs int64 /* number of decrementer tics interrupts */ + MpcRIntrs int64 /* number of mpc's received interrupts */ + MpcSIntrs int64 /* number of mpc's sent interrupts */ + PhantIntrs int64 /* number of phantom interrupts */ + IdleDonatedPurr int64 /* number of idle cycles donated by a dedicated partition enabled for donation */ + IdleDonatedSpurr int64 /* number of idle spurr cycles donated by a dedicated partition enabled for donation */ + BusyDonatedPurr int64 /* number of busy cycles donated by a dedicated partition enabled for donation */ + BusyDonatedSpurr int64 /* number of busy spurr cycles donated by a dedicated partition enabled for donation */ + IdleStolenPurr int64 /* number of idle cycles stolen by the hypervisor from a dedicated partition */ + IdleStolenSpurr int64 /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenPurr int64 /* number of busy cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenSpurr int64 /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */ + IOWait int32 /* number of processes that are asleep waiting for buffered I/O */ + PhysIO int32 /* number of processes waiting for raw I/O */ + TWait int64 /* number of threads that are waiting for filesystem direct(cio) */ + Hpi int64 /* number of hypervisor page-ins */ + Hpit int64 /* Time spent in hypervisor page-ins (in nanoseconds) */ + PUserSpurr int64 /* number of spurr cycles spent in user mode */ + PSysSpurr int64 /* number of spurr cycles spent in kernel mode */ + PIdleSpurr int64 /* number of spurr cycles spent in idle mode */ + PWaitSpurr int64 /* number of spurr cycles spent in wait mode */ + SpurrFlag int /* set if running in spurr mode */ + Version int64 /* version number (1, 2, etc.,) */ + TbLast int64 /*time base counter */ + PurrCoalescing int64 /* If the calling partition is authorized to see pool wide statistics then PURR cycles consumed to coalesce data else set to zero.*/ + SpurrCoalescing int64 /* If the calling partition is authorized to see pool wide statistics then SPURR cycles consumed to coalesce data else set to zero. */ +} + +type CPUUtil struct { + Version int64 + CpuID string /* holds the id of the cpu */ + Entitlement float32 /* Partition's entitlement */ + UserPct float32 /* % of utilization in user mode */ + KernPct float32 /* % of utilization in kernel mode */ + IdlePct float32 /* % of utilization in idle mode */ + WaitPct float32 /* % of utilization in wait mode */ + PhysicalBusy float32 /* physical cpus busy */ + PhysicalConsumed float32 /* total cpus consumed by the partition */ + FreqPct float32 /* Average freq% over the last interval */ + EntitlementPct float32 /* % of entitlement used */ + BusyPct float32 /* % of entitlement busy */ + IdleDonatedPct float32 /* % idle cycles donated */ + BusyDonatedPct float32 /* % of busy cycles donated */ + IdleStolenPct float32 /* % idle cycles stolen */ + BusyStolenPct float32 /* % busy cycles stolen */ + LUserPct float32 /* % of utilization in user mode, in terms of logical processor ticks */ + LKernPct float32 /* % of utilization in kernel mode, in terms of logical processor ticks*/ + LIdlePct float32 /* % of utilization in idle mode, in terms of logical processor ticks */ + LWaitPct float32 /* % of utilization in wait mode, in terms of logical processor ticks */ + DeltaTime int64 /* delta time in milliseconds, for which utilization is evaluated */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_disk.go b/vendor/github.com/power-devops/perfstat/types_disk.go new file mode 100644 index 00000000..50e323db --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_disk.go @@ -0,0 +1,176 @@ +package perfstat + +type DiskTotal struct { + Number int32 /* total number of disks */ + Size int64 /* total size of all disks (in MB) */ + Free int64 /* free portion of all disks (in MB) */ + XRate int64 /* __rxfers: total number of transfers from disk */ + Xfers int64 /* total number of transfers to/from disk */ + Wblks int64 /* 512 bytes blocks written to all disks */ + Rblks int64 /* 512 bytes blocks read from all disks */ + Time int64 /* amount of time disks are active */ + Version int64 /* version number (1, 2, etc.,) */ + Rserv int64 /* Average read or receive service time */ + MinRserv int64 /* min read or receive service time */ + MaxRserv int64 /* max read or receive service time */ + RTimeOut int64 /* number of read request timeouts */ + RFailed int64 /* number of failed read requests */ + Wserv int64 /* Average write or send service time */ + MinWserv int64 /* min write or send service time */ + MaxWserv int64 /* max write or send service time */ + WTimeOut int64 /* number of write request timeouts */ + WFailed int64 /* number of failed write requests */ + WqDepth int64 /* instantaneous wait queue depth (number of requests waiting to be sent to disk) */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* min wait queueing time */ + WqMaxTime int64 /* max wait queueing time */ +} + +// Disk Adapter Types +const ( + DA_SCSI = 0 /* 0 ==> SCSI, SAS, other legacy adapter types */ + DA_VSCSI = 1 /* 1 ==> Virtual SCSI/SAS Adapter */ + DA_FCA = 2 /* 2 ==> Fiber Channel Adapter */ +) + +type DiskAdapter struct { + Name string /* name of the adapter (from ODM) */ + Description string /* adapter description (from ODM) */ + Number int32 /* number of disks connected to adapter */ + Size int64 /* total size of all disks (in MB) */ + Free int64 /* free portion of all disks (in MB) */ + XRate int64 /* __rxfers: total number of reads via adapter */ + Xfers int64 /* total number of transfers via adapter */ + Rblks int64 /* 512 bytes blocks written via adapter */ + Wblks int64 /* 512 bytes blocks read via adapter */ + Time int64 /* amount of time disks are active */ + Version int64 /* version number (1, 2, etc.,) */ + AdapterType int64 /* 0 ==> SCSI, SAS, other legacy adapter types, 1 ==> Virtual SCSI/SAS Adapter, 2 ==> Fiber Channel Adapter */ + DkBSize int64 /* Number of Bytes in a block for this disk*/ + DkRxfers int64 /* Number of transfers from disk */ + DkRserv int64 /* read or receive service time */ + DkWserv int64 /* write or send service time */ + MinRserv int64 /* Minimum read service time */ + MaxRserv int64 /* Maximum read service time */ + MinWserv int64 /* Minimum Write service time */ + MaxWserv int64 /* Maximum write service time */ + WqDepth int64 /* driver wait queue depth */ + WqSampled int64 /* accumulated sampled dk_wq_depth */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* minimum wait queueing time */ + WqMaxTime int64 /* maximum wait queueing time */ + QFull int64 /* "Service" queue full occurrence count (number of times the adapter/devices connected to the adapter is not accepting any more request) */ + QSampled int64 /* accumulated sampled */ +} + +type Disk struct { + Name string /* name of the disk */ + Description string /* disk description (from ODM) */ + VGName string /* volume group name (from ODM) */ + Size int64 /* size of the disk (in MB) */ + Free int64 /* free portion of the disk (in MB) */ + BSize int64 /* disk block size (in bytes) */ + XRate int64 /* number of transfers from disk */ + Xfers int64 /* number of transfers to/from disk */ + Wblks int64 /* number of blocks written to disk */ + Rblks int64 /* number of blocks read from disk */ + QDepth int64 /* instantaneous "service" queue depth (number of requests sent to disk and not completed yet) */ + Time int64 /* amount of time disk is active */ + Adapter string /* disk adapter name */ + PathsCount int32 /* number of paths to this disk */ + QFull int64 /* "service" queue full occurrence count (number of times the disk is not accepting any more request) */ + Rserv int64 /* read or receive service time */ + RTimeOut int64 /* number of read request timeouts */ + Rfailed int64 /* number of failed read requests */ + MinRserv int64 /* min read or receive service time */ + MaxRserv int64 /* max read or receive service time */ + Wserv int64 /* write or send service time */ + WTimeOut int64 /* number of write request timeouts */ + Wfailed int64 /* number of failed write requests */ + MinWserv int64 /* min write or send service time */ + MaxWserv int64 /* max write or send service time */ + WqDepth int64 /* instantaneous wait queue depth (number of requests waiting to be sent to disk) */ + WqSampled int64 /* accumulated sampled dk_wq_depth */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* min wait queueing time */ + WqMaxTime int64 /* max wait queueing time */ + QSampled int64 /* accumulated sampled dk_q_depth */ + Version int64 /* version number (1, 2, etc.,) */ + PseudoDisk bool /*Indicates whether pseudo or physical disk */ + VTDisk bool /* 1- Virtual Target Disk, 0 - Others */ +} + +type DiskPath struct { + Name string /* name of the path */ + XRate int64 /* __rxfers: number of reads via the path */ + Xfers int64 /* number of transfers via the path */ + Rblks int64 /* 512 bytes blocks written via the path */ + Wblks int64 /* 512 bytes blocks read via the path */ + Time int64 /* amount of time disks are active */ + Adapter string /* disk adapter name (from ODM) */ + QFull int64 /* "service" queue full occurrence count (number of times the disk is not accepting any more request) */ + Rserv int64 /* read or receive service time */ + RTimeOut int64 /* number of read request timeouts */ + Rfailed int64 /* number of failed read requests */ + MinRserv int64 /* min read or receive service time */ + MaxRserv int64 /* max read or receive service time */ + Wserv int64 /* write or send service time */ + WTimeOut int64 /* number of write request timeouts */ + Wfailed int64 /* number of failed write requests */ + MinWserv int64 /* min write or send service time */ + MaxWserv int64 /* max write or send service time */ + WqDepth int64 /* instantaneous wait queue depth (number of requests waiting to be sent to disk) */ + WqSampled int64 /* accumulated sampled dk_wq_depth */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* min wait queueing time */ + WqMaxTime int64 /* max wait queueing time */ + QSampled int64 /* accumulated sampled dk_q_depth */ + Version int64 /* version number (1, 2, etc.,) */ +} + +const ( + FC_DOWN = 0 // FC Adapter state is DOWN + FC_UP = 1 // FC Adapter state is UP +) + +const ( + FCT_FCHBA = 0 // FC type - real Fiber Channel Adapter + FCT_VFC = 1 // FC type - virtual Fiber Channel +) + +type FCAdapter struct { + Version int64 /* version number (1, 2, etc.,) */ + Name string /* name of the adapter */ + State int32 /* FC Adapter state UP or DOWN */ + InputRequests int64 /* Number of Input Requests*/ + OutputRequests int64 /* Number of Output Requests */ + InputBytes int64 /* Number of Input Bytes */ + OutputBytes int64 /* Number of Output Bytes */ + EffMaxTransfer int64 /* Adapter's Effective Maximum Transfer Value */ + NoDMAResourceCnt int64 /* Count of DMA failures due to no DMA Resource available */ + NoCmdResourceCnt int64 /* Count of failures to allocate a command due to no command resource available */ + AttentionType int32 /* Link up or down Indicator */ + SecondsSinceLastReset int64 /* Displays the seconds since last reset of the statistics on the adapter */ + TxFrames int64 /* Number of frames transmitted */ + TxWords int64 /* Fiber Channel Kbytes transmitted */ + RxFrames int64 /* Number of Frames Received */ + RxWords int64 /* Fiber Channel Kbytes Received */ + LIPCount int64 /* Count of LIP (Loop Initialization Protocol) Events received in case we have FC-AL */ + NOSCount int64 /* Count of NOS (Not_Operational) Events. This indicates a link failure state. */ + ErrorFrames int64 /* Number of frames received with the CRC Error */ + DumpedFrames int64 /* Number of lost frames */ + LinkFailureCount int64 /* Count of Link failures */ + LossofSyncCount int64 /* Count of loss of sync */ + LossofSignal int64 /* Count of loss of Signal */ + PrimitiveSeqProtocolErrCount int64 /* number of times a primitive sequence was in error */ + InvalidTxWordCount int64 /* Count of Invalid Transmission words received */ + InvalidCRCCount int64 /* Count of CRC Errors in a Received Frame */ + PortFcId int64 /* SCSI Id of the adapter */ + PortSpeed int64 /* Speed of Adapter in GBIT */ + PortType string /* Type of connection. The Possible Values are Fabric, Private Loop, Point-to-Point, unknown */ + PortWWN int64 /* World Wide Port name */ + PortSupportedSpeed int64 /* Supported Port Speed in GBIT */ + AdapterType int /* 0 - Fiber Chanel, 1 - Virtual Fiber Chanel Adapter */ + VfcName string /* name of the Virtual Fiber Chanel(VFC) adapter */ + ClientPartName string /* name of the client partition */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_fs.go b/vendor/github.com/power-devops/perfstat/types_fs.go new file mode 100644 index 00000000..b4b43ac6 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_fs.go @@ -0,0 +1,195 @@ +package perfstat + +import ( + "strings" +) + +type FileSystem struct { + Device string /* name of the mounted device */ + MountPoint string /* where the device is mounted */ + FSType int /* File system type, see the constants below */ + Flags uint /* Flags of the file system */ + TotalBlocks int64 /* number of 512 bytes blocks in the filesystem */ + FreeBlocks int64 /* number of free 512 bytes block in the filesystem */ + TotalInodes int64 /* total number of inodes in the filesystem */ + FreeInodes int64 /* number of free inodes in the filesystem */ +} + +func (f *FileSystem) TypeString() string { + switch f.FSType { + case FS_JFS2: + return "jfs2" + case FS_NAMEFS: + return "namefs" + case FS_NFS: + return "nfs" + case FS_JFS: + return "jfs" + case FS_CDROM: + return "cdrfs" + case FS_PROCFS: + return "procfs" + case FS_SFS: + return "sfs" + case FS_CACHEFS: + return "cachefs" + case FS_NFS3: + return "nfs3" + case FS_AUTOFS: + return "autofs" + case FS_POOLFS: + return "poolfs" + case FS_VXFS: + return "vxfs" + case FS_VXODM: + return "vxodm" + case FS_UDF: + return "udfs" + case FS_NFS4: + return "nfs4" + case FS_RFS4: + return "rfs4" + case FS_CIFS: + return "cifs" + case FS_PMEMFS: + return "pmemfs" + case FS_AHAFS: + return "ahafs" + case FS_STNFS: + return "stnfs" + case FS_ASMFS: + return "asmfs" + } + return "unknown" +} + +func (f *FileSystem) FlagsString() string { + var flags []string + + switch { + case f.Flags&VFS_READONLY != 0: + flags = append(flags, "ro") + case f.Flags&VFS_REMOVABLE != 0: + flags = append(flags, "removable") + case f.Flags&VFS_DEVMOUNT != 0: + flags = append(flags, "local") + case f.Flags&VFS_REMOTE != 0: + flags = append(flags, "remote") + case f.Flags&VFS_SYSV_MOUNT != 0: + flags = append(flags, "sysv") + case f.Flags&VFS_UNMOUNTING != 0: + flags = append(flags, "unmounting") + case f.Flags&VFS_NOSUID != 0: + flags = append(flags, "nosuid") + case f.Flags&VFS_NODEV != 0: + flags = append(flags, "nodev") + case f.Flags&VFS_NOINTEG != 0: + flags = append(flags, "nointeg") + case f.Flags&VFS_NOMANAGER != 0: + flags = append(flags, "nomanager") + case f.Flags&VFS_NOCASE != 0: + flags = append(flags, "nocase") + case f.Flags&VFS_UPCASE != 0: + flags = append(flags, "upcase") + case f.Flags&VFS_NBC != 0: + flags = append(flags, "nbc") + case f.Flags&VFS_MIND != 0: + flags = append(flags, "mind") + case f.Flags&VFS_RBR != 0: + flags = append(flags, "rbr") + case f.Flags&VFS_RBW != 0: + flags = append(flags, "rbw") + case f.Flags&VFS_DISCONNECTED != 0: + flags = append(flags, "disconnected") + case f.Flags&VFS_SHUTDOWN != 0: + flags = append(flags, "shutdown") + case f.Flags&VFS_VMOUNTOK != 0: + flags = append(flags, "vmountok") + case f.Flags&VFS_SUSER != 0: + flags = append(flags, "suser") + case f.Flags&VFS_SOFT_MOUNT != 0: + flags = append(flags, "soft") + case f.Flags&VFS_UNMOUNTED != 0: + flags = append(flags, "unmounted") + case f.Flags&VFS_DEADMOUNT != 0: + flags = append(flags, "deadmount") + case f.Flags&VFS_SNAPSHOT != 0: + flags = append(flags, "snapshot") + case f.Flags&VFS_VCM_ON != 0: + flags = append(flags, "vcm_on") + case f.Flags&VFS_VCM_MONITOR != 0: + flags = append(flags, "vcm_monitor") + case f.Flags&VFS_ATIMEOFF != 0: + flags = append(flags, "noatime") + case f.Flags&VFS_READMOSTLY != 0: + flags = append(flags, "readmostly") + case f.Flags&VFS_CIOR != 0: + flags = append(flags, "cior") + case f.Flags&VFS_CIO != 0: + flags = append(flags, "cio") + case f.Flags&VFS_DIO != 0: + flags = append(flags, "dio") + } + + return strings.Join(flags, ",") +} + +// Filesystem types +const ( + FS_JFS2 = 0 /* AIX physical fs "jfs2" */ + FS_NAMEFS = 1 /* AIX pseudo fs "namefs" */ + FS_NFS = 2 /* SUN Network File System "nfs" */ + FS_JFS = 3 /* AIX R3 physical fs "jfs" */ + FS_CDROM = 5 /* CDROM File System "cdrom" */ + FS_PROCFS = 6 /* PROCFS File System "proc" */ + FS_SFS = 16 /* AIX Special FS (STREAM mounts) */ + FS_CACHEFS = 17 /* Cachefs file system */ + FS_NFS3 = 18 /* NFSv3 file system */ + FS_AUTOFS = 19 /* Automount file system */ + FS_POOLFS = 20 /* Pool file system */ + FS_VXFS = 32 /* THRPGIO File System "vxfs" */ + FS_VXODM = 33 /* For Veritas File System */ + FS_UDF = 34 /* UDFS file system */ + FS_NFS4 = 35 /* NFSv4 file system */ + FS_RFS4 = 36 /* NFSv4 Pseudo file system */ + FS_CIFS = 37 /* AIX SMBFS (CIFS client) */ + FS_PMEMFS = 38 /* MCR Async Mobility pseudo file system */ + FS_AHAFS = 39 /* AHAFS File System "aha" */ + FS_STNFS = 40 /* Short-Term NFS */ + FS_ASMFS = 41 /* Oracle ASM FS */ +) + +// Filesystem flags +const ( + VFS_READONLY = 0x00000001 /* rdonly access to vfs */ + VFS_REMOVABLE = 0x00000002 /* removable (diskette) media */ + VFS_DEVMOUNT = 0x00000004 /* physical device mount */ + VFS_REMOTE = 0x00000008 /* file system is on network */ + VFS_SYSV_MOUNT = 0x00000010 /* System V style mount */ + VFS_UNMOUNTING = 0x00000020 /* originated by unmount() */ + VFS_NOSUID = 0x00000040 /* don't maintain suid-ness across this mount */ + VFS_NODEV = 0x00000080 /* don't allow device access across this mount */ + VFS_NOINTEG = 0x00000100 /* no integrity mount option */ + VFS_NOMANAGER = 0x00000200 /* mount managed fs w/o manager */ + VFS_NOCASE = 0x00000400 /* do not map dir names */ + VFS_UPCASE = 0x00000800 /* map dir names to uppercase */ + VFS_NBC = 0x00001000 /* NBC cached file in this vfs */ + VFS_MIND = 0x00002000 /* multi-segment .indirect */ + VFS_RBR = 0x00004000 /* Release-behind when reading */ + VFS_RBW = 0x00008000 /* Release-behind when writing */ + VFS_DISCONNECTED = 0x00010000 /* file mount not in use */ + VFS_SHUTDOWN = 0x00020000 /* forced unmount for shutdown */ + VFS_VMOUNTOK = 0x00040000 /* dir/file mnt permission flag */ + VFS_SUSER = 0x00080000 /* client-side suser perm. flag */ + VFS_SOFT_MOUNT = 0x00100000 /* file-over-file or directory over directory "soft" mount */ + VFS_UNMOUNTED = 0x00200000 /* unmount completed, stale vnodes are left in the vfs */ + VFS_DEADMOUNT = 0x00400000 /* softmount vfs should be disconnected at last vnode free */ + VFS_SNAPSHOT = 0x00800000 /* snapshot mount */ + VFS_VCM_ON = 0x01000000 /* VCM is currently active */ + VFS_VCM_MONITOR = 0x02000000 /* VCM monitoring is active */ + VFS_ATIMEOFF = 0x04000000 /* no atime updates during i/o */ + VFS_READMOSTLY = 0x10000000 /* ROFS allows open for write */ + VFS_CIOR = 0x20000000 /* O_CIOR mount */ + VFS_CIO = 0x40000000 /* O_CIO mount */ + VFS_DIO = 0x80000000 /* O_DIRECT mount */ +) diff --git a/vendor/github.com/power-devops/perfstat/types_lpar.go b/vendor/github.com/power-devops/perfstat/types_lpar.go new file mode 100644 index 00000000..f95f8c30 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_lpar.go @@ -0,0 +1,129 @@ +package perfstat + +type PartitionType struct { + SmtCapable bool /* OS supports SMT mode */ + SmtEnabled bool /* SMT mode is on */ + LparCapable bool /* OS supports logical partitioning */ + LparEnabled bool /* logical partitioning is on */ + SharedCapable bool /* OS supports shared processor LPAR */ + SharedEnabled bool /* partition runs in shared mode */ + DLparCapable bool /* OS supports dynamic LPAR */ + Capped bool /* partition is capped */ + Kernel64bit bool /* kernel is 64 bit */ + PoolUtilAuthority bool /* pool utilization available */ + DonateCapable bool /* capable of donating cycles */ + DonateEnabled bool /* enabled for donating cycles */ + AmsCapable bool /* 1 = AMS(Active Memory Sharing) capable, 0 = Not AMS capable */ + AmsEnabled bool /* 1 = AMS(Active Memory Sharing) enabled, 0 = Not AMS enabled */ + PowerSave bool /*1= Power saving mode is enabled*/ + AmeEnabled bool /* Active Memory Expansion is enabled */ + SharedExtended bool +} + +type PartitionValue struct { + Online int64 + Max int64 + Min int64 + Desired int64 +} + +type PartitionConfig struct { + Version int64 /* Version number */ + Name string /* Partition Name */ + Node string /* Node Name */ + Conf PartitionType /* Partition Properties */ + Number int32 /* Partition Number */ + GroupID int32 /* Group ID */ + ProcessorFamily string /* Processor Type */ + ProcessorModel string /* Processor Model */ + MachineID string /* Machine ID */ + ProcessorMhz float64 /* Processor Clock Speed in MHz */ + NumProcessors PartitionValue /* Number of Configured Physical Processors in frame*/ + OSName string /* Name of Operating System */ + OSVersion string /* Version of operating System */ + OSBuild string /* Build of Operating System */ + LCpus int32 /* Number of Logical CPUs */ + SmtThreads int32 /* Number of SMT Threads */ + Drives int32 /* Total Number of Drives */ + NetworkAdapters int32 /* Total Number of Network Adapters */ + CpuCap PartitionValue /* Min, Max and Online CPU Capacity */ + Weightage int32 /* Variable Processor Capacity Weightage */ + EntCapacity int32 /* number of processor units this partition is entitled to receive */ + VCpus PartitionValue /* Min, Max and Online Virtual CPUs */ + PoolID int32 /* Shared Pool ID of physical processors, to which this partition belongs*/ + ActiveCpusInPool int32 /* Count of physical CPUs in the shared processor pool, to which this partition belongs */ + PoolWeightage int32 /* Pool Weightage */ + SharedPCpu int32 /* Number of physical processors allocated for shared processor use */ + MaxPoolCap int32 /* Maximum processor capacity of partition's pool */ + EntPoolCap int32 /* Entitled processor capacity of partition's pool */ + Mem PartitionValue /* Min, Max and Online Memory */ + MemWeightage int32 /* Variable Memory Capacity Weightage */ + TotalIOMemoryEntitlement int64 /* I/O Memory Entitlement of the partition in bytes */ + MemPoolID int32 /* AMS pool id of the pool the LPAR belongs to */ + HyperPgSize int64 /* Hypervisor page size in KB*/ + ExpMem PartitionValue /* Min, Max and Online Expanded Memory */ + TargetMemExpFactor int64 /* Target Memory Expansion Factor scaled by 100 */ + TargetMemExpSize int64 /* Expanded Memory Size in MB */ + SubProcessorMode int32 /* Split core mode, its value can be 0,1,2 or 4. 0 for unsupported, 1 for capable but not enabled, 2 or 4 for enabled*/ +} + +const ( + AME_TYPE_V1 = 0x1 + AME_TYPE_V2 = 0x2 + LPAR_INFO_CAPPED = 0x01 /* Parition Capped */ + LPAR_INFO_AUTH_PIC = 0x02 /* Authority granted for poolidle*/ + LPAR_INFO_SMT_ENABLED = 0x04 /* SMT Enabled */ + LPAR_INFO_WPAR_ACTIVE = 0x08 /* Process Running Within a WPAR */ + LPAR_INFO_EXTENDED = 0x10 /* Extended shared processor pool information */ + LPAR_INFO_AME_ENABLED = 0x20 /* Active Mem. Expansion (AME) enabled*/ + LPAR_INFO_SEM_ENABLED = 0x40 /* Speculative Execution Mode enabled */ +) + +type PartitionInfo struct { + Version int /* version for this structure */ + OnlineMemory uint64 /* MB of currently online memory */ + TotalDispatchTime uint64 /* Total lpar dispatch time in nsecs */ + PoolIdleTime uint64 /* Idle time of shared CPU pool nsecs*/ + DispatchLatency uint64 /* Max latency inbetween dispatches of this LPAR on physCPUS in nsecs */ + LparFlags uint /* LPAR flags */ + PCpusInSys uint /* # of active licensed physical CPUs in system */ + OnlineVCpus uint /* # of current online virtual CPUs */ + OnlineLCpus uint /* # of current online logical CPUs */ + PCpusInPool uint /* # physical CPUs in shared pool */ + UnallocCapacity uint /* Unallocated Capacity available in shared pool */ + EntitledCapacity uint /* Entitled Processor Capacity for this partition */ + VariableWeight uint /* Variable Processor Capacity Weight */ + UnallocWeight uint /* Unallocated Variable Weight available for this partition */ + MinReqVCpuCapacity uint /* OS minimum required virtual processor capacity. */ + GroupId uint8 /* ID of a LPAR group/aggregation */ + PoolId uint8 /* ID of a shared pool */ + ShCpusInSys uint /* # of physical processors allocated for shared processor use */ + MaxPoolCapacity uint /* Maximum processor capacity of partition's pool */ + EntitledPoolCapacity uint /* Entitled processor capacity of partition's pool */ + PoolMaxTime uint64 /* Summation of maximum time that could be consumed by the pool, in nanoseconds */ + PoolBusyTime uint64 /* Summation of busy time accumulated across all partitions in the pool, in nanoseconds */ + PoolScaledBusyTime uint64 /* Scaled summation of busy time accumulated across all partitions in the pool, in nanoseconds */ + ShCpuTotalTime uint64 /* Summation of total time across all physical processors allocated for shared processor use, in nanoseconds */ + ShCpuBusyTime uint64 /* Summation of busy time accumulated across all shared processor partitions, in nanoseconds */ + ShCpuScaledBusyTime uint64 /* Scaled summation of busy time accumulated across all shared processor partitions, in nanoseconds */ + EntMemCapacity uint64 /* Partition's current entitlement memory capacity setting */ + PhysMem uint64 /* Amount of physical memory, in bytes, currently backing the partition's logical memory */ + VrmPoolPhysMem uint64 /* Total amount of physical memory in the VRM pool */ + HypPageSize uint /* Page size hypervisor is using to virtualize partition's memory */ + VrmPoolId int /* ID of VRM pool */ + VrmGroupId int /* eWLM VRM group to which partition belongs */ + VarMemWeight int /* Partition's current variable memory capacity weighting setting */ + UnallocVarMemWeight int /* Amount of unallocated variable memory capacity weight available to LPAR's group */ + UnallocEntMemCapacity uint64 /* Amount of unallocated I/O memory entitlement available to LPAR's group */ + TrueOnlineMemory uint64 /* true MB of currently online memory */ + AmeOnlineMemory uint64 /* AME MB of currently online memory */ + AmeType uint8 + SpecExecMode uint8 /* Speculative Execution Mode */ + AmeFactor uint /* memory expansion factor for LPAR */ + EmPartMajorCode uint /* Major and minor codes for our */ + EmPartMinorCode uint /* current energy management mode */ + BytesCoalesced uint64 /* The number of bytes of the calling partition.s logical real memory coalesced because they contained duplicated data */ + BytesCoalescedMemPool uint64 /* If the calling partition is authorized to see pool wide statistics then the number of bytes of logical real memory coalesced because they contained duplicated data in the calling partition.s memory pool else set to zero.*/ + PurrCoalescing uint64 /* If the calling partition is authorized to see pool wide statistics then PURR cycles consumed to coalesce data else set to zero.*/ + SpurrCoalescing uint64 /* If the calling partition is authorized to see pool wide statistics then SPURR cycles consumed to coalesce data else set to zero.*/ +} diff --git a/vendor/github.com/power-devops/perfstat/types_lvm.go b/vendor/github.com/power-devops/perfstat/types_lvm.go new file mode 100644 index 00000000..8f7176a6 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_lvm.go @@ -0,0 +1,31 @@ +package perfstat + +type LogicalVolume struct { + Name string /* logical volume name */ + VGName string /* volume group name */ + OpenClose int64 /* LVM_QLVOPEN, etc. (see lvm.h) */ + State int64 /* LVM_UNDEF, etc. (see lvm.h) */ + MirrorPolicy int64 /* LVM_PARALLEL, etc. (see lvm.h) */ + MirrorWriteConsistency int64 /* LVM_CONSIST, etc. (see lvm.h) */ + WriteVerify int64 /* LVM_VERIFY, etc. (see lvm.h) */ + PPsize int64 /* physical partition size in MB */ + LogicalPartitions int64 /* total number of logical paritions configured for this logical volume */ + Mirrors int32 /* number of physical mirrors for each logical partition */ + IOCnt int64 /* Number of read and write requests */ + KBReads int64 /* Number of Kilobytes read */ + KBWrites int64 /* Number of Kilobytes written */ + Version int64 /* version number (1, 2, etc.,) */ +} + +type VolumeGroup struct { + Name string /* volume group name */ + TotalDisks int64 /* number of physical volumes in the volume group */ + ActiveDisks int64 /* number of active physical volumes in the volume group */ + TotalLogicalVolumes int64 /* number of logical volumes in the volume group */ + OpenedLogicalVolumes int64 /* number of logical volumes opened in the volume group */ + IOCnt int64 /* Number of read and write requests */ + KBReads int64 /* Number of Kilobytes read */ + KBWrites int64 /* Number of Kilobytes written */ + Version int64 /* version number (1, 2, etc.,) */ + VariedState int /* Indicates volume group available or not */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_memory.go b/vendor/github.com/power-devops/perfstat/types_memory.go new file mode 100644 index 00000000..096d29ad --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_memory.go @@ -0,0 +1,101 @@ +package perfstat + +type MemoryTotal struct { + VirtualTotal int64 /* total virtual memory (in 4KB pages) */ + RealTotal int64 /* total real memory (in 4KB pages) */ + RealFree int64 /* free real memory (in 4KB pages) */ + RealPinned int64 /* real memory which is pinned (in 4KB pages) */ + RealInUse int64 /* real memory which is in use (in 4KB pages) */ + BadPages int64 /* number of bad pages */ + PageFaults int64 /* number of page faults */ + PageIn int64 /* number of pages paged in */ + PageOut int64 /* number of pages paged out */ + PgSpIn int64 /* number of page ins from paging space */ + PgSpOut int64 /* number of page outs from paging space */ + Scans int64 /* number of page scans by clock */ + Cycles int64 /* number of page replacement cycles */ + PgSteals int64 /* number of page steals */ + NumPerm int64 /* number of frames used for files (in 4KB pages) */ + PgSpTotal int64 /* total paging space (in 4KB pages) */ + PgSpFree int64 /* free paging space (in 4KB pages) */ + PgSpRsvd int64 /* reserved paging space (in 4KB pages) */ + RealSystem int64 /* real memory used by system segments (in 4KB pages). */ + RealUser int64 /* real memory used by non-system segments (in 4KB pages). */ + RealProcess int64 /* real memory used by process segments (in 4KB pages). */ + VirtualActive int64 /* Active virtual pages. Virtual pages are considered active if they have been accessed */ + IOME int64 /* I/O memory entitlement of the partition in bytes*/ + IOMU int64 /* I/O memory entitlement of the partition in use in bytes*/ + IOHWM int64 /* High water mark of I/O memory entitlement used in bytes*/ + PMem int64 /* Amount of physical mmeory currently backing partition's logical memory in bytes*/ + CompressedTotal int64 /* Total numbers of pages in compressed pool (in 4KB pages) */ + CompressedWSegPg int64 /* Number of compressed working storage pages */ + CPgIn int64 /* number of page ins to compressed pool */ + CPgOut int64 /* number of page outs from compressed pool */ + TrueSize int64 /* True Memory Size in 4KB pages */ + ExpandedMemory int64 /* Expanded Memory Size in 4KB pages */ + CompressedWSegSize int64 /* Total size of the compressed working storage pages in the pool */ + TargetCPoolSize int64 /* Target Compressed Pool Size in bytes */ + MaxCPoolSize int64 /* Max Size of Compressed Pool in bytes */ + MinUCPoolSize int64 /* Min Size of Uncompressed Pool in bytes */ + CPoolSize int64 /* Compressed Pool size in bytes */ + UCPoolSize int64 /* Uncompressed Pool size in bytes */ + CPoolInUse int64 /* Compressed Pool Used in bytes */ + UCPoolInUse int64 /* Uncompressed Pool Used in bytes */ + Version int64 /* version number (1, 2, etc.,) */ + RealAvailable int64 /* number of pages (in 4KB pages) of memory available without paging out working segments */ + BytesCoalesced int64 /* The number of bytes of the calling partition.s logical real memory coalesced because they contained duplicated data */ + BytesCoalescedMemPool int64 /* number of bytes of logical real memory coalesced because they contained duplicated data in the calling partition.s memory */ +} + +type MemoryPage struct { + PSize int64 /* page size in bytes */ + RealTotal int64 /* number of real memory frames of this page size */ + RealFree int64 /* number of pages on free list */ + RealPinned int64 /* number of pages pinned */ + RealInUse int64 /* number of pages in use */ + PgExct int64 /* number of page faults */ + PgIns int64 /* number of pages paged in */ + PgOuts int64 /* number of pages paged out */ + PgSpIns int64 /* number of page ins from paging space */ + PgSpOuts int64 /* number of page outs from paging space */ + Scans int64 /* number of page scans by clock */ + Cycles int64 /* number of page replacement cycles */ + PgSteals int64 /* number of page steals */ + NumPerm int64 /* number of frames used for files */ + NumPgSp int64 /* number of pages with allocated paging space */ + RealSystem int64 /* number of pages used by system segments. */ + RealUser int64 /* number of pages used by non-system segments. */ + RealProcess int64 /* number of pages used by process segments. */ + VirtActive int64 /* Active virtual pages. */ + ComprsdTotal int64 /* Number of pages of this size compressed */ + ComprsdWsegPgs int64 /* Number of compressed working storage pages */ + CPgIns int64 /* number of page ins of this page size to compressed pool */ + CPgOuts int64 /* number of page outs of this page size from compressed pool */ + CPoolInUse int64 /* Compressed Size of this page size in Compressed Pool */ + UCPoolSize int64 /* Uncompressed Pool size in bytes of this page size */ + ComprsdWsegSize int64 /* Total size of the compressed working storage pages in the pool */ + Version int64 /* version number (1, 2, etc.,) */ + RealAvail int64 /* number of pages (in 4KB pages) of memory available without paging out working segments */ +} + +// paging space types +const ( + LV_PAGING = 1 + NFS_PAGING = 2 + UNKNOWN_PAGING = 3 +) + +type PagingSpace struct { + Name string /* Paging space name */ + Type uint8 /* type of paging device (LV_PAGING or NFS_PAGING) */ + VGName string /* volume group name */ + Hostname string /* host name of paging server */ + Filename string /* swap file name on server */ + LPSize int64 /* size in number of logical partitions */ + MBSize int64 /* size in megabytes */ + MBUsed int64 /* portion used in megabytes */ + IOPending int64 /* number of pending I/O */ + Active uint8 /* indicates if active (1 if so, 0 if not) */ + Automatic uint8 /* indicates if automatic (1 if so, 0 if not) */ + Version int64 /* version number (1, 2, etc.,) */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_network.go b/vendor/github.com/power-devops/perfstat/types_network.go new file mode 100644 index 00000000..e69d0041 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_network.go @@ -0,0 +1,163 @@ +package perfstat + +// Network Interface types +const ( + IFT_OTHER = 0x1 + IFT_1822 = 0x2 /* old-style arpanet imp */ + IFT_HDH1822 = 0x3 /* HDH arpanet imp */ + IFT_X25DDN = 0x4 /* x25 to imp */ + IFT_X25 = 0x5 /* PDN X25 interface (RFC877) */ + IFT_ETHER = 0x6 /* Ethernet CSMACD */ + IFT_ISO88023 = 0x7 /* CMSA CD */ + IFT_ISO88024 = 0x8 /* Token Bus */ + IFT_ISO88025 = 0x9 /* Token Ring */ + IFT_ISO88026 = 0xa /* MAN */ + IFT_STARLAN = 0xb + IFT_P10 = 0xc /* Proteon 10MBit ring */ + IFT_P80 = 0xd /* Proteon 10MBit ring */ + IFT_HY = 0xe /* Hyperchannel */ + IFT_FDDI = 0xf + IFT_LAPB = 0x10 + IFT_SDLC = 0x11 + IFT_T1 = 0x12 + IFT_CEPT = 0x13 /* E1 - european T1 */ + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_PTPSERIAL = 0x16 /* Proprietary PTP serial */ + IFT_PPP = 0x17 /* RFC 1331 */ + IFT_LOOP = 0x18 /* loopback */ + IFT_EON = 0x19 /* ISO over IP */ + IFT_XETHER = 0x1a /* obsolete 3MB experimental ethernet */ + IFT_NSIP = 0x1b /* XNS over IP */ + IFT_SLIP = 0x1c /* IP over generic TTY */ + IFT_ULTRA = 0x1d /* Ultra Technologies */ + IFT_DS3 = 0x1e /* Generic T3 */ + IFT_SIP = 0x1f /* SMDS */ + IFT_FRELAY = 0x20 /* Frame Relay DTE only */ + IFT_RS232 = 0x21 + IFT_PARA = 0x22 /* parallel-port */ + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ATM = 0x25 /* ATM cells */ + IFT_MIOX25 = 0x26 + IFT_SONET = 0x27 /* SONET or SDH */ + IFT_X25PLE = 0x28 + IFT_ISO88022LLC = 0x29 + IFT_LOCALTALK = 0x2a + IFT_SMDSDXI = 0x2b + IFT_FRELAYDCE = 0x2c /* Frame Relay DCE */ + IFT_V35 = 0x2d + IFT_HSSI = 0x2e + IFT_HIPPI = 0x2f + IFT_MODEM = 0x30 /* Generic Modem */ + IFT_AAL5 = 0x31 /* AAL5 over ATM */ + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SMDSICIP = 0x34 /* SMDS InterCarrier Interface */ + IFT_PROPVIRTUAL = 0x35 /* Proprietary Virtual/internal */ + IFT_PROPMUX = 0x36 /* Proprietary Multiplexing */ + IFT_VIPA = 0x37 /* Virtual Interface */ + IFT_SN = 0x38 /* Federation Switch */ + IFT_SP = 0x39 /* SP switch */ + IFT_FCS = 0x3a /* IP over Fiber Channel */ + IFT_TUNNEL = 0x3b + IFT_GIFTUNNEL = 0x3c /* IPv4 over IPv6 tunnel */ + IFT_HF = 0x3d /* Support for PERCS HFI*/ + IFT_CLUSTER = 0x3e /* cluster pseudo network interface */ + IFT_FB = 0xc7 /* IP over Infiniband. Number by IANA */ +) + +type NetIfaceTotal struct { + Number int32 /* number of network interfaces */ + IPackets int64 /* number of packets received on interface */ + IBytes int64 /* number of bytes received on interface */ + IErrors int64 /* number of input errors on interface */ + OPackets int64 /* number of packets sent on interface */ + OBytes int64 /* number of bytes sent on interface */ + OErrors int64 /* number of output errors on interface */ + Collisions int64 /* number of collisions on csma interface */ + XmitDrops int64 /* number of packets not transmitted */ + Version int64 /* version number (1, 2, etc.,) */ +} + +type NetIface struct { + Name string /* name of the interface */ + Description string /* interface description (from ODM, similar to lscfg output) */ + Type uint8 /* ethernet, tokenring, etc. interpretation can be done using /usr/include/net/if_types.h */ + MTU int64 /* network frame size */ + IPackets int64 /* number of packets received on interface */ + IBytes int64 /* number of bytes received on interface */ + IErrors int64 /* number of input errors on interface */ + OPackets int64 /* number of packets sent on interface */ + OBytes int64 /* number of bytes sent on interface */ + OErrors int64 /* number of output errors on interface */ + Collisions int64 /* number of collisions on csma interface */ + Bitrate int64 /* adapter rating in bit per second */ + XmitDrops int64 /* number of packets not transmitted */ + Version int64 /* version number (1, 2, etc.,) */ + IfIqDrops int64 /* Dropped on input, this interface */ + IfArpDrops int64 /* Dropped because no arp response */ +} + +type NetBuffer struct { + Name string /* size in ascii, always power of 2 (ex: "32", "64", "128") */ + InUse int64 /* number of buffer currently allocated */ + Calls int64 /* number of buffer allocations since last reset */ + Delayed int64 /* number of delayed allocations */ + Free int64 /* number of free calls */ + Failed int64 /* number of failed allocations */ + HighWatermark int64 /* high threshold for number of buffer allocated */ + Freed int64 /* number of buffers freed */ + Version int64 /* version number (1, 2, etc.,) */ +} + +// Network adapter types +const ( + NET_PHY = 0 /* physical device */ + NET_SEA = 1 /* shared ethernet adapter */ + NET_VIR = 2 /* virtual device */ + NET_HEA = 3 /* host ethernet adapter */ + NET_EC = 4 /* etherchannel */ + NET_VLAN = 5 /* vlan pseudo device */ +) + +type NetAdapter struct { + Version int64 /* version number (1,2, etc) */ + Name string /* name of the adapter */ + TxPackets int64 /* Transmit Packets on interface */ + TxBytes int64 /* Transmit Bytes on interface */ + TxInterrupts int64 /* Transfer Interrupts */ + TxErrors int64 /* Transmit Errors */ + TxPacketsDropped int64 /* Packets Dropped at the time of Data Transmission */ + TxQueueSize int64 /* Maximum Packets on Software Transmit Queue */ + TxQueueLen int64 /* Transmission Queue Length */ + TxQueueOverflow int64 /* Transmission Queue Overflow */ + TxBroadcastPackets int64 /* Number of Broadcast Packets Transmitted */ + TxMulticastPackets int64 /* Number of Multicast packets Transmitted */ + TxCarrierSense int64 /* Lost Carrier Sense signal count */ + TxDMAUnderrun int64 /* Count of DMA Under-runs for Transmission */ + TxLostCTSErrors int64 /* The number of unsuccessful transmissions due to the loss of the Clear-to-Send signal error */ + TxMaxCollisionErrors int64 /* Maximum Collision Errors at Transmission */ + TxLateCollisionErrors int64 /* Late Collision Errors at Transmission */ + TxDeferred int64 /* The number of packets deferred for Transmission. */ + TxTimeoutErrors int64 /* Time Out Errors for Transmission */ + TxSingleCollisionCount int64 /* Count of Single Collision error at Transmission */ + TxMultipleCollisionCount int64 /* Count of Multiple Collision error at Transmission */ + RxPackets int64 /* Receive Packets on interface */ + RxBytes int64 /* Receive Bytes on interface */ + RxInterrupts int64 /* Receive Interrupts */ + RxErrors int64 /* Input errors on interface */ + RxPacketsDropped int64 /* The number of packets accepted by the device driver for transmission which were not (for any reason) given to the device. */ + RxBadPackets int64 /* Count of Bad Packets Received. */ + RxMulticastPackets int64 /* Number of MultiCast Packets Received */ + RxBroadcastPackets int64 /* Number of Broadcast Packets Received */ + RxCRCErrors int64 /* Count of Packets Received with CRC errors */ + RxDMAOverrun int64 /* Count of DMA over-runs for Data Receival. */ + RxAlignmentErrors int64 /* Packets Received with Alignment Error */ + RxNoResourceErrors int64 /* Packets Received with No Resource Errors */ + RxCollisionErrors int64 /* Packets Received with Collision errors */ + RxPacketTooShortErrors int64 /* Count of Short Packets Received. */ + RxPacketTooLongErrors int64 /* Count of Too Long Packets Received. */ + RxPacketDiscardedByAdapter int64 /* Count of Received Packets discarded by Adapter. */ + AdapterType int32 /* 0 - Physical, 1 - SEA, 2 - Virtual, 3 -HEA */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_process.go b/vendor/github.com/power-devops/perfstat/types_process.go new file mode 100644 index 00000000..325c70b0 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_process.go @@ -0,0 +1,43 @@ +package perfstat + +type Process struct { + Version int64 /* version number (1, 2, etc.,) */ + PID int64 /* Process ID */ + ProcessName string /* Name of The Process */ + Priority int32 /* Process Priority */ + NumThreads int64 /* Thread Count */ + UID int64 /* Owner Info */ + ClassID int64 /* WLM Class Name */ + Size int64 /* Virtual Size of the Process in KB(Exclusive Usage, Leaving all Shared Library Text & Shared File Pages, Shared Memory, Memory Mapped) */ + RealMemData int64 /* Real Memory used for Data in KB */ + RealMemText int64 /* Real Memory used for Text in KB */ + VirtMemData int64 /* Virtual Memory used to Data in KB */ + VirtMemText int64 /* Virtual Memory used for Text in KB */ + SharedLibDataSize int64 /* Data Size from Shared Library in KB */ + HeapSize int64 /* Heap Size in KB */ + RealInUse int64 /* The Real memory in use(in KB) by the process including all kind of segments (excluding system segments). This includes Text, Data, Shared Library Text, Shared Library Data, File Pages, Shared Memory & Memory Mapped */ + VirtInUse int64 /* The Virtual memory in use(in KB) by the process including all kind of segments (excluding system segments). This includes Text, Data, Shared Library Text, Shared Library Data, File Pages, Shared Memory & Memory Mapped */ + Pinned int64 /* Pinned Memory(in KB) for this process inclusive of all segments */ + PgSpInUse int64 /* Paging Space used(in KB) inclusive of all segments */ + FilePages int64 /* File Pages used(in KB) including shared pages */ + RealInUseMap int64 /* Real memory used(in KB) for Shared Memory and Memory Mapped regions */ + VirtInUseMap int64 /* Virtual Memory used(in KB) for Shared Memory and Memory Mapped regions */ + PinnedInUseMap int64 /* Pinned memory(in KB) for Shared Memory and Memory Mapped regions */ + UCpuTime float64 /* User Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_process_util or perfstat_process respectively. */ + SCpuTime float64 /* System Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_process_util or perfstat_process respectively. */ + LastTimeBase int64 /* Timebase Counter */ + InBytes int64 /* Bytes Read from Disk */ + OutBytes int64 /* Bytes Written to Disk */ + InOps int64 /* In Operations from Disk */ + OutOps int64 /* Out Operations from Disk */ +} + +type Thread struct { + TID int64 /* thread identifier */ + PID int64 /* process identifier */ + CpuID int64 /* processor on which I'm bound */ + UCpuTime float64 /* User Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_thread_util or perfstat_thread respectively. */ + SCpuTime float64 /* System Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_thread_util or perfstat_thread respectively. */ + LastTimeBase int64 /* Timebase Counter */ + Version int64 +} diff --git a/vendor/github.com/power-devops/perfstat/uptime.go b/vendor/github.com/power-devops/perfstat/uptime.go new file mode 100644 index 00000000..86087874 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/uptime.go @@ -0,0 +1,36 @@ +//go:build aix +// +build aix + +package perfstat + +/* +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "time" +) + +func timeSince(ts uint64) uint64 { + return uint64(time.Now().Unix()) - ts +} + +// BootTime() returns the time of the last boot in UNIX seconds +func BootTime() (uint64, error) { + sec := C.boottime() + if sec == -1 { + return 0, fmt.Errorf("Can't determine boot time") + } + return uint64(sec), nil +} + +// UptimeSeconds() calculates uptime in seconds +func UptimeSeconds() (uint64, error) { + boot, err := BootTime() + if err != nil { + return 0, err + } + return timeSince(boot), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/LICENSE b/vendor/github.com/shirou/gopsutil/v4/LICENSE new file mode 100644 index 00000000..6f06adcb --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/LICENSE @@ -0,0 +1,61 @@ +gopsutil is distributed under BSD license reproduced below. + +Copyright (c) 2014, WAKAYAMA Shirou +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the gopsutil authors nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +------- +internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go. + + + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/github.com/shirou/gopsutil/v4/common/env.go b/vendor/github.com/shirou/gopsutil/v4/common/env.go new file mode 100644 index 00000000..47e471c4 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/common/env.go @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: BSD-3-Clause +package common + +type EnvKeyType string + +// EnvKey is a context key that can be used to set programmatically the environment +// gopsutil relies on to perform calls against the OS. +// Example of use: +// +// ctx := context.WithValue(context.Background(), common.EnvKey, EnvMap{common.HostProcEnvKey: "/myproc"}) +// avg, err := load.AvgWithContext(ctx) +var EnvKey = EnvKeyType("env") + +const ( + HostProcEnvKey EnvKeyType = "HOST_PROC" + HostSysEnvKey EnvKeyType = "HOST_SYS" + HostEtcEnvKey EnvKeyType = "HOST_ETC" + HostVarEnvKey EnvKeyType = "HOST_VAR" + HostRunEnvKey EnvKeyType = "HOST_RUN" + HostDevEnvKey EnvKeyType = "HOST_DEV" + HostRootEnvKey EnvKeyType = "HOST_ROOT" + HostProcMountinfo EnvKeyType = "HOST_PROC_MOUNTINFO" +) + +type EnvMap map[EnvKeyType]string diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go new file mode 100644 index 00000000..9bc3dfb5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "math" + "runtime" + "strconv" + "strings" + "sync" + "time" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +// TimesStat contains the amounts of time the CPU has spent performing different +// kinds of work. Time units are in seconds. It is based on linux /proc/stat file. +type TimesStat struct { + CPU string `json:"cpu"` + User float64 `json:"user"` + System float64 `json:"system"` + Idle float64 `json:"idle"` + Nice float64 `json:"nice"` + Iowait float64 `json:"iowait"` + Irq float64 `json:"irq"` + Softirq float64 `json:"softirq"` + Steal float64 `json:"steal"` + Guest float64 `json:"guest"` + GuestNice float64 `json:"guestNice"` +} + +type InfoStat struct { + CPU int32 `json:"cpu"` + VendorID string `json:"vendorId"` + Family string `json:"family"` + Model string `json:"model"` + Stepping int32 `json:"stepping"` + PhysicalID string `json:"physicalId"` + CoreID string `json:"coreId"` + Cores int32 `json:"cores"` + ModelName string `json:"modelName"` + Mhz float64 `json:"mhz"` + CacheSize int32 `json:"cacheSize"` + Flags []string `json:"flags"` + Microcode string `json:"microcode"` +} + +type lastPercent struct { + sync.Mutex + lastCPUTimes []TimesStat + lastPerCPUTimes []TimesStat +} + +var ( + lastCPUPercent lastPercent + invoke common.Invoker = common.Invoke{} +) + +func init() { + lastCPUPercent.Lock() + lastCPUPercent.lastCPUTimes, _ = Times(false) + lastCPUPercent.lastPerCPUTimes, _ = Times(true) + lastCPUPercent.Unlock() +} + +// Counts returns the number of physical or logical cores in the system +func Counts(logical bool) (int, error) { + return CountsWithContext(context.Background(), logical) +} + +func (c TimesStat) String() string { + v := []string{ + `"cpu":"` + c.CPU + `"`, + `"user":` + strconv.FormatFloat(c.User, 'f', 1, 64), + `"system":` + strconv.FormatFloat(c.System, 'f', 1, 64), + `"idle":` + strconv.FormatFloat(c.Idle, 'f', 1, 64), + `"nice":` + strconv.FormatFloat(c.Nice, 'f', 1, 64), + `"iowait":` + strconv.FormatFloat(c.Iowait, 'f', 1, 64), + `"irq":` + strconv.FormatFloat(c.Irq, 'f', 1, 64), + `"softirq":` + strconv.FormatFloat(c.Softirq, 'f', 1, 64), + `"steal":` + strconv.FormatFloat(c.Steal, 'f', 1, 64), + `"guest":` + strconv.FormatFloat(c.Guest, 'f', 1, 64), + `"guestNice":` + strconv.FormatFloat(c.GuestNice, 'f', 1, 64), + } + + return `{` + strings.Join(v, ",") + `}` +} + +// Deprecated: Total returns the total number of seconds in a CPUTimesStat +// Please do not use this internal function. +func (c TimesStat) Total() float64 { + total := c.User + c.System + c.Idle + c.Nice + c.Iowait + c.Irq + + c.Softirq + c.Steal + c.Guest + c.GuestNice + + return total +} + +func (c InfoStat) String() string { + s, _ := json.Marshal(c) + return string(s) +} + +func getAllBusy(t TimesStat) (float64, float64) { + tot := t.Total() + if runtime.GOOS == "linux" { + tot -= t.Guest // Linux 2.6.24+ + tot -= t.GuestNice // Linux 3.2.0+ + } + + busy := tot - t.Idle - t.Iowait + + return tot, busy +} + +func calculateBusy(t1, t2 TimesStat) float64 { + t1All, t1Busy := getAllBusy(t1) + t2All, t2Busy := getAllBusy(t2) + + if t2Busy <= t1Busy { + return 0 + } + if t2All <= t1All { + return 100 + } + return math.Min(100, math.Max(0, (t2Busy-t1Busy)/(t2All-t1All)*100)) +} + +func calculateAllBusy(t1, t2 []TimesStat) ([]float64, error) { + // Make sure the CPU measurements have the same length. + if len(t1) != len(t2) { + return nil, fmt.Errorf( + "received two CPU counts: %d != %d", + len(t1), len(t2), + ) + } + + ret := make([]float64, len(t1)) + for i, t := range t2 { + ret[i] = calculateBusy(t1[i], t) + } + return ret, nil +} + +// Percent calculates the percentage of cpu used either per CPU or combined. +// If an interval of 0 is given it will compare the current cpu times against the last call. +// Returns one value per cpu, or a single value if percpu is set to false. +func Percent(interval time.Duration, percpu bool) ([]float64, error) { + return PercentWithContext(context.Background(), interval, percpu) +} + +func PercentWithContext(ctx context.Context, interval time.Duration, percpu bool) ([]float64, error) { + if interval <= 0 { + return percentUsedFromLastCallWithContext(ctx, percpu) + } + + // Get CPU usage at the start of the interval. + cpuTimes1, err := TimesWithContext(ctx, percpu) + if err != nil { + return nil, err + } + + if err := common.Sleep(ctx, interval); err != nil { + return nil, err + } + + // And at the end of the interval. + cpuTimes2, err := TimesWithContext(ctx, percpu) + if err != nil { + return nil, err + } + + return calculateAllBusy(cpuTimes1, cpuTimes2) +} + +func percentUsedFromLastCall(percpu bool) ([]float64, error) { + return percentUsedFromLastCallWithContext(context.Background(), percpu) +} + +func percentUsedFromLastCallWithContext(ctx context.Context, percpu bool) ([]float64, error) { + cpuTimes, err := TimesWithContext(ctx, percpu) + if err != nil { + return nil, err + } + lastCPUPercent.Lock() + defer lastCPUPercent.Unlock() + var lastTimes []TimesStat + if percpu { + lastTimes = lastCPUPercent.lastPerCPUTimes + lastCPUPercent.lastPerCPUTimes = cpuTimes + } else { + lastTimes = lastCPUPercent.lastCPUTimes + lastCPUPercent.lastCPUTimes = cpuTimes + } + + if lastTimes == nil { + return nil, errors.New("error getting times for cpu percent. lastTimes was nil") + } + return calculateAllBusy(lastTimes, cpuTimes) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix.go new file mode 100644 index 00000000..bc766bd4 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix.go @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix + +package cpu + +import ( + "context" +) + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_cgo.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_cgo.go new file mode 100644 index 00000000..8bd84de6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_cgo.go @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && cgo + +package cpu + +import ( + "context" + + "github.com/power-devops/perfstat" +) + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + var ret []TimesStat + if percpu { + cpus, err := perfstat.CpuStat() + if err != nil { + return nil, err + } + for _, c := range cpus { + ct := &TimesStat{ + CPU: c.Name, + Idle: float64(c.Idle), + User: float64(c.User), + System: float64(c.Sys), + Iowait: float64(c.Wait), + } + ret = append(ret, *ct) + } + } else { + c, err := perfstat.CpuTotalStat() + if err != nil { + return nil, err + } + ct := &TimesStat{ + CPU: "cpu-total", + Idle: float64(c.Idle), + User: float64(c.User), + System: float64(c.Sys), + Iowait: float64(c.Wait), + } + ret = append(ret, *ct) + } + return ret, nil +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + c, err := perfstat.CpuTotalStat() + if err != nil { + return nil, err + } + p, err := perfstat.LparInfo() + if err != nil { + return nil, err + } + info := InfoStat{ + CPU: 0, + ModelName: c.Description, + Mhz: float64(c.ProcessorHz / 1000000), + Cores: int32(p.OnlineVCpus), + } + result := []InfoStat{info} + return result, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + if logical { + c, err := perfstat.CpuTotalStat() + if err != nil { + return 0, err + } + return c.NCpusCfg, nil + } + // For physical count, use the number of online virtual CPUs (before SMT multiplications). + p, err := perfstat.LparInfo() + if err != nil { + return 0, err + } + return int(p.OnlineVCpus), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_nocgo.go new file mode 100644 index 00000000..981e32e5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_nocgo.go @@ -0,0 +1,157 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && !cgo + +package cpu + +import ( + "context" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + var ret []TimesStat + if percpu { + perOut, err := invoke.CommandWithContext(ctx, "sar", "-u", "-P", "ALL", "10", "1") + if err != nil { + return nil, err + } + lines := strings.Split(string(perOut), "\n") + if len(lines) < 6 { + return []TimesStat{}, common.ErrNotImplementedError + } + + hp := strings.Fields(lines[5]) // headers + for l := 6; l < len(lines)-1; l++ { + ct := &TimesStat{} + v := strings.Fields(lines[l]) // values + for i, header := range hp { + // We're done in any of these use cases + if i >= len(v) || v[0] == "-" { + break + } + + // Position variable for v + pos := i + // There is a missing field at the beginning of all but the first line + // so adjust the position + if l > 6 { + pos = i - 1 + } + // We don't want invalid positions + if pos < 0 { + continue + } + + if t, err := strconv.ParseFloat(v[pos], 64); err == nil { + switch header { + case `cpu`: + ct.CPU = strconv.FormatFloat(t, 'f', -1, 64) + case `%usr`: + ct.User = t + case `%sys`: + ct.System = t + case `%wio`: + ct.Iowait = t + case `%idle`: + ct.Idle = t + } + } + } + // Valid CPU data, so append it + ret = append(ret, *ct) + } + } else { + out, err := invoke.CommandWithContext(ctx, "sar", "-u", "10", "1") + if err != nil { + return nil, err + } + lines := strings.Split(string(out), "\n") + if len(lines) < 5 { + return []TimesStat{}, common.ErrNotImplementedError + } + + ct := &TimesStat{CPU: "cpu-total"} + h := strings.Fields(lines[len(lines)-3]) // headers + v := strings.Fields(lines[len(lines)-2]) // values + for i, header := range h { + if t, err := strconv.ParseFloat(v[i], 64); err == nil { + switch header { + case `%usr`: + ct.User = t + case `%sys`: + ct.System = t + case `%wio`: + ct.Iowait = t + case `%idle`: + ct.Idle = t + } + } + } + + ret = append(ret, *ct) + } + + return ret, nil +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + out, err := invoke.CommandWithContext(ctx, "prtconf") + if err != nil { + return nil, err + } + + ret := InfoStat{} + for _, line := range strings.Split(string(out), "\n") { + switch { + case strings.HasPrefix(line, "Number Of Processors:"): + p := strings.Fields(line) + if len(p) > 3 { + if t, err := strconv.ParseUint(p[3], 10, 64); err == nil { + ret.Cores = int32(t) + } + } + case strings.HasPrefix(line, "Processor Clock Speed:"): + p := strings.Fields(line) + if len(p) > 4 { + if t, err := strconv.ParseFloat(p[3], 64); err == nil { + switch strings.ToUpper(p[4]) { + case "MHZ": + ret.Mhz = t + case "GHZ": + ret.Mhz = t * 1000.0 + case "KHZ": + ret.Mhz = t / 1000.0 + default: + ret.Mhz = t + } + } + } + case strings.HasPrefix(line, "System Model:"): + p := strings.Split(string(line), ":") + if p != nil { + ret.VendorID = strings.TrimSpace(p[1]) + } + case strings.HasPrefix(line, "Processor Type:"): + p := strings.Split(string(line), ":") + if p != nil { + c := strings.Split(string(p[1]), "_") + if c != nil { + ret.Family = strings.TrimSpace(c[0]) + ret.Model = strings.TrimSpace(c[1]) + } + } + } + } + return []InfoStat{ret}, nil +} + +func CountsWithContext(ctx context.Context, _ bool) (int, error) { + info, err := InfoWithContext(ctx) + if err == nil { + return int(info[0].Cores), nil + } + return 0, err +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin.go new file mode 100644 index 00000000..d3b6dbc5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin.go @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin + +package cpu + +import ( + "context" + "errors" + "fmt" + "strconv" + "strings" + "unsafe" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +// sys/resource.h +const ( + CPUser = 0 + cpNice = 1 + cpSys = 2 + cpIntr = 3 + cpIdle = 4 + cpUStates = 5 +) + +// mach/machine.h +const ( + cpuStateUser = 0 + cpuStateSystem = 1 + cpuStateIdle = 2 + cpuStateNice = 3 + cpuStateMax = 4 +) + +// mach/processor_info.h +const ( + processorCpuLoadInfo = 2 //nolint:revive //FIXME +) + +type hostCpuLoadInfoData struct { //nolint:revive //FIXME + cpuTicks [cpuStateMax]uint32 +} + +// default value. from time.h +var ClocksPerSec = float64(128) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { + sys, err := common.NewSystemLib() + if err != nil { + return nil, err + } + defer sys.Close() + + if percpu { + return perCPUTimes(sys) + } + + return allCPUTimes(sys) +} + +// Returns only one CPUInfoStat on FreeBSD +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(_ context.Context) ([]InfoStat, error) { + var ret []InfoStat + + c := InfoStat{} + c.ModelName, _ = unix.Sysctl("machdep.cpu.brand_string") + family, _ := unix.SysctlUint32("machdep.cpu.family") + c.Family = strconv.FormatUint(uint64(family), 10) + model, _ := unix.SysctlUint32("machdep.cpu.model") + c.Model = strconv.FormatUint(uint64(model), 10) + stepping, _ := unix.SysctlUint32("machdep.cpu.stepping") + c.Stepping = int32(stepping) + features, err := unix.Sysctl("machdep.cpu.features") + if err == nil { + for _, v := range strings.Fields(features) { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + leaf7Features, err := unix.Sysctl("machdep.cpu.leaf7_features") + if err == nil { + for _, v := range strings.Fields(leaf7Features) { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + extfeatures, err := unix.Sysctl("machdep.cpu.extfeatures") + if err == nil { + for _, v := range strings.Fields(extfeatures) { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + cores, _ := unix.SysctlUint32("machdep.cpu.core_count") + c.Cores = int32(cores) + cacheSize, _ := unix.SysctlUint32("machdep.cpu.cache.size") + c.CacheSize = int32(cacheSize) + c.VendorID, _ = unix.Sysctl("machdep.cpu.vendor") + + v, err := getFrequency() + if err == nil { + c.Mhz = v + } + + return append(ret, c), nil +} + +func CountsWithContext(_ context.Context, logical bool) (int, error) { + var cpuArgument string + if logical { + cpuArgument = "hw.logicalcpu" + } else { + cpuArgument = "hw.physicalcpu" + } + + count, err := unix.SysctlUint32(cpuArgument) + if err != nil { + return 0, err + } + + return int(count), nil +} + +func perCPUTimes(sys *common.SystemLib) ([]TimesStat, error) { + var count, ncpu uint32 + var cpuload *hostCpuLoadInfoData + + status := sys.HostProcessorInfo(sys.MachHostSelf(), processorCpuLoadInfo, + &ncpu, uintptr(unsafe.Pointer(&cpuload)), &count) + + if status != common.KERN_SUCCESS { + return nil, fmt.Errorf("host_processor_info error=%d", status) + } + + if cpuload == nil { + return nil, errors.New("host_processor_info returned nil cpuload") + } + + defer sys.VMDeallocate(sys.MachTaskSelf(), uintptr(unsafe.Pointer(cpuload)), uintptr(ncpu)) + + ret := []TimesStat{} + loads := unsafe.Slice(cpuload, ncpu) + + for i := 0; i < int(ncpu); i++ { + c := TimesStat{ + CPU: fmt.Sprintf("cpu%d", i), + User: float64(loads[i].cpuTicks[cpuStateUser]) / ClocksPerSec, + System: float64(loads[i].cpuTicks[cpuStateSystem]) / ClocksPerSec, + Nice: float64(loads[i].cpuTicks[cpuStateNice]) / ClocksPerSec, + Idle: float64(loads[i].cpuTicks[cpuStateIdle]) / ClocksPerSec, + } + ret = append(ret, c) + } + + return ret, nil +} + +func allCPUTimes(sys *common.SystemLib) ([]TimesStat, error) { + var cpuload hostCpuLoadInfoData + count := uint32(cpuStateMax) + + status := sys.HostStatistics(sys.MachHostSelf(), common.HOST_CPU_LOAD_INFO, + uintptr(unsafe.Pointer(&cpuload)), &count) + + if status != common.KERN_SUCCESS { + return nil, fmt.Errorf("host_statistics error=%d", status) + } + + c := TimesStat{ + CPU: "cpu-total", + User: float64(cpuload.cpuTicks[cpuStateUser]) / ClocksPerSec, + System: float64(cpuload.cpuTicks[cpuStateSystem]) / ClocksPerSec, + Nice: float64(cpuload.cpuTicks[cpuStateNice]) / ClocksPerSec, + Idle: float64(cpuload.cpuTicks[cpuStateIdle]) / ClocksPerSec, + } + + return []TimesStat{c}, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go new file mode 100644 index 00000000..c9628a6d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin && arm64 + +package cpu + +import ( + "encoding/binary" + "fmt" + "sync" + "unsafe" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +// Keep IOKit and CoreFoundation libraries open for the process lifetime. +// See: https://github.com/shirou/gopsutil/issues/1832 +var ( + cpuLibOnce sync.Once + cpuIOKit *common.IOKitLib + cpuCF *common.CoreFoundationLib + cpuLibErr error +) + +func initCPULibraries() { + cpuIOKit, cpuLibErr = common.NewIOKitLib() + if cpuLibErr != nil { + return + } + cpuCF, cpuLibErr = common.NewCoreFoundationLib() +} + +// https://github.com/shoenig/go-m1cpu/blob/v0.1.6/cpu.go +func getFrequency() (float64, error) { + cpuLibOnce.Do(initCPULibraries) + if cpuLibErr != nil { + return 0, cpuLibErr + } + + iokit := cpuIOKit + corefoundation := cpuCF + + matching := iokit.IOServiceMatching("AppleARMIODevice") + + var iterator uint32 + if status := iokit.IOServiceGetMatchingServices(common.KIOMainPortDefault, uintptr(matching), &iterator); status != common.KERN_SUCCESS { + return 0.0, fmt.Errorf("IOServiceGetMatchingServices error=%d", status) + } + defer iokit.IOObjectRelease(iterator) + + pCorekey := corefoundation.CFStringCreateWithCString(common.KCFAllocatorDefault, "voltage-states5-sram", common.KCFStringEncodingUTF8) + defer corefoundation.CFRelease(uintptr(pCorekey)) + + var pCoreHz uint32 + for { + service := iokit.IOIteratorNext(iterator) + if service <= 0 { + break + } + + buf := common.NewCStr(512) + iokit.IORegistryEntryGetName(service, buf) + + if buf.GoString() == "pmgr" { + pCoreRef := iokit.IORegistryEntryCreateCFProperty(service, uintptr(pCorekey), common.KCFAllocatorDefault, common.KNilOptions) + length := corefoundation.CFDataGetLength(uintptr(pCoreRef)) + data := corefoundation.CFDataGetBytePtr(uintptr(pCoreRef)) + + // composite uint32 from the byte array + buf := unsafe.Slice((*byte)(data), length) + + // combine the bytes into a uint32 value + b := buf[length-8 : length-4] + pCoreHz = binary.LittleEndian.Uint32(b) + corefoundation.CFRelease(uintptr(pCoreRef)) + iokit.IOObjectRelease(service) + break + } + + iokit.IOObjectRelease(service) + } + + return float64(pCoreHz / 1_000_000), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_fallback.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_fallback.go new file mode 100644 index 00000000..b9e52aba --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_fallback.go @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin && !arm64 + +package cpu + +import "golang.org/x/sys/unix" + +func getFrequency() (float64, error) { + // Use the rated frequency of the CPU. This is a static value and does not + // account for low power or Turbo Boost modes. + cpuFrequency, err := unix.SysctlUint64("hw.cpufrequency") + return float64(cpuFrequency) / 1000000.0, err +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly.go new file mode 100644 index 00000000..48f2804d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly.go @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +import ( + "context" + "fmt" + "reflect" + "regexp" + "runtime" + "strconv" + "strings" + "unsafe" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var ( + ClocksPerSec = float64(128) + cpuMatch = regexp.MustCompile(`^CPU:`) + originMatch = regexp.MustCompile(`Origin\s*=\s*"(.+)"\s+Id\s*=\s*(.+)\s+Stepping\s*=\s*(.+)`) + featuresMatch = regexp.MustCompile(`Features=.+<(.+)>`) + featuresMatch2 = regexp.MustCompile(`Features2=[a-f\dx]+<(.+)>`) + cpuEnd = regexp.MustCompile(`^Trying to mount root`) + cpuTimesSize int + emptyTimes cpuTimes +) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func timeStat(name string, t *cpuTimes) *TimesStat { + return &TimesStat{ + User: float64(t.User) / ClocksPerSec, + Nice: float64(t.Nice) / ClocksPerSec, + System: float64(t.Sys) / ClocksPerSec, + Idle: float64(t.Idle) / ClocksPerSec, + Irq: float64(t.Intr) / ClocksPerSec, + CPU: name, + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + buf, err := unix.SysctlRaw("kern.cp_times") + if err != nil { + return nil, err + } + + // We can't do this in init due to the conflict with cpu.init() + if cpuTimesSize == 0 { + cpuTimesSize = int(reflect.TypeOf(cpuTimes{}).Size()) + } + + ncpus := len(buf) / cpuTimesSize + ret := make([]TimesStat, 0, ncpus) + for i := 0; i < ncpus; i++ { + times := (*cpuTimes)(unsafe.Pointer(&buf[i*cpuTimesSize])) + if *times == emptyTimes { + // CPU not present + continue + } + ret = append(ret, *timeStat(fmt.Sprintf("cpu%d", len(ret)), times)) + } + return ret, nil + } + + buf, err := unix.SysctlRaw("kern.cp_time") + if err != nil { + return nil, err + } + + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + return []TimesStat{*timeStat("cpu-total", times)}, nil +} + +// Returns only one InfoStat on DragonflyBSD. The information regarding core +// count, however is accurate and it is assumed that all InfoStat attributes +// are the same across CPUs. +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(_ context.Context) ([]InfoStat, error) { + const dmesgBoot = "/var/run/dmesg.boot" + + c, err := parseDmesgBoot(dmesgBoot) + if err != nil { + return nil, err + } + + var u32 uint32 + if u32, err = unix.SysctlUint32("hw.clockrate"); err != nil { + return nil, err + } + c.Mhz = float64(u32) + + var num int + var buf string + if buf, err = unix.Sysctl("hw.cpu_topology.tree"); err != nil { + return nil, err + } + num = strings.Count(buf, "CHIP") + c.Cores = int32(strings.Count(string(buf), "CORE") / num) + + if c.ModelName, err = unix.Sysctl("hw.model"); err != nil { + return nil, err + } + + ret := make([]InfoStat, num) + for i := 0; i < num; i++ { + ret[i] = c + } + + return ret, nil +} + +func parseDmesgBoot(fileName string) (InfoStat, error) { + c := InfoStat{} + lines, err := common.ReadLines(fileName) + if err != nil { + return c, fmt.Errorf("could not read %s: %w", fileName, err) + } + + for _, line := range lines { + if matches := cpuEnd.FindStringSubmatch(line); matches != nil { + break + } else if matches := originMatch.FindStringSubmatch(line); matches != nil { + c.VendorID = matches[1] + t, err := strconv.ParseInt(matches[2], 10, 32) + if err != nil { + return c, fmt.Errorf("unable to parse DragonflyBSD CPU stepping information from %q: %w", line, err) + } + c.Stepping = int32(t) + } else if matches := featuresMatch.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } else if matches := featuresMatch2.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + } + + return c, nil +} + +func CountsWithContext(_ context.Context, _ bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly_amd64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly_amd64.go new file mode 100644 index 00000000..25ececa6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly_amd64.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_fallback.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_fallback.go new file mode 100644 index 00000000..245c1ec9 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_fallback.go @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !solaris && !windows && !dragonfly && !plan9 && !aix + +package cpu + +import ( + "context" + "runtime" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + return []TimesStat{}, common.ErrNotImplementedError +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + return []InfoStat{}, common.ErrNotImplementedError +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd.go new file mode 100644 index 00000000..3e0aeb26 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd.go @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +import ( + "context" + "fmt" + "reflect" + "regexp" + "runtime" + "strconv" + "strings" + "unsafe" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var ( + ClocksPerSec = float64(128) + cpuMatch = regexp.MustCompile(`^CPU:`) + originMatch = regexp.MustCompile(`Origin\s*=\s*"(.+)"\s+Id\s*=\s*(.+)\s+Family\s*=\s*(.+)\s+Model\s*=\s*(.+)\s+Stepping\s*=\s*(.+)`) + featuresMatch = regexp.MustCompile(`Features=.+<(.+)>`) + featuresMatch2 = regexp.MustCompile(`Features2=[a-f\dx]+<(.+)>`) + cpuEnd = regexp.MustCompile(`^Trying to mount root`) + cpuCores = regexp.MustCompile(`FreeBSD/SMP: (\d*) package\(s\) x (\d*) core\(s\)`) + cpuTimesSize int + emptyTimes cpuTimes +) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func timeStat(name string, t *cpuTimes) *TimesStat { + return &TimesStat{ + User: float64(t.User) / ClocksPerSec, + Nice: float64(t.Nice) / ClocksPerSec, + System: float64(t.Sys) / ClocksPerSec, + Idle: float64(t.Idle) / ClocksPerSec, + Irq: float64(t.Intr) / ClocksPerSec, + CPU: name, + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + buf, err := unix.SysctlRaw("kern.cp_times") + if err != nil { + return nil, err + } + + // We can't do this in init due to the conflict with cpu.init() + if cpuTimesSize == 0 { + cpuTimesSize = int(reflect.TypeOf(cpuTimes{}).Size()) + } + + ncpus := len(buf) / cpuTimesSize + ret := make([]TimesStat, 0, ncpus) + for i := 0; i < ncpus; i++ { + times := (*cpuTimes)(unsafe.Pointer(&buf[i*cpuTimesSize])) + if *times == emptyTimes { + // CPU not present + continue + } + ret = append(ret, *timeStat(fmt.Sprintf("cpu%d", len(ret)), times)) + } + return ret, nil + } + + buf, err := unix.SysctlRaw("kern.cp_time") + if err != nil { + return nil, err + } + + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + return []TimesStat{*timeStat("cpu-total", times)}, nil +} + +// Returns only one InfoStat on FreeBSD. The information regarding core +// count, however is accurate and it is assumed that all InfoStat attributes +// are the same across CPUs. +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(_ context.Context) ([]InfoStat, error) { + const dmesgBoot = "/var/run/dmesg.boot" + + c, num, err := parseDmesgBoot(dmesgBoot) + if err != nil { + return nil, err + } + + var u32 uint32 + if u32, err = unix.SysctlUint32("hw.clockrate"); err != nil { + return nil, err + } + c.Mhz = float64(u32) + + if u32, err = unix.SysctlUint32("hw.ncpu"); err != nil { + return nil, err + } + c.Cores = int32(u32) + + if c.ModelName, err = unix.Sysctl("hw.model"); err != nil { + return nil, err + } + + ret := make([]InfoStat, num) + for i := 0; i < num; i++ { + ret[i] = c + } + + return ret, nil +} + +func parseDmesgBoot(fileName string) (InfoStat, int, error) { + c := InfoStat{} + lines, err := common.ReadLines(fileName) + if err != nil { + return c, 0, fmt.Errorf("could not read %s: %w", fileName, err) + } + + cpuNum := 1 // default cpu num is 1 + for _, line := range lines { + if matches := cpuEnd.FindStringSubmatch(line); matches != nil { + break + } else if matches := originMatch.FindStringSubmatch(line); matches != nil { + c.VendorID = matches[1] + c.Family = matches[3] + c.Model = matches[4] + t, err := strconv.ParseInt(matches[5], 10, 32) + if err != nil { + return c, 0, fmt.Errorf("unable to parse FreeBSD CPU stepping information from %q: %w", line, err) + } + c.Stepping = int32(t) + } else if matches := featuresMatch.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } else if matches := featuresMatch2.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } else if matches := cpuCores.FindStringSubmatch(line); matches != nil { + t, err := strconv.ParseInt(matches[1], 10, 32) + if err != nil { + return c, 0, fmt.Errorf("unable to parse FreeBSD CPU Nums from %q: %w", line, err) + } + cpuNum = int(t) + t2, err := strconv.ParseInt(matches[2], 10, 32) + if err != nil { + return c, 0, fmt.Errorf("unable to parse FreeBSD CPU cores from %q: %w", line, err) + } + c.Cores = int32(t2) + } + } + + return c, cpuNum, nil +} + +func CountsWithContext(_ context.Context, _ bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_386.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_386.go new file mode 100644 index 00000000..e4799bcf --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_386.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_amd64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_amd64.go new file mode 100644 index 00000000..25ececa6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_amd64.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm.go new file mode 100644 index 00000000..e4799bcf --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm64.go new file mode 100644 index 00000000..25ececa6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm64.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_linux.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_linux.go new file mode 100644 index 00000000..4072f19c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_linux.go @@ -0,0 +1,531 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux + +package cpu + +import ( + "context" + "errors" + "fmt" + "path/filepath" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var ClocksPerSec = float64(100) + +var armModelToModelName = map[uint64]string{ + 0x810: "ARM810", + 0x920: "ARM920", + 0x922: "ARM922", + 0x926: "ARM926", + 0x940: "ARM940", + 0x946: "ARM946", + 0x966: "ARM966", + 0xa20: "ARM1020", + 0xa22: "ARM1022", + 0xa26: "ARM1026", + 0xb02: "ARM11 MPCore", + 0xb36: "ARM1136", + 0xb56: "ARM1156", + 0xb76: "ARM1176", + 0xc05: "Cortex-A5", + 0xc07: "Cortex-A7", + 0xc08: "Cortex-A8", + 0xc09: "Cortex-A9", + 0xc0d: "Cortex-A17", + 0xc0f: "Cortex-A15", + 0xc0e: "Cortex-A17", + 0xc14: "Cortex-R4", + 0xc15: "Cortex-R5", + 0xc17: "Cortex-R7", + 0xc18: "Cortex-R8", + 0xc20: "Cortex-M0", + 0xc21: "Cortex-M1", + 0xc23: "Cortex-M3", + 0xc24: "Cortex-M4", + 0xc27: "Cortex-M7", + 0xc60: "Cortex-M0+", + 0xd01: "Cortex-A32", + 0xd02: "Cortex-A34", + 0xd03: "Cortex-A53", + 0xd04: "Cortex-A35", + 0xd05: "Cortex-A55", + 0xd06: "Cortex-A65", + 0xd07: "Cortex-A57", + 0xd08: "Cortex-A72", + 0xd09: "Cortex-A73", + 0xd0a: "Cortex-A75", + 0xd0b: "Cortex-A76", + 0xd0c: "Neoverse-N1", + 0xd0d: "Cortex-A77", + 0xd0e: "Cortex-A76AE", + 0xd13: "Cortex-R52", + 0xd20: "Cortex-M23", + 0xd21: "Cortex-M33", + 0xd40: "Neoverse-V1", + 0xd41: "Cortex-A78", + 0xd42: "Cortex-A78AE", + 0xd43: "Cortex-A65AE", + 0xd44: "Cortex-X1", + 0xd46: "Cortex-A510", + 0xd47: "Cortex-A710", + 0xd48: "Cortex-X2", + 0xd49: "Neoverse-N2", + 0xd4a: "Neoverse-E1", + 0xd4b: "Cortex-A78C", + 0xd4c: "Cortex-X1C", + 0xd4d: "Cortex-A715", + 0xd4e: "Cortex-X3", + 0xd4f: "Neoverse-V2", + 0xd81: "Cortex-A720", + 0xd82: "Cortex-X4", + 0xd84: "Neoverse-V3", + 0xd85: "Cortex-X925", + 0xd87: "Cortex-A725", + 0xd8e: "Neoverse-N3", +} + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + filename := common.HostProcWithContext(ctx, "stat") + lines := []string{} + var err error + if percpu { + statlines, err := common.ReadLines(filename) + if err != nil || len(statlines) < 2 { + return []TimesStat{}, nil + } + for _, line := range statlines[1:] { + if !strings.HasPrefix(line, "cpu") { + break + } + lines = append(lines, line) + } + } else { + lines, err = common.ReadLinesOffsetN(filename, 0, 1) + if err != nil || len(lines) == 0 { + return []TimesStat{}, nil + } + } + + ret := make([]TimesStat, 0, len(lines)) + + for _, line := range lines { + ct, err := parseStatLine(line) + if err != nil { + continue + } + ret = append(ret, *ct) + + } + return ret, nil +} + +func sysCPUPath(ctx context.Context, cpu int32, relPath string) string { + return common.HostSysWithContext(ctx, fmt.Sprintf("devices/system/cpu/cpu%d", cpu), relPath) +} + +func finishCPUInfo(ctx context.Context, c *InfoStat) { + var lines []string + var err error + var value float64 + + if c.CoreID == "" { + lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "topology/core_id")) + if err == nil { + c.CoreID = lines[0] + } + } + + // override the value of c.Mhz with cpufreq/cpuinfo_max_freq regardless + // of the value from /proc/cpuinfo because we want to report the maximum + // clock-speed of the CPU for c.Mhz, matching the behaviour of Windows + lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "cpufreq/cpuinfo_max_freq")) + // if we encounter errors below such as there are no cpuinfo_max_freq file, + // we just ignore. so let Mhz is 0. + if err != nil || len(lines) == 0 { + return + } + value, err = strconv.ParseFloat(lines[0], 64) + if err != nil { + return + } + c.Mhz = value / 1000.0 // value is in kHz + if c.Mhz > 9999 { + c.Mhz /= 1000.0 // value in Hz + } +} + +// CPUInfo on linux will return 1 item per physical thread. +// +// CPUs have three levels of counting: sockets, cores, threads. +// Cores with HyperThreading count as having 2 threads per core. +// Sockets often come with many physical CPU cores. +// For example a single socket board with two cores each with HT will +// return 4 CPUInfoStat structs on Linux and the "Cores" field set to 1. +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + filename := common.HostProcWithContext(ctx, "cpuinfo") + lines, err := common.ReadLines(filename) + if err != nil { + return nil, fmt.Errorf("could not read %s: %w", filename, err) + } + + var ret []InfoStat + var processorName string + + c := InfoStat{CPU: -1, Cores: 1} + for _, line := range lines { + fields := strings.SplitN(line, ":", 2) + if len(fields) < 2 { + continue + } + key := strings.TrimSpace(fields[0]) + value := strings.TrimSpace(fields[1]) + + switch key { + case "Processor": + processorName = value + case "processor", "cpu number": + if c.CPU >= 0 { + finishCPUInfo(ctx, &c) + ret = append(ret, c) + } + c = InfoStat{Cores: 1, ModelName: processorName} + t, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return ret, err + } + c.CPU = int32(t) + case "vendorId", "vendor_id": + c.VendorID = value + if strings.Contains(value, "S390") { + processorName = "S390" + } + case "mvendorid": + if !strings.HasPrefix(value, "0x") { + continue + } + + if v, err := strconv.ParseUint(value[2:], 16, 32); err == nil { + switch v { + case 0x31e: + c.VendorID = "Andes" + case 0x029: + c.VendorID = "Microchip" + case 0x127: + c.VendorID = "MIPS" + case 0x489: + c.VendorID = "SiFive" + case 0x5b7: + c.VendorID = "T-Head" + } + } + case "CPU implementer": + if v, err := strconv.ParseUint(value, 0, 8); err == nil { + switch v { + case 0x41: + c.VendorID = "ARM" + case 0x42: + c.VendorID = "Broadcom" + case 0x43: + c.VendorID = "Cavium" + case 0x44: + c.VendorID = "DEC" + case 0x46: + c.VendorID = "Fujitsu" + case 0x48: + c.VendorID = "HiSilicon" + case 0x49: + c.VendorID = "Infineon" + case 0x4d: + c.VendorID = "Motorola/Freescale" + case 0x4e: + c.VendorID = "NVIDIA" + case 0x50: + c.VendorID = "APM" + case 0x51: + c.VendorID = "Qualcomm" + case 0x56: + c.VendorID = "Marvell" + case 0x61: + c.VendorID = "Apple" + case 0x69: + c.VendorID = "Intel" + case 0xc0: + c.VendorID = "Ampere" + } + } + case "cpu family", "marchid": + c.Family = value + case "model", "CPU part", "mimpid": + c.Model = value + // if CPU is arm based, model name is found via model number. refer to: arch/arm64/kernel/cpuinfo.c + if c.VendorID == "ARM" { + if v, err := strconv.ParseUint(c.Model, 0, 16); err == nil { + modelName, exist := armModelToModelName[v] + if exist { + c.ModelName = modelName + } else { + c.ModelName = "Undefined" + } + } + } + case "Model Name", "model name", "cpu", "uarch": + c.ModelName = value + if strings.Contains(value, "POWER") { + c.Model = strings.Split(value, " ")[0] + c.Family = "POWER" + c.VendorID = "IBM" + } + case "stepping", "revision", "CPU revision": + val := value + + if key == "revision" { + val = strings.Split(value, ".")[0] + } + + if strings.EqualFold(val, "unknown") { + continue + } + + t, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return ret, err + } + c.Stepping = int32(t) + case "cpu MHz", "clock", "cpu MHz dynamic": + // treat this as the fallback value, thus we ignore error + if t, err := strconv.ParseFloat(strings.Replace(value, "MHz", "", 1), 64); err == nil { + c.Mhz = t + } + case "cache size": + t, err := strconv.ParseInt(strings.Replace(value, " KB", "", 1), 10, 64) + if err != nil { + return ret, err + } + c.CacheSize = int32(t) + case "physical id", "hart": + c.PhysicalID = value + case "core id": + c.CoreID = value + case "flags", "Features": + c.Flags = strings.FieldsFunc(value, func(r rune) bool { + return r == ',' || r == ' ' + }) + case "isa", "hart isa": + if len(c.Flags) != 0 || !strings.HasPrefix(value, "rv64") { + continue + } + c.Flags = riscvISAParse(value) + case "microcode": + c.Microcode = value + } + } + if c.CPU >= 0 { + finishCPUInfo(ctx, &c) + ret = append(ret, c) + } + return ret, nil +} + +func parseStatLine(line string) (*TimesStat, error) { + fields := strings.Fields(line) + + if len(fields) < 8 { + return nil, errors.New("stat does not contain cpu info") + } + + if !strings.HasPrefix(fields[0], "cpu") { + return nil, errors.New("not contain cpu") + } + + cpu := fields[0] + if cpu == "cpu" { + cpu = "cpu-total" + } + user, err := strconv.ParseFloat(fields[1], 64) + if err != nil { + return nil, err + } + nice, err := strconv.ParseFloat(fields[2], 64) + if err != nil { + return nil, err + } + system, err := strconv.ParseFloat(fields[3], 64) + if err != nil { + return nil, err + } + idle, err := strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, err + } + iowait, err := strconv.ParseFloat(fields[5], 64) + if err != nil { + return nil, err + } + irq, err := strconv.ParseFloat(fields[6], 64) + if err != nil { + return nil, err + } + softirq, err := strconv.ParseFloat(fields[7], 64) + if err != nil { + return nil, err + } + + ct := &TimesStat{ + CPU: cpu, + User: user / ClocksPerSec, + Nice: nice / ClocksPerSec, + System: system / ClocksPerSec, + Idle: idle / ClocksPerSec, + Iowait: iowait / ClocksPerSec, + Irq: irq / ClocksPerSec, + Softirq: softirq / ClocksPerSec, + } + if len(fields) > 8 { // Linux >= 2.6.11 + steal, err := strconv.ParseFloat(fields[8], 64) + if err != nil { + return nil, err + } + ct.Steal = steal / ClocksPerSec + } + if len(fields) > 9 { // Linux >= 2.6.24 + guest, err := strconv.ParseFloat(fields[9], 64) + if err != nil { + return nil, err + } + ct.Guest = guest / ClocksPerSec + } + if len(fields) > 10 { // Linux >= 3.2.0 + guestNice, err := strconv.ParseFloat(fields[10], 64) + if err != nil { + return nil, err + } + ct.GuestNice = guestNice / ClocksPerSec + } + + return ct, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + if logical { + ret := 0 + // https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_pslinux.py#L599 + procCpuinfo := common.HostProcWithContext(ctx, "cpuinfo") + lines, err := common.ReadLines(procCpuinfo) + if err == nil { + for _, line := range lines { + line = strings.ToLower(line) + if strings.HasPrefix(line, "processor") { + _, err = strconv.ParseInt(strings.TrimSpace(line[strings.IndexByte(line, ':')+1:]), 10, 32) + if err == nil { + ret++ + } + } + } + } + if ret == 0 { + procStat := common.HostProcWithContext(ctx, "stat") + lines, err = common.ReadLines(procStat) + if err != nil { + return 0, err + } + for _, line := range lines { + if len(line) >= 4 && strings.HasPrefix(line, "cpu") && '0' <= line[3] && line[3] <= '9' { // `^cpu\d` regexp matching + ret++ + } + } + } + return ret, nil + } + // physical cores + // https://github.com/giampaolo/psutil/blob/8415355c8badc9c94418b19bdf26e622f06f0cce/psutil/_pslinux.py#L615-L628 + threadSiblingsLists := make(map[string]bool) + // These 2 files are the same but */core_cpus_list is newer while */thread_siblings_list is deprecated and may disappear in the future. + // https://www.kernel.org/doc/Documentation/admin-guide/cputopology.rst + // https://github.com/giampaolo/psutil/pull/1727#issuecomment-707624964 + // https://lkml.org/lkml/2019/2/26/41 + for _, glob := range []string{"devices/system/cpu/cpu[0-9]*/topology/core_cpus_list", "devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list"} { + if files, err := filepath.Glob(common.HostSysWithContext(ctx, glob)); err == nil { + for _, file := range files { + lines, err := common.ReadLines(file) + if err != nil || len(lines) != 1 { + continue + } + threadSiblingsLists[lines[0]] = true + } + ret := len(threadSiblingsLists) + if ret != 0 { + return ret, nil + } + } + } + // https://github.com/giampaolo/psutil/blob/122174a10b75c9beebe15f6c07dcf3afbe3b120d/psutil/_pslinux.py#L631-L652 + filename := common.HostProcWithContext(ctx, "cpuinfo") + lines, err := common.ReadLines(filename) + if err != nil { + return 0, err + } + mapping := make(map[int]int) + currentInfo := make(map[string]int) + for _, line := range lines { + line = strings.ToLower(strings.TrimSpace(line)) + if line == "" { + // new section + id, okID := currentInfo["physical id"] + cores, okCores := currentInfo["cpu cores"] + if okID && okCores { + mapping[id] = cores + } + currentInfo = make(map[string]int) + continue + } + fields := strings.SplitN(line, ":", 2) + if len(fields) < 2 { + continue + } + fields[0] = strings.TrimSpace(fields[0]) + if fields[0] == "physical id" || fields[0] == "cpu cores" { + val, err := strconv.ParseInt(strings.TrimSpace(fields[1]), 10, 32) + if err != nil { + continue + } + currentInfo[fields[0]] = int(val) + } + } + ret := 0 + for _, v := range mapping { + ret += v + } + return ret, nil +} + +func riscvISAParse(s string) []string { + ext := strings.Split(s, "_") + if len(ext[0]) <= 4 { + return nil + } + // the base extensions must "rv64" prefix + base := strings.Split(ext[0][4:], "") + return append(base, ext[1:]...) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd.go new file mode 100644 index 00000000..9e23edb6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd.go @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build netbsd + +package cpu + +import ( + "context" + "fmt" + "runtime" + "unsafe" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +const ( + // sys/sysctl.h + ctlKern = 1 // "high kernel": proc, limits + ctlHw = 6 // CTL_HW + kernCpTime = 51 // KERN_CPTIME +) + +var ClocksPerSec = float64(100) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { + ret := make([]TimesStat, 0) + if !percpu { + mib := []int32{ctlKern, kernCpTime} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + ret = append(ret, TimesStat{ + CPU: "cpu-total", + User: float64(times.User), + Nice: float64(times.Nice), + System: float64(times.Sys), + Idle: float64(times.Idle), + Irq: float64(times.Intr), + }) + return ret, nil + } + + ncpu, err := unix.SysctlUint32("hw.ncpu") + if err != nil { + return ret, err + } + + var i uint32 + for i = 0; i < ncpu; i++ { + mib := []int32{ctlKern, kernCpTime, int32(i)} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + + stats := (*cpuTimes)(unsafe.Pointer(&buf[0])) + ret = append(ret, TimesStat{ + CPU: fmt.Sprintf("cpu%d", i), + User: float64(stats.User), + Nice: float64(stats.Nice), + System: float64(stats.Sys), + Idle: float64(stats.Idle), + Irq: float64(stats.Intr), + }) + } + + return ret, nil +} + +// Returns only one (minimal) CPUInfoStat on NetBSD +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(_ context.Context) ([]InfoStat, error) { + var ret []InfoStat + var err error + + c := InfoStat{} + + mhz, err := unix.Sysctl("machdep.dmi.processor-frequency") + if err != nil { + return nil, err + } + _, err = fmt.Sscanf(mhz, "%f", &c.Mhz) + if err != nil { + return nil, err + } + + ncpu, err := unix.SysctlUint32("hw.ncpuonline") + if err != nil { + return nil, err + } + c.Cores = int32(ncpu) + + if c.ModelName, err = unix.Sysctl("machdep.dmi.processor-version"); err != nil { + return nil, err + } + + return append(ret, c), nil +} + +func CountsWithContext(_ context.Context, _ bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_amd64.go new file mode 100644 index 00000000..25ececa6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_amd64.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm.go new file mode 100644 index 00000000..e4799bcf --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm64.go new file mode 100644 index 00000000..25ececa6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm64.go @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd.go new file mode 100644 index 00000000..9b37d296 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd.go @@ -0,0 +1,139 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd + +package cpu + +import ( + "context" + "fmt" + "runtime" + "unsafe" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +const ( + // sys/sched.h + cpuOnline = 0x0001 // CPUSTATS_ONLINE + + // sys/sysctl.h + ctlKern = 1 // "high kernel": proc, limits + ctlHw = 6 // CTL_HW + smt = 24 // HW_SMT + kernCpTime = 40 // KERN_CPTIME + kernCPUStats = 85 // KERN_CPUSTATS +) + +var ClocksPerSec = float64(128) + +type cpuStats struct { + // cs_time[CPUSTATES] + User uint64 + Nice uint64 + Sys uint64 + Spin uint64 + Intr uint64 + Idle uint64 + + // cs_flags + Flags uint64 +} + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { + ret := make([]TimesStat, 0) + if !percpu { + mib := []int32{ctlKern, kernCpTime} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + ret = append(ret, TimesStat{ + CPU: "cpu-total", + User: float64(times.User) / ClocksPerSec, + Nice: float64(times.Nice) / ClocksPerSec, + System: float64(times.Sys) / ClocksPerSec, + Idle: float64(times.Idle) / ClocksPerSec, + Irq: float64(times.Intr) / ClocksPerSec, + }) + return ret, nil + } + + ncpu, err := unix.SysctlUint32("hw.ncpu") + if err != nil { + return ret, err + } + + var i uint32 + for i = 0; i < ncpu; i++ { + mib := []int32{ctlKern, kernCPUStats, int32(i)} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + + stats := (*cpuStats)(unsafe.Pointer(&buf[0])) + if (stats.Flags & cpuOnline) == 0 { + continue + } + ret = append(ret, TimesStat{ + CPU: fmt.Sprintf("cpu%d", i), + User: float64(stats.User) / ClocksPerSec, + Nice: float64(stats.Nice) / ClocksPerSec, + System: float64(stats.Sys) / ClocksPerSec, + Idle: float64(stats.Idle) / ClocksPerSec, + Irq: float64(stats.Intr) / ClocksPerSec, + }) + } + + return ret, nil +} + +// Returns only one (minimal) CPUInfoStat on OpenBSD +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(_ context.Context) ([]InfoStat, error) { + var ret []InfoStat + var err error + + c := InfoStat{} + + mhz, err := unix.SysctlUint32("hw.cpuspeed") + if err != nil { + return nil, err + } + c.Mhz = float64(mhz) + + ncpu, err := unix.SysctlUint32("hw.ncpuonline") + if err != nil { + return nil, err + } + c.Cores = int32(ncpu) + + if c.ModelName, err = unix.Sysctl("hw.model"); err != nil { + return nil, err + } + + return append(ret, c), nil +} + +func CountsWithContext(_ context.Context, _ bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_386.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_386.go new file mode 100644 index 00000000..40a6f43e --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_386.go @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Spin uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_amd64.go new file mode 100644 index 00000000..464156d5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_amd64.go @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Spin uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm.go new file mode 100644 index 00000000..40a6f43e --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm.go @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Spin uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm64.go new file mode 100644 index 00000000..464156d5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm64.go @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Spin uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_riscv64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_riscv64.go new file mode 100644 index 00000000..464156d5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_riscv64.go @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Spin uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_plan9.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_plan9.go new file mode 100644 index 00000000..02ad3f74 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_plan9.go @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build plan9 + +package cpu + +import ( + "context" + "os" + "runtime" + + stats "github.com/lufia/plan9stats" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, _ bool) ([]TimesStat, error) { + // BUG: percpu flag is not supported yet. + root := os.Getenv("HOST_ROOT") + c, err := stats.ReadCPUType(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + s, err := stats.ReadCPUStats(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + return []TimesStat{ + { + CPU: c.Name, + User: s.User.Seconds(), + System: s.Sys.Seconds(), + Idle: s.Idle.Seconds(), + }, + }, nil +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(_ context.Context) ([]InfoStat, error) { + return []InfoStat{}, common.ErrNotImplementedError +} + +func CountsWithContext(_ context.Context, _ bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_solaris.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_solaris.go new file mode 100644 index 00000000..9494e3c3 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_solaris.go @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: BSD-3-Clause +package cpu + +import ( + "context" + "errors" + "fmt" + "regexp" + "runtime" + "sort" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" +) + +var ClocksPerSec = float64(128) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +// sum all values in a float64 map with float64 keys +func msum(x map[float64]float64) float64 { + total := 0.0 + for _, y := range x { + total += y + } + return total +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +var kstatSplit = regexp.MustCompile(`[:\s]+`) + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + kstatSysOut, err := invoke.CommandWithContext(ctx, "kstat", "-p", "cpu_stat:*:*:/^idle$|^user$|^kernel$|^iowait$|^swap$/") + if err != nil { + return nil, fmt.Errorf("cannot execute kstat: %w", err) + } + cpu := make(map[float64]float64) + idle := make(map[float64]float64) + user := make(map[float64]float64) + kern := make(map[float64]float64) + iowt := make(map[float64]float64) + // swap := make(map[float64]float64) + for _, line := range strings.Split(string(kstatSysOut), "\n") { + fields := kstatSplit.Split(line, -1) + if fields[0] != "cpu_stat" { + continue + } + cpuNumber, err := strconv.ParseFloat(fields[1], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse cpu number: %w", err) + } + cpu[cpuNumber] = cpuNumber + switch fields[3] { + case "idle": + idle[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse idle: %w", err) + } + case "user": + user[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse user: %w", err) + } + case "kernel": + kern[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse kernel: %w", err) + } + case "iowait": + iowt[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse iowait: %w", err) + } + // not sure how this translates, don't report, add to kernel, something else? + /*case "swap": + swap[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse swap: %s", err) + } */ + } + } + ret := make([]TimesStat, 0, len(cpu)) + if percpu { + for _, c := range cpu { + ct := &TimesStat{ + CPU: fmt.Sprintf("cpu%d", int(cpu[c])), + Idle: idle[c] / ClocksPerSec, + User: user[c] / ClocksPerSec, + System: kern[c] / ClocksPerSec, + Iowait: iowt[c] / ClocksPerSec, + } + ret = append(ret, *ct) + } + } else { + ct := &TimesStat{ + CPU: "cpu-total", + Idle: msum(idle) / ClocksPerSec, + User: msum(user) / ClocksPerSec, + System: msum(kern) / ClocksPerSec, + Iowait: msum(iowt) / ClocksPerSec, + } + ret = append(ret, *ct) + } + return ret, nil +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + psrInfoOut, err := invoke.CommandWithContext(ctx, "psrinfo", "-p", "-v") + if err != nil { + return nil, fmt.Errorf("cannot execute psrinfo: %w", err) + } + + procs, err := parseProcessorInfo(string(psrInfoOut)) + if err != nil { + return nil, fmt.Errorf("error parsing psrinfo output: %w", err) + } + + isaInfoOut, err := invoke.CommandWithContext(ctx, "isainfo", "-b", "-v") + if err != nil { + return nil, fmt.Errorf("cannot execute isainfo: %w", err) + } + + flags, err := parseISAInfo(string(isaInfoOut)) + if err != nil { + return nil, fmt.Errorf("error parsing isainfo output: %w", err) + } + + result := make([]InfoStat, 0, len(flags)) + for i := range procs { + procWithFlags := procs[i] + procWithFlags.Flags = flags + result = append(result, procWithFlags) + } + + return result, nil +} + +var flagsMatch = regexp.MustCompile(`[\w.]+`) + +func parseISAInfo(cmdOutput string) ([]string, error) { + words := flagsMatch.FindAllString(cmdOutput, -1) + + // Sanity check the output + if len(words) < 4 || words[1] != "bit" || words[3] != "applications" { + return nil, errors.New("attempted to parse invalid isainfo output") + } + + flags := words[4:] + sort.Strings(flags) + + return flags, nil +} + +var psrInfoMatch = regexp.MustCompile(`The physical processor has (?:([\d]+) virtual processors? \(([\d-]+)\)|([\d]+) cores and ([\d]+) virtual processors[^\n]+)\n(?:\s+ The core has.+\n)*\s+.+ \((\w+) ([\S]+) family (.+) model (.+) step (.+) clock (.+) MHz\)\n[\s]*(.*)`) + +const ( + psrNumCoresOffset = 1 + psrNumCoresHTOffset = 3 + psrNumHTOffset = 4 + psrVendorIDOffset = 5 + psrFamilyOffset = 7 + psrModelOffset = 8 + psrStepOffset = 9 + psrClockOffset = 10 + psrModelNameOffset = 11 +) + +func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) { + matches := psrInfoMatch.FindAllStringSubmatch(cmdOutput, -1) + + var infoStatCount int32 + result := make([]InfoStat, 0, len(matches)) + for physicalIndex, physicalCPU := range matches { + var step int32 + var clock float64 + + if physicalCPU[psrStepOffset] != "" { + stepParsed, err := strconv.ParseInt(physicalCPU[psrStepOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for step as 32-bit integer: %w", physicalCPU[9], err) + } + step = int32(stepParsed) + } + + if physicalCPU[psrClockOffset] != "" { + clockParsed, err := strconv.ParseInt(physicalCPU[psrClockOffset], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for clock as 32-bit integer: %w", physicalCPU[10], err) + } + clock = float64(clockParsed) + } + + var err error + var numCores int64 + var numHT int64 + switch { + case physicalCPU[psrNumCoresOffset] != "": + numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %w", physicalCPU[1], err) + } + + for i := 0; i < int(numCores); i++ { + result = append(result, InfoStat{ + CPU: infoStatCount, + PhysicalID: strconv.Itoa(physicalIndex), + CoreID: strconv.Itoa(i), + Cores: 1, + VendorID: physicalCPU[psrVendorIDOffset], + ModelName: physicalCPU[psrModelNameOffset], + Family: physicalCPU[psrFamilyOffset], + Model: physicalCPU[psrModelOffset], + Stepping: step, + Mhz: clock, + }) + infoStatCount++ + } + case physicalCPU[psrNumCoresHTOffset] != "": + numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresHTOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %w", physicalCPU[3], err) + } + + numHT, err = strconv.ParseInt(physicalCPU[psrNumHTOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for hyperthread count as 32-bit integer: %w", physicalCPU[4], err) + } + + for i := 0; i < int(numCores); i++ { + result = append(result, InfoStat{ + CPU: infoStatCount, + PhysicalID: strconv.Itoa(physicalIndex), + CoreID: strconv.Itoa(i), + Cores: int32(numHT) / int32(numCores), + VendorID: physicalCPU[psrVendorIDOffset], + ModelName: physicalCPU[psrModelNameOffset], + Family: physicalCPU[psrFamilyOffset], + Model: physicalCPU[psrModelOffset], + Stepping: step, + Mhz: clock, + }) + infoStatCount++ + } + default: + return nil, errors.New("values for cores with and without hyperthreading are both set") + } + } + return result, nil +} + +func CountsWithContext(_ context.Context, _ bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go new file mode 100644 index 00000000..a6000a3c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go @@ -0,0 +1,477 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build windows + +package cpu + +import ( + "context" + "errors" + "fmt" + "math/bits" + "path/filepath" + "strconv" + "strings" + "syscall" + "unsafe" + + "golang.org/x/sys/windows" + "golang.org/x/sys/windows/registry" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var ( + procGetNativeSystemInfo = common.Modkernel32.NewProc("GetNativeSystemInfo") + procGetLogicalProcessorInformationEx = common.Modkernel32.NewProc("GetLogicalProcessorInformationEx") + procGetSystemFirmwareTable = common.Modkernel32.NewProc("GetSystemFirmwareTable") + procCallNtPowerInformation = common.ModPowrProf.NewProc("CallNtPowerInformation") +) + +type win32_Processor struct { //nolint:revive //FIXME + Family uint16 + Manufacturer string + Name string + NumberOfLogicalProcessors uint32 + NumberOfCores uint32 + ProcessorID *string + Stepping *string + MaxClockSpeed uint32 +} + +// SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION +// defined in windows api doc with the following +// https://docs.microsoft.com/en-us/windows/desktop/api/winternl/nf-winternl-ntquerysysteminformation#system_processor_performance_information +// additional fields documented here +// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/sysinfo/processor_performance.htm +type win32_SystemProcessorPerformanceInformation struct { //nolint:revive //FIXME + IdleTime int64 // idle time in 100ns (this is not a filetime). + KernelTime int64 // kernel time in 100ns. kernel time includes idle time. (this is not a filetime). + UserTime int64 // usertime in 100ns (this is not a filetime). + DpcTime int64 // dpc time in 100ns (this is not a filetime). + InterruptTime int64 // interrupt time in 100ns + InterruptCount uint64 // ULONG needs to be uint64 +} + +// https://learn.microsoft.com/en-us/windows/win32/power/processor-power-information-str +type processorPowerInformation struct { + number uint32 // http://download.microsoft.com/download/a/d/f/adf1347d-08dc-41a4-9084-623b1194d4b2/MoreThan64proc.docx + maxMhz uint32 + currentMhz uint32 + mhzLimit uint32 + maxIdleState uint32 + currentIdleState uint32 +} + +const ( + ClocksPerSec = 10000000.0 + + // systemProcessorPerformanceInformationClass information class to query with NTQuerySystemInformation + // https://processhacker.sourceforge.io/doc/ntexapi_8h.html#ad5d815b48e8f4da1ef2eb7a2f18a54e0 + win32_SystemProcessorPerformanceInformationClass = 8 //nolint:revive //FIXME + + // size of systemProcessorPerformanceInfoSize in memory + win32_SystemProcessorPerformanceInfoSize = uint32(unsafe.Sizeof(win32_SystemProcessorPerformanceInformation{})) //nolint:revive //FIXME + + firmwareTableProviderSignatureRSMB = 0x52534d42 // "RSMB" https://gitlab.winehq.org/dreamer/wine/-/blame/wine-7.0-rc6/dlls/ntdll/unix/system.c#L230 + smBiosHeaderSize = 8 // SMBIOS header size + smbiosEndOfTable = 127 // Minimum length for processor structure + smbiosTypeProcessor = 4 // SMBIOS Type 4: Processor Information + smbiosProcessorMinLength = 0x18 // Minimum length for processor structure + + centralProcessorRegistryKey = `HARDWARE\DESCRIPTION\System\CentralProcessor` +) + +type relationship uint32 + +// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlogicalprocessorinformationex +const ( + relationProcessorCore = relationship(0) + relationProcessorPackage = relationship(3) +) + +const ( + kAffinitySize = unsafe.Sizeof(int(0)) + // https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/interrupt-affinity-and-priority + maxLogicalProcessorsPerGroup = uint32(unsafe.Sizeof(kAffinitySize * 8)) + // https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ne-wdm-power_information_level + processorInformation = 11 +) + +// Times returns times stat per cpu and combined for all CPUs +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + return perCPUTimes() + } + + var ret []TimesStat + var lpIdleTime common.FILETIME + var lpKernelTime common.FILETIME + var lpUserTime common.FILETIME + // GetSystemTimes returns 0 for error, in which case we check err, + // see https://pkg.go.dev/golang.org/x/sys/windows#LazyProc.Call + r, _, err := common.ProcGetSystemTimes.Call( + uintptr(unsafe.Pointer(&lpIdleTime)), + uintptr(unsafe.Pointer(&lpKernelTime)), + uintptr(unsafe.Pointer(&lpUserTime))) + if r == 0 { + return nil, err + } + + LOT := float64(0.0000001) + HIT := (LOT * 4294967296.0) + idle := ((HIT * float64(lpIdleTime.DwHighDateTime)) + (LOT * float64(lpIdleTime.DwLowDateTime))) + user := ((HIT * float64(lpUserTime.DwHighDateTime)) + (LOT * float64(lpUserTime.DwLowDateTime))) + kernel := ((HIT * float64(lpKernelTime.DwHighDateTime)) + (LOT * float64(lpKernelTime.DwLowDateTime))) + system := (kernel - idle) + + ret = append(ret, TimesStat{ + CPU: "cpu-total", + Idle: float64(idle), + User: float64(user), + System: float64(system), + }) + return ret, nil +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +// this function iterates over each set bit in the package affinity mask, each bit represent a logical processor in a group (assuming you are iteriang over a package mask) +// the function is used also to compute the global logical processor number +// https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups +// see https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-group_affinity +// and https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-processor_relationship +// and https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-system_logical_processor_information_ex +func forEachSetBit64(mask uint64, fn func(bit int)) { + m := mask + for m != 0 { + b := bits.TrailingZeros64(m) + fn(b) + m &= m - 1 + } +} + +func getProcessorPowerInformation(ctx context.Context) ([]processorPowerInformation, error) { + numLP, countErr := CountsWithContext(ctx, true) + if countErr != nil { + return nil, fmt.Errorf("failed to get logical processor count: %w", countErr) + } + if numLP <= 0 { + return nil, fmt.Errorf("invalid logical processor count: %d", numLP) + } + + ppiSize := uintptr(numLP) * unsafe.Sizeof(processorPowerInformation{}) + buf := make([]byte, ppiSize) + ppi, _, err := procCallNtPowerInformation.Call( + uintptr(processorInformation), + 0, + 0, + uintptr(unsafe.Pointer(&buf[0])), + uintptr(ppiSize), + ) + if ppi != 0 { + return nil, fmt.Errorf("CallNtPowerInformation failed with code %d: %w", ppi, err) + } + ppis := unsafe.Slice((*processorPowerInformation)(unsafe.Pointer(&buf[0])), numLP) + return ppis, nil +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + var ret []InfoStat + processorPackages, err := getSystemLogicalProcessorInformationEx(relationProcessorPackage) + if err != nil { + return ret, fmt.Errorf("failed to get processor package information: %w", err) + } + + ppis, powerInformationErr := getProcessorPowerInformation(ctx) + if powerInformationErr != nil { + return ret, fmt.Errorf("failed to get processor power information: %w", powerInformationErr) + } + + family, processorId, smBIOSErr := getSMBIOSProcessorInfo() + if smBIOSErr != nil { + return ret, smBIOSErr + } + + for i, pkg := range processorPackages { + logicalCount := 0 + maxMhz := 0 + model := "" + vendorId := "" + // iterate over each set bit in the package affinity mask + for _, ga := range pkg.processor.groupMask { + g := int(ga.group) + forEachSetBit64(uint64(ga.mask), func(bit int) { + // the global logical processor label + globalLpl := g*int(maxLogicalProcessorsPerGroup) + bit + if globalLpl >= 0 && globalLpl < len(ppis) { + logicalCount++ + m := int(ppis[globalLpl].maxMhz) + if m > maxMhz { + maxMhz = m + } + } + + registryKeyPath := filepath.Join(centralProcessorRegistryKey, strconv.Itoa(globalLpl)) + key, err := registry.OpenKey(registry.LOCAL_MACHINE, registryKeyPath, registry.QUERY_VALUE|registry.READ) + if err == nil { + model = getRegistryStringValueIfUnset(key, "ProcessorNameString", model) + vendorId = getRegistryStringValueIfUnset(key, "VendorIdentifier", vendorId) + _ = key.Close() + } + }) + } + ret = append(ret, InfoStat{ + CPU: int32(i), + Family: strconv.FormatUint(uint64(family), 10), + VendorID: vendorId, + ModelName: model, + Cores: int32(logicalCount), + PhysicalID: processorId, + Mhz: float64(maxMhz), + Flags: []string{}, + }) + } + + return ret, nil +} + +// perCPUTimes returns times stat per cpu, per core and overall for all CPUs +func perCPUTimes() ([]TimesStat, error) { + var ret []TimesStat + stats, err := perfInfo() + if err != nil { + return nil, err + } + for core, v := range stats { + c := TimesStat{ + CPU: fmt.Sprintf("cpu%d", core), + User: float64(v.UserTime) / ClocksPerSec, + System: float64(v.KernelTime-v.IdleTime) / ClocksPerSec, + Idle: float64(v.IdleTime) / ClocksPerSec, + Irq: float64(v.InterruptTime) / ClocksPerSec, + } + ret = append(ret, c) + } + return ret, nil +} + +// makes call to Windows API function to retrieve performance information for each core +func perfInfo() ([]win32_SystemProcessorPerformanceInformation, error) { + // Make maxResults large for safety. + // We can't invoke the api call with a results array that's too small. + // If we have more than 2056 cores on a single host, then it's probably the future. + maxBuffer := 2056 + // buffer for results from the windows proc + resultBuffer := make([]win32_SystemProcessorPerformanceInformation, maxBuffer) + // size of the buffer in memory + bufferSize := uintptr(win32_SystemProcessorPerformanceInfoSize) * uintptr(maxBuffer) + // size of the returned response + var retSize uint32 + + // Invoke windows api proc. + // The returned err from the windows dll proc will always be non-nil even when successful. + // See https://godoc.org/golang.org/x/sys/windows#LazyProc.Call for more information + retCode, _, err := common.ProcNtQuerySystemInformation.Call( + win32_SystemProcessorPerformanceInformationClass, // System Information Class -> SystemProcessorPerformanceInformation + uintptr(unsafe.Pointer(&resultBuffer[0])), // pointer to first element in result buffer + bufferSize, // size of the buffer in memory + uintptr(unsafe.Pointer(&retSize)), // pointer to the size of the returned results the windows proc will set this + ) + + // check return code for errors + if retCode != 0 { + return nil, fmt.Errorf("call to NtQuerySystemInformation returned %d. err: %s", retCode, err.Error()) + } + + // calculate the number of returned elements based on the returned size + numReturnedElements := retSize / win32_SystemProcessorPerformanceInfoSize + + // trim results to the number of returned elements + resultBuffer = resultBuffer[:numReturnedElements] + + return resultBuffer, nil +} + +// SystemInfo is an equivalent representation of SYSTEM_INFO in the Windows API. +// https://msdn.microsoft.com/en-us/library/ms724958%28VS.85%29.aspx?f=255&MSPPError=-2147217396 +// https://github.com/elastic/go-windows/blob/bb1581babc04d5cb29a2bfa7a9ac6781c730c8dd/kernel32.go#L43 +type systemInfo struct { + wProcessorArchitecture uint16 + wReserved uint16 + dwPageSize uint32 + lpMinimumApplicationAddress uintptr + lpMaximumApplicationAddress uintptr + dwActiveProcessorMask uintptr + dwNumberOfProcessors uint32 + dwProcessorType uint32 + dwAllocationGranularity uint32 + wProcessorLevel uint16 + wProcessorRevision uint16 +} + +type groupAffinity struct { + mask uintptr // https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/interrupt-affinity-and-priority#about-kaffinity + group uint16 + reserved [3]uint16 +} + +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-processor_relationship +type processorRelationship struct { + flags byte + efficientClass byte + reserved [20]byte + groupCount uint16 + groupMask [1]groupAffinity +} + +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-system_logical_processor_information_ex +type systemLogicalProcessorInformationEx struct { + relationship uint32 + size uint32 + processor processorRelationship +} + +// getSMBIOSProcessorInfo reads the SMBIOS Type 4 (Processor Information) structure and returns the Processor Family and ProcessorId fields. +// If not found, returns 0 and an empty string. +func getSMBIOSProcessorInfo() (family uint8, processorId string, err error) { + // https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemfirmwaretable + size, _, err := procGetSystemFirmwareTable.Call( + uintptr(firmwareTableProviderSignatureRSMB), + 0, + 0, + 0, + ) + if size == 0 { + return 0, "", fmt.Errorf("failed to get SMBIOS table size: %w", err) + } + buf := make([]byte, size) + ret, _, err := procGetSystemFirmwareTable.Call( + uintptr(firmwareTableProviderSignatureRSMB), + 0, + uintptr(unsafe.Pointer(&buf[0])), + uintptr(size), + ) + if ret == 0 { + return 0, "", fmt.Errorf("failed to read SMBIOS table: %w", err) + } + // https://wiki.osdev.org/System_Management_BIOS + i := smBiosHeaderSize // skip SMBIOS header (first 8 bytes) + maxIterations := len(buf) * 2 + iterations := 0 + for i < len(buf) && iterations < maxIterations { + iterations++ + if i+4 > len(buf) { + break + } + typ := buf[i] + length := buf[i+1] + if typ == smbiosEndOfTable { + break + } + if typ == smbiosTypeProcessor && length >= smbiosProcessorMinLength && i+int(length) <= len(buf) { + // Ensure we have enough bytes for procIdBytes + if i+16 > len(buf) { + break + } + // Get the processor family from byte at offset 6 + family = buf[i+6] + // Extract processor ID bytes (8 bytes total) from offsets 8-15 + procIdBytes := buf[i+8 : i+16] + // Convert first 4 bytes to 32-bit EAX register value (little endian) + eax := uint32(procIdBytes[0]) | uint32(procIdBytes[1])<<8 | uint32(procIdBytes[2])<<16 | uint32(procIdBytes[3])<<24 + // Convert last 4 bytes to 32-bit EDX register value (little endian) + edx := uint32(procIdBytes[4]) | uint32(procIdBytes[5])<<8 | uint32(procIdBytes[6])<<16 | uint32(procIdBytes[7])<<24 + // Format processor ID as 16 character hex string (EDX+EAX) + procId := fmt.Sprintf("%08X%08X", edx, eax) + return family, procId, nil + } + // skip to next structure + j := i + int(length) + innerIterations := 0 + maxInner := len(buf) // failsafe for inner loop + for j+1 < len(buf) && innerIterations < maxInner { + innerIterations++ + if buf[j] == 0 && buf[j+1] == 0 { + j += 2 + break + } + j++ + } + if innerIterations >= maxInner { + break // malformed buffer, avoid infinite loop + } + i = j + } + return 0, "", fmt.Errorf("SMBIOS processor information not found: %w", syscall.ERROR_NOT_FOUND) +} + +func getSystemLogicalProcessorInformationEx(relationship relationship) ([]systemLogicalProcessorInformationEx, error) { + var length uint32 + // First call to determine the required buffer size + _, _, err := procGetLogicalProcessorInformationEx.Call(uintptr(relationship), 0, uintptr(unsafe.Pointer(&length))) + if err != nil && !errors.Is(err, windows.ERROR_INSUFFICIENT_BUFFER) { + return nil, fmt.Errorf("failed to get buffer size: %w", err) + } + + // Allocate the buffer + buffer := make([]byte, length) + + // Second call to retrieve the processor information + _, _, err = procGetLogicalProcessorInformationEx.Call(uintptr(relationship), uintptr(unsafe.Pointer(&buffer[0])), uintptr(unsafe.Pointer(&length))) + if err != nil && !errors.Is(err, windows.NTE_OP_OK) { + return nil, fmt.Errorf("failed to get logical processor information: %w", err) + } + + // Convert the byte slice into a slice of systemLogicalProcessorInformationEx structs + offset := uintptr(0) + var infos []systemLogicalProcessorInformationEx + for offset < uintptr(length) { + info := (*systemLogicalProcessorInformationEx)(unsafe.Pointer(uintptr(unsafe.Pointer(&buffer[0])) + offset)) + infos = append(infos, *info) + offset += uintptr(info.size) + } + + return infos, nil +} + +func getPhysicalCoreCount() (int, error) { + infos, err := getSystemLogicalProcessorInformationEx(relationProcessorCore) + return len(infos), err +} + +func getRegistryStringValueIfUnset(key registry.Key, keyName, value string) string { + if value != "" { + return value + } + val, _, err := key.GetStringValue(keyName) + if err == nil { + return strings.TrimSpace(val) + } + return "" +} + +func CountsWithContext(_ context.Context, logical bool) (int, error) { + if logical { + // Get logical processor count https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_psutil_windows.c#L97 + ret := windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS) + if ret != 0 { + return int(ret), nil + } + + var sInfo systemInfo + _, _, err := procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sInfo))) + if sInfo.dwNumberOfProcessors == 0 { + return 0, err + } + return int(sInfo.dwNumberOfProcessors), nil + } + + // Get physical core count https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_psutil_windows.c#L499 + return getPhysicalCoreCount() +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common.go new file mode 100644 index 00000000..dce15b3b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common.go @@ -0,0 +1,475 @@ +// SPDX-License-Identifier: BSD-3-Clause +package common + +// +// gopsutil is a port of psutil(http://pythonhosted.org/psutil/). +// This covers these architectures. +// - linux (amd64, arm) +// - freebsd (amd64) +// - windows (amd64) +// - aix (ppc64) + +import ( + "bufio" + "bytes" + "context" + "errors" + "fmt" + "io" + "math" + "net/url" + "os" + "os/exec" + "path" + "path/filepath" + "reflect" + "runtime" + "slices" + "strconv" + "strings" + "time" + + "github.com/shirou/gopsutil/v4/common" +) + +var ( + Timeout = 3 * time.Second + ErrNotImplementedError = errors.New("not implemented yet") + ErrTimeout = errors.New("command timed out") +) + +type Invoker interface { + Command(string, ...string) ([]byte, error) + CommandWithContext(context.Context, string, ...string) ([]byte, error) +} + +type Invoke struct{} + +func (i Invoke) Command(name string, arg ...string) ([]byte, error) { + ctx, cancel := context.WithTimeout(context.Background(), Timeout) + defer cancel() + return i.CommandWithContext(ctx, name, arg...) +} + +func (Invoke) CommandWithContext(ctx context.Context, name string, arg ...string) ([]byte, error) { + cmd := exec.CommandContext(ctx, name, arg...) + + var buf bytes.Buffer + cmd.Stdout = &buf + cmd.Stderr = &buf + + if err := cmd.Start(); err != nil { + return buf.Bytes(), err + } + + if err := cmd.Wait(); err != nil { + return buf.Bytes(), err + } + + return buf.Bytes(), nil +} + +type FakeInvoke struct { + Suffix string // Suffix species expected file name suffix such as "fail" + Error error // If Error specified, return the error. +} + +// Command in FakeInvoke returns from expected file if exists. +func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error) { + if i.Error != nil { + return []byte{}, i.Error + } + + arch := runtime.GOOS + + commandName := filepath.Base(name) + + fname := strings.Join(append([]string{commandName}, arg...), "") + fname = url.QueryEscape(fname) + fpath := path.Join("testdata", arch, fname) + if i.Suffix != "" { + fpath += "_" + i.Suffix + } + if PathExists(fpath) { + return os.ReadFile(fpath) + } + return []byte{}, fmt.Errorf("could not find testdata: %s", fpath) +} + +func (i FakeInvoke) CommandWithContext(_ context.Context, name string, arg ...string) ([]byte, error) { + return i.Command(name, arg...) +} + +// ReadFile reads contents from a file +func ReadFile(filename string) (string, error) { + content, err := os.ReadFile(filename) + if err != nil { + return "", err + } + + return string(content), nil +} + +// ReadLines reads contents from a file and splits them by new lines. +// A convenience wrapper to ReadLinesOffsetN(filename, 0, -1). +func ReadLines(filename string) ([]string, error) { + return ReadLinesOffsetN(filename, 0, -1) +} + +// ReadLine reads a file and returns the first occurrence of a line that is prefixed with prefix. +func ReadLine(filename, prefix string) (string, error) { + f, err := os.Open(filename) + if err != nil { + return "", err + } + defer f.Close() + r := bufio.NewReader(f) + for { + line, err := r.ReadString('\n') + if err != nil { + if err == io.EOF { + break + } + return "", err + } + if strings.HasPrefix(line, prefix) { + return line, nil + } + } + + return "", nil +} + +// ReadLinesOffsetN reads contents from file and splits them by new line. +// The offset tells at which line number to start. +// The count determines the number of lines to read (starting from offset): +// n >= 0: at most n lines +// n < 0: whole file +func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error) { + f, err := os.Open(filename) + if err != nil { + return []string{""}, err + } + defer f.Close() + + var ret []string + + r := bufio.NewReader(f) + for i := uint(0); i < uint(n)+offset || n < 0; i++ { + line, err := r.ReadString('\n') + if err != nil { + if err == io.EOF && line != "" { + ret = append(ret, strings.Trim(line, "\n")) + } + break + } + if i < offset { + continue + } + ret = append(ret, strings.Trim(line, "\n")) + } + + return ret, nil +} + +func IntToString(orig []int8) string { + ret := make([]byte, len(orig)) + size := -1 + for i, o := range orig { + if o == 0 { + size = i + break + } + ret[i] = byte(o) + } + if size == -1 { + size = len(orig) + } + + return string(ret[0:size]) +} + +func UintToString(orig []uint8) string { + ret := make([]byte, len(orig)) + size := -1 + for i, o := range orig { + if o == 0 { + size = i + break + } + ret[i] = byte(o) + } + if size == -1 { + size = len(orig) + } + + return string(ret[0:size]) +} + +func ByteToString(orig []byte) string { + n := -1 + l := -1 + for i, b := range orig { + // skip left side null + if l == -1 && b == 0 { + continue + } + if l == -1 { + l = i + } + + if b == 0 { + break + } + n = i + 1 + } + if n == -1 { + return string(orig) + } + return string(orig[l:n]) +} + +// ReadInts reads contents from single line file and returns them as []int32. +func ReadInts(filename string) ([]int64, error) { + f, err := os.Open(filename) + if err != nil { + return []int64{}, err + } + defer f.Close() + + var ret []int64 + + r := bufio.NewReader(f) + + // The int files that this is concerned with should only be one liners. + line, err := r.ReadString('\n') + if err != nil { + return []int64{}, err + } + + i, err := strconv.ParseInt(strings.Trim(line, "\n"), 10, 32) + if err != nil { + return []int64{}, err + } + ret = append(ret, i) + + return ret, nil +} + +// Parse Hex to uint32 without error +func HexToUint32(hex string) uint32 { + vv, _ := strconv.ParseUint(hex, 16, 32) + return uint32(vv) +} + +// Parse to int32 without error +func mustParseInt32(val string) int32 { + vv, _ := strconv.ParseInt(val, 10, 32) + return int32(vv) +} + +// Parse to uint64 without error +func mustParseUint64(val string) uint64 { + vv, _ := strconv.ParseInt(val, 10, 64) + return uint64(vv) +} + +// Parse to Float64 without error +func mustParseFloat64(val string) float64 { + vv, _ := strconv.ParseFloat(val, 64) + return vv +} + +// StringsHas checks the target string slice contains src or not +func StringsHas(target []string, src string) bool { + for _, t := range target { + if strings.TrimSpace(t) == src { + return true + } + } + return false +} + +// StringsContains checks the src in any string of the target string slice +func StringsContains(target []string, src string) bool { + return slices.ContainsFunc(target, func(s string) bool { + return strings.Contains(s, src) + }) +} + +// IntContains checks the src in any int of the target int slice. +func IntContains(target []int, src int) bool { + return slices.Contains(target, src) +} + +// get struct attributes. +// This method is used only for debugging platform dependent code. +func attributes(m any) map[string]reflect.Type { + typ := reflect.TypeOf(m) + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + + attrs := make(map[string]reflect.Type) + if typ.Kind() != reflect.Struct { + return nil + } + + for i := 0; i < typ.NumField(); i++ { + p := typ.Field(i) + if !p.Anonymous { + attrs[p.Name] = p.Type + } + } + + return attrs +} + +func PathExists(filename string) bool { + if _, err := os.Stat(filename); err == nil { + return true + } + return false +} + +// PathExistsWithContents returns the filename exists and it is not empty +func PathExistsWithContents(filename string) bool { + info, err := os.Stat(filename) + if err != nil { + return false + } + return info.Size() > 4 && !info.IsDir() // at least 4 bytes +} + +// GetEnvWithContext retrieves the environment variable key. If it does not exist it returns the default. +// The context may optionally contain a map superseding os.EnvKey. +func GetEnvWithContext(ctx context.Context, key, dfault string, combineWith ...string) string { + var value string + if env, ok := ctx.Value(common.EnvKey).(common.EnvMap); ok { + value = env[common.EnvKeyType(key)] + } + if value == "" { + value = os.Getenv(key) + } + if value == "" { + value = dfault + } + + return combine(value, combineWith) +} + +// GetEnv retrieves the environment variable key. If it does not exist it returns the default. +func GetEnv(key, dfault string, combineWith ...string) string { + value := os.Getenv(key) + if value == "" { + value = dfault + } + + return combine(value, combineWith) +} + +func combine(value string, combineWith []string) string { + switch len(combineWith) { + case 0: + return value + case 1: + return filepath.Join(value, combineWith[0]) + default: + all := make([]string, len(combineWith)+1) + all[0] = value + copy(all[1:], combineWith) + return filepath.Join(all...) + } +} + +func HostProc(combineWith ...string) string { + return GetEnv("HOST_PROC", "/proc", combineWith...) +} + +func HostSys(combineWith ...string) string { + return GetEnv("HOST_SYS", "/sys", combineWith...) +} + +func HostEtc(combineWith ...string) string { + return GetEnv("HOST_ETC", "/etc", combineWith...) +} + +func HostVar(combineWith ...string) string { + return GetEnv("HOST_VAR", "/var", combineWith...) +} + +func HostRun(combineWith ...string) string { + return GetEnv("HOST_RUN", "/run", combineWith...) +} + +func HostDev(combineWith ...string) string { + return GetEnv("HOST_DEV", "/dev", combineWith...) +} + +func HostRoot(combineWith ...string) string { + return GetEnv("HOST_ROOT", "/", combineWith...) +} + +func HostProcWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_PROC", "/proc", combineWith...) +} + +func HostProcMountInfoWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_PROC_MOUNTINFO", "", combineWith...) +} + +func HostSysWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_SYS", "/sys", combineWith...) +} + +func HostEtcWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_ETC", "/etc", combineWith...) +} + +func HostVarWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_VAR", "/var", combineWith...) +} + +func HostRunWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_RUN", "/run", combineWith...) +} + +func HostDevWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_DEV", "/dev", combineWith...) +} + +func HostRootWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_ROOT", "/", combineWith...) +} + +// getSysctrlEnv sets LC_ALL=C in a list of env vars for use when running +// sysctl commands. +func getSysctrlEnv(env []string) []string { + foundLC := false + for i, line := range env { + if strings.HasPrefix(line, "LC_ALL") { + env[i] = "LC_ALL=C" + foundLC = true + } + } + if !foundLC { + env = append(env, "LC_ALL=C") + } + return env +} + +// Round places rounds the number 'val' to 'n' decimal places +func Round(val float64, n int) float64 { + // Calculate the power of 10 to the n + pow10 := math.Pow(10, float64(n)) + // Multiply the value by pow10, round it, then divide it by pow10 + return math.Round(val*pow10) / pow10 +} + +func TimeSince(ts uint64) uint64 { + return uint64(time.Now().Unix()) - ts +} + +func TimeSinceMillis(ts uint64) uint64 { + return uint64(time.Now().UnixMilli()) - ts +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_aix.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_aix.go new file mode 100644 index 00000000..5579c3bc --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_aix.go @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix + +package common + +import ( + "context" + "errors" + "strconv" + "strings" +) + +func BootTimeWithContext(ctx context.Context, invoke Invoker) (btime uint64, err error) { + ut, err := UptimeWithContext(ctx, invoke) + if err != nil { + return 0, err + } + + if ut <= 0 { + return 0, errors.New("uptime was not set, so cannot calculate boot time from it") + } + + return TimeSince(ut), nil +} + +// Uses ps to get the elapsed time for PID 1 in DAYS-HOURS:MINUTES:SECONDS format. +// Examples of ps -o etimes -p 1 output: +// 124-01:40:39 (with days) +// 15:03:02 (without days, hours only) +// 01:02 (just-rebooted systems, minutes and seconds) +func UptimeWithContext(ctx context.Context, invoke Invoker) (uint64, error) { + out, err := invoke.CommandWithContext(ctx, "ps", "-o", "etimes", "-p", "1") + if err != nil { + return 0, err + } + + lines := strings.Split(strings.TrimSpace(string(out)), "\n") + if len(lines) < 2 { + return 0, errors.New("ps output has fewer than 2 rows") + } + + // Extract the etimes value from the second row, trimming whitespace + etimes := strings.TrimSpace(lines[1]) + return ParseUptime(etimes), nil +} + +// Parses etimes output from ps command into total seconds. +// Handles formats like: +// - "124-01:40:39" (DAYS-HOURS:MINUTES:SECONDS) +// - "15:03:02" (HOURS:MINUTES:SECONDS) +// - "01:02" (MINUTES:SECONDS, from just-rebooted systems) +func ParseUptime(etimes string) uint64 { + var days, hours, mins, secs uint64 + + // Check if days component is present (contains a dash) + if strings.Contains(etimes, "-") { + parts := strings.Split(etimes, "-") + if len(parts) != 2 { + return 0 + } + + var err error + days, err = strconv.ParseUint(parts[0], 10, 64) + if err != nil { + return 0 + } + + // Parse the HH:MM:SS portion (after days, must have 3 parts) + etimes = parts[1] + timeParts := strings.Split(etimes, ":") + if len(timeParts) != 3 { + return 0 + } + + var err2 error + hours, err2 = strconv.ParseUint(timeParts[0], 10, 64) + if err2 != nil { + return 0 + } + + mins, err2 = strconv.ParseUint(timeParts[1], 10, 64) + if err2 != nil { + return 0 + } + + secs, err2 = strconv.ParseUint(timeParts[2], 10, 64) + if err2 != nil { + return 0 + } + } else { + // Parse time portions (either HH:MM:SS or MM:SS) when no days present + timeParts := strings.Split(etimes, ":") + switch len(timeParts) { + case 3: + // HH:MM:SS format + var err error + hours, err = strconv.ParseUint(timeParts[0], 10, 64) + if err != nil { + return 0 + } + + mins, err = strconv.ParseUint(timeParts[1], 10, 64) + if err != nil { + return 0 + } + + secs, err = strconv.ParseUint(timeParts[2], 10, 64) + if err != nil { + return 0 + } + case 2: + // MM:SS format (just-rebooted systems) + var err error + mins, err = strconv.ParseUint(timeParts[0], 10, 64) + if err != nil { + return 0 + } + + secs, err = strconv.ParseUint(timeParts[1], 10, 64) + if err != nil { + return 0 + } + default: + return 0 + } + } + + // Convert to total seconds + totalSeconds := (days * 24 * 60 * 60) + (hours * 60 * 60) + (mins * 60) + secs + return totalSeconds +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go new file mode 100644 index 00000000..caa1b8d9 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go @@ -0,0 +1,577 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin + +package common + +import ( + "errors" + "fmt" + "math" + "sync" + "unsafe" + + "github.com/ebitengine/purego" +) + +// Library represents a dynamic library loaded by purego. +type library struct { + handle uintptr + fnMap map[string]any + mu sync.RWMutex +} + +// library paths +const ( + IOKitLibPath = "/System/Library/Frameworks/IOKit.framework/IOKit" + CoreFoundationLibPath = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation" + SystemLibPath = "/usr/lib/libSystem.B.dylib" +) + +func newLibrary(path string) (*library, error) { + lib, err := purego.Dlopen(path, purego.RTLD_LAZY|purego.RTLD_GLOBAL) + if err != nil { + return nil, err + } + + return &library{ + handle: lib, + fnMap: make(map[string]any), + }, nil +} + +func (lib *library) Dlsym(symbol string) (uintptr, error) { + return purego.Dlsym(lib.handle, symbol) +} + +// getFunc resolves a function pointer from the library, caching it in fnMap. +// Thread-safe via double-checked locking to support shared library handles. +func getFunc[T any](lib *library, symbol string) T { + // Fast path: read lock only + lib.mu.RLock() + if f, ok := lib.fnMap[symbol].(*dlFunc[T]); ok { + lib.mu.RUnlock() + return f.fn + } + lib.mu.RUnlock() + + // Slow path: write lock for first-time resolution + lib.mu.Lock() + defer lib.mu.Unlock() + + // Double-check after acquiring write lock + if f, ok := lib.fnMap[symbol].(*dlFunc[T]); ok { + return f.fn + } + + dlfun := newDlfunc[T](symbol) + dlfun.init(lib.handle) + lib.fnMap[symbol] = dlfun + return dlfun.fn +} + +func (lib *library) Close() { + purego.Dlclose(lib.handle) +} + +type dlFunc[T any] struct { + sym string + fn T +} + +func (d *dlFunc[T]) init(handle uintptr) { + purego.RegisterLibFunc(&d.fn, handle, d.sym) +} + +func newDlfunc[T any](sym string) *dlFunc[T] { + return &dlFunc[T]{sym: sym} +} + +type CoreFoundationLib struct { + *library +} + +func NewCoreFoundationLib() (*CoreFoundationLib, error) { + library, err := newLibrary(CoreFoundationLibPath) + if err != nil { + return nil, err + } + return &CoreFoundationLib{library}, nil +} + +func (c *CoreFoundationLib) CFGetTypeID(cf uintptr) int64 { + fn := getFunc[CFGetTypeIDFunc](c.library, "CFGetTypeID") + return fn(cf) +} + +func (c *CoreFoundationLib) CFNumberCreate(allocator uintptr, theType int64, valuePtr uintptr) unsafe.Pointer { + fn := getFunc[CFNumberCreateFunc](c.library, "CFNumberCreate") + return fn(allocator, theType, valuePtr) +} + +func (c *CoreFoundationLib) CFNumberGetValue(num uintptr, theType int64, valuePtr uintptr) bool { + fn := getFunc[CFNumberGetValueFunc](c.library, "CFNumberGetValue") + return fn(num, theType, valuePtr) +} + +func (c *CoreFoundationLib) CFDictionaryCreate(allocator uintptr, keys, values *unsafe.Pointer, numValues int64, + keyCallBacks, valueCallBacks uintptr, +) unsafe.Pointer { + fn := getFunc[CFDictionaryCreateFunc](c.library, "CFDictionaryCreate") + return fn(allocator, keys, values, numValues, keyCallBacks, valueCallBacks) +} + +func (c *CoreFoundationLib) CFDictionaryAddValue(theDict, key, value uintptr) { + fn := getFunc[CFDictionaryAddValueFunc](c.library, "CFDictionaryAddValue") + fn(theDict, key, value) +} + +func (c *CoreFoundationLib) CFDictionaryGetValue(theDict, key uintptr) unsafe.Pointer { + fn := getFunc[CFDictionaryGetValueFunc](c.library, "CFDictionaryGetValue") + return fn(theDict, key) +} + +func (c *CoreFoundationLib) CFArrayGetCount(theArray uintptr) int64 { + fn := getFunc[CFArrayGetCountFunc](c.library, "CFArrayGetCount") + return fn(theArray) +} + +func (c *CoreFoundationLib) CFArrayGetValueAtIndex(theArray uintptr, index int64) unsafe.Pointer { + fn := getFunc[CFArrayGetValueAtIndexFunc](c.library, "CFArrayGetValueAtIndex") + return fn(theArray, index) +} + +func (c *CoreFoundationLib) CFStringCreateMutable(alloc uintptr, maxLength int64) unsafe.Pointer { + fn := getFunc[CFStringCreateMutableFunc](c.library, "CFStringCreateMutable") + return fn(alloc, maxLength) +} + +func (c *CoreFoundationLib) CFStringGetLength(theString uintptr) int64 { + fn := getFunc[CFStringGetLengthFunc](c.library, "CFStringGetLength") + return fn(theString) +} + +func (c *CoreFoundationLib) CFStringGetCString(theString uintptr, buffer CStr, bufferSize int64, encoding uint32) { + fn := getFunc[CFStringGetCStringFunc](c.library, "CFStringGetCString") + fn(theString, buffer, bufferSize, encoding) +} + +func (c *CoreFoundationLib) CFStringCreateWithCString(alloc uintptr, cStr string, encoding uint32) unsafe.Pointer { + fn := getFunc[CFStringCreateWithCStringFunc](c.library, "CFStringCreateWithCString") + return fn(alloc, cStr, encoding) +} + +func (c *CoreFoundationLib) CFDataGetLength(theData uintptr) int64 { + fn := getFunc[CFDataGetLengthFunc](c.library, "CFDataGetLength") + return fn(theData) +} + +func (c *CoreFoundationLib) CFDataGetBytePtr(theData uintptr) unsafe.Pointer { + fn := getFunc[CFDataGetBytePtrFunc](c.library, "CFDataGetBytePtr") + return fn(theData) +} + +func (c *CoreFoundationLib) CFRelease(cf uintptr) { + fn := getFunc[CFReleaseFunc](c.library, "CFRelease") + fn(cf) +} + +type IOKitLib struct { + *library +} + +func NewIOKitLib() (*IOKitLib, error) { + library, err := newLibrary(IOKitLibPath) + if err != nil { + return nil, err + } + return &IOKitLib{library}, nil +} + +func (l *IOKitLib) IOServiceGetMatchingService(mainPort uint32, matching uintptr) uint32 { + fn := getFunc[IOServiceGetMatchingServiceFunc](l.library, "IOServiceGetMatchingService") + return fn(mainPort, matching) +} + +func (l *IOKitLib) IOServiceGetMatchingServices(mainPort uint32, matching uintptr, existing *uint32) int32 { + fn := getFunc[IOServiceGetMatchingServicesFunc](l.library, "IOServiceGetMatchingServices") + return fn(mainPort, matching, existing) +} + +func (l *IOKitLib) IOServiceMatching(name string) unsafe.Pointer { + fn := getFunc[IOServiceMatchingFunc](l.library, "IOServiceMatching") + return fn(name) +} + +func (l *IOKitLib) IOServiceOpen(service, owningTask, connType uint32, connect *uint32) int32 { + fn := getFunc[IOServiceOpenFunc](l.library, "IOServiceOpen") + return fn(service, owningTask, connType, connect) +} + +func (l *IOKitLib) IOServiceClose(connect uint32) int32 { + fn := getFunc[IOServiceCloseFunc](l.library, "IOServiceClose") + return fn(connect) +} + +func (l *IOKitLib) IOIteratorNext(iterator uint32) uint32 { + fn := getFunc[IOIteratorNextFunc](l.library, "IOIteratorNext") + return fn(iterator) +} + +func (l *IOKitLib) IORegistryEntryGetName(entry uint32, name CStr) int32 { + fn := getFunc[IORegistryEntryGetNameFunc](l.library, "IORegistryEntryGetName") + return fn(entry, name) +} + +func (l *IOKitLib) IORegistryEntryGetParentEntry(entry uint32, plane string, parent *uint32) int32 { + fn := getFunc[IORegistryEntryGetParentEntryFunc](l.library, "IORegistryEntryGetParentEntry") + return fn(entry, plane, parent) +} + +func (l *IOKitLib) IORegistryEntryCreateCFProperty(entry uint32, key, allocator uintptr, options uint32) unsafe.Pointer { + fn := getFunc[IORegistryEntryCreateCFPropertyFunc](l.library, "IORegistryEntryCreateCFProperty") + return fn(entry, key, allocator, options) +} + +func (l *IOKitLib) IORegistryEntryCreateCFProperties(entry uint32, properties unsafe.Pointer, allocator uintptr, options uint32) int32 { + fn := getFunc[IORegistryEntryCreateCFPropertiesFunc](l.library, "IORegistryEntryCreateCFProperties") + return fn(entry, properties, allocator, options) +} + +func (l *IOKitLib) IOObjectConformsTo(object uint32, className string) bool { + fn := getFunc[IOObjectConformsToFunc](l.library, "IOObjectConformsTo") + return fn(object, className) +} + +func (l *IOKitLib) IOObjectRelease(object uint32) int32 { + fn := getFunc[IOObjectReleaseFunc](l.library, "IOObjectRelease") + return fn(object) +} + +func (l *IOKitLib) IOConnectCallStructMethod(connection, selector uint32, inputStruct, inputStructCnt, outputStruct uintptr, outputStructCnt *uintptr) int32 { + fn := getFunc[IOConnectCallStructMethodFunc](l.library, "IOConnectCallStructMethod") + return fn(connection, selector, inputStruct, inputStructCnt, outputStruct, outputStructCnt) +} + +func (l *IOKitLib) IOHIDEventSystemClientCreate(allocator uintptr) unsafe.Pointer { + fn := getFunc[IOHIDEventSystemClientCreateFunc](l.library, "IOHIDEventSystemClientCreate") + return fn(allocator) +} + +func (l *IOKitLib) IOHIDEventSystemClientSetMatching(client, match uintptr) int32 { + fn := getFunc[IOHIDEventSystemClientSetMatchingFunc](l.library, "IOHIDEventSystemClientSetMatching") + return fn(client, match) +} + +func (l *IOKitLib) IOHIDServiceClientCopyEvent(service uintptr, eventType int64, options int32, timeout int64) unsafe.Pointer { + fn := getFunc[IOHIDServiceClientCopyEventFunc](l.library, "IOHIDServiceClientCopyEvent") + return fn(service, eventType, options, timeout) +} + +func (l *IOKitLib) IOHIDServiceClientCopyProperty(service, property uintptr) unsafe.Pointer { + fn := getFunc[IOHIDServiceClientCopyPropertyFunc](l.library, "IOHIDServiceClientCopyProperty") + return fn(service, property) +} + +func (l *IOKitLib) IOHIDEventGetFloatValue(event uintptr, field int32) float64 { + fn := getFunc[IOHIDEventGetFloatValueFunc](l.library, "IOHIDEventGetFloatValue") + return fn(event, field) +} + +func (l *IOKitLib) IOHIDEventSystemClientCopyServices(client uintptr) unsafe.Pointer { + fn := getFunc[IOHIDEventSystemClientCopyServicesFunc](l.library, "IOHIDEventSystemClientCopyServices") + return fn(client) +} + +type SystemLib struct { + *library +} + +func NewSystemLib() (*SystemLib, error) { + library, err := newLibrary(SystemLibPath) + if err != nil { + return nil, err + } + return &SystemLib{library}, nil +} + +func (s *SystemLib) HostProcessorInfo(host uint32, flavor int32, outProcessorCount *uint32, outProcessorInfo uintptr, + outProcessorInfoCnt *uint32, +) int32 { + fn := getFunc[HostProcessorInfoFunc](s.library, "host_processor_info") + return fn(host, flavor, outProcessorCount, outProcessorInfo, outProcessorInfoCnt) +} + +func (s *SystemLib) HostStatistics(host uint32, flavor int32, hostInfoOut uintptr, hostInfoOutCnt *uint32) int32 { + fn := getFunc[HostStatisticsFunc](s.library, "host_statistics") + return fn(host, flavor, hostInfoOut, hostInfoOutCnt) +} + +func (s *SystemLib) MachHostSelf() uint32 { + fn := getFunc[MachHostSelfFunc](s.library, "mach_host_self") + return fn() +} + +func (s *SystemLib) MachTaskSelf() uint32 { + fn := getFunc[MachTaskSelfFunc](s.library, "mach_task_self") + return fn() +} + +func (s *SystemLib) MachTimeBaseInfo(info uintptr) int32 { + fn := getFunc[MachTimeBaseInfoFunc](s.library, "mach_timebase_info") + return fn(info) +} + +func (s *SystemLib) VMDeallocate(targetTask uint32, vmAddress, vmSize uintptr) int32 { + fn := getFunc[VMDeallocateFunc](s.library, "vm_deallocate") + return fn(targetTask, vmAddress, vmSize) +} + +func (s *SystemLib) ProcPidPath(pid int32, buffer uintptr, bufferSize uint32) int32 { + fn := getFunc[ProcPidPathFunc](s.library, "proc_pidpath") + return fn(pid, buffer, bufferSize) +} + +func (s *SystemLib) ProcPidInfo(pid, flavor int32, arg uint64, buffer uintptr, bufferSize int32) int32 { + fn := getFunc[ProcPidInfoFunc](s.library, "proc_pidinfo") + return fn(pid, flavor, arg, buffer, bufferSize) +} + +// status codes +const ( + KERN_SUCCESS = 0 +) + +// IOKit types and constants. +type ( + IOServiceGetMatchingServiceFunc func(mainPort uint32, matching uintptr) uint32 + IOServiceGetMatchingServicesFunc func(mainPort uint32, matching uintptr, existing *uint32) int32 + IOServiceMatchingFunc func(name string) unsafe.Pointer + IOServiceOpenFunc func(service, owningTask, connType uint32, connect *uint32) int32 + IOServiceCloseFunc func(connect uint32) int32 + IOIteratorNextFunc func(iterator uint32) uint32 + IORegistryEntryGetNameFunc func(entry uint32, name CStr) int32 + IORegistryEntryGetParentEntryFunc func(entry uint32, plane string, parent *uint32) int32 + IORegistryEntryCreateCFPropertyFunc func(entry uint32, key, allocator uintptr, options uint32) unsafe.Pointer + IORegistryEntryCreateCFPropertiesFunc func(entry uint32, properties unsafe.Pointer, allocator uintptr, options uint32) int32 + IOObjectConformsToFunc func(object uint32, className string) bool + IOObjectReleaseFunc func(object uint32) int32 + IOConnectCallStructMethodFunc func(connection, selector uint32, inputStruct, inputStructCnt, outputStruct uintptr, outputStructCnt *uintptr) int32 + + IOHIDEventSystemClientCreateFunc func(allocator uintptr) unsafe.Pointer + IOHIDEventSystemClientSetMatchingFunc func(client, match uintptr) int32 + IOHIDServiceClientCopyEventFunc func(service uintptr, eventType int64, + options int32, timeout int64) unsafe.Pointer + IOHIDServiceClientCopyPropertyFunc func(service, property uintptr) unsafe.Pointer + IOHIDEventGetFloatValueFunc func(event uintptr, field int32) float64 + IOHIDEventSystemClientCopyServicesFunc func(client uintptr) unsafe.Pointer +) + +const ( + KIOMainPortDefault = 0 + + KIOHIDEventTypeTemperature = 15 + + KNilOptions = 0 +) + +const ( + KIOMediaWholeKey = "Media" + KIOServicePlane = "IOService" +) + +// CoreFoundation types and constants. +type ( + CFGetTypeIDFunc func(cf uintptr) int64 + CFNumberCreateFunc func(allocator uintptr, theType int64, valuePtr uintptr) unsafe.Pointer + CFNumberGetValueFunc func(num uintptr, theType int64, valuePtr uintptr) bool + CFDictionaryCreateFunc func(allocator uintptr, keys, values *unsafe.Pointer, numValues int64, + keyCallBacks, valueCallBacks uintptr) unsafe.Pointer + CFDictionaryAddValueFunc func(theDict, key, value uintptr) + CFDictionaryGetValueFunc func(theDict, key uintptr) unsafe.Pointer + CFArrayGetCountFunc func(theArray uintptr) int64 + CFArrayGetValueAtIndexFunc func(theArray uintptr, index int64) unsafe.Pointer + CFStringCreateMutableFunc func(alloc uintptr, maxLength int64) unsafe.Pointer + CFStringGetLengthFunc func(theString uintptr) int64 + CFStringGetCStringFunc func(theString uintptr, buffer CStr, bufferSize int64, encoding uint32) + CFStringCreateWithCStringFunc func(alloc uintptr, cStr string, encoding uint32) unsafe.Pointer + CFDataGetLengthFunc func(theData uintptr) int64 + CFDataGetBytePtrFunc func(theData uintptr) unsafe.Pointer + CFReleaseFunc func(cf uintptr) +) + +const ( + KCFStringEncodingUTF8 = 0x08000100 + KCFNumberSInt64Type = 4 + KCFNumberIntType = 9 + KCFAllocatorDefault = 0 + KCFNotFound = -1 +) + +// libSystem types and constants. +type MachTimeBaseInfo struct { + Numer uint32 + Denom uint32 +} + +type ( + HostProcessorInfoFunc func(host uint32, flavor int32, outProcessorCount *uint32, outProcessorInfo uintptr, + outProcessorInfoCnt *uint32) int32 + HostStatisticsFunc func(host uint32, flavor int32, hostInfoOut uintptr, hostInfoOutCnt *uint32) int32 + MachHostSelfFunc func() uint32 + MachTaskSelfFunc func() uint32 + MachTimeBaseInfoFunc func(info uintptr) int32 + VMDeallocateFunc func(targetTask uint32, vmAddress, vmSize uintptr) int32 +) + +const ( + HostProcessorInfoSym = "host_processor_info" + HostStatisticsSym = "host_statistics" + MachHostSelfSym = "mach_host_self" + MachTaskSelfSym = "mach_task_self" + MachTimeBaseInfoSym = "mach_timebase_info" + VMDeallocateSym = "vm_deallocate" +) + +const ( + HOST_VM_INFO = 2 + HOST_CPU_LOAD_INFO = 3 + + HOST_VM_INFO_COUNT = 0xf +) + +type ( + ProcPidPathFunc func(pid int32, buffer uintptr, bufferSize uint32) int32 + ProcPidInfoFunc func(pid, flavor int32, arg uint64, buffer uintptr, bufferSize int32) int32 +) + +const ( + SysctlSym = "sysctl" + ProcPidPathSym = "proc_pidpath" + ProcPidInfoSym = "proc_pidinfo" +) + +const ( + MAXPATHLEN = 1024 + PROC_PIDLISTFDS = 1 + PROC_PIDPATHINFO_MAXSIZE = 4 * MAXPATHLEN + PROC_PIDTASKINFO = 4 + PROC_PIDVNODEPATHINFO = 9 +) + +// SMC represents a SMC instance. +type SMC struct { + lib *IOKitLib + conn uint32 +} + +const ioServiceSMC = "AppleSMC" + +const ( + KSMCUserClientOpen = 0 + KSMCUserClientClose = 1 + KSMCHandleYPCEvent = 2 + KSMCReadKey = 5 + KSMCWriteKey = 6 + KSMCGetKeyCount = 7 + KSMCGetKeyFromIndex = 8 + KSMCGetKeyInfo = 9 +) + +const ( + KSMCSuccess = 0 + KSMCError = 1 + KSMCKeyNotFound = 132 +) + +func NewSMC() (*SMC, error) { + iokit, err := NewIOKitLib() + if err != nil { + return nil, err + } + + service := iokit.IOServiceGetMatchingService(0, uintptr(iokit.IOServiceMatching(ioServiceSMC))) + if service == 0 { + return nil, fmt.Errorf("ERROR: %s NOT FOUND", ioServiceSMC) + } + + var conn uint32 + machTaskSelf := getFunc[MachTaskSelfFunc](iokit.library, "mach_task_self") + if result := iokit.IOServiceOpen(service, machTaskSelf(), 0, &conn); result != 0 { + return nil, errors.New("ERROR: IOServiceOpen failed") + } + + iokit.IOObjectRelease(service) + return &SMC{ + lib: iokit, + conn: conn, + }, nil +} + +func (s *SMC) CallStruct(selector uint32, inputStruct, inputStructCnt, outputStruct uintptr, outputStructCnt *uintptr) int32 { + return s.lib.IOConnectCallStructMethod(s.conn, selector, inputStruct, inputStructCnt, outputStruct, outputStructCnt) +} + +func (s *SMC) Close() error { + if result := s.lib.IOServiceClose(s.conn); result != 0 { + return errors.New("ERROR: IOServiceClose failed") + } + s.lib.Close() + return nil +} + +type CStr []byte + +func NewCStr(length int64) CStr { + return make(CStr, length) +} + +func (s CStr) Length() int64 { + return int64(len(s)) +} + +func (s CStr) Ptr() *byte { + if len(s) < 1 { + return nil + } + + return &s[0] +} + +func (s CStr) Addr() uintptr { + return uintptr(unsafe.Pointer(s.Ptr())) +} + +func (s CStr) GoString() string { + if s == nil { + return "" + } + + var length int + for _, char := range s { + if char == '\x00' { + break + } + length++ + } + return string(s[:length]) +} + +// https://github.com/ebitengine/purego/blob/main/internal/strings/strings.go#L26 +func GoString(cStr *byte) string { + if cStr == nil { + return "" + } + var length int + for *(*byte)(unsafe.Add(unsafe.Pointer(cStr), uintptr(length))) != '\x00' { + length++ + } + return string(unsafe.Slice(cStr, length)) +} + +// https://github.com/apple-oss-distributions/CF/blob/dc54c6bb1c1e5e0b9486c1d26dd5bef110b20bf3/CFString.c#L463 +func GetCFStringBufLengthForUTF8(length int64) int64 { + if length > (math.MaxInt64 / 3) { + return KCFNotFound + } + return length*3 + 1 // includes null terminator +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go new file mode 100644 index 00000000..7a40a40c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build freebsd || openbsd + +package common + +import ( + "fmt" + "unsafe" + + "golang.org/x/sys/unix" +) + +func SysctlUint(mib string) (uint64, error) { + buf, err := unix.SysctlRaw(mib) + if err != nil { + return 0, err + } + if len(buf) == 8 { // 64 bit + return *(*uint64)(unsafe.Pointer(&buf[0])), nil + } + if len(buf) == 4 { // 32bit + t := *(*uint32)(unsafe.Pointer(&buf[0])) + return uint64(t), nil + } + return 0, fmt.Errorf("unexpected size: %s, %d", mib, len(buf)) +} + +func CallSyscall(mib []int32) ([]byte, uint64, error) { + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + + // get required buffer size + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + var b []byte + return b, length, err + } + if length == 0 { + var b []byte + return b, length, err + } + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go new file mode 100644 index 00000000..a2473f41 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go @@ -0,0 +1,343 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux + +package common + +import ( + "context" + "errors" + "os" + "path/filepath" + "strconv" + "strings" + "sync" + "sync/atomic" + "syscall" + "time" +) + +// cachedBootTime must be accessed via atomic.Load/StoreUint64 +var cachedBootTime uint64 + +func NumProcs() (uint64, error) { + return NumProcsWithContext(context.Background()) +} + +func NumProcsWithContext(ctx context.Context) (uint64, error) { + f, err := os.Open(HostProcWithContext(ctx)) + if err != nil { + return 0, err + } + defer f.Close() + + list, err := f.Readdirnames(-1) + if err != nil { + return 0, err + } + var cnt uint64 + + for _, v := range list { + if _, err = strconv.ParseUint(v, 10, 64); err == nil { + cnt++ + } + } + + return cnt, nil +} + +func BootTimeWithContext(ctx context.Context, enableCache bool) (uint64, error) { + if enableCache { + t := atomic.LoadUint64(&cachedBootTime) + if t != 0 { + return t, nil + } + } + + system, role, err := VirtualizationWithContext(ctx) + if err != nil { + return 0, err + } + + useStatFile := true + if system == "lxc" && role == "guest" { + // if lxc, /proc/uptime is used. + useStatFile = false + } else if system == "docker" && role == "guest" { + // also docker, guest + useStatFile = false + } + + if useStatFile { + t, err := readBootTimeStat(ctx) + if err != nil { + return 0, err + } + if enableCache { + atomic.StoreUint64(&cachedBootTime, t) + } + + return t, nil + } + + filename := HostProcWithContext(ctx, "uptime") + lines, err := ReadLines(filename) + if err != nil { + return handleBootTimeFileReadErr(err) + } + currentTime := float64(time.Now().UnixNano()) / float64(time.Second) + + if len(lines) != 1 { + return 0, errors.New("wrong uptime format") + } + f := strings.Fields(lines[0]) + b, err := strconv.ParseFloat(f[0], 64) + if err != nil { + return 0, err + } + t := currentTime - b + + if enableCache { + atomic.StoreUint64(&cachedBootTime, uint64(t)) + } + + return uint64(t), nil +} + +func handleBootTimeFileReadErr(err error) (uint64, error) { + if !os.IsPermission(err) { + return 0, err + } + var info syscall.Sysinfo_t + err = syscall.Sysinfo(&info) + if err != nil { + return 0, err + } + + currentTime := time.Now().UnixNano() / int64(time.Second) + t := currentTime - int64(info.Uptime) + return uint64(t), nil +} + +func readBootTimeStat(ctx context.Context) (uint64, error) { + filename := HostProcWithContext(ctx, "stat") + line, err := ReadLine(filename, "btime") + if err != nil { + return handleBootTimeFileReadErr(err) + } + if strings.HasPrefix(line, "btime") { + f := strings.Fields(line) + if len(f) != 2 { + return 0, errors.New("wrong btime format") + } + b, err := strconv.ParseInt(f[1], 10, 64) + if err != nil { + return 0, err + } + t := uint64(b) + return t, nil + } + return 0, errors.New("could not find btime") +} + +func Virtualization() (string, string, error) { + return VirtualizationWithContext(context.Background()) +} + +// required variables for concurrency safe virtualization caching +var ( + cachedVirtMap map[string]string + cachedVirtMutex sync.RWMutex + cachedVirtOnce sync.Once +) + +func VirtualizationWithContext(ctx context.Context) (string, string, error) { + var system, role string + + // if cached already, return from cache + cachedVirtMutex.RLock() // unlock won't be deferred so concurrent reads don't wait for long + if cachedVirtMap != nil { + cachedSystem, cachedRole := cachedVirtMap["system"], cachedVirtMap["role"] + cachedVirtMutex.RUnlock() + return cachedSystem, cachedRole, nil + } + cachedVirtMutex.RUnlock() + + filename := HostProcWithContext(ctx, "xen") + if PathExists(filename) { + system = "xen" + role = "guest" // assume guest + + if PathExists(filepath.Join(filename, "capabilities")) { + contents, err := ReadLines(filepath.Join(filename, "capabilities")) + if err == nil { + if StringsContains(contents, "control_d") { + role = "host" + } + } + } + } + + filename = HostProcWithContext(ctx, "modules") + if PathExists(filename) { + contents, err := ReadLines(filename) + if err == nil { + switch { + case StringsContains(contents, "kvm"): + system = "kvm" + role = "host" + case StringsContains(contents, "hv_util"): + system = "hyperv" + role = "guest" + case StringsContains(contents, "vboxdrv"): + system = "vbox" + role = "host" + case StringsContains(contents, "vboxguest"): + system = "vbox" + role = "guest" + case StringsContains(contents, "vmware"): + system = "vmware" + role = "guest" + } + } + } + + filename = HostProcWithContext(ctx, "cpuinfo") + if PathExists(filename) { + contents, err := ReadLines(filename) + if err == nil { + if StringsContains(contents, "QEMU Virtual CPU") || + StringsContains(contents, "Common KVM processor") || + StringsContains(contents, "Common 32-bit KVM processor") { + system = "kvm" + role = "guest" + } + } + } + + filename = HostProcWithContext(ctx, "bus/pci/devices") + if PathExists(filename) { + contents, err := ReadLines(filename) + if err == nil { + if StringsContains(contents, "virtio-pci") { + role = "guest" + } + } + } + + filename = HostProcWithContext(ctx) + if PathExists(filepath.Join(filename, "bc", "0")) { + system = "openvz" + role = "host" + } else if PathExists(filepath.Join(filename, "vz")) { + system = "openvz" + role = "guest" + } + + // not use dmidecode because it requires root + if PathExists(filepath.Join(filename, "self", "status")) { + contents, err := ReadLines(filepath.Join(filename, "self", "status")) + if err == nil { + if StringsContains(contents, "s_context:") || + StringsContains(contents, "VxID:") { + system = "linux-vserver" + } + // TODO: guest or host + } + } + + if PathExists(filepath.Join(filename, "1", "environ")) { + contents, err := ReadFile(filepath.Join(filename, "1", "environ")) + + if err == nil { + if strings.Contains(contents, "container=lxc") { + system = "lxc" + role = "guest" + } + } + } + + if PathExists(filepath.Join(filename, "self", "cgroup")) { + contents, err := ReadLines(filepath.Join(filename, "self", "cgroup")) + if err == nil { + switch { + case StringsContains(contents, "lxc"): + system = "lxc" + role = "guest" + case StringsContains(contents, "docker"): + system = "docker" + role = "guest" + case StringsContains(contents, "machine-rkt"): + system = "rkt" + role = "guest" + case PathExists("/usr/bin/lxc-version"): + system = "lxc" + role = "host" + } + } + } + + if PathExists(HostEtcWithContext(ctx, "os-release")) { + p, _, err := GetOSReleaseWithContext(ctx) + if err == nil && p == "coreos" { + system = "rkt" // Is it true? + role = "host" + } + } + + if PathExists(HostRootWithContext(ctx, ".dockerenv")) { + system = "docker" + role = "guest" + } + + // before returning for the first time, cache the system and role + cachedVirtOnce.Do(func() { + cachedVirtMutex.Lock() + defer cachedVirtMutex.Unlock() + cachedVirtMap = map[string]string{ + "system": system, + "role": role, + } + }) + + return system, role, nil +} + +func GetOSRelease() (platform, version string, err error) { + return GetOSReleaseWithContext(context.Background()) +} + +func GetOSReleaseWithContext(ctx context.Context) (platform, version string, err error) { + contents, err := ReadLines(HostEtcWithContext(ctx, "os-release")) + if err != nil { + return "", "", nil // return empty + } + for _, line := range contents { + field := strings.Split(line, "=") + if len(field) < 2 { + continue + } + switch field[0] { + case "ID": // use ID for lowercase + platform = trimQuotes(field[1]) + case "VERSION_ID": + version = trimQuotes(field[1]) + } + } + + // cleanup amazon ID + if platform == "amzn" { + platform = "amazon" + } + + return platform, version, nil +} + +// Remove quotes of the source string +func trimQuotes(s string) string { + if len(s) >= 2 { + if s[0] == '"' && s[len(s)-1] == '"' { + return s[1 : len(s)-1] + } + } + return s +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go new file mode 100644 index 00000000..52796ddb --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build netbsd + +package common + +import ( + "unsafe" + + "golang.org/x/sys/unix" +) + +func CallSyscall(mib []int32) ([]byte, uint64, error) { + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + + // get required buffer size + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + var b []byte + return b, length, err + } + if length == 0 { + var b []byte + return b, length, err + } + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go new file mode 100644 index 00000000..df44ac04 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd + +package common + +import ( + "unsafe" + + "golang.org/x/sys/unix" +) + +func CallSyscall(mib []int32) ([]byte, uint64, error) { + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + + // get required buffer size + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + var b []byte + return b, length, err + } + if length == 0 { + var b []byte + return b, length, err + } + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_unix.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_unix.go new file mode 100644 index 00000000..2ccb3760 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_unix.go @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux || freebsd || darwin || openbsd + +package common + +import ( + "context" + "errors" + "os/exec" + "strconv" + "strings" +) + +func CallLsofWithContext(ctx context.Context, invoke Invoker, pid int32, args ...string) ([]string, error) { + var cmd []string + if pid == 0 { // will get from all processes. + cmd = []string{"-a", "-n", "-P"} + } else { + cmd = []string{"-a", "-n", "-P", "-p", strconv.Itoa(int(pid))} + } + cmd = append(cmd, args...) + out, err := invoke.CommandWithContext(ctx, "lsof", cmd...) + if err != nil { + if errors.Is(err, exec.ErrNotFound) { + return []string{}, err + } + // if no pid found, lsof returns code 1. + if err.Error() == "exit status 1" && len(out) == 0 { + return []string{}, nil + } + } + lines := strings.Split(string(out), "\n") + + var ret []string + for _, l := range lines[1:] { + if l == "" { + continue + } + ret = append(ret, l) + } + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go new file mode 100644 index 00000000..31df6efe --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go @@ -0,0 +1,305 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build windows + +package common + +import ( + "context" + "fmt" + "path/filepath" + "reflect" + "strings" + "syscall" + "unsafe" + + "github.com/yusufpapurcu/wmi" + "golang.org/x/sys/windows" +) + +// for double values +type PDH_FMT_COUNTERVALUE_DOUBLE struct { //nolint:revive //FIXME + CStatus uint32 + DoubleValue float64 +} + +// for 64 bit integer values +type PDH_FMT_COUNTERVALUE_LARGE struct { //nolint:revive //FIXME + CStatus uint32 + LargeValue int64 +} + +// for long values +type PDH_FMT_COUNTERVALUE_LONG struct { //nolint:revive //FIXME + CStatus uint32 + LongValue int32 + padding [4]byte +} + +// windows system const +const ( + ERROR_SUCCESS = 0 + ERROR_FILE_NOT_FOUND = 2 + DRIVE_REMOVABLE = 2 + DRIVE_FIXED = 3 + HKEY_LOCAL_MACHINE = 0x80000002 + RRF_RT_REG_SZ = 0x00000002 + RRF_RT_REG_DWORD = 0x00000010 + PDH_FMT_LONG = 0x00000100 + PDH_FMT_DOUBLE = 0x00000200 + PDH_FMT_LARGE = 0x00000400 + PDH_INVALID_DATA = 0xc0000bc6 + PDH_INVALID_HANDLE = 0xC0000bbc + PDH_NO_DATA = 0x800007d5 + + STATUS_BUFFER_OVERFLOW = 0x80000005 + STATUS_BUFFER_TOO_SMALL = 0xC0000023 + STATUS_INFO_LENGTH_MISMATCH = 0xC0000004 +) + +const ( + ProcessBasicInformation = 0 + ProcessWow64Information = 26 + ProcessQueryInformation = windows.PROCESS_DUP_HANDLE | windows.PROCESS_QUERY_INFORMATION + + SystemExtendedHandleInformationClass = 64 +) + +var ( + Modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + ModNt = windows.NewLazySystemDLL("ntdll.dll") + ModPdh = windows.NewLazySystemDLL("pdh.dll") + ModPsapi = windows.NewLazySystemDLL("psapi.dll") + ModPowrProf = windows.NewLazySystemDLL("powrprof.dll") + + ProcGetSystemTimes = Modkernel32.NewProc("GetSystemTimes") + ProcNtQuerySystemInformation = ModNt.NewProc("NtQuerySystemInformation") + ProcRtlGetNativeSystemInformation = ModNt.NewProc("RtlGetNativeSystemInformation") + ProcRtlNtStatusToDosError = ModNt.NewProc("RtlNtStatusToDosError") + ProcNtQueryInformationProcess = ModNt.NewProc("NtQueryInformationProcess") + ProcNtReadVirtualMemory = ModNt.NewProc("NtReadVirtualMemory") + ProcNtWow64QueryInformationProcess64 = ModNt.NewProc("NtWow64QueryInformationProcess64") + ProcNtWow64ReadVirtualMemory64 = ModNt.NewProc("NtWow64ReadVirtualMemory64") + + PdhOpenQuery = ModPdh.NewProc("PdhOpenQuery") + PdhAddEnglishCounterW = ModPdh.NewProc("PdhAddEnglishCounterW") + PdhCollectQueryData = ModPdh.NewProc("PdhCollectQueryData") + PdhGetFormattedCounterValue = ModPdh.NewProc("PdhGetFormattedCounterValue") + PdhCloseQuery = ModPdh.NewProc("PdhCloseQuery") + + procQueryDosDeviceW = Modkernel32.NewProc("QueryDosDeviceW") +) + +type FILETIME struct { + DwLowDateTime uint32 + DwHighDateTime uint32 +} + +// borrowed from net/interface_windows.go +func BytePtrToString(p *uint8) string { + a := (*[10000]uint8)(unsafe.Pointer(p)) + i := 0 + for a[i] != 0 { + i++ + } + return string(a[:i]) +} + +// CounterInfo struct is used to track a windows performance counter +// copied from https://github.com/mackerelio/mackerel-agent/ +type CounterInfo struct { + PostName string + CounterName string + Counter windows.Handle +} + +// CreateQuery with a PdhOpenQuery call +// copied from https://github.com/mackerelio/mackerel-agent/ +func CreateQuery() (windows.Handle, error) { + var query windows.Handle + r, _, err := PdhOpenQuery.Call(0, 0, uintptr(unsafe.Pointer(&query))) + if r != 0 { + return 0, err + } + return query, nil +} + +// CreateCounter with a PdhAddEnglishCounterW call +func CreateCounter(query windows.Handle, pname, cname string) (*CounterInfo, error) { + var counter windows.Handle + r, _, err := PdhAddEnglishCounterW.Call( + uintptr(query), + uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(cname))), + 0, + uintptr(unsafe.Pointer(&counter))) + if r != 0 { + return nil, err + } + return &CounterInfo{ + PostName: pname, + CounterName: cname, + Counter: counter, + }, nil +} + +// GetCounterValue get counter value from handle +// adapted from https://github.com/mackerelio/mackerel-agent/ +func GetCounterValue(counter windows.Handle) (float64, error) { + var value PDH_FMT_COUNTERVALUE_DOUBLE + r, _, err := PdhGetFormattedCounterValue.Call(uintptr(counter), PDH_FMT_DOUBLE, uintptr(0), uintptr(unsafe.Pointer(&value))) + if r != 0 && r != PDH_INVALID_DATA { + return 0.0, err + } + return value.DoubleValue, nil +} + +type Win32PerformanceCounter struct { + PostName string + CounterName string + Query windows.Handle + Counter windows.Handle +} + +func NewWin32PerformanceCounter(postName, counterName string) (*Win32PerformanceCounter, error) { + query, err := CreateQuery() + if err != nil { + return nil, err + } + counter := Win32PerformanceCounter{ + Query: query, + PostName: postName, + CounterName: counterName, + } + r, _, err := PdhAddEnglishCounterW.Call( + uintptr(counter.Query), + uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(counter.CounterName))), + 0, + uintptr(unsafe.Pointer(&counter.Counter)), + ) + if r != 0 { + return nil, err + } + return &counter, nil +} + +func (w *Win32PerformanceCounter) GetValue() (float64, error) { + r, _, err := PdhCollectQueryData.Call(uintptr(w.Query)) + if r != 0 && err != nil { + if r == PDH_NO_DATA { + return 0.0, fmt.Errorf("%w: this counter has not data", err) + } + return 0.0, err + } + + return GetCounterValue(w.Counter) +} + +func ProcessorQueueLengthCounter() (*Win32PerformanceCounter, error) { + return NewWin32PerformanceCounter("processor_queue_length", `\System\Processor Queue Length`) +} + +// WMIQueryWithContext - wraps wmi.Query with a timed-out context to avoid hanging +func WMIQueryWithContext(ctx context.Context, query string, dst any, connectServerArgs ...any) error { + if _, ok := ctx.Deadline(); !ok { + ctxTimeout, cancel := context.WithTimeout(ctx, Timeout) + defer cancel() + ctx = ctxTimeout + } + + errChan := make(chan error, 1) + go func() { + errChan <- wmi.Query(query, dst, connectServerArgs...) + }() + + select { + case <-ctx.Done(): + return ctx.Err() + case err := <-errChan: + return err + } +} + +// Convert paths using native DOS format like: +// +// "\Device\HarddiskVolume1\Windows\systemew\file.txt" +// +// into: +// +// "C:\Windows\systemew\file.txt" +func ConvertDOSPath(p string) string { + rawDrive := strings.Join(strings.Split(p, `\`)[:3], `\`) + + for d := 'A'; d <= 'Z'; d++ { + szDeviceName := string(d) + ":" + szTarget := make([]uint16, 512) + ret, _, _ := procQueryDosDeviceW.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(szDeviceName))), + uintptr(unsafe.Pointer(&szTarget[0])), + uintptr(len(szTarget))) + if ret != 0 && windows.UTF16ToString(szTarget) == rawDrive { + return filepath.Join(szDeviceName, p[len(rawDrive):]) + } + } + return p +} + +type NtStatus uint32 + +func (s NtStatus) Error() error { + if s == 0 { + return nil + } + return fmt.Errorf("NtStatus 0x%08x", uint32(s)) +} + +func (s NtStatus) IsError() bool { + return s>>30 == 3 +} + +type SystemExtendedHandleTableEntryInformation struct { + Object uintptr + UniqueProcessId uintptr + HandleValue uintptr + GrantedAccess uint32 + CreatorBackTraceIndex uint16 + ObjectTypeIndex uint16 + HandleAttributes uint32 + Reserved uint32 +} + +type SystemExtendedHandleInformation struct { + NumberOfHandles uintptr + Reserved uintptr + Handles [1]SystemExtendedHandleTableEntryInformation +} + +// CallWithExpandingBuffer https://github.com/hillu/go-ntdll +func CallWithExpandingBuffer(fn func() NtStatus, buf *[]byte, resultLength *uint32) NtStatus { + for { + st := fn() + if st == STATUS_BUFFER_OVERFLOW || st == STATUS_BUFFER_TOO_SMALL || st == STATUS_INFO_LENGTH_MISMATCH { + if int(*resultLength) <= cap(*buf) { + (*reflect.SliceHeader)(unsafe.Pointer(buf)).Len = int(*resultLength) + } else { + *buf = make([]byte, int(*resultLength)) + } + continue + } + if !st.IsError() { + *buf = (*buf)[:int(*resultLength)] + } + return st + } +} + +func NtQuerySystemInformation( + SystemInformationClass uint32, + SystemInformation *byte, + SystemInformationLength uint32, + ReturnLength *uint32, +) NtStatus { + r0, _, _ := ProcNtQuerySystemInformation.Call( + uintptr(SystemInformationClass), + uintptr(unsafe.Pointer(SystemInformation)), + uintptr(SystemInformationLength), + uintptr(unsafe.Pointer(ReturnLength))) + return NtStatus(r0) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/endian.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/endian.go new file mode 100644 index 00000000..113ff2e9 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/endian.go @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: BSD-3-Clause +package common + +import "unsafe" + +// IsLittleEndian checks if the current platform uses little-endian. +// copied from https://github.com/ntrrg/ntgo/blob/v0.8.0/runtime/infrastructure.go#L16 (MIT License) +func IsLittleEndian() bool { + var x int16 = 0x0011 + return *(*byte)(unsafe.Pointer(&x)) == 0x11 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/readlink_linux.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/readlink_linux.go new file mode 100644 index 00000000..ea2d4677 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/readlink_linux.go @@ -0,0 +1,53 @@ +package common + +import ( + "errors" + "os" + "sync" + "syscall" +) + +var bufferPool = sync.Pool{ + New: func() any { + b := make([]byte, syscall.PathMax) + return &b + }, +} + +// The following three functions are copied from stdlib. + +// ignoringEINTR2 is ignoringEINTR, but returning an additional value. +func ignoringEINTR2[T any](fn func() (T, error)) (T, error) { + for { + v, err := fn() + if !errors.Is(err, syscall.EINTR) { + return v, err + } + } +} + +// Many functions in package syscall return a count of -1 instead of 0. +// Using fixCount(call()) instead of call() corrects the count. +func fixCount(n int, err error) (int, error) { + if n < 0 { + n = 0 + } + return n, err +} + +// Readlink behaves like os.Readlink but caches the buffer passed to syscall.Readlink. +func Readlink(name string) (string, error) { + b := bufferPool.Get().(*[]byte) + + n, err := ignoringEINTR2(func() (int, error) { + return fixCount(syscall.Readlink(name, *b)) + }) + if err != nil { + bufferPool.Put(b) + return "", &os.PathError{Op: "readlink", Path: name, Err: err} + } + + result := string((*b)[:n]) + bufferPool.Put(b) + return result, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/sleep.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/sleep.go new file mode 100644 index 00000000..504f13ff --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/sleep.go @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: BSD-3-Clause +package common + +import ( + "context" + "time" +) + +// Sleep awaits for provided interval. +// Can be interrupted by context cancellation. +func Sleep(ctx context.Context, interval time.Duration) error { + timer := time.NewTimer(interval) + select { + case <-ctx.Done(): + if !timer.Stop() { + <-timer.C + } + return ctx.Err() + case <-timer.C: + return nil + } +} diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go new file mode 100644 index 00000000..6bbfc2d7 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: BSD-3-Clause +package common + +import ( + "fmt" + "strings" +) + +const ( + maxWarnings = 100 // An arbitrary limit to avoid excessive memory usage, it has no sense to store hundreds of errors + tooManyErrorsMessage = "too many errors reported, next errors were discarded" + numberOfWarningsMessage = "Number of warnings:" +) + +type Warnings struct { + List []error + tooManyErrors bool + Verbose bool +} + +func (w *Warnings) Add(err error) { + if len(w.List) >= maxWarnings { + w.tooManyErrors = true + return + } + w.List = append(w.List, err) +} + +func (w *Warnings) Reference() error { + if len(w.List) > 0 { + return w + } + return nil +} + +func (w *Warnings) Error() string { + if w.Verbose { + str := "" + var sb strings.Builder + for i, e := range w.List { + fmt.Fprintf(&sb, "\tError %d: %s\n", i, e.Error()) + } + str += sb.String() + if w.tooManyErrors { + str += fmt.Sprintf("\t%s\n", tooManyErrorsMessage) + } + return str + } + if w.tooManyErrors { + return fmt.Sprintf("%s > %v - %s", numberOfWarningsMessage, maxWarnings, tooManyErrorsMessage) + } + return fmt.Sprintf("%s %v", numberOfWarningsMessage, len(w.List)) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/ex_linux.go b/vendor/github.com/shirou/gopsutil/v4/mem/ex_linux.go new file mode 100644 index 00000000..b69dfb60 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/ex_linux.go @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux + +package mem + +import ( + "context" + "encoding/json" +) + +type ExVirtualMemory struct { + ActiveFile uint64 `json:"activefile"` + InactiveFile uint64 `json:"inactivefile"` + ActiveAnon uint64 `json:"activeanon"` + InactiveAnon uint64 `json:"inactiveanon"` + Unevictable uint64 `json:"unevictable"` + Percpu uint64 `json:"percpu"` + KernelStack uint64 `json:"kernelstack"` +} + +func (v ExVirtualMemory) String() string { + s, _ := json.Marshal(v) + return string(s) +} + +type ExLinux struct{} + +func NewExLinux() *ExLinux { + return &ExLinux{} +} + +func (ex *ExLinux) VirtualMemory() (*ExVirtualMemory, error) { + return ex.VirtualMemoryWithContext(context.Background()) +} + +func (*ExLinux) VirtualMemoryWithContext(ctx context.Context) (*ExVirtualMemory, error) { + _, vmEx, err := fillFromMeminfoWithContext(ctx) + if err != nil { + return nil, err + } + return vmEx, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/ex_windows.go b/vendor/github.com/shirou/gopsutil/v4/mem/ex_windows.go new file mode 100644 index 00000000..907143d3 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/ex_windows.go @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build windows + +package mem + +import ( + "unsafe" +) + +// ExVirtualMemory represents Windows specific information +// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex +// https://learn.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-performance_information +type ExVirtualMemory struct { + CommitLimit uint64 `json:"commitLimit"` + CommitTotal uint64 `json:"commitTotal"` + VirtualTotal uint64 `json:"virtualTotal"` + VirtualAvail uint64 `json:"virtualAvail"` + PhysTotal uint64 `json:"physTotal"` + PhysAvail uint64 `json:"physAvail"` + PageFileTotal uint64 `json:"pageFileTotal"` + PageFileAvail uint64 `json:"pageFileAvail"` +} + +type ExWindows struct{} + +func NewExWindows() *ExWindows { + return &ExWindows{} +} + +func (*ExWindows) VirtualMemory() (*ExVirtualMemory, error) { + var memInfo memoryStatusEx + memInfo.cbSize = uint32(unsafe.Sizeof(memInfo)) + // If mem == 0 since this is an error according to GlobalMemoryStatusEx documentation + // In that case, use err which is constructed from GetLastError(), + // see https://pkg.go.dev/golang.org/x/sys/windows#LazyProc.Call + mem, _, err := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&memInfo))) + if mem == 0 { + return nil, err + } + + var perfInfo performanceInformation + perfInfo.cb = uint32(unsafe.Sizeof(perfInfo)) + // Analogous to above: perf == 0 is an error according to the GetPerformanceInfo documentation, + // use err in that case + perf, _, err := procGetPerformanceInfo.Call(uintptr(unsafe.Pointer(&perfInfo)), uintptr(perfInfo.cb)) + if perf == 0 { + return nil, err + } + + ret := &ExVirtualMemory{ + CommitLimit: perfInfo.commitLimit * perfInfo.pageSize, + CommitTotal: perfInfo.commitTotal * perfInfo.pageSize, + VirtualTotal: memInfo.ullTotalVirtual, + VirtualAvail: memInfo.ullAvailVirtual, + PhysTotal: memInfo.ullTotalPhys, + PhysAvail: memInfo.ullAvailPhys, + PageFileTotal: memInfo.ullTotalPageFile, + PageFileAvail: memInfo.ullAvailPageFile, + } + + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem.go new file mode 100644 index 00000000..f4f46f0d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem.go @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: BSD-3-Clause +package mem + +import ( + "encoding/json" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var invoke common.Invoker = common.Invoke{} + +// Memory usage statistics. Total, Available and Used contain numbers of bytes +// for human consumption. +// +// The other fields in this struct contain kernel specific values. +type VirtualMemoryStat struct { + // Total amount of RAM on this system + Total uint64 `json:"total"` + + // RAM available for programs to allocate + // + // This value is computed from the kernel specific values. + Available uint64 `json:"available"` + + // RAM used by programs + // + // This value is computed from the kernel specific values. + Used uint64 `json:"used"` + + // Percentage of RAM used by programs + // + // This value is computed from the kernel specific values. + UsedPercent float64 `json:"usedPercent"` + + // This is the kernel's notion of free memory; RAM chips whose bits nobody + // cares about the value of right now. For a human consumable number, + // Available is what you really want. + Free uint64 `json:"free"` + + // OS X / BSD specific numbers: + // http://www.macyourself.com/2010/02/17/what-is-free-wired-active-and-inactive-system-memory-ram/ + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + + // FreeBSD specific numbers: + // https://reviews.freebsd.org/D8467 + Laundry uint64 `json:"laundry"` + + // Linux specific numbers + // https://blogs.oracle.com/linux/understanding-linux-kernel-memory-statistics + // https://www.kernel.org/doc/Documentation/filesystems/proc.txt + // https://www.kernel.org/doc/Documentation/vm/overcommit-accounting + // https://www.kernel.org/doc/Documentation/vm/transhuge.txt + // + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + WriteBack uint64 `json:"writeBack"` + Dirty uint64 `json:"dirty"` + WriteBackTmp uint64 `json:"writeBackTmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + Sreclaimable uint64 `json:"sreclaimable"` + Sunreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pageTables"` + SwapCached uint64 `json:"swapCached"` + CommitLimit uint64 `json:"commitLimit"` + CommittedAS uint64 `json:"committedAS"` + HighTotal uint64 `json:"highTotal"` + HighFree uint64 `json:"highFree"` + LowTotal uint64 `json:"lowTotal"` + LowFree uint64 `json:"lowFree"` + SwapTotal uint64 `json:"swapTotal"` + SwapFree uint64 `json:"swapFree"` + Mapped uint64 `json:"mapped"` + VmallocTotal uint64 `json:"vmallocTotal"` + VmallocUsed uint64 `json:"vmallocUsed"` + VmallocChunk uint64 `json:"vmallocChunk"` + HugePagesTotal uint64 `json:"hugePagesTotal"` + HugePagesFree uint64 `json:"hugePagesFree"` + HugePagesRsvd uint64 `json:"hugePagesRsvd"` + HugePagesSurp uint64 `json:"hugePagesSurp"` + HugePageSize uint64 `json:"hugePageSize"` + AnonHugePages uint64 `json:"anonHugePages"` +} + +type SwapMemoryStat struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + UsedPercent float64 `json:"usedPercent"` + Sin uint64 `json:"sin"` + Sout uint64 `json:"sout"` + PgIn uint64 `json:"pgIn"` + PgOut uint64 `json:"pgOut"` + PgFault uint64 `json:"pgFault"` + + // Linux specific numbers + // https://www.kernel.org/doc/Documentation/cgroup-v2.txt + PgMajFault uint64 `json:"pgMajFault"` +} + +func (m VirtualMemoryStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +func (m SwapMemoryStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +type SwapDevice struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` +} + +func (m SwapDevice) String() string { + s, _ := json.Marshal(m) + return string(s) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix.go new file mode 100644 index 00000000..ac2c39dd --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix.go @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix + +package mem + +import ( + "context" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapDevices() ([]*SwapDevice, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_cgo.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_cgo.go new file mode 100644 index 00000000..2d03dd0c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_cgo.go @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && cgo + +package mem + +import ( + "context" + + "github.com/power-devops/perfstat" +) + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + m, err := perfstat.MemoryTotalStat() + if err != nil { + return nil, err + } + pagesize := uint64(4096) + ret := VirtualMemoryStat{ + Total: uint64(m.RealTotal) * pagesize, + Available: uint64(m.RealAvailable) * pagesize, + Free: uint64(m.RealFree) * pagesize, + Used: uint64(m.RealInUse) * pagesize, + UsedPercent: 100 * float64(m.RealInUse) / float64(m.RealTotal), + Active: uint64(m.VirtualActive) * pagesize, + SwapTotal: uint64(m.PgSpTotal) * pagesize, + SwapFree: uint64(m.PgSpFree) * pagesize, + } + return &ret, nil +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + m, err := perfstat.MemoryTotalStat() + if err != nil { + return nil, err + } + pagesize := uint64(4096) + swapUsed := uint64(m.PgSpTotal-m.PgSpFree-m.PgSpRsvd) * pagesize + swapTotal := uint64(m.PgSpTotal) * pagesize + ret := SwapMemoryStat{ + Total: swapTotal, + Free: uint64(m.PgSpFree) * pagesize, + Used: swapUsed, + UsedPercent: float64(100*swapUsed) / float64(swapTotal), + Sin: uint64(m.PgSpIn), + Sout: uint64(m.PgSpOut), + PgIn: uint64(m.PageIn), + PgOut: uint64(m.PageOut), + PgFault: uint64(m.PageFaults), + } + return &ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_nocgo.go new file mode 100644 index 00000000..bc3c0ed3 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_nocgo.go @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && !cgo + +package mem + +import ( + "context" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + vmem, swap, err := callSVMon(ctx, true) + if err != nil { + return nil, err + } + if vmem.Total == 0 { + return nil, common.ErrNotImplementedError + } + vmem.SwapTotal = swap.Total + vmem.SwapFree = swap.Free + return vmem, nil +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + _, swap, err := callSVMon(ctx, false) + if err != nil { + return nil, err + } + if swap.Total == 0 { + return nil, common.ErrNotImplementedError + } + return swap, nil +} + +func callSVMon(ctx context.Context, virt bool) (*VirtualMemoryStat, *SwapMemoryStat, error) { + out, err := invoke.CommandWithContext(ctx, "svmon", "-G") + if err != nil { + return nil, nil, err + } + + pagesize := uint64(4096) + vmem := &VirtualMemoryStat{} + swap := &SwapMemoryStat{} + for _, line := range strings.Split(string(out), "\n") { + if virt && strings.HasPrefix(line, "memory") { + p := strings.Fields(line) + if len(p) > 2 { + if t, err := strconv.ParseUint(p[1], 10, 64); err == nil { + vmem.Total = t * pagesize + } + if t, err := strconv.ParseUint(p[2], 10, 64); err == nil { + vmem.Used = t * pagesize + if vmem.Total > 0 { + vmem.UsedPercent = 100 * float64(vmem.Used) / float64(vmem.Total) + } + } + if t, err := strconv.ParseUint(p[3], 10, 64); err == nil { + vmem.Free = t * pagesize + } + } + } else if strings.HasPrefix(line, "pg space") { + p := strings.Fields(line) + if len(p) > 3 { + if t, err := strconv.ParseUint(p[2], 10, 64); err == nil { + swap.Total = t * pagesize + } + if t, err := strconv.ParseUint(p[3], 10, 64); err == nil { + swap.Free = swap.Total - t*pagesize + } + } + break + } + } + return vmem, swap, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_bsd.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_bsd.go new file mode 100644 index 00000000..4f3e57c0 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_bsd.go @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build freebsd || openbsd || netbsd + +package mem + +import ( + "context" + "fmt" + "strconv" + "strings" +) + +const swapCommand = "swapctl" + +// swapctl column indexes +const ( + nameCol = 0 + totalKiBCol = 1 + usedKiBCol = 2 +) + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + output, err := invoke.CommandWithContext(ctx, swapCommand, "-lk") + if err != nil { + return nil, fmt.Errorf("could not execute %q: %w", swapCommand, err) + } + + return parseSwapctlOutput(string(output)) +} + +func parseSwapctlOutput(output string) ([]*SwapDevice, error) { + lines := strings.Split(output, "\n") + if len(lines) == 0 { + return nil, fmt.Errorf("could not parse output of %q: no lines in %q", swapCommand, output) + } + + // Check header headerFields are as expected. + header := lines[0] + header = strings.ToLower(header) + header = strings.ReplaceAll(header, ":", "") + headerFields := strings.Fields(header) + if len(headerFields) < usedKiBCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields in header %q", swapCommand, header) + } + if headerFields[nameCol] != "device" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[nameCol], "device") + } + if headerFields[totalKiBCol] != "1kb-blocks" && headerFields[totalKiBCol] != "1k-blocks" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[totalKiBCol], "1kb-blocks") + } + if headerFields[usedKiBCol] != "used" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[usedKiBCol], "used") + } + + var swapDevices []*SwapDevice + for _, line := range lines[1:] { + if line == "" { + continue // the terminal line is typically empty + } + fields := strings.Fields(line) + if len(fields) < usedKiBCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields", swapCommand) + } + + totalKiB, err := strconv.ParseUint(fields[totalKiBCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Size' column in %q: %w", swapCommand, err) + } + + usedKiB, err := strconv.ParseUint(fields[usedKiBCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Used' column in %q: %w", swapCommand, err) + } + + swapDevices = append(swapDevices, &SwapDevice{ + Name: fields[nameCol], + UsedBytes: usedKiB * 1024, + FreeBytes: (totalKiB - usedKiB) * 1024, + }) + } + + return swapDevices, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_darwin.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_darwin.go new file mode 100644 index 00000000..1b3e9f21 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_darwin.go @@ -0,0 +1,127 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin + +package mem + +import ( + "context" + "fmt" + "unsafe" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func getHwMemsize() (uint64, error) { + total, err := unix.SysctlUint64("hw.memsize") + if err != nil { + return 0, err + } + return total, nil +} + +// xsw_usage in sys/sysctl.h +type swapUsage struct { + Total uint64 + Avail uint64 + Used uint64 + Pagesize int32 + Encrypted bool +} + +// SwapMemory returns swapinfo. +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { + // https://github.com/yanllearnn/go-osstat/blob/ae8a279d26f52ec946a03698c7f50a26cfb427e3/memory/memory_darwin.go + var ret *SwapMemoryStat + + value, err := unix.SysctlRaw("vm.swapusage") + if err != nil { + return ret, err + } + if len(value) != 32 { + return ret, fmt.Errorf("unexpected output of sysctl vm.swapusage: %v (len: %d)", value, len(value)) + } + swap := (*swapUsage)(unsafe.Pointer(&value[0])) + + u := float64(0) + if swap.Total != 0 { + u = ((float64(swap.Total) - float64(swap.Avail)) / float64(swap.Total)) * 100.0 + } + + ret = &SwapMemoryStat{ + Total: swap.Total, + Used: swap.Used, + Free: swap.Avail, + UsedPercent: u, + } + + return ret, nil +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { + return nil, common.ErrNotImplementedError +} + +type vmStatisticsData struct { + freeCount uint32 + activeCount uint32 + inactiveCount uint32 + wireCount uint32 + _ [44]byte // Not used here +} + +// VirtualMemory returns VirtualmemoryStat. +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { + sys, err := common.NewSystemLib() + if err != nil { + return nil, err + } + defer sys.Close() + + count := uint32(common.HOST_VM_INFO_COUNT) + var vmstat vmStatisticsData + + status := sys.HostStatistics(sys.MachHostSelf(), common.HOST_VM_INFO, + uintptr(unsafe.Pointer(&vmstat)), &count) + + if status != common.KERN_SUCCESS { + return nil, fmt.Errorf("host_statistics error=%d", status) + } + + pageSizeAddr, _ := sys.Dlsym("vm_kernel_page_size") + pageSize := **(**uint64)(unsafe.Pointer(&pageSizeAddr)) + total, err := getHwMemsize() + if err != nil { + return nil, err + } + totalCount := uint32(total / pageSize) + + availableCount := vmstat.inactiveCount + vmstat.freeCount + usedPercent := 100 * float64(totalCount-availableCount) / float64(totalCount) + + usedCount := totalCount - availableCount + + return &VirtualMemoryStat{ + Total: total, + Available: pageSize * uint64(availableCount), + Used: pageSize * uint64(usedCount), + UsedPercent: usedPercent, + Free: pageSize * uint64(vmstat.freeCount), + Active: pageSize * uint64(vmstat.activeCount), + Inactive: pageSize * uint64(vmstat.inactiveCount), + Wired: pageSize * uint64(vmstat.wireCount), + }, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_fallback.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_fallback.go new file mode 100644 index 00000000..74283a2b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_fallback.go @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build !darwin && !linux && !freebsd && !openbsd && !solaris && !windows && !plan9 && !aix && !netbsd + +package mem + +import ( + "context" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { + return nil, common.ErrNotImplementedError +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { + return nil, common.ErrNotImplementedError +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_freebsd.go new file mode 100644 index 00000000..dbe6d919 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_freebsd.go @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build freebsd + +package mem + +import ( + "context" + "errors" + "unsafe" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { + pageSize, err := common.SysctlUint("vm.stats.vm.v_page_size") + if err != nil { + return nil, err + } + physmem, err := common.SysctlUint("hw.physmem") + if err != nil { + return nil, err + } + + free, err := common.SysctlUint("vm.stats.vm.v_free_count") + if err != nil { + return nil, err + } + active, err := common.SysctlUint("vm.stats.vm.v_active_count") + if err != nil { + return nil, err + } + inactive, err := common.SysctlUint("vm.stats.vm.v_inactive_count") + if err != nil { + return nil, err + } + buffers, err := common.SysctlUint("vfs.bufspace") + if err != nil { + return nil, err + } + wired, err := common.SysctlUint("vm.stats.vm.v_wire_count") + if err != nil { + return nil, err + } + var cached, laundry uint64 + osreldate, _ := common.SysctlUint("kern.osreldate") + if osreldate < 1102000 { + cached, err = common.SysctlUint("vm.stats.vm.v_cache_count") + if err != nil { + return nil, err + } + } else { + laundry, err = common.SysctlUint("vm.stats.vm.v_laundry_count") + if err != nil { + return nil, err + } + } + + p := pageSize + ret := &VirtualMemoryStat{ + Total: physmem, + Free: free * p, + Active: active * p, + Inactive: inactive * p, + Cached: cached * p, + Buffers: buffers, + Wired: wired * p, + Laundry: laundry * p, + } + + ret.Available = ret.Inactive + ret.Cached + ret.Free + ret.Laundry + ret.Used = ret.Total - ret.Available + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + return ret, nil +} + +// Return swapinfo +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +// Constants from vm/vm_param.h +const ( + XSWDEV_VERSION11 = 1 + XSWDEV_VERSION = 2 +) + +// Types from vm/vm_param.h +type xswdev struct { + Version uint32 // Version is the version + Dev uint64 // Dev is the device identifier + Flags int32 // Flags is the swap flags applied to the device + NBlks int32 // NBlks is the total number of blocks + Used int32 // Used is the number of blocks used +} + +// xswdev11 is a compatibility for under FreeBSD 11 +// sys/vm/swap_pager.c +type xswdev11 struct { + Version uint32 // Version is the version + Dev uint32 // Dev is the device identifier + Flags int32 // Flags is the swap flags applied to the device + NBlks int32 // NBlks is the total number of blocks + Used int32 // Used is the number of blocks used +} + +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { + // FreeBSD can have multiple swap devices so we total them up + i, err := common.SysctlUint("vm.nswapdev") + if err != nil { + return nil, err + } + + if i == 0 { + return nil, errors.New("no swap devices found") + } + + c := int(i) + + i, err = common.SysctlUint("vm.stats.vm.v_page_size") + if err != nil { + return nil, err + } + pageSize := i + + var buf []byte + s := &SwapMemoryStat{} + for n := 0; n < c; n++ { + buf, err = unix.SysctlRaw("vm.swap_info", n) + if err != nil { + return nil, err + } + + // first, try to parse with version 2 + xsw := (*xswdev)(unsafe.Pointer(&buf[0])) + switch { + case xsw.Version == XSWDEV_VERSION11: + // this is version 1, so try to parse again + xsw := (*xswdev11)(unsafe.Pointer(&buf[0])) + if xsw.Version != XSWDEV_VERSION11 { + return nil, errors.New("xswdev version mismatch(11)") + } + s.Total += uint64(xsw.NBlks) + s.Used += uint64(xsw.Used) + case xsw.Version != XSWDEV_VERSION: + return nil, errors.New("xswdev version mismatch") + default: + s.Total += uint64(xsw.NBlks) + s.Used += uint64(xsw.Used) + } + + } + + if s.Total != 0 { + s.UsedPercent = float64(s.Used) / float64(s.Total) * 100 + } + s.Total *= pageSize + s.Used *= pageSize + s.Free = s.Total - s.Used + + return s, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_linux.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_linux.go new file mode 100644 index 00000000..a888c5ba --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_linux.go @@ -0,0 +1,524 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux + +package mem + +import ( + "bufio" + "context" + "fmt" + "io" + "math" + "os" + "strconv" + "strings" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + vm, _, err := fillFromMeminfoWithContext(ctx) + if err != nil { + return nil, err + } + return vm, nil +} + +func fillFromMeminfoWithContext(ctx context.Context) (*VirtualMemoryStat, *ExVirtualMemory, error) { + filename := common.HostProcWithContext(ctx, "meminfo") + lines, err := common.ReadLines(filename) + if err != nil { + return nil, nil, fmt.Errorf("couldn't read %s: %w", filename, err) + } + + // flag if MemAvailable is in /proc/meminfo (kernel 3.14+) + memavail := false + activeFile := false // "Active(file)" not available: 2.6.28 / Dec 2008 + inactiveFile := false // "Inactive(file)" not available: 2.6.28 / Dec 2008 + sReclaimable := false // "Sreclaimable:" not available: 2.6.19 / Nov 2006 + + ret := &VirtualMemoryStat{} + retEx := &ExVirtualMemory{} + + for _, line := range lines { + fields := strings.Split(line, ":") + if len(fields) != 2 { + continue + } + key := strings.TrimSpace(fields[0]) + value := strings.TrimSpace(fields[1]) + value = strings.ReplaceAll(value, " kB", "") + + switch key { + case "MemTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Total = t * 1024 + case "MemFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Free = t * 1024 + case "MemAvailable": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + memavail = true + ret.Available = t * 1024 + case "Buffers": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Buffers = t * 1024 + case "Cached": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Cached = t * 1024 + case "Active": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Active = t * 1024 + case "Inactive": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Inactive = t * 1024 + case "Active(anon)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.ActiveAnon = t * 1024 + case "Inactive(anon)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.InactiveAnon = t * 1024 + case "Active(file)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + activeFile = true + retEx.ActiveFile = t * 1024 + case "Inactive(file)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + inactiveFile = true + retEx.InactiveFile = t * 1024 + case "Unevictable": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.Unevictable = t * 1024 + case "Percpu": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.Percpu = t * 1024 + case "Writeback": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.WriteBack = t * 1024 + case "WritebackTmp": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.WriteBackTmp = t * 1024 + case "Dirty": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Dirty = t * 1024 + case "Shmem": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Shared = t * 1024 + case "Slab": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Slab = t * 1024 + case "SReclaimable": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + sReclaimable = true + ret.Sreclaimable = t * 1024 + case "SUnreclaim": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Sunreclaim = t * 1024 + case "KernelStack": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.KernelStack = t * 1024 + case "PageTables": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.PageTables = t * 1024 + case "SwapCached": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.SwapCached = t * 1024 + case "CommitLimit": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.CommitLimit = t * 1024 + case "Committed_AS": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.CommittedAS = t * 1024 + case "HighTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HighTotal = t * 1024 + case "HighFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HighFree = t * 1024 + case "LowTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.LowTotal = t * 1024 + case "LowFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.LowFree = t * 1024 + case "SwapTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.SwapTotal = t * 1024 + case "SwapFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.SwapFree = t * 1024 + case "Mapped": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Mapped = t * 1024 + case "VmallocTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.VmallocTotal = t * 1024 + case "VmallocUsed": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.VmallocUsed = t * 1024 + case "VmallocChunk": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.VmallocChunk = t * 1024 + case "HugePages_Total": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesTotal = t + case "HugePages_Free": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesFree = t + case "HugePages_Rsvd": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesRsvd = t + case "HugePages_Surp": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesSurp = t + case "Hugepagesize": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePageSize = t * 1024 + case "AnonHugePages": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.AnonHugePages = t * 1024 + } + } + + ret.Cached += ret.Sreclaimable + + if !memavail { + if activeFile && inactiveFile && sReclaimable { + ret.Available = calculateAvailVmem(ctx, ret, retEx) + } else { + ret.Available = ret.Cached + ret.Free + } + } + ret.Used = ret.Total - ret.Available + + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + return ret, retEx, nil +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + sysinfo := &unix.Sysinfo_t{} + + if err := unix.Sysinfo(sysinfo); err != nil { + return nil, err + } + ret := &SwapMemoryStat{ + Total: uint64(sysinfo.Totalswap) * uint64(sysinfo.Unit), + Free: uint64(sysinfo.Freeswap) * uint64(sysinfo.Unit), + } + ret.Used = ret.Total - ret.Free + // check Infinity + if ret.Total != 0 { + ret.UsedPercent = float64(ret.Total-ret.Free) / float64(ret.Total) * 100.0 + } else { + ret.UsedPercent = 0 + } + filename := common.HostProcWithContext(ctx, "vmstat") + lines, err := common.ReadLines(filename) + if err != nil { + return nil, fmt.Errorf("couldn't read %s: %w", filename, err) + } + for _, l := range lines { + fields := strings.Fields(l) + if len(fields) < 2 { + continue + } + switch fields[0] { + case "pswpin": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.Sin = value * 4 * 1024 + case "pswpout": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.Sout = value * 4 * 1024 + case "pgpgin": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgIn = value * 4 * 1024 + case "pgpgout": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgOut = value * 4 * 1024 + case "pgfault": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgFault = value * 4 * 1024 + case "pgmajfault": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgMajFault = value * 4 * 1024 + } + } + return ret, nil +} + +// calculateAvailVmem is a fallback under kernel 3.14 where /proc/meminfo does not provide +// "MemAvailable:" column. It reimplements an algorithm from the link below +// https://github.com/giampaolo/psutil/pull/890 +func calculateAvailVmem(ctx context.Context, ret *VirtualMemoryStat, retEx *ExVirtualMemory) uint64 { + var watermarkLow uint64 + + fn := common.HostProcWithContext(ctx, "zoneinfo") + lines, err := common.ReadLines(fn) + if err != nil { + return ret.Free + ret.Cached // fallback under kernel 2.6.13 + } + + pagesize := uint64(os.Getpagesize()) + watermarkLow = 0 + + for _, line := range lines { + fields := strings.Fields(line) + + if strings.HasPrefix(fields[0], "low") { + lowValue, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + lowValue = 0 + } + watermarkLow += lowValue + } + } + + watermarkLow *= pagesize + + availMemory := ret.Free - watermarkLow + pageCache := retEx.ActiveFile + retEx.InactiveFile + pageCache -= uint64(math.Min(float64(pageCache/2), float64(watermarkLow))) + availMemory += pageCache + availMemory += ret.Sreclaimable - uint64(math.Min(float64(ret.Sreclaimable/2.0), float64(watermarkLow))) + + if availMemory < 0 { + availMemory = 0 + } + + return availMemory +} + +const swapsFilename = "swaps" + +// swaps file column indexes +const ( + nameCol = 0 + // typeCol = 1 + totalCol = 2 + usedCol = 3 + // priorityCol = 4 +) + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + swapsFilePath := common.HostProcWithContext(ctx, swapsFilename) + f, err := os.Open(swapsFilePath) + if err != nil { + return nil, err + } + defer f.Close() + + return parseSwapsFile(ctx, f) +} + +func parseSwapsFile(ctx context.Context, r io.Reader) ([]*SwapDevice, error) { + swapsFilePath := common.HostProcWithContext(ctx, swapsFilename) + scanner := bufio.NewScanner(r) + if !scanner.Scan() { + if err := scanner.Err(); err != nil { + return nil, fmt.Errorf("couldn't read file %q: %w", swapsFilePath, err) + } + return nil, fmt.Errorf("unexpected end-of-file in %q", swapsFilePath) + + } + + // Check header headerFields are as expected + headerFields := strings.Fields(scanner.Text()) + if len(headerFields) < usedCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields in header", swapsFilePath) + } + if headerFields[nameCol] != "Filename" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapsFilePath, headerFields[nameCol], "Filename") + } + if headerFields[totalCol] != "Size" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapsFilePath, headerFields[totalCol], "Size") + } + if headerFields[usedCol] != "Used" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapsFilePath, headerFields[usedCol], "Used") + } + + var swapDevices []*SwapDevice + for scanner.Scan() { + fields := strings.Fields(scanner.Text()) + if len(fields) < usedCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields", swapsFilePath) + } + + totalKiB, err := strconv.ParseUint(fields[totalCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Size' column in %q: %w", swapsFilePath, err) + } + + usedKiB, err := strconv.ParseUint(fields[usedCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Used' column in %q: %w", swapsFilePath, err) + } + + swapDevices = append(swapDevices, &SwapDevice{ + Name: fields[nameCol], + UsedBytes: usedKiB * 1024, + FreeBytes: (totalKiB - usedKiB) * 1024, + }) + } + + if err := scanner.Err(); err != nil { + return nil, fmt.Errorf("couldn't read file %q: %w", swapsFilePath, err) + } + + return swapDevices, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_netbsd.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_netbsd.go new file mode 100644 index 00000000..8ef539ca --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_netbsd.go @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build netbsd + +package mem + +import ( + "context" + "errors" + "fmt" + + "golang.org/x/sys/unix" +) + +func GetPageSize() (uint64, error) { + return GetPageSizeWithContext(context.Background()) +} + +func GetPageSizeWithContext(_ context.Context) (uint64, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") + if err != nil { + return 0, err + } + return uint64(uvmexp.Pagesize), nil +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") + if err != nil { + return nil, err + } + p := uint64(uvmexp.Pagesize) + + ret := &VirtualMemoryStat{ + Total: uint64(uvmexp.Npages) * p, + Free: uint64(uvmexp.Free) * p, + Active: uint64(uvmexp.Active) * p, + Inactive: uint64(uvmexp.Inactive) * p, + Cached: 0, // not available + Wired: uint64(uvmexp.Wired) * p, + } + + ret.Available = ret.Inactive + ret.Cached + ret.Free + ret.Used = ret.Total - ret.Available + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + // Get buffers from vm.bufmem sysctl + ret.Buffers, err = unix.SysctlUint64("vm.bufmem") + if err != nil { + return nil, err + } + + return ret, nil +} + +// Return swapctl summary info +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + out, err := invoke.CommandWithContext(ctx, "swapctl", "-sk") + if err != nil { + return &SwapMemoryStat{}, nil + } + + line := string(out) + var total, used, free uint64 + + _, err = fmt.Sscanf(line, + "total: %d 1K-blocks allocated, %d used, %d available", + &total, &used, &free) + if err != nil { + return nil, errors.New("failed to parse swapctl output") + } + + percent := float64(used) / float64(total) * 100 + return &SwapMemoryStat{ + Total: total * 1024, + Used: used * 1024, + Free: free * 1024, + UsedPercent: percent, + }, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd.go new file mode 100644 index 00000000..69d8a811 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd.go @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd + +package mem + +import ( + "bytes" + "context" + "encoding/binary" + "errors" + "fmt" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func GetPageSize() (uint64, error) { + return GetPageSizeWithContext(context.Background()) +} + +func GetPageSizeWithContext(_ context.Context) (uint64, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") + if err != nil { + return 0, err + } + return uint64(uvmexp.Pagesize), nil +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") + if err != nil { + return nil, err + } + p := uint64(uvmexp.Pagesize) + + mib := []int32{CTLVfs, VfsGeneric, VfsBcacheStat} + buf, length, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + if length < sizeOfBcachestats { + return nil, fmt.Errorf("short syscall ret %d bytes", length) + } + var bcs Bcachestats + br := bytes.NewReader(buf) + if err := binary.Read(br, binary.LittleEndian, &bcs); err != nil { + return nil, err + } + // On OpenBSD, the buffer cache is the closest equivalent to both + // Linux's Buffers and Cached memory. + bcache := uint64(bcs.Numbufpages) * p + + ret := &VirtualMemoryStat{ + Total: uint64(uvmexp.Npages) * p, + Free: uint64(uvmexp.Free) * p, + Active: uint64(uvmexp.Active) * p, + Inactive: uint64(uvmexp.Inactive) * p, + Cached: bcache, + Buffers: bcache, + Wired: uint64(uvmexp.Wired) * p, + } + + ret.Available = ret.Inactive + ret.Cached + ret.Free + ret.Used = ret.Total - ret.Available + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + return ret, nil +} + +// Return swapctl summary info +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + out, err := invoke.CommandWithContext(ctx, "swapctl", "-sk") + if err != nil { + return &SwapMemoryStat{}, nil + } + + line := string(out) + var total, used, free uint64 + + _, err = fmt.Sscanf(line, + "total: %d 1K-blocks allocated, %d used, %d available", + &total, &used, &free) + if err != nil { + return nil, errors.New("failed to parse swapctl output") + } + + percent := float64(used) / float64(total) * 100 + return &SwapMemoryStat{ + Total: total * 1024, + Used: used * 1024, + Free: free * 1024, + UsedPercent: percent, + }, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_386.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_386.go new file mode 100644 index 00000000..552e93f4 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_386.go @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && 386 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs mem/types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x90 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 + Highflips int64 + Highflops int64 + Dmaflips int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_amd64.go new file mode 100644 index 00000000..73e5b72a --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_amd64.go @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x78 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm.go new file mode 100644 index 00000000..57b5861d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm.go @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && arm + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs mem/types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x90 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 + Highflips int64 + Highflops int64 + Dmaflips int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm64.go new file mode 100644 index 00000000..f39a6456 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm64.go @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs mem/types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x90 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 + Highflips int64 + Highflops int64 + Dmaflips int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_riscv64.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_riscv64.go new file mode 100644 index 00000000..f9f838f5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_riscv64.go @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && riscv64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs mem/types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x90 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 + Highflips int64 + Highflops int64 + Dmaflips int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_plan9.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_plan9.go new file mode 100644 index 00000000..0df0745c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_plan9.go @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build plan9 + +package mem + +import ( + "context" + "os" + + stats "github.com/lufia/plan9stats" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + root := os.Getenv("HOST_ROOT") + m, err := stats.ReadMemStats(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + u := 0.0 + if m.SwapPages.Avail != 0 { + u = float64(m.SwapPages.Used) / float64(m.SwapPages.Avail) * 100.0 + } + return &SwapMemoryStat{ + Total: uint64(m.SwapPages.Avail * m.PageSize), + Used: uint64(m.SwapPages.Used * m.PageSize), + Free: uint64(m.SwapPages.Free() * m.PageSize), + UsedPercent: u, + }, nil +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + root := os.Getenv("HOST_ROOT") + m, err := stats.ReadMemStats(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + u := 0.0 + if m.UserPages.Avail != 0 { + u = float64(m.UserPages.Used) / float64(m.UserPages.Avail) * 100.0 + } + return &VirtualMemoryStat{ + Total: uint64(m.Total), + Available: uint64(m.UserPages.Free() * m.PageSize), + Used: uint64(m.UserPages.Used * m.PageSize), + UsedPercent: u, + Free: uint64(m.UserPages.Free() * m.PageSize), + + SwapTotal: uint64(m.SwapPages.Avail * m.PageSize), + SwapFree: uint64(m.SwapPages.Free() * m.PageSize), + }, nil +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_solaris.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_solaris.go new file mode 100644 index 00000000..1a391dc4 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_solaris.go @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build solaris + +package mem + +import ( + "context" + "errors" + "fmt" + "regexp" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +// VirtualMemory for Solaris is a minimal implementation which only returns +// what Nomad needs. It does take into account global vs zone, however. +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + result := &VirtualMemoryStat{} + + zoneName, err := zoneName(ctx) + if err != nil { + return nil, err + } + + if zoneName == "global" { + capacity, err := globalZoneMemoryCapacity(ctx) + if err != nil { + return nil, err + } + result.Total = capacity + freemem, err := globalZoneFreeMemory(ctx) + if err != nil { + return nil, err + } + result.Available = freemem + result.Free = freemem + result.Used = result.Total - result.Free + } else { + capacity, err := nonGlobalZoneMemoryCapacity(ctx) + if err != nil { + return nil, err + } + result.Total = capacity + } + + return result, nil +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { + return nil, common.ErrNotImplementedError +} + +func zoneName(ctx context.Context) (string, error) { + out, err := invoke.CommandWithContext(ctx, "zonename") + if err != nil { + return "", err + } + + return strings.TrimSpace(string(out)), nil +} + +var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: (\d+) Megabytes`) + +func globalZoneMemoryCapacity(ctx context.Context) (uint64, error) { + out, err := invoke.CommandWithContext(ctx, "prtconf") + if err != nil { + return 0, err + } + + match := globalZoneMemoryCapacityMatch.FindAllStringSubmatch(string(out), -1) + if len(match) != 1 { + return 0, errors.New("memory size not contained in output of prtconf") + } + + totalMB, err := strconv.ParseUint(match[0][1], 10, 64) + if err != nil { + return 0, err + } + + return totalMB * 1024 * 1024, nil +} + +func globalZoneFreeMemory(ctx context.Context) (uint64, error) { + output, err := invoke.CommandWithContext(ctx, "pagesize") + if err != nil { + return 0, err + } + + pagesize, err := strconv.ParseUint(strings.TrimSpace(string(output)), 10, 64) + if err != nil { + return 0, err + } + + free, err := sysconf.Sysconf(sysconf.SC_AVPHYS_PAGES) + if err != nil { + return 0, err + } + + return uint64(free) * pagesize, nil +} + +var kstatMatch = regexp.MustCompile(`(\S+)\s+(\S*)`) + +func nonGlobalZoneMemoryCapacity(ctx context.Context) (uint64, error) { + out, err := invoke.CommandWithContext(ctx, "kstat", "-p", "-c", "zone_memory_cap", "memory_cap:*:*:physcap") + if err != nil { + return 0, err + } + + kstats := kstatMatch.FindAllStringSubmatch(string(out), -1) + if len(kstats) != 1 { + return 0, fmt.Errorf("expected 1 kstat, found %d", len(kstats)) + } + + memSizeBytes, err := strconv.ParseUint(kstats[0][2], 10, 64) + if err != nil { + return 0, err + } + + return memSizeBytes, nil +} + +const swapCommand = "swap" + +// The blockSize as reported by `swap -l`. See https://docs.oracle.com/cd/E23824_01/html/821-1459/fsswap-52195.html +const blockSize = 512 + +// swapctl column indexes +const ( + nameCol = 0 + // devCol = 1 + // swaploCol = 2 + totalBlocksCol = 3 + freeBlocksCol = 4 +) + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + output, err := invoke.CommandWithContext(ctx, swapCommand, "-l") + if err != nil { + return nil, fmt.Errorf("could not execute %q: %w", swapCommand, err) + } + + return parseSwapsCommandOutput(string(output)) +} + +func parseSwapsCommandOutput(output string) ([]*SwapDevice, error) { + lines := strings.Split(output, "\n") + if len(lines) == 0 { + return nil, fmt.Errorf("could not parse output of %q: no lines in %q", swapCommand, output) + } + + // Check header headerFields are as expected. + headerFields := strings.Fields(lines[0]) + if len(headerFields) < freeBlocksCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields in header %q", swapCommand, lines[0]) + } + if headerFields[nameCol] != "swapfile" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[nameCol], "swapfile") + } + if headerFields[totalBlocksCol] != "blocks" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[totalBlocksCol], "blocks") + } + if headerFields[freeBlocksCol] != "free" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[freeBlocksCol], "free") + } + + var swapDevices []*SwapDevice + for _, line := range lines[1:] { + if line == "" { + continue // the terminal line is typically empty + } + fields := strings.Fields(line) + if len(fields) < freeBlocksCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields", swapCommand) + } + + totalBlocks, err := strconv.ParseUint(fields[totalBlocksCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Size' column in %q: %w", swapCommand, err) + } + + freeBlocks, err := strconv.ParseUint(fields[freeBlocksCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Used' column in %q: %w", swapCommand, err) + } + + swapDevices = append(swapDevices, &SwapDevice{ + Name: fields[nameCol], + UsedBytes: (totalBlocks - freeBlocks) * blockSize, + FreeBytes: freeBlocks * blockSize, + }) + } + + return swapDevices, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/mem/mem_windows.go b/vendor/github.com/shirou/gopsutil/v4/mem/mem_windows.go new file mode 100644 index 00000000..f7421f64 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/mem/mem_windows.go @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build windows + +package mem + +import ( + "context" + "sync" + "syscall" + "unsafe" + + "golang.org/x/sys/windows" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var ( + procEnumPageFilesW = common.ModPsapi.NewProc("EnumPageFilesW") + procGetNativeSystemInfo = common.Modkernel32.NewProc("GetNativeSystemInfo") + procGetPerformanceInfo = common.ModPsapi.NewProc("GetPerformanceInfo") + procGlobalMemoryStatusEx = common.Modkernel32.NewProc("GlobalMemoryStatusEx") +) + +type memoryStatusEx struct { + cbSize uint32 + dwMemoryLoad uint32 + ullTotalPhys uint64 // in bytes + ullAvailPhys uint64 + ullTotalPageFile uint64 + ullAvailPageFile uint64 + ullTotalVirtual uint64 + ullAvailVirtual uint64 + ullAvailExtendedVirtual uint64 +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { + var memInfo memoryStatusEx + memInfo.cbSize = uint32(unsafe.Sizeof(memInfo)) + // GlobalMemoryStatusEx returns 0 for error, in which case we check err, + // see https://pkg.go.dev/golang.org/x/sys/windows#LazyProc.Call + mem, _, err := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&memInfo))) + if mem == 0 { + return nil, err + } + + ret := &VirtualMemoryStat{ + Total: memInfo.ullTotalPhys, + Available: memInfo.ullAvailPhys, + Free: memInfo.ullAvailPhys, + UsedPercent: float64(memInfo.dwMemoryLoad), + } + + ret.Used = ret.Total - ret.Available + return ret, nil +} + +type performanceInformation struct { + cb uint32 + commitTotal uint64 + commitLimit uint64 + commitPeak uint64 + physicalTotal uint64 + physicalAvailable uint64 + systemCache uint64 + kernelTotal uint64 + kernelPaged uint64 + kernelNonpaged uint64 + pageSize uint64 + handleCount uint32 + processCount uint32 + threadCount uint32 +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { + // Use the performance counter to get the swap usage percentage + counter, err := common.NewWin32PerformanceCounter("swap_percentage", `\Paging File(_Total)\% Usage`) + if err != nil { + return nil, err + } + defer common.PdhCloseQuery.Call(uintptr(counter.Query)) + + usedPercent, err := counter.GetValue() + if err != nil { + return nil, err + } + + // Get total memory from performance information + var perfInfo performanceInformation + perfInfo.cb = uint32(unsafe.Sizeof(perfInfo)) + // GetPerformanceInfo returns 0 for error, in which case we check err, + // see https://pkg.go.dev/golang.org/x/sys/windows#LazyProc.Call + mem, _, err := procGetPerformanceInfo.Call(uintptr(unsafe.Pointer(&perfInfo)), uintptr(perfInfo.cb)) + if mem == 0 { + return nil, err + } + totalPhys := perfInfo.physicalTotal * perfInfo.pageSize + totalSys := perfInfo.commitLimit * perfInfo.pageSize + total := totalSys - totalPhys + + var used uint64 + if total > 0 { + used = uint64(0.01 * usedPercent * float64(total)) + } else { + usedPercent = 0.0 + used = 0 + } + + ret := &SwapMemoryStat{ + Total: total, + Used: used, + Free: total - used, + UsedPercent: common.Round(usedPercent, 1), + } + + return ret, nil +} + +var ( + pageSize uint64 + pageSizeOnce sync.Once +) + +type systemInfo struct { + wProcessorArchitecture uint16 + wReserved uint16 + dwPageSize uint32 + lpMinimumApplicationAddress uintptr + lpMaximumApplicationAddress uintptr + dwActiveProcessorMask uintptr + dwNumberOfProcessors uint32 + dwProcessorType uint32 + dwAllocationGranularity uint32 + wProcessorLevel uint16 + wProcessorRevision uint16 +} + +// system type as defined in https://docs.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-enum_page_file_information +type enumPageFileInformation struct { + cb uint32 + reserved uint32 + totalSize uint64 + totalInUse uint64 + peakUsage uint64 +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { + pageSizeOnce.Do(func() { + var sysInfo systemInfo + procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sysInfo))) + pageSize = uint64(sysInfo.dwPageSize) + }) + + // the following system call invokes the supplied callback function once for each page file before returning + // see https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumpagefilesw + var swapDevices []*SwapDevice + // EnumPageFilesW returns 0 for error, in which case we check err, + // see https://pkg.go.dev/golang.org/x/sys/windows#LazyProc.Call + result, _, err := procEnumPageFilesW.Call(windows.NewCallback(pEnumPageFileCallbackW), uintptr(unsafe.Pointer(&swapDevices))) + if result == 0 { + return nil, err + } + + return swapDevices, nil +} + +// system callback as defined in https://docs.microsoft.com/en-us/windows/win32/api/psapi/nc-psapi-penum_page_file_callbackw +func pEnumPageFileCallbackW(swapDevices *[]*SwapDevice, enumPageFileInfo *enumPageFileInformation, lpFilenamePtr *[syscall.MAX_LONG_PATH]uint16) *bool { + *swapDevices = append(*swapDevices, &SwapDevice{ + Name: syscall.UTF16ToString((*lpFilenamePtr)[:]), + UsedBytes: enumPageFileInfo.totalInUse * pageSize, + FreeBytes: (enumPageFileInfo.totalSize - enumPageFileInfo.totalInUse) * pageSize, + }) + + // return true to continue enumerating page files + ret := true + return &ret +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net.go b/vendor/github.com/shirou/gopsutil/v4/net/net.go new file mode 100644 index 00000000..1d1f9f08 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net.go @@ -0,0 +1,356 @@ +// SPDX-License-Identifier: BSD-3-Clause +package net + +import ( + "context" + "encoding/json" + "net" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var invoke common.Invoker = common.Invoke{} + +type IOCountersStat struct { + Name string `json:"name"` // interface name + BytesSent uint64 `json:"bytesSent"` // number of bytes sent + BytesRecv uint64 `json:"bytesRecv"` // number of bytes received + PacketsSent uint64 `json:"packetsSent"` // number of packets sent + PacketsRecv uint64 `json:"packetsRecv"` // number of packets received + Errin uint64 `json:"errin"` // total number of errors while receiving + Errout uint64 `json:"errout"` // total number of errors while sending + Dropin uint64 `json:"dropin"` // total number of incoming packets which were dropped + Dropout uint64 `json:"dropout"` // total number of outgoing packets which were dropped (always 0 on OSX and BSD) + Fifoin uint64 `json:"fifoin"` // total number of FIFO buffers errors while receiving + Fifoout uint64 `json:"fifoout"` // total number of FIFO buffers errors while sending +} + +// Addr is implemented compatibility to psutil +type Addr struct { + IP string `json:"ip"` + Port uint32 `json:"port"` +} + +type ConnectionStat struct { + Fd uint32 `json:"fd"` + Family uint32 `json:"family"` + Type uint32 `json:"type"` + Laddr Addr `json:"localaddr"` + Raddr Addr `json:"remoteaddr"` + Status string `json:"status"` + Uids []int32 `json:"uids"` + Pid int32 `json:"pid"` +} + +// System wide stats about different network protocols +type ProtoCountersStat struct { + Protocol string `json:"protocol"` + Stats map[string]int64 `json:"stats"` +} + +// NetInterfaceAddr is designed for represent interface addresses +type InterfaceAddr struct { + Addr string `json:"addr"` +} + +// InterfaceAddrList is a list of InterfaceAddr +type InterfaceAddrList []InterfaceAddr + +type InterfaceStat struct { + Index int `json:"index"` + MTU int `json:"mtu"` // maximum transmission unit + Name string `json:"name"` // e.g., "en0", "lo0", "eth0.100" + HardwareAddr string `json:"hardwareAddr"` // IEEE MAC-48, EUI-48 and EUI-64 form + Flags []string `json:"flags"` // e.g., FlagUp, FlagLoopback, FlagMulticast + Addrs InterfaceAddrList `json:"addrs"` +} + +// InterfaceStatList is a list of InterfaceStat +type InterfaceStatList []InterfaceStat + +type FilterStat struct { + ConnTrackCount int64 `json:"connTrackCount"` + ConnTrackMax int64 `json:"connTrackMax"` +} + +// ConntrackStat has conntrack summary info +type ConntrackStat struct { + Entries uint32 `json:"entries"` // Number of entries in the conntrack table + Searched uint32 `json:"searched"` // Number of conntrack table lookups performed + Found uint32 `json:"found"` // Number of searched entries which were successful + New uint32 `json:"new"` // Number of entries added which were not expected before + Invalid uint32 `json:"invalid"` // Number of packets seen which can not be tracked + Ignore uint32 `json:"ignore"` // Packets seen which are already connected to an entry + Delete uint32 `json:"delete"` // Number of entries which were removed + DeleteList uint32 `json:"deleteList"` // Number of entries which were put to dying list + Insert uint32 `json:"insert"` // Number of entries inserted into the list + InsertFailed uint32 `json:"insertFailed"` // # insertion attempted but failed (same entry exists) + Drop uint32 `json:"drop"` // Number of packets dropped due to conntrack failure. + EarlyDrop uint32 `json:"earlyDrop"` // Dropped entries to make room for new ones, if maxsize reached + IcmpError uint32 `json:"icmpError"` // Subset of invalid. Packets that can't be tracked d/t error + ExpectNew uint32 `json:"expectNew"` // Entries added after an expectation was already present + ExpectCreate uint32 `json:"expectCreate"` // Expectations added + ExpectDelete uint32 `json:"expectDelete"` // Expectations deleted + SearchRestart uint32 `json:"searchRestart"` // Conntrack table lookups restarted due to hashtable resizes +} + +func NewConntrackStat(e, s, f, n, inv, ign, del, dlst, ins, insfail, drop, edrop, ie, en, ec, ed, sr uint32) *ConntrackStat { + return &ConntrackStat{ + Entries: e, + Searched: s, + Found: f, + New: n, + Invalid: inv, + Ignore: ign, + Delete: del, + DeleteList: dlst, + Insert: ins, + InsertFailed: insfail, + Drop: drop, + EarlyDrop: edrop, + IcmpError: ie, + ExpectNew: en, + ExpectCreate: ec, + ExpectDelete: ed, + SearchRestart: sr, + } +} + +type ConntrackStatList struct { + items []*ConntrackStat +} + +func NewConntrackStatList() *ConntrackStatList { + return &ConntrackStatList{ + items: []*ConntrackStat{}, + } +} + +func (l *ConntrackStatList) Append(c *ConntrackStat) { + l.items = append(l.items, c) +} + +func (l *ConntrackStatList) Items() []ConntrackStat { + items := make([]ConntrackStat, len(l.items)) + for i, el := range l.items { + items[i] = *el + } + return items +} + +// Summary returns a single-element list with totals from all list items. +func (l *ConntrackStatList) Summary() []ConntrackStat { + summary := NewConntrackStat(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + for _, cs := range l.items { + summary.Entries += cs.Entries + summary.Searched += cs.Searched + summary.Found += cs.Found + summary.New += cs.New + summary.Invalid += cs.Invalid + summary.Ignore += cs.Ignore + summary.Delete += cs.Delete + summary.DeleteList += cs.DeleteList + summary.Insert += cs.Insert + summary.InsertFailed += cs.InsertFailed + summary.Drop += cs.Drop + summary.EarlyDrop += cs.EarlyDrop + summary.IcmpError += cs.IcmpError + summary.ExpectNew += cs.ExpectNew + summary.ExpectCreate += cs.ExpectCreate + summary.ExpectDelete += cs.ExpectDelete + summary.SearchRestart += cs.SearchRestart + } + return []ConntrackStat{*summary} +} + +func (n IOCountersStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (n ConnectionStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (n ProtoCountersStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (a Addr) String() string { + s, _ := json.Marshal(a) + return string(s) +} + +func (n InterfaceStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (l InterfaceStatList) String() string { + s, _ := json.Marshal(l) + return string(s) +} + +func (n InterfaceAddr) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (n ConntrackStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func Interfaces() (InterfaceStatList, error) { + return InterfacesWithContext(context.Background()) +} + +func InterfacesWithContext(_ context.Context) (InterfaceStatList, error) { + is, err := net.Interfaces() + if err != nil { + return nil, err + } + ret := make(InterfaceStatList, 0, len(is)) + for _, ifi := range is { + + var flags []string + if ifi.Flags&net.FlagUp != 0 { + flags = append(flags, "up") + } + if ifi.Flags&net.FlagBroadcast != 0 { + flags = append(flags, "broadcast") + } + if ifi.Flags&net.FlagLoopback != 0 { + flags = append(flags, "loopback") + } + if ifi.Flags&net.FlagPointToPoint != 0 { + flags = append(flags, "pointtopoint") + } + if ifi.Flags&net.FlagMulticast != 0 { + flags = append(flags, "multicast") + } + + r := InterfaceStat{ + Index: ifi.Index, + Name: ifi.Name, + MTU: ifi.MTU, + HardwareAddr: ifi.HardwareAddr.String(), + Flags: flags, + } + addrs, err := ifi.Addrs() + if err == nil { + r.Addrs = make(InterfaceAddrList, 0, len(addrs)) + for _, addr := range addrs { + r.Addrs = append(r.Addrs, InterfaceAddr{ + Addr: addr.String(), + }) + } + + } + ret = append(ret, r) + } + + return ret, nil +} + +func getIOCountersAll(n []IOCountersStat) []IOCountersStat { + r := IOCountersStat{ + Name: "all", + } + for _, nic := range n { + r.BytesRecv += nic.BytesRecv + r.PacketsRecv += nic.PacketsRecv + r.Errin += nic.Errin + r.Dropin += nic.Dropin + r.BytesSent += nic.BytesSent + r.PacketsSent += nic.PacketsSent + r.Errout += nic.Errout + r.Dropout += nic.Dropout + } + + return []IOCountersStat{r} +} + +// IOCounters returns network I/O statistics for every network +// interface installed on the system. If pernic argument is false, +// return only sum of all information (which name is 'all'). If true, +// every network interface installed on the system is returned +// separately. +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersByFileWithContext(context.Background(), pernic, filename) +} + +// ProtoCounters returns network statistics for the entire system +// If protocols is empty then all protocols are returned, otherwise +// just the protocols in the list are returned. +// Available protocols: +// [ip,icmp,icmpmsg,tcp,udp,udplite] +// Not Implemented for FreeBSD, Windows, OpenBSD, Darwin +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +// FilterCounters returns iptables conntrack statistics +// the currently in use conntrack count and the max. +// If the file does not exist or is invalid it will return nil. +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +// ConntrackStats returns more detailed info about the conntrack table +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +// Return a list of network connections opened. +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +// Return a list of network connections opened returning at most `max` +// connections for each running process. +func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsMaxWithContext(context.Background(), kind, maxConn) +} + +// Return a list of network connections opened, omitting `Uids`. +// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be +// removed from the API in the future. +func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) { + return ConnectionsWithoutUidsWithContext(context.Background(), kind) +} + +// Return a list of network connections opened by a process. +func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(context.Background(), kind, pid) +} + +// Return a list of network connections opened, omitting `Uids`. +// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be +// removed from the API in the future. +func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, maxConn) +} + +// Return up to `max` network connections opened by a process. +func ConnectionsPidMax(kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(context.Background(), kind, pid, maxConn) +} + +// Pids retunres all pids. +// Note: this is a copy of process_linux.Pids() +// FIXME: Import process occurs import cycle. +// move to common made other platform breaking. Need consider. +func Pids() ([]int32, error) { + return PidsWithContext(context.Background()) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go b/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go new file mode 100644 index 00000000..4531dd44 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go @@ -0,0 +1,300 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix + +package net + +import ( + "context" + "fmt" + "regexp" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +// Deprecated: use process.PidsWithContext instead +func PidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func parseNetstatNetLine(line string) (ConnectionStat, error) { + f := strings.Fields(line) + if len(f) < 5 { + return ConnectionStat{}, fmt.Errorf("wrong line,%s", line) + } + + var netType, netFamily uint32 + switch f[0] { + case "tcp", "tcp4": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET + case "udp", "udp4": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET + case "tcp6": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET6 + case "udp6": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET6 + default: + return ConnectionStat{}, fmt.Errorf("unknown type, %s", f[0]) + } + + laddr, raddr, err := parseNetstatAddr(f[3], f[4], netFamily) + if err != nil { + return ConnectionStat{}, fmt.Errorf("failed to parse netaddr, %s %s", f[3], f[4]) + } + + n := ConnectionStat{ + Fd: uint32(0), // not supported + Family: uint32(netFamily), + Type: uint32(netType), + Laddr: laddr, + Raddr: raddr, + Pid: int32(0), // not supported + } + if len(f) == 6 { + n.Status = f[5] + } + + return n, nil +} + +var portMatch = regexp.MustCompile(`(.*)\.(\d+)$`) + +func parseAddr(l string, family uint32) (Addr, error) { + matches := portMatch.FindStringSubmatch(l) + if matches == nil { + return Addr{}, fmt.Errorf("wrong addr, %s", l) + } + host := matches[1] + port := matches[2] + if host == "*" { + switch family { + case syscall.AF_INET: + host = "0.0.0.0" + case syscall.AF_INET6: + host = "::" + default: + return Addr{}, fmt.Errorf("unknown family, %d", family) + } + } + lport, err := strconv.ParseInt(port, 10, 32) + if err != nil { + return Addr{}, err + } + return Addr{IP: host, Port: uint32(lport)}, nil +} + +// This function only works for netstat returning addresses with a "." +// before the port (0.0.0.0.22 instead of 0.0.0.0:22). +func parseNetstatAddr(local, remote string, family uint32) (laddr, raddr Addr, err error) { + laddr, err = parseAddr(local, family) + if remote != "*.*" { // remote addr exists + raddr, err = parseAddr(remote, family) + if err != nil { + return laddr, raddr, err + } + } + + return laddr, raddr, err +} + +func parseNetstatUnixLine(f []string) (ConnectionStat, error) { + if len(f) < 8 { + return ConnectionStat{}, fmt.Errorf("wrong number of fields: expected >=8 got %d", len(f)) + } + + var netType uint32 + + switch f[1] { + case "dgram": + netType = syscall.SOCK_DGRAM + case "stream": + netType = syscall.SOCK_STREAM + default: + return ConnectionStat{}, fmt.Errorf("unknown type: %s", f[1]) + } + + // Some Unix Socket don't have any address associated + addr := "" + if len(f) == 9 { + addr = f[8] + } + + c := ConnectionStat{ + Fd: uint32(0), // not supported + Family: uint32(syscall.AF_UNIX), + Type: uint32(netType), + Laddr: Addr{ + IP: addr, + }, + Status: "NONE", + Pid: int32(0), // not supported + } + + return c, nil +} + +// Return true if proto is the corresponding to the kind parameter +// Only for Inet lines +func hasCorrectInetProto(kind, proto string) bool { + switch kind { + case "all", "inet": + return true + case "unix": + return false + case "inet4": + return !strings.HasSuffix(proto, "6") + case "inet6": + return strings.HasSuffix(proto, "6") + case "tcp": + return proto == "tcp" || proto == "tcp4" || proto == "tcp6" + case "tcp4": + return proto == "tcp" || proto == "tcp4" + case "tcp6": + return proto == "tcp6" + case "udp": + return proto == "udp" || proto == "udp4" || proto == "udp6" + case "udp4": + return proto == "udp" || proto == "udp4" + case "udp6": + return proto == "udp6" + } + return false +} + +func parseNetstatA(output, kind string) ([]ConnectionStat, error) { + var ret []ConnectionStat + lines := strings.Split(string(output), "\n") + + for _, line := range lines { + fields := strings.Fields(line) + if len(fields) < 1 { + continue + } + + switch { + case strings.HasPrefix(fields[0], "f1"): + // Unix lines + if len(fields) < 2 { + // every unix connections have two lines + continue + } + + c, err := parseNetstatUnixLine(fields) + if err != nil { + return nil, fmt.Errorf("failed to parse Unix Address (%s): %w", line, err) + } + + ret = append(ret, c) + + case strings.HasPrefix(fields[0], "tcp") || strings.HasPrefix(fields[0], "udp"): + // Inet lines + if !hasCorrectInetProto(kind, fields[0]) { + continue + } + + // On AIX, netstat display some connections with "*.*" as local addresses + // Skip them as they aren't real connections. + if fields[3] == "*.*" { + continue + } + + c, err := parseNetstatNetLine(line) + if err != nil { + return nil, fmt.Errorf("failed to parse Inet Address (%s): %w", line, err) + } + + ret = append(ret, c) + default: + // Header lines + continue + } + } + + return ret, nil +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + args := []string{"-na"} + switch strings.ToLower(kind) { + default: + fallthrough + case "": + kind = "all" + case "all": + // nothing to add + case "inet", "inet4", "inet6": + args = append(args, "-finet") + case "tcp", "tcp4", "tcp6": + args = append(args, "-finet") + case "udp", "udp4", "udp6": + args = append(args, "-finet") + case "unix": + args = append(args, "-funix") + } + + out, err := invoke.CommandWithContext(ctx, "netstat", args...) + if err != nil { + return nil, err + } + + ret, err := parseNetstatA(string(out), kind) + if err != nil { + return nil, err + } + + return ret, nil +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true) +} + +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int, _ bool) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_aix_cgo.go b/vendor/github.com/shirou/gopsutil/v4/net/net_aix_cgo.go new file mode 100644 index 00000000..71786369 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_aix_cgo.go @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && cgo + +package net + +import ( + "context" + + "github.com/power-devops/perfstat" +) + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + ifs, err := perfstat.NetIfaceStat() + if err != nil { + return nil, err + } + + iocounters := make([]IOCountersStat, 0, len(ifs)) + for _, netif := range ifs { + n := IOCountersStat{ + Name: netif.Name, + BytesSent: uint64(netif.OBytes), + BytesRecv: uint64(netif.IBytes), + PacketsSent: uint64(netif.OPackets), + PacketsRecv: uint64(netif.IPackets), + Errin: uint64(netif.IErrors), + Errout: uint64(netif.OErrors), + Dropin: uint64(netif.IfIqDrops), + Dropout: uint64(netif.XmitDrops), + } + iocounters = append(iocounters, n) + } + if !pernic { + return getIOCountersAll(iocounters), nil + } + return iocounters, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v4/net/net_aix_nocgo.go new file mode 100644 index 00000000..834534d3 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_aix_nocgo.go @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && !cgo + +package net + +import ( + "context" + "errors" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func parseNetstatI(output string) ([]IOCountersStat, error) { + lines := strings.Split(string(output), "\n") + ret := make([]IOCountersStat, 0, len(lines)-1) + exists := make([]string, 0, len(ret)) + + // Check first line is header + if len(lines) > 0 && strings.Fields(lines[0])[0] != "Name" { + return nil, errors.New("not a 'netstat -i' output") + } + + for _, line := range lines[1:] { + values := strings.Fields(line) + if len(values) < 1 || values[0] == "Name" { + continue + } + if common.StringsHas(exists, values[0]) { + // skip if already get + continue + } + exists = append(exists, values[0]) + + if len(values) < 9 { + continue + } + + base := 1 + // sometimes Address is omitted + if len(values) < 10 { + base = 0 + } + + parsed := make([]uint64, 0, 5) + vv := []string{ + values[base+3], // Ipkts == PacketsRecv + values[base+4], // Ierrs == Errin + values[base+5], // Opkts == PacketsSent + values[base+6], // Oerrs == Errout + values[base+8], // Drops == Dropout + } + + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + t, err := strconv.ParseUint(target, 10, 64) + if err != nil { + return nil, err + } + parsed = append(parsed, t) + } + + n := IOCountersStat{ + Name: values[0], + PacketsRecv: parsed[0], + Errin: parsed[1], + PacketsSent: parsed[2], + Errout: parsed[3], + Dropout: parsed[4], + } + ret = append(ret, n) + } + return ret, nil +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + out, err := invoke.CommandWithContext(ctx, "netstat", "-idn") + if err != nil { + return nil, err + } + + iocounters, err := parseNetstatI(string(out)) + if err != nil { + return nil, err + } + if !pernic { + return getIOCountersAll(iocounters), nil + } + return iocounters, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go b/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go new file mode 100644 index 00000000..9531ad5b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go @@ -0,0 +1,265 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin + +package net + +import ( + "context" + "errors" + "fmt" + "os/exec" + "regexp" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var ( + errNetstatHeader = errors.New("can't parse header of netstat output") + netstatLinkRegexp = regexp.MustCompile(`^$`) +) + +const endOfLine = "\n" + +func parseNetstatLine(line string) (stat *IOCountersStat, linkID *uint, err error) { + var ( + numericValue uint64 + columns = strings.Fields(line) + ) + + if columns[0] == "Name" { + return nil, nil, errNetstatHeader + } + + // try to extract the numeric value from + if subMatch := netstatLinkRegexp.FindStringSubmatch(columns[2]); len(subMatch) == 2 { + numericValue, err = strconv.ParseUint(subMatch[1], 10, 64) + if err != nil { + return nil, nil, err + } + linkIDUint := uint(numericValue) + linkID = &linkIDUint + } + + base := 1 + numberColumns := len(columns) + // sometimes Address is omitted + if numberColumns < 12 { + base = 0 + } + if numberColumns < 11 || numberColumns > 13 { + return nil, nil, fmt.Errorf("line %q do have an invalid number of columns %d", line, numberColumns) + } + + parsed := make([]uint64, 0, 7) + vv := []string{ + columns[base+3], // Ipkts == PacketsRecv + columns[base+4], // Ierrs == Errin + columns[base+5], // Ibytes == BytesRecv + columns[base+6], // Opkts == PacketsSent + columns[base+7], // Oerrs == Errout + columns[base+8], // Obytes == BytesSent + columns[base+10], // Drop == Dropout + } + + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + if numericValue, err = strconv.ParseUint(target, 10, 64); err != nil { + return nil, nil, err + } + parsed = append(parsed, numericValue) + } + + stat = &IOCountersStat{ + Name: strings.Trim(columns[0], "*"), // remove the * that sometimes is on right on interface + PacketsRecv: parsed[0], + Errin: parsed[1], + BytesRecv: parsed[2], + PacketsSent: parsed[3], + Errout: parsed[4], + BytesSent: parsed[5], + Dropout: parsed[6], + } + return stat, linkID, nil +} + +type netstatInterface struct { + linkID *uint + stat *IOCountersStat +} + +func parseNetstatOutput(output string) ([]netstatInterface, error) { + var ( + err error + lines = strings.Split(strings.Trim(output, endOfLine), endOfLine) + ) + + // number of interfaces is number of lines less one for the header + numberInterfaces := len(lines) - 1 + + interfaces := make([]netstatInterface, numberInterfaces) + // no output beside header + if numberInterfaces == 0 { + return interfaces, nil + } + + for index := 0; index < numberInterfaces; index++ { + nsIface := netstatInterface{} + if nsIface.stat, nsIface.linkID, err = parseNetstatLine(lines[index+1]); err != nil { + return nil, err + } + interfaces[index] = nsIface + } + return interfaces, nil +} + +// map that hold the name of a network interface and the number of usage +type mapInterfaceNameUsage map[string]uint + +func newMapInterfaceNameUsage(ifaces []netstatInterface) mapInterfaceNameUsage { + output := make(mapInterfaceNameUsage) + for index := range ifaces { + if ifaces[index].linkID != nil { + ifaceName := ifaces[index].stat.Name + usage, ok := output[ifaceName] + if ok { + output[ifaceName] = usage + 1 + } else { + output[ifaceName] = 1 + } + } + } + return output +} + +func (mapi mapInterfaceNameUsage) isTruncated() bool { + for _, usage := range mapi { + if usage > 1 { + return true + } + } + return false +} + +func (mapi mapInterfaceNameUsage) notTruncated() []string { + output := make([]string, 0) + for ifaceName, usage := range mapi { + if usage == 1 { + output = append(output, ifaceName) + } + } + return output +} + +// Deprecated: use process.PidsWithContext instead +func PidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +// example of `netstat -ibdnW` output on yosemite +// Name Mtu Network Address Ipkts Ierrs Ibytes Opkts Oerrs Obytes Coll Drop +// lo0 16384 869107 0 169411755 869107 0 169411755 0 0 +// lo0 16384 ::1/128 ::1 869107 - 169411755 869107 - 169411755 - - +// lo0 16384 127 127.0.0.1 869107 - 169411755 869107 - 169411755 - - +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + var ( + ret []IOCountersStat + retIndex int + ) + + netstat, err := exec.LookPath("netstat") + if err != nil { + return nil, err + } + + // try to get all interface metrics, and hope there won't be any truncated + out, err := invoke.CommandWithContext(ctx, netstat, "-ibdnW") + if err != nil { + return nil, err + } + + nsInterfaces, err := parseNetstatOutput(string(out)) + if err != nil { + return nil, err + } + + ifaceUsage := newMapInterfaceNameUsage(nsInterfaces) + notTruncated := ifaceUsage.notTruncated() + ret = make([]IOCountersStat, len(notTruncated)) + + if !ifaceUsage.isTruncated() { + // no truncated interface name, return stats of all interface with + for index := range nsInterfaces { + if nsInterfaces[index].linkID != nil { + ret[retIndex] = *nsInterfaces[index].stat + retIndex++ + } + } + } else { + // duplicated interface, list all interfaces + if out, err = invoke.CommandWithContext(ctx, "ifconfig", "-l"); err != nil { + return nil, err + } + interfaceNames := strings.Fields(strings.TrimRight(string(out), endOfLine)) + + // for each of the interface name, run netstat if we don't have any stats yet + for _, interfaceName := range interfaceNames { + truncated := true + for index := range nsInterfaces { + if nsInterfaces[index].linkID != nil && nsInterfaces[index].stat.Name == interfaceName { + // handle the non truncated name to avoid execute netstat for them again + ret[retIndex] = *nsInterfaces[index].stat + retIndex++ + truncated = false + break + } + } + if truncated { + // run netstat with -I$ifacename + if out, err = invoke.CommandWithContext(ctx, netstat, "-ibdnWI"+interfaceName); err != nil { + return nil, err + } + parsedIfaces, err := parseNetstatOutput(string(out)) + if err != nil { + return nil, err + } + if len(parsedIfaces) == 0 { + // interface had been removed since `ifconfig -l` had been executed + continue + } + for index := range parsedIfaces { + if parsedIfaces[index].linkID != nil { + ret = append(ret, *parsedIfaces[index].stat) + break + } + } + } + } + } + + if !pernic { + return getIOCountersAll(ret), nil + } + return ret, nil +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go b/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go new file mode 100644 index 00000000..29c2a148 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build !aix && !darwin && !linux && !freebsd && !openbsd && !windows && !solaris + +package net + +import ( + "context" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func IOCountersWithContext(_ context.Context, _ bool) ([]IOCountersStat, error) { + return []IOCountersStat{}, common.ErrNotImplementedError +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +// Deprecated: use process.PidsWithContext instead +func PidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true) +} + +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int, _ bool) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go new file mode 100644 index 00000000..a72aa00a --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build freebsd + +package net + +import ( + "context" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +// Deprecated: use process.PidsWithContext instead +func PidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + out, err := invoke.CommandWithContext(ctx, "netstat", "-ibdnW") + if err != nil { + return nil, err + } + + lines := strings.Split(string(out), "\n") + ret := make([]IOCountersStat, 0, len(lines)-1) + exists := make([]string, 0, len(ret)) + + for _, line := range lines { + values := strings.Fields(line) + if len(values) < 1 || values[0] == "Name" { + continue + } + if common.StringsHas(exists, values[0]) { + // skip if already get + continue + } + exists = append(exists, values[0]) + + if len(values) < 12 { + continue + } + base := 1 + // sometimes Address is omitted + if len(values) < 13 { + base = 0 + } + + parsed := make([]uint64, 0, 8) + vv := []string{ + values[base+3], // PacketsRecv + values[base+4], // Errin + values[base+5], // Dropin + values[base+6], // BytesRecvn + values[base+7], // PacketSent + values[base+8], // Errout + values[base+9], // BytesSent + values[base+11], // Dropout + } + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + t, err := strconv.ParseUint(target, 10, 64) + if err != nil { + return nil, err + } + parsed = append(parsed, t) + } + + n := IOCountersStat{ + Name: values[0], + PacketsRecv: parsed[0], + Errin: parsed[1], + Dropin: parsed[2], + BytesRecv: parsed[3], + PacketsSent: parsed[4], + Errout: parsed[5], + BytesSent: parsed[6], + Dropout: parsed[7], + } + ret = append(ret, n) + } + + if !pernic { + return getIOCountersAll(ret), nil + } + + return ret, nil +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go b/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go new file mode 100644 index 00000000..a3dd17aa --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go @@ -0,0 +1,817 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux + +package net + +import ( + "bytes" + "context" + "encoding/hex" + "errors" + "fmt" + "io" + "net" + "os" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +const ( // Conntrack Column numbers + ctENTRIES = iota + ctSEARCHED + ctFOUND + ctNEW + ctINVALID + ctIGNORE + ctDELETE + ctDELETE_LIST //nolint:revive //FIXME + ctINSERT + ctINSERT_FAILED //nolint:revive //FIXME + ctDROP + ctEARLY_DROP //nolint:revive //FIXME + ctICMP_ERROR //nolint:revive //FIXME + CT_EXPEctNEW //nolint:revive //FIXME + ctEXPECT_CREATE //nolint:revive //FIXME + CT_EXPEctDELETE //nolint:revive //FIXME + ctSEARCH_RESTART //nolint:revive //FIXME +) + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + filename := common.HostProcWithContext(ctx, "net/dev") + return IOCountersByFileWithContext(ctx, pernic, filename) +} + +func IOCountersByFileWithContext(_ context.Context, pernic bool, filename string) ([]IOCountersStat, error) { + lines, err := common.ReadLines(filename) + if err != nil { + return nil, err + } + + statlen := len(lines) - 1 + + ret := make([]IOCountersStat, 0, statlen) + + for _, line := range lines[2:] { + // Split interface name and stats data at the last ":" + separatorPos := strings.LastIndex(line, ":") + if separatorPos == -1 { + continue + } + interfacePart := line[0:separatorPos] + statsPart := line[separatorPos+1:] + + interfaceName := strings.TrimSpace(interfacePart) + if interfaceName == "" { + continue + } + + fields := strings.Fields(strings.TrimSpace(statsPart)) + bytesRecv, err := strconv.ParseUint(fields[0], 10, 64) + if err != nil { + return ret, err + } + packetsRecv, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return ret, err + } + errIn, err := strconv.ParseUint(fields[2], 10, 64) + if err != nil { + return ret, err + } + dropIn, err := strconv.ParseUint(fields[3], 10, 64) + if err != nil { + return ret, err + } + fifoIn, err := strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return ret, err + } + bytesSent, err := strconv.ParseUint(fields[8], 10, 64) + if err != nil { + return ret, err + } + packetsSent, err := strconv.ParseUint(fields[9], 10, 64) + if err != nil { + return ret, err + } + errOut, err := strconv.ParseUint(fields[10], 10, 64) + if err != nil { + return ret, err + } + dropOut, err := strconv.ParseUint(fields[11], 10, 64) + if err != nil { + return ret, err + } + fifoOut, err := strconv.ParseUint(fields[12], 10, 64) + if err != nil { + return ret, err + } + + nic := IOCountersStat{ + Name: interfaceName, + BytesRecv: bytesRecv, + PacketsRecv: packetsRecv, + Errin: errIn, + Dropin: dropIn, + Fifoin: fifoIn, + BytesSent: bytesSent, + PacketsSent: packetsSent, + Errout: errOut, + Dropout: dropOut, + Fifoout: fifoOut, + } + ret = append(ret, nic) + } + + if !pernic { + return getIOCountersAll(ret), nil + } + + return ret, nil +} + +var netProtocols = []string{ + "ip", + "icmp", + "icmpmsg", + "tcp", + "udp", + "udplite", +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + if len(protocols) == 0 { + protocols = netProtocols + } + + stats := make([]ProtoCountersStat, 0, len(protocols)) + protos := make(map[string]bool, len(protocols)) + for _, p := range protocols { + protos[p] = true + } + + filename := common.HostProcWithContext(ctx, "net/snmp") + lines, err := common.ReadLines(filename) + if err != nil { + return nil, err + } + + linecount := len(lines) + for i := 0; i < linecount; i++ { + line := lines[i] + r := strings.IndexRune(line, ':') + if r == -1 { + return nil, errors.New(filename + " is not formatted correctly, expected ':'.") + } + proto := strings.ToLower(line[:r]) + if !protos[proto] { + // skip protocol and data line + i++ + continue + } + + // Read header line + statNames := strings.Split(line[r+2:], " ") + + // Read data line + i++ + statValues := strings.Split(lines[i][r+2:], " ") + if len(statNames) != len(statValues) { + return nil, errors.New(filename + " is not formatted correctly, expected same number of columns.") + } + stat := ProtoCountersStat{ + Protocol: proto, + Stats: make(map[string]int64, len(statNames)), + } + for j := range statNames { + value, err := strconv.ParseInt(statValues[j], 10, 64) + if err != nil { + return nil, err + } + stat.Stats[statNames[j]] = value + } + stats = append(stats, stat) + } + return stats, nil +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + countfile := common.HostProcWithContext(ctx, "sys/net/netfilter/nf_conntrack_count") + maxfile := common.HostProcWithContext(ctx, "sys/net/netfilter/nf_conntrack_max") + + count, err := common.ReadInts(countfile) + if err != nil { + return nil, err + } + stats := make([]FilterStat, 0, 1) + + maxConn, err := common.ReadInts(maxfile) + if err != nil { + return nil, err + } + + payload := FilterStat{ + ConnTrackCount: count[0], + ConnTrackMax: maxConn[0], + } + + stats = append(stats, payload) + return stats, nil +} + +// ConntrackStatsWithContext returns more detailed info about the conntrack table +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return conntrackStatsFromFile(common.HostProcWithContext(ctx, "net/stat/nf_conntrack"), percpu) +} + +// conntrackStatsFromFile returns more detailed info about the conntrack table +// from `filename` +// If 'percpu' is false, the result will contain exactly one item with totals/summary +func conntrackStatsFromFile(filename string, percpu bool) ([]ConntrackStat, error) { + lines, err := common.ReadLines(filename) + if err != nil { + return nil, err + } + + statlist := NewConntrackStatList() + + for _, line := range lines { + fields := strings.Fields(line) + if len(fields) == 17 && fields[0] != "entries" { + statlist.Append(NewConntrackStat( + common.HexToUint32(fields[ctENTRIES]), + common.HexToUint32(fields[ctSEARCHED]), + common.HexToUint32(fields[ctFOUND]), + common.HexToUint32(fields[ctNEW]), + common.HexToUint32(fields[ctINVALID]), + common.HexToUint32(fields[ctIGNORE]), + common.HexToUint32(fields[ctDELETE]), + common.HexToUint32(fields[ctDELETE_LIST]), + common.HexToUint32(fields[ctINSERT]), + common.HexToUint32(fields[ctINSERT_FAILED]), + common.HexToUint32(fields[ctDROP]), + common.HexToUint32(fields[ctEARLY_DROP]), + common.HexToUint32(fields[ctICMP_ERROR]), + common.HexToUint32(fields[CT_EXPEctNEW]), + common.HexToUint32(fields[ctEXPECT_CREATE]), + common.HexToUint32(fields[CT_EXPEctDELETE]), + common.HexToUint32(fields[ctSEARCH_RESTART]), + )) + } + } + + if percpu { + return statlist.Items(), nil + } + return statlist.Summary(), nil +} + +// http://students.mimuw.edu.pl/lxr/source/include/net/tcp_states.h +var tcpStatuses = map[string]string{ + "01": "ESTABLISHED", + "02": "SYN_SENT", + "03": "SYN_RECV", + "04": "FIN_WAIT1", + "05": "FIN_WAIT2", + "06": "TIME_WAIT", + "07": "CLOSE", + "08": "CLOSE_WAIT", + "09": "LAST_ACK", + "0A": "LISTEN", + "0B": "CLOSING", +} + +type netConnectionKindType struct { + family uint32 + sockType uint32 + filename string +} + +var kindTCP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_STREAM, + filename: "tcp", +} + +var kindTCP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_STREAM, + filename: "tcp6", +} + +var kindUDP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_DGRAM, + filename: "udp", +} + +var kindUDP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_DGRAM, + filename: "udp6", +} + +var kindUNIX = netConnectionKindType{ + family: syscall.AF_UNIX, + filename: "unix", +} + +var netConnectionKindMap = map[string][]netConnectionKindType{ + "all": {kindTCP4, kindTCP6, kindUDP4, kindUDP6, kindUNIX}, + "tcp": {kindTCP4, kindTCP6}, + "tcp4": {kindTCP4}, + "tcp6": {kindTCP6}, + "udp": {kindUDP4, kindUDP6}, + "udp4": {kindUDP4}, + "udp6": {kindUDP6}, + "unix": {kindUNIX}, + "inet": {kindTCP4, kindTCP6, kindUDP4, kindUDP6}, + "inet4": {kindTCP4, kindUDP4}, + "inet6": {kindTCP6, kindUDP6}, +} + +type inodeMap struct { + pid int32 + fd uint32 +} + +type connTmp struct { + fd uint32 + family uint32 + sockType uint32 + laddr Addr + raddr Addr + status string + pid int32 + boundPid int32 + path string + inode string +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true) +} + +func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int, skipUids bool) ([]ConnectionStat, error) { + tmap, ok := netConnectionKindMap[kind] + if !ok { + return nil, fmt.Errorf("invalid kind, %s", kind) + } + root := common.HostProcWithContext(ctx) + var err error + var inodes map[string][]inodeMap + if pid == 0 { + inodes, err = getProcInodesAllWithContext(ctx, root, maxConn) + } else { + inodes, err = getProcInodes(root, pid, maxConn) + if len(inodes) == 0 { + // no connection for the pid + return []ConnectionStat{}, nil + } + } + if err != nil { + return nil, fmt.Errorf("could not get pid(s), %d: %w", pid, err) + } + return statsFromInodesWithContext(ctx, root, pid, tmap, inodes, skipUids) +} + +// connectionDedupKey builds a key to deduplicate connections. +// For inet sockets, the tuple (type, src, dst, status) is sufficient. +// For unix sockets, unnamed sockets share the same empty address, +// so pid, fd, and inode must be included to avoid incorrect deduplication. +// The inode is especially important when pid/fd are unavailable (e.g., +// unprivileged queries where inode-to-pid mapping fails). +func connectionDedupKey(family uint32, c connTmp) string { + if family == syscall.AF_UNIX { + return fmt.Sprintf("%d-%d-%s-%d-%s:%d-%s:%d-%s", c.pid, c.fd, c.inode, c.sockType, c.laddr.IP, c.laddr.Port, c.raddr.IP, c.raddr.Port, c.status) + } + return fmt.Sprintf("%d-%s:%d-%s:%d-%s", c.sockType, c.laddr.IP, c.laddr.Port, c.raddr.IP, c.raddr.Port, c.status) +} + +func statsFromInodesWithContext(ctx context.Context, root string, pid int32, tmap []netConnectionKindType, inodes map[string][]inodeMap, skipUids bool) ([]ConnectionStat, error) { + dupCheckMap := make(map[string]struct{}) + var ret []ConnectionStat + + var err error + for _, t := range tmap { + var path string + var ls []connTmp + if pid == 0 { + path = fmt.Sprintf("%s/net/%s", root, t.filename) + } else { + path = fmt.Sprintf("%s/%d/net/%s", root, pid, t.filename) + } + switch t.family { + case syscall.AF_INET, syscall.AF_INET6: + ls, err = processInet(path, t, inodes, pid) + case syscall.AF_UNIX: + ls, err = processUnix(path, t, inodes, pid) + } + if err != nil { + return nil, err + } + for _, c := range ls { + connKey := connectionDedupKey(t.family, c) + if _, ok := dupCheckMap[connKey]; ok { + continue + } + + conn := ConnectionStat{ + Fd: c.fd, + Family: c.family, + Type: c.sockType, + Laddr: c.laddr, + Raddr: c.raddr, + Status: c.status, + Pid: c.pid, + } + if c.pid == 0 { + conn.Pid = c.boundPid + } else { + conn.Pid = c.pid + } + + if !skipUids { + // fetch process owner Real, effective, saved set, and filesystem UIDs + proc := process{Pid: conn.Pid} + conn.Uids, _ = proc.getUids(ctx) + } + + ret = append(ret, conn) + dupCheckMap[connKey] = struct{}{} + } + + } + + return ret, nil +} + +// getProcInodes returns fd of the pid. +func getProcInodes(root string, pid int32, maxConn int) (map[string][]inodeMap, error) { + ret := make(map[string][]inodeMap) + + dir := fmt.Sprintf("%s/%d/fd", root, pid) + f, err := os.Open(dir) + if err != nil { + return ret, err + } + defer f.Close() + dirEntries, err := f.ReadDir(maxConn) + if err != nil { + return ret, err + } + for _, dirEntry := range dirEntries { + inodePath := fmt.Sprintf("%s/%d/fd/%s", root, pid, dirEntry.Name()) + + inode, err := os.Readlink(inodePath) + if err != nil { + continue + } + if !strings.HasPrefix(inode, "socket:[") { + continue + } + // the process is using a socket + l := len(inode) + inode = inode[8 : l-1] + _, ok := ret[inode] + if !ok { + ret[inode] = make([]inodeMap, 0) + } + fd, err := strconv.ParseInt(dirEntry.Name(), 10, 32) + if err != nil { + continue + } + + i := inodeMap{ + pid: pid, + fd: uint32(fd), + } + ret[inode] = append(ret[inode], i) + } + return ret, nil +} + +func PidsWithContext(ctx context.Context) ([]int32, error) { + var ret []int32 + + d, err := os.Open(common.HostProcWithContext(ctx)) + if err != nil { + return nil, err + } + defer d.Close() + + fnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, fname := range fnames { + pid, err := strconv.ParseInt(fname, 10, 32) + if err != nil { + // if not numeric name, just skip + continue + } + ret = append(ret, int32(pid)) + } + + return ret, nil +} + +// Note: the following is based off process_linux structs and methods +// we need these to fetch the owner of a process ID +// FIXME: Import process occurs import cycle. +// see remarks on pids() +type process struct { + Pid int32 `json:"pid"` + uids []int32 +} + +// Uids returns user ids of the process as a slice of the int +func (p *process) getUids(ctx context.Context) ([]int32, error) { + err := p.fillFromStatus(ctx) + if err != nil { + return []int32{}, err + } + return p.uids, nil +} + +// Get status from /proc/(pid)/status +func (p *process) fillFromStatus(ctx context.Context) error { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "status") + contents, err := os.ReadFile(statPath) + if err != nil { + return err + } + lines := strings.Split(string(contents), "\n") + for _, line := range lines { + tabParts := strings.SplitN(line, "\t", 2) + if len(tabParts) < 2 { + continue + } + value := tabParts[1] + if strings.TrimRight(tabParts[0], ":") == "Uid" { + p.uids = make([]int32, 0, 4) + for _, i := range strings.Split(value, "\t") { + v, err := strconv.ParseInt(i, 10, 32) + if err != nil { + return err + } + p.uids = append(p.uids, int32(v)) + } + } + } + return nil +} + +func getProcInodesAllWithContext(ctx context.Context, root string, maxConn int) (map[string][]inodeMap, error) { + pids, err := PidsWithContext(ctx) + if err != nil { + return nil, err + } + ret := make(map[string][]inodeMap) + + for _, pid := range pids { + t, err := getProcInodes(root, pid, maxConn) + if err != nil { + // skip if permission error or no longer exists + if os.IsPermission(err) || os.IsNotExist(err) || errors.Is(err, io.EOF) { + continue + } + return ret, err + } + if len(t) == 0 { + continue + } + // TODO: update ret. + ret = updateMap(ret, t) + } + return ret, nil +} + +// decodeAddress decode address represents addr in proc/net/* +// ex: +// "0500000A:0016" -> "10.0.0.5", 22 +// "0085002452100113070057A13F025401:0035" -> "2400:8500:1301:1052:a157:7:154:23f", 53 +func decodeAddress(family uint32, src string) (Addr, error) { + t := strings.Split(src, ":") + if len(t) != 2 { + return Addr{}, fmt.Errorf("does not contain port, %s", src) + } + addr := t[0] + port, err := strconv.ParseUint(t[1], 16, 16) + if err != nil { + return Addr{}, fmt.Errorf("invalid port, %s", src) + } + decoded, err := hex.DecodeString(addr) + if err != nil { + return Addr{}, fmt.Errorf("decode error, %w", err) + } + var ip net.IP + + if family == syscall.AF_INET { + if common.IsLittleEndian() { + ip = net.IP(Reverse(decoded)) + } else { + ip = net.IP(decoded) + } + } else { // IPv6 + ip, err = parseIPv6HexString(decoded) + if err != nil { + return Addr{}, err + } + } + return Addr{ + IP: ip.String(), + Port: uint32(port), + }, nil +} + +func Reverse(s []byte) []byte { + for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { + s[i], s[j] = s[j], s[i] + } + return s +} + +// parseIPv6HexString parse array of bytes to IPv6 string +func parseIPv6HexString(src []byte) (net.IP, error) { + if len(src) != 16 { + return nil, errors.New("invalid IPv6 string") + } + + buf := make([]byte, 0, 16) + for i := 0; i < len(src); i += 4 { + r := Reverse(src[i : i+4]) + buf = append(buf, r...) + } + return net.IP(buf), nil +} + +func processInet(file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) { + if strings.HasSuffix(file, "6") && !common.PathExists(file) { + // IPv6 not supported, return empty. + return []connTmp{}, nil + } + + // Read the contents of the /proc file with a single read sys call. + // This minimizes duplicates in the returned connections + // For more info: + // https://github.com/shirou/gopsutil/pull/361 + contents, err := os.ReadFile(file) + if err != nil { + return nil, err + } + + lines := bytes.Split(contents, []byte("\n")) + + var ret []connTmp + // skip first line + for _, line := range lines[1:] { + l := strings.Fields(string(line)) + if len(l) < 10 { + continue + } + laddr := l[1] + raddr := l[2] + status := l[3] + inode := l[9] + pid := int32(0) + fd := uint32(0) + i, exists := inodes[inode] + if exists { + pid = i[0].pid + fd = i[0].fd + } + if filterPid > 0 && filterPid != pid { + continue + } + if kind.sockType == syscall.SOCK_STREAM { + status = tcpStatuses[status] + } else { + status = "NONE" + } + la, err := decodeAddress(kind.family, laddr) + if err != nil { + continue + } + ra, err := decodeAddress(kind.family, raddr) + if err != nil { + continue + } + + ret = append(ret, connTmp{ + fd: fd, + family: kind.family, + sockType: kind.sockType, + laddr: la, + raddr: ra, + status: status, + pid: pid, + inode: inode, + }) + } + + return ret, nil +} + +func processUnix(file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) { + // Read the contents of the /proc file with a single read sys call. + // This minimizes duplicates in the returned connections + // For more info: + // https://github.com/shirou/gopsutil/pull/361 + contents, err := os.ReadFile(file) + if err != nil { + return nil, err + } + + lines := bytes.Split(contents, []byte("\n")) + + var ret []connTmp + // skip first line + for _, line := range lines[1:] { + tokens := strings.Fields(string(line)) + if len(tokens) < 6 { + continue + } + st, err := strconv.ParseInt(tokens[4], 10, 32) + if err != nil { + return nil, err + } + + inode := tokens[6] + + var pairs []inodeMap + pairs, exists := inodes[inode] + if !exists { + pairs = []inodeMap{ + {}, + } + } + for _, pair := range pairs { + if filterPid > 0 && filterPid != pair.pid { + continue + } + var path string + if len(tokens) == 8 { + path = tokens[len(tokens)-1] + } + ret = append(ret, connTmp{ + fd: pair.fd, + family: kind.family, + sockType: uint32(st), + laddr: Addr{ + IP: path, + }, + pid: pair.pid, + status: "NONE", + path: path, + inode: inode, + }) + } + } + + return ret, nil +} + +func updateMap(src, add map[string][]inodeMap) map[string][]inodeMap { + for key, value := range add { + a, exists := src[key] + if !exists { + src[key] = value + continue + } + src[key] = append(a, value...) + } + return src +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go b/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go new file mode 100644 index 00000000..ec4cfb95 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go @@ -0,0 +1,339 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd + +package net + +import ( + "context" + "fmt" + "os/exec" + "regexp" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var portMatch = regexp.MustCompile(`(.*)\.(\d+)$`) + +func ParseNetstat(output string, mode string, + iocs map[string]IOCountersStat, +) error { + lines := strings.Split(output, "\n") + + exists := make([]string, 0, len(lines)-1) + + columns := 9 + if mode == "inb" { + columns = 6 + } + for _, line := range lines { + values := strings.Fields(line) + if len(values) < 1 || values[0] == "Name" { + continue + } + if common.StringsHas(exists, values[0]) { + // skip if already get + continue + } + + if len(values) < columns { + continue + } + base := 1 + // sometimes Address is omitted + if len(values) < columns { + base = 0 + } + + parsed := make([]uint64, 0, 8) + var vv []string + switch mode { + case "inb": + vv = []string{ + values[base+3], // BytesRecv + values[base+4], // BytesSent + } + case "ind": + vv = []string{ + values[base+3], // Ipkts + values[base+4], // Idrop + values[base+5], // Opkts + values[base+6], // Odrops + } + case "ine": + vv = []string{ + values[base+4], // Ierrs + values[base+6], // Oerrs + } + } + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + t, err := strconv.ParseUint(target, 10, 64) + if err != nil { + return err + } + parsed = append(parsed, t) + } + exists = append(exists, values[0]) + + n, present := iocs[values[0]] + if !present { + n = IOCountersStat{Name: values[0]} + } + + switch mode { + case "inb": + n.BytesRecv = parsed[0] + n.BytesSent = parsed[1] + case "ind": + n.PacketsRecv = parsed[0] + n.Dropin = parsed[1] + n.PacketsSent = parsed[2] + n.Dropout = parsed[3] + case "ine": + n.Errin = parsed[0] + n.Errout = parsed[1] + } + + iocs[n.Name] = n + } + return nil +} + +// Deprecated: use process.PidsWithContext instead +func PidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + netstat, err := exec.LookPath("netstat") + if err != nil { + return nil, err + } + out, err := invoke.CommandWithContext(ctx, netstat, "-inb") + if err != nil { + return nil, err + } + out2, err := invoke.CommandWithContext(ctx, netstat, "-ind") + if err != nil { + return nil, err + } + out3, err := invoke.CommandWithContext(ctx, netstat, "-ine") + if err != nil { + return nil, err + } + iocs := make(map[string]IOCountersStat) + + lines := strings.Split(string(out), "\n") + ret := make([]IOCountersStat, 0, len(lines)-1) + + err = ParseNetstat(string(out), "inb", iocs) + if err != nil { + return nil, err + } + err = ParseNetstat(string(out2), "ind", iocs) + if err != nil { + return nil, err + } + err = ParseNetstat(string(out3), "ine", iocs) + if err != nil { + return nil, err + } + + for _, ioc := range iocs { + ret = append(ret, ioc) + } + + if !pernic { + return getIOCountersAll(ret), nil + } + + return ret, nil +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func parseNetstatLine(line string) (ConnectionStat, error) { + f := strings.Fields(line) + if len(f) < 5 { + return ConnectionStat{}, fmt.Errorf("wrong line,%s", line) + } + + var netType, netFamily uint32 + switch f[0] { + case "tcp": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET + case "udp": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET + case "tcp6": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET6 + case "udp6": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET6 + default: + return ConnectionStat{}, fmt.Errorf("unknown type, %s", f[0]) + } + + laddr, raddr, err := parseNetstatAddr(f[3], f[4], netFamily) + if err != nil { + return ConnectionStat{}, fmt.Errorf("failed to parse netaddr, %s %s", f[3], f[4]) + } + + n := ConnectionStat{ + Fd: uint32(0), // not supported + Family: uint32(netFamily), + Type: uint32(netType), + Laddr: laddr, + Raddr: raddr, + Pid: int32(0), // not supported + } + if len(f) == 6 { + n.Status = f[5] + } + + return n, nil +} + +func parseAddr(l string, family uint32) (Addr, error) { + matches := portMatch.FindStringSubmatch(l) + if matches == nil { + return Addr{}, fmt.Errorf("wrong addr, %s", l) + } + host := matches[1] + port := matches[2] + if host == "*" { + switch family { + case syscall.AF_INET: + host = "0.0.0.0" + case syscall.AF_INET6: + host = "::" + default: + return Addr{}, fmt.Errorf("unknown family, %d", family) + } + } + lport, err := strconv.ParseInt(port, 10, 32) + if err != nil { + return Addr{}, err + } + return Addr{IP: host, Port: uint32(lport)}, nil +} + +func parseNetstatAddr(local, remote string, family uint32) (laddr, raddr Addr, err error) { + laddr, err = parseAddr(local, family) + if remote != "*.*" { // remote addr exists + raddr, err = parseAddr(remote, family) + if err != nil { + return laddr, raddr, err + } + } + + return laddr, raddr, err +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + var ret []ConnectionStat + + args := []string{"-na"} + switch strings.ToLower(kind) { + default: + fallthrough + case "", "all", "inet": + // nothing to add + case "inet4": + args = append(args, "-finet") + case "inet6": + args = append(args, "-finet6") + case "tcp": + args = append(args, "-ptcp") + case "tcp4": + args = append(args, "-ptcp", "-finet") + case "tcp6": + args = append(args, "-ptcp", "-finet6") + case "udp": + args = append(args, "-pudp") + case "udp4": + args = append(args, "-pudp", "-finet") + case "udp6": + args = append(args, "-pudp", "-finet6") + case "unix": + return ret, common.ErrNotImplementedError + } + + netstat, err := exec.LookPath("netstat") + if err != nil { + return nil, err + } + out, err := invoke.CommandWithContext(ctx, netstat, args...) + if err != nil { + return nil, err + } + lines := strings.Split(string(out), "\n") + for _, line := range lines { + if !strings.HasPrefix(line, "tcp") && !strings.HasPrefix(line, "udp") { + continue + } + n, err := parseNetstatLine(line) + if err != nil { + continue + } + + ret = append(ret, n) + } + + return ret, nil +} + +func ConnectionsPidWithContext(_ context.Context, _ string, _ int32) ([]ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn) +} + +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go b/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go new file mode 100644 index 00000000..df067806 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build solaris + +package net + +import ( + "context" + "errors" + "fmt" + "regexp" + "runtime" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var kstatSplit = regexp.MustCompile(`[:\s]+`) + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + // collect all the net class's links with below statistics + filterstr := "/^(?!vnic)/::phys:/^rbytes64$|^ipackets64$|^idrops64$|^ierrors$|^obytes64$|^opackets64$|^odrops64$|^oerrors$/" + if runtime.GOOS == "illumos" { + filterstr = "/[^vnic]/::mac:/^rbytes64$|^ipackets64$|^idrops64$|^ierrors$|^obytes64$|^opackets64$|^odrops64$|^oerrors$/" + } + kstatSysOut, err := invoke.CommandWithContext(ctx, "kstat", "-c", "net", "-p", filterstr) + if err != nil { + return nil, fmt.Errorf("cannot execute kstat: %w", err) + } + + lines := strings.Split(strings.TrimSpace(string(kstatSysOut)), "\n") + if len(lines) == 0 { + return nil, errors.New("no interface found") + } + rbytes64arr := make(map[string]uint64) + ipackets64arr := make(map[string]uint64) + idrops64arr := make(map[string]uint64) + ierrorsarr := make(map[string]uint64) + obytes64arr := make(map[string]uint64) + opackets64arr := make(map[string]uint64) + odrops64arr := make(map[string]uint64) + oerrorsarr := make(map[string]uint64) + + for _, line := range lines { + fields := kstatSplit.Split(line, -1) + interfaceName := fields[0] + instance := fields[1] + switch fields[3] { + case "rbytes64": + rbytes64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse rbytes64: %w", err) + } + case "ipackets64": + ipackets64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse ipackets64: %w", err) + } + case "idrops64": + idrops64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse idrops64: %w", err) + } + case "ierrors": + ierrorsarr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse ierrors: %w", err) + } + case "obytes64": + obytes64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse obytes64: %w", err) + } + case "opackets64": + opackets64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse opackets64: %w", err) + } + case "odrops64": + odrops64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse odrops64: %w", err) + } + case "oerrors": + oerrorsarr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse oerrors: %w", err) + } + } + } + ret := make([]IOCountersStat, 0) + for k := range rbytes64arr { + nic := IOCountersStat{ + Name: k, + BytesRecv: rbytes64arr[k], + PacketsRecv: ipackets64arr[k], + Errin: ierrorsarr[k], + Dropin: idrops64arr[k], + BytesSent: obytes64arr[k], + PacketsSent: opackets64arr[k], + Errout: oerrorsarr[k], + Dropout: odrops64arr[k], + } + ret = append(ret, nic) + } + + if !pernic { + return getIOCountersAll(ret), nil + } + + return ret, nil +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +// Deprecated: use process.PidsWithContext instead +func PidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true) +} + +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int, _ bool) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go b/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go new file mode 100644 index 00000000..c491a291 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build freebsd || darwin + +package net + +import ( + "context" + "fmt" + "net" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + var ret []ConnectionStat + + args := []string{"-i"} + switch strings.ToLower(kind) { + default: + fallthrough + case "", "all", "inet": + args = append(args, "tcp", "-i", "udp") + case "inet4": + args = append(args, "4") + case "inet6": + args = append(args, "6") + case "tcp": + args = append(args, "tcp") + case "tcp4": + args = append(args, "4tcp") + case "tcp6": + args = append(args, "6tcp") + case "udp": + args = append(args, "udp") + case "udp4": + args = append(args, "4udp") + case "udp6": + args = append(args, "6udp") + case "unix": + args = []string{"-U"} + } + + r, err := common.CallLsofWithContext(ctx, invoke, pid, args...) + if err != nil { + return nil, err + } + for _, rr := range r { + if strings.HasPrefix(rr, "COMMAND") { + continue + } + n, err := parseNetLine(rr) + if err != nil { + continue + } + + ret = append(ret, n) + } + + return ret, nil +} + +var constMap = map[string]int{ + "unix": syscall.AF_UNIX, + "TCP": syscall.SOCK_STREAM, + "UDP": syscall.SOCK_DGRAM, + "IPv4": syscall.AF_INET, + "IPv6": syscall.AF_INET6, +} + +func parseNetLine(line string) (ConnectionStat, error) { + f := strings.Fields(line) + if len(f) < 8 { + return ConnectionStat{}, fmt.Errorf("wrong line,%s", line) + } + + if len(f) == 8 { + f = append(f, f[7]) + f[7] = "unix" + } + + pid, err := strconv.ParseInt(f[1], 10, 32) + if err != nil { + return ConnectionStat{}, err + } + fd, err := strconv.ParseInt(strings.Trim(f[3], "u"), 10, 32) + if err != nil { + return ConnectionStat{}, fmt.Errorf("unknown fd, %s", f[3]) + } + netFamily, ok := constMap[f[4]] + if !ok { + return ConnectionStat{}, fmt.Errorf("unknown family, %s", f[4]) + } + netType, ok := constMap[f[7]] + if !ok { + return ConnectionStat{}, fmt.Errorf("unknown type, %s", f[7]) + } + + var laddr, raddr Addr + if f[7] == "unix" { + laddr.IP = f[8] + } else { + laddr, raddr, err = parseNetAddr(f[8]) + if err != nil { + return ConnectionStat{}, fmt.Errorf("failed to parse netaddr, %s", f[8]) + } + } + + n := ConnectionStat{ + Fd: uint32(fd), + Family: uint32(netFamily), + Type: uint32(netType), + Laddr: laddr, + Raddr: raddr, + Pid: int32(pid), + } + if len(f) == 10 { + n.Status = strings.Trim(f[9], "()") + } + + return n, nil +} + +func parseAddr(l string) (Addr, error) { + host, port, err := net.SplitHostPort(l) + if err != nil { + return Addr{}, fmt.Errorf("wrong addr, %s", l) + } + lport, err := strconv.ParseInt(port, 10, 32) + if err != nil { + return Addr{}, err + } + return Addr{IP: host, Port: uint32(lport)}, nil +} + +func parseNetAddr(line string) (laddr, raddr Addr, err error) { + addrs := strings.Split(line, "->") + if len(addrs) == 0 { + return laddr, raddr, fmt.Errorf("wrong netaddr, %s", line) + } + laddr, err = parseAddr(addrs[0]) + if len(addrs) == 2 { // remote addr exists + raddr, err = parseAddr(addrs[1]) + if err != nil { + return laddr, raddr, err + } + } + + return laddr, raddr, err +} + +func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn) +} + +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go b/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go new file mode 100644 index 00000000..f530e4e5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go @@ -0,0 +1,731 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build windows + +package net + +import ( + "context" + "errors" + "fmt" + "net" + "os" + "syscall" + "unsafe" + + "golang.org/x/sys/windows" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +var ( + modiphlpapi = windows.NewLazySystemDLL("iphlpapi.dll") + procGetExtendedTCPTable = modiphlpapi.NewProc("GetExtendedTcpTable") + procGetExtendedUDPTable = modiphlpapi.NewProc("GetExtendedUdpTable") + procGetIfEntry2 = modiphlpapi.NewProc("GetIfEntry2") +) + +const ( + TCPTableBasicListener = iota + TCPTableBasicConnections + TCPTableBasicAll + TCPTableOwnerPIDListener + TCPTableOwnerPIDConnections + TCPTableOwnerPIDAll + TCPTableOwnerModuleListener + TCPTableOwnerModuleConnections + TCPTableOwnerModuleAll +) + +type netConnectionKindType struct { + family uint32 + sockType uint32 + filename string +} + +var kindTCP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_STREAM, + filename: "tcp", +} + +var kindTCP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_STREAM, + filename: "tcp6", +} + +var kindUDP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_DGRAM, + filename: "udp", +} + +var kindUDP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_DGRAM, + filename: "udp6", +} + +var netConnectionKindMap = map[string][]netConnectionKindType{ + "all": {kindTCP4, kindTCP6, kindUDP4, kindUDP6}, + "tcp": {kindTCP4, kindTCP6}, + "tcp4": {kindTCP4}, + "tcp6": {kindTCP6}, + "udp": {kindUDP4, kindUDP6}, + "udp4": {kindUDP4}, + "udp6": {kindUDP6}, + "inet": {kindTCP4, kindTCP6, kindUDP4, kindUDP6}, + "inet4": {kindTCP4, kindUDP4}, + "inet6": {kindTCP6, kindUDP6}, +} + +// https://github.com/microsoft/ethr/blob/aecdaf923970e5a9b4c461b4e2e3963d781ad2cc/plt_windows.go#L114-L170 +type guid struct { + Data1 uint32 + Data2 uint16 + Data3 uint16 + Data4 [8]byte +} + +const ( + maxStringSize = 256 + maxPhysAddressLength = 32 + pad0for64_4for32 = 0 +) + +type mibIfRow2 struct { + InterfaceLuid uint64 + InterfaceIndex uint32 + InterfaceGuid guid //nolint:revive //FIXME + Alias [maxStringSize + 1]uint16 + Description [maxStringSize + 1]uint16 + PhysicalAddressLength uint32 + PhysicalAddress [maxPhysAddressLength]uint8 + PermanentPhysicalAddress [maxPhysAddressLength]uint8 + Mtu uint32 + Type uint32 + TunnelType uint32 + MediaType uint32 + PhysicalMediumType uint32 + AccessType uint32 + DirectionType uint32 + InterfaceAndOperStatusFlags uint32 + OperStatus uint32 + AdminStatus uint32 + MediaConnectState uint32 + NetworkGuid guid //nolint:revive //FIXME + ConnectionType uint32 + padding1 [pad0for64_4for32]byte + TransmitLinkSpeed uint64 + ReceiveLinkSpeed uint64 + InOctets uint64 + InUcastPkts uint64 + InNUcastPkts uint64 + InDiscards uint64 + InErrors uint64 + InUnknownProtos uint64 + InUcastOctets uint64 + InMulticastOctets uint64 + InBroadcastOctets uint64 + OutOctets uint64 + OutUcastPkts uint64 + OutNUcastPkts uint64 + OutDiscards uint64 + OutErrors uint64 + OutUcastOctets uint64 + OutMulticastOctets uint64 + OutBroadcastOctets uint64 + OutQLen uint64 +} + +func IOCountersWithContext(_ context.Context, pernic bool) ([]IOCountersStat, error) { + ifs, err := net.Interfaces() + if err != nil { + return nil, err + } + var counters []IOCountersStat + + err = procGetIfEntry2.Find() + if err == nil { // Vista+, uint64 values (issue#693) + for _, ifi := range ifs { + c := IOCountersStat{ + Name: ifi.Name, + } + + row := mibIfRow2{InterfaceIndex: uint32(ifi.Index)} + ret, _, err := procGetIfEntry2.Call(uintptr(unsafe.Pointer(&row))) + if ret != 0 { + return nil, os.NewSyscallError("GetIfEntry2", err) + } + c.BytesSent = uint64(row.OutOctets) + c.BytesRecv = uint64(row.InOctets) + c.PacketsSent = uint64(row.OutUcastPkts) + c.PacketsRecv = uint64(row.InUcastPkts) + c.Errin = uint64(row.InErrors) + c.Errout = uint64(row.OutErrors) + c.Dropin = uint64(row.InDiscards) + c.Dropout = uint64(row.OutDiscards) + + counters = append(counters, c) + } + } else { // WinXP fallback, uint32 values + for _, ifi := range ifs { + c := IOCountersStat{ + Name: ifi.Name, + } + + row := windows.MibIfRow{Index: uint32(ifi.Index)} + err = windows.GetIfEntry(&row) + if err != nil { + return nil, os.NewSyscallError("GetIfEntry", err) + } + c.BytesSent = uint64(row.OutOctets) + c.BytesRecv = uint64(row.InOctets) + c.PacketsSent = uint64(row.OutUcastPkts) + c.PacketsRecv = uint64(row.InUcastPkts) + c.Errin = uint64(row.InErrors) + c.Errout = uint64(row.OutErrors) + c.Dropin = uint64(row.InDiscards) + c.Dropout = uint64(row.OutDiscards) + + counters = append(counters, c) + } + } + + if !pernic { + return getIOCountersAll(counters), nil + } + return counters, nil +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(ctx, kind, 0) +} + +func ConnectionsPidWithContext(_ context.Context, kind string, pid int32) ([]ConnectionStat, error) { + tmap, ok := netConnectionKindMap[kind] + if !ok { + return nil, fmt.Errorf("invalid kind, %s", kind) + } + return getProcInet(tmap, pid) +} + +func getProcInet(kinds []netConnectionKindType, pid int32) ([]ConnectionStat, error) { + stats := make([]ConnectionStat, 0) + + for _, kind := range kinds { + s, err := getNetStatWithKind(kind) + if err != nil { + continue + } + + if pid == 0 { + stats = append(stats, s...) + } else { + for _, ns := range s { + if ns.Pid != pid { + continue + } + stats = append(stats, ns) + } + } + } + + return stats, nil +} + +func getNetStatWithKind(kindType netConnectionKindType) ([]ConnectionStat, error) { + if kindType.filename == "" { + return nil, errors.New("kind filename must be required") + } + + switch kindType.filename { + case kindTCP4.filename: + return getTCPConnections(kindTCP4.family) + case kindTCP6.filename: + return getTCPConnections(kindTCP6.family) + case kindUDP4.filename: + return getUDPConnections(kindUDP4.family) + case kindUDP6.filename: + return getUDPConnections(kindUDP6.family) + } + + return nil, fmt.Errorf("invalid kind filename, %s", kindType.filename) +} + +// Deprecated: use process.PidsWithContext instead +func PidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true) +} + +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int, _ bool) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func getTableUintptr(family uint32, buf []byte) uintptr { + var ( + pmibTCPTable pmibTCPTableOwnerPidAll + pmibTCP6Table pmibTCP6TableOwnerPidAll + + p uintptr + ) + switch family { + case kindTCP4.family: + if len(buf) > 0 { + pmibTCPTable = (*mibTCPTableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } else { + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } + case kindTCP6.family: + if len(buf) > 0 { + pmibTCP6Table = (*mibTCP6TableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } else { + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } + } + return p +} + +func getTableInfo(filename string, table any) (index, step, length int) { + switch filename { + case kindTCP4.filename: + index = int(unsafe.Sizeof(table.(pmibTCPTableOwnerPidAll).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibTCPTableOwnerPidAll).Table)) + length = int(table.(pmibTCPTableOwnerPidAll).DwNumEntries) + case kindTCP6.filename: + index = int(unsafe.Sizeof(table.(pmibTCP6TableOwnerPidAll).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibTCP6TableOwnerPidAll).Table)) + length = int(table.(pmibTCP6TableOwnerPidAll).DwNumEntries) + case kindUDP4.filename: + index = int(unsafe.Sizeof(table.(pmibUDPTableOwnerPid).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibUDPTableOwnerPid).Table)) + length = int(table.(pmibUDPTableOwnerPid).DwNumEntries) + case kindUDP6.filename: + index = int(unsafe.Sizeof(table.(pmibUDP6TableOwnerPid).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibUDP6TableOwnerPid).Table)) + length = int(table.(pmibUDP6TableOwnerPid).DwNumEntries) + } + + return index, step, length +} + +func getTCPConnections(family uint32) ([]ConnectionStat, error) { + var ( + p uintptr + buf []byte + size uint32 + + pmibTCPTable pmibTCPTableOwnerPidAll + pmibTCP6Table pmibTCP6TableOwnerPidAll + ) + + if family == 0 { + return nil, errors.New("faimly must be required") + } + + for { + switch family { + case kindTCP4.family: + if len(buf) > 0 { + pmibTCPTable = (*mibTCPTableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } else { + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } + case kindTCP6.family: + if len(buf) > 0 { + pmibTCP6Table = (*mibTCP6TableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } else { + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } + } + + err := getExtendedTCPTable(p, + &size, + true, + family, + tcpTableOwnerPidAll, + 0) + if err == nil { + break + } + if !errors.Is(err, windows.ERROR_INSUFFICIENT_BUFFER) { + return nil, err + } + buf = make([]byte, size) + } + + var ( + index, step int + length int + ) + + stats := make([]ConnectionStat, 0) + switch family { + case kindTCP4.family: + index, step, length = getTableInfo(kindTCP4.filename, pmibTCPTable) + case kindTCP6.family: + index, step, length = getTableInfo(kindTCP6.filename, pmibTCP6Table) + } + + if length == 0 { + return nil, nil + } + + for i := 0; i < length; i++ { + switch family { + case kindTCP4.family: + mibs := (*mibTCPRowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + case kindTCP6.family: + mibs := (*mibTCP6RowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + } + + index += step + } + return stats, nil +} + +func getUDPConnections(family uint32) ([]ConnectionStat, error) { + var ( + p uintptr + buf []byte + size uint32 + + pmibUDPTable pmibUDPTableOwnerPid + pmibUDP6Table pmibUDP6TableOwnerPid + ) + + if family == 0 { + return nil, errors.New("faimly must be required") + } + + for { + switch family { + case kindUDP4.family: + if len(buf) > 0 { + pmibUDPTable = (*mibUDPTableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibUDPTable)) + } else { + p = uintptr(unsafe.Pointer(pmibUDPTable)) + } + case kindUDP6.family: + if len(buf) > 0 { + pmibUDP6Table = (*mibUDP6TableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibUDP6Table)) + } else { + p = uintptr(unsafe.Pointer(pmibUDP6Table)) + } + } + + err := getExtendedUDPTable( + p, + &size, + true, + family, + udpTableOwnerPid, + 0, + ) + if err == nil { + break + } + if !errors.Is(err, windows.ERROR_INSUFFICIENT_BUFFER) { + return nil, err + } + buf = make([]byte, size) + } + + var index, step, length int + + stats := make([]ConnectionStat, 0) + switch family { + case kindUDP4.family: + index, step, length = getTableInfo(kindUDP4.filename, pmibUDPTable) + case kindUDP6.family: + index, step, length = getTableInfo(kindUDP6.filename, pmibUDP6Table) + } + + if length == 0 { + return nil, nil + } + + for i := 0; i < length; i++ { + switch family { + case kindUDP4.family: + mibs := (*mibUDPRowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + case kindUDP6.family: + mibs := (*mibUDP6RowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + } + + index += step + } + return stats, nil +} + +// tcpStatuses https://msdn.microsoft.com/en-us/library/windows/desktop/bb485761(v=vs.85).aspx +var tcpStatuses = map[mibTCPState]string{ + 1: "CLOSED", + 2: "LISTEN", + 3: "SYN_SENT", + 4: "SYN_RECEIVED", + 5: "ESTABLISHED", + 6: "FIN_WAIT_1", + 7: "FIN_WAIT_2", + 8: "CLOSE_WAIT", + 9: "CLOSING", + 10: "LAST_ACK", + 11: "TIME_WAIT", + 12: "DELETE", +} + +func getExtendedTCPTable(pTCPTable uintptr, pdwSize *uint32, bOrder bool, ulAf uint32, tableClass tcpTableClass, reserved uint32) (errcode error) { + r1, _, _ := syscall.Syscall6(procGetExtendedTCPTable.Addr(), 6, pTCPTable, uintptr(unsafe.Pointer(pdwSize)), getUintptrFromBool(bOrder), uintptr(ulAf), uintptr(tableClass), uintptr(reserved)) + if r1 != 0 { + errcode = syscall.Errno(r1) + } + return errcode +} + +func getExtendedUDPTable(pUDPTable uintptr, pdwSize *uint32, bOrder bool, ulAf uint32, tableClass udpTableClass, reserved uint32) (errcode error) { + r1, _, _ := syscall.Syscall6(procGetExtendedUDPTable.Addr(), 6, pUDPTable, uintptr(unsafe.Pointer(pdwSize)), getUintptrFromBool(bOrder), uintptr(ulAf), uintptr(tableClass), uintptr(reserved)) + if r1 != 0 { + errcode = syscall.Errno(r1) + } + return errcode +} + +func getUintptrFromBool(b bool) uintptr { + if b { + return 1 + } + return 0 +} + +const anySize = 1 + +// type MIB_TCP_STATE int32 +type mibTCPState int32 + +type tcpTableClass int32 + +const ( + tcpTableBasicListener tcpTableClass = iota + tcpTableBasicConnections + tcpTableBasicAll + tcpTableOwnerPidListener + tcpTableOwnerPidConnections + tcpTableOwnerPidAll + tcpTableOwnerModuleListener + tcpTableOwnerModuleConnections + tcpTableOwnerModuleAll +) + +type udpTableClass int32 + +const ( + udpTableBasic udpTableClass = iota + udpTableOwnerPid + udpTableOwnerModule +) + +// TCP + +type mibTCPRowOwnerPid struct { + DwState uint32 + DwLocalAddr uint32 + DwLocalPort uint32 + DwRemoteAddr uint32 + DwRemotePort uint32 + DwOwningPid uint32 +} + +func (m *mibTCPRowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindTCP4.family, + Type: kindTCP4.sockType, + Laddr: Addr{ + IP: parseIPv4HexString(m.DwLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Raddr: Addr{ + IP: parseIPv4HexString(m.DwRemoteAddr), + Port: uint32(decodePort(m.DwRemotePort)), + }, + Pid: int32(m.DwOwningPid), + Status: tcpStatuses[mibTCPState(m.DwState)], + } + + return ns +} + +type mibTCPTableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibTCPRowOwnerPid +} + +type mibTCP6RowOwnerPid struct { + UcLocalAddr [16]byte + DwLocalScopeId uint32 + DwLocalPort uint32 + UcRemoteAddr [16]byte + DwRemoteScopeId uint32 + DwRemotePort uint32 + DwState uint32 + DwOwningPid uint32 +} + +func (m *mibTCP6RowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindTCP6.family, + Type: kindTCP6.sockType, + Laddr: Addr{ + IP: parseIPv6HexString(m.UcLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Raddr: Addr{ + IP: parseIPv6HexString(m.UcRemoteAddr), + Port: uint32(decodePort(m.DwRemotePort)), + }, + Pid: int32(m.DwOwningPid), + Status: tcpStatuses[mibTCPState(m.DwState)], + } + + return ns +} + +type mibTCP6TableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibTCP6RowOwnerPid +} + +type ( + pmibTCPTableOwnerPidAll *mibTCPTableOwnerPid + pmibTCP6TableOwnerPidAll *mibTCP6TableOwnerPid +) + +// UDP + +type mibUDPRowOwnerPid struct { + DwLocalAddr uint32 + DwLocalPort uint32 + DwOwningPid uint32 +} + +func (m *mibUDPRowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindUDP4.family, + Type: kindUDP4.sockType, + Laddr: Addr{ + IP: parseIPv4HexString(m.DwLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Pid: int32(m.DwOwningPid), + } + + return ns +} + +type mibUDPTableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibUDPRowOwnerPid +} + +type mibUDP6RowOwnerPid struct { + UcLocalAddr [16]byte + DwLocalScopeId uint32 + DwLocalPort uint32 + DwOwningPid uint32 +} + +func (m *mibUDP6RowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindUDP6.family, + Type: kindUDP6.sockType, + Laddr: Addr{ + IP: parseIPv6HexString(m.UcLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Pid: int32(m.DwOwningPid), + } + + return ns +} + +type mibUDP6TableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibUDP6RowOwnerPid +} + +type ( + pmibUDPTableOwnerPid *mibUDPTableOwnerPid + pmibUDP6TableOwnerPid *mibUDP6TableOwnerPid +) + +func decodePort(port uint32) uint16 { + return syscall.Ntohs(uint16(port)) +} + +func parseIPv4HexString(addr uint32) string { + return fmt.Sprintf("%d.%d.%d.%d", addr&255, addr>>8&255, addr>>16&255, addr>>24&255) +} + +func parseIPv6HexString(addr [16]byte) string { + var ret [16]byte + for i := 0; i < 16; i++ { + ret[i] = uint8(addr[i]) + } + + // convert []byte to net.IP + ip := net.IP(ret[:]) + return ip.String() +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process.go b/vendor/github.com/shirou/gopsutil/v4/process/process.go new file mode 100644 index 00000000..5db5ff48 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process.go @@ -0,0 +1,645 @@ +// SPDX-License-Identifier: BSD-3-Clause +package process + +import ( + "context" + "encoding/json" + "errors" + "regexp" + "runtime" + "sort" + "sync" + "time" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/mem" + "github.com/shirou/gopsutil/v4/net" +) + +var ( + invoke common.Invoker = common.Invoke{} + strictIntPtrn = regexp.MustCompile(`^\d+$`) + ErrorNoChildren = errors.New("process does not have children") // Deprecated: ErrorNoChildren is never returned by process.Children(), check its returned []*Process slice length instead + ErrorProcessNotRunning = errors.New("process does not exist") + ErrorNotPermitted = errors.New("operation not permitted") +) + +type Process struct { + Pid int32 `json:"pid"` + name string + status string + parent int32 + parentMutex sync.RWMutex // for windows ppid cache + numCtxSwitches *NumCtxSwitchesStat + uids []uint32 + gids []uint32 + groups []uint32 + numThreads int32 + memInfo *MemoryInfoStat + sigInfo *SignalInfoStat + createTime int64 + + lastCPUTimes *cpu.TimesStat + lastCPUTime time.Time + + tgid int32 +} + +// Process status +const ( + // Running marks a task a running or runnable (on the run queue) + Running = "running" + // Blocked marks a task waiting on a short, uninterruptible operation (usually I/O) + Blocked = "blocked" + // Idle marks a task sleeping for more than about 20 seconds + Idle = "idle" + // Lock marks a task waiting to acquire a lock + Lock = "lock" + // Sleep marks task waiting for short, interruptible operation + Sleep = "sleep" + // Stop marks a stopped process + Stop = "stop" + // Wait marks an idle interrupt thread (or paging in pre 2.6.xx Linux) + Wait = "wait" + // Zombie marks a defunct process, terminated but not reaped by its parent + Zombie = "zombie" + + // Solaris states. See https://github.com/collectd/collectd/blob/1da3305c10c8ff9a63081284cf3d4bb0f6daffd8/src/processes.c#L2115 + Daemon = "daemon" + Detached = "detached" + System = "system" + Orphan = "orphan" + + UnknownState = "" +) + +type OpenFilesStat struct { + Path string `json:"path"` + Fd uint64 `json:"fd"` +} + +type MemoryInfoStat struct { + RSS uint64 `json:"rss"` // bytes + VMS uint64 `json:"vms"` // bytes + HWM uint64 `json:"hwm"` // bytes + Data uint64 `json:"data"` // bytes + Stack uint64 `json:"stack"` // bytes + Locked uint64 `json:"locked"` // bytes + Swap uint64 `json:"swap"` // bytes +} + +type SignalInfoStat struct { + PendingProcess uint64 `json:"pending_process"` + PendingThread uint64 `json:"pending_thread"` + Blocked uint64 `json:"blocked"` + Ignored uint64 `json:"ignored"` + Caught uint64 `json:"caught"` +} + +type RlimitStat struct { + Resource int32 `json:"resource"` + Soft uint64 `json:"soft"` + Hard uint64 `json:"hard"` + Used uint64 `json:"used"` +} + +type IOCountersStat struct { + // ReadCount is a number of read I/O operations such as syscalls. + ReadCount uint64 `json:"readCount"` + // WriteCount is a number of read I/O operations such as syscalls. + WriteCount uint64 `json:"writeCount"` + // ReadBytes is a number of all I/O read in bytes. This includes disk I/O on Linux and Windows. + ReadBytes uint64 `json:"readBytes"` + // WriteBytes is a number of all I/O write in bytes. This includes disk I/O on Linux and Windows. + WriteBytes uint64 `json:"writeBytes"` + // DiskReadBytes is a number of disk I/O write in bytes. Currently only Linux has this value. + DiskReadBytes uint64 `json:"diskReadBytes"` + // DiskWriteBytes is a number of disk I/O read in bytes. Currently only Linux has this value. + DiskWriteBytes uint64 `json:"diskWriteBytes"` +} + +type NumCtxSwitchesStat struct { + Voluntary int64 `json:"voluntary"` + Involuntary int64 `json:"involuntary"` +} + +type PageFaultsStat struct { + MinorFaults uint64 `json:"minorFaults"` + MajorFaults uint64 `json:"majorFaults"` + ChildMinorFaults uint64 `json:"childMinorFaults"` + ChildMajorFaults uint64 `json:"childMajorFaults"` +} + +// Resource limit constants are from /usr/include/x86_64-linux-gnu/bits/resource.h +// from libc6-dev package in Ubuntu 16.10 +const ( + RLIMIT_CPU int32 = 0 + RLIMIT_FSIZE int32 = 1 + RLIMIT_DATA int32 = 2 + RLIMIT_STACK int32 = 3 + RLIMIT_CORE int32 = 4 + RLIMIT_RSS int32 = 5 + RLIMIT_NPROC int32 = 6 + RLIMIT_NOFILE int32 = 7 + RLIMIT_MEMLOCK int32 = 8 + RLIMIT_AS int32 = 9 + RLIMIT_LOCKS int32 = 10 + RLIMIT_SIGPENDING int32 = 11 + RLIMIT_MSGQUEUE int32 = 12 + RLIMIT_NICE int32 = 13 + RLIMIT_RTPRIO int32 = 14 + RLIMIT_RTTIME int32 = 15 +) + +func (p Process) String() string { + s, _ := json.Marshal(p) + return string(s) +} + +func (o OpenFilesStat) String() string { + s, _ := json.Marshal(o) + return string(s) +} + +func (m MemoryInfoStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +func (r RlimitStat) String() string { + s, _ := json.Marshal(r) + return string(s) +} + +func (i IOCountersStat) String() string { + s, _ := json.Marshal(i) + return string(s) +} + +func (p NumCtxSwitchesStat) String() string { + s, _ := json.Marshal(p) + return string(s) +} + +var enableBootTimeCache bool + +// EnableBootTimeCache change cache behavior of BootTime. If true, cache BootTime value. Default is false. +func EnableBootTimeCache(enable bool) { + enableBootTimeCache = enable +} + +// Pids returns a slice of process ID list which are running now. +func Pids() ([]int32, error) { + return PidsWithContext(context.Background()) +} + +func PidsWithContext(ctx context.Context) ([]int32, error) { + pids, err := pidsWithContext(ctx) + sort.Slice(pids, func(i, j int) bool { return pids[i] < pids[j] }) + return pids, err +} + +// Processes returns a slice of pointers to Process structs for all +// currently running processes. +func Processes() ([]*Process, error) { + return ProcessesWithContext(context.Background()) +} + +// NewProcess creates a new Process instance, it only stores the pid and +// checks that the process exists. Other method on Process can be used +// to get more information about the process. An error will be returned +// if the process does not exist. +func NewProcess(pid int32) (*Process, error) { + return NewProcessWithContext(context.Background(), pid) +} + +func NewProcessWithContext(ctx context.Context, pid int32) (*Process, error) { + p := &Process{ + Pid: pid, + } + + exists, err := PidExistsWithContext(ctx, pid) + if err != nil { + return p, err + } + if !exists { + return p, ErrorProcessNotRunning + } + p.CreateTimeWithContext(ctx) + return p, nil +} + +func PidExists(pid int32) (bool, error) { + return PidExistsWithContext(context.Background(), pid) +} + +// Background returns true if the process is in background, false otherwise. +func (p *Process) Background() (bool, error) { + return p.BackgroundWithContext(context.Background()) +} + +func (p *Process) BackgroundWithContext(ctx context.Context) (bool, error) { + fg, err := p.ForegroundWithContext(ctx) + if err != nil { + return false, err + } + return !fg, err +} + +// If interval is 0, return difference from last call(non-blocking). +// If interval > 0, wait interval sec and return difference between start and end. +func (p *Process) Percent(interval time.Duration) (float64, error) { + return p.PercentWithContext(context.Background(), interval) +} + +func (p *Process) PercentWithContext(ctx context.Context, interval time.Duration) (float64, error) { + cpuTimes, err := p.TimesWithContext(ctx) + if err != nil { + return 0, err + } + now := time.Now() + + if interval > 0 { + p.lastCPUTimes = cpuTimes + p.lastCPUTime = now + if err := common.Sleep(ctx, interval); err != nil { + return 0, err + } + cpuTimes, err = p.TimesWithContext(ctx) + now = time.Now() + if err != nil { + return 0, err + } + } else if p.lastCPUTimes == nil { + // invoked first time + p.lastCPUTimes = cpuTimes + p.lastCPUTime = now + return 0, nil + } + + numcpu := runtime.NumCPU() + delta := (now.Sub(p.lastCPUTime).Seconds()) * float64(numcpu) + ret := calculatePercent(p.lastCPUTimes, cpuTimes, delta, numcpu) + p.lastCPUTimes = cpuTimes + p.lastCPUTime = now + return ret, nil +} + +// IsRunning returns whether the process is still running or not. +func (p *Process) IsRunning() (bool, error) { + return p.IsRunningWithContext(context.Background()) +} + +func (p *Process) IsRunningWithContext(ctx context.Context) (bool, error) { + createTime, err := p.CreateTimeWithContext(ctx) + if err != nil { + return false, err + } + p2, err := NewProcessWithContext(ctx, p.Pid) + if errors.Is(err, ErrorProcessNotRunning) { + return false, nil + } + createTime2, err := p2.CreateTimeWithContext(ctx) + if err != nil { + return false, err + } + return createTime == createTime2, nil +} + +// CreateTime returns created time of the process in milliseconds since the epoch, in UTC. +func (p *Process) CreateTime() (int64, error) { + return p.CreateTimeWithContext(context.Background()) +} + +func (p *Process) CreateTimeWithContext(ctx context.Context) (int64, error) { + if p.createTime != 0 { + return p.createTime, nil + } + createTime, err := p.createTimeWithContext(ctx) + p.createTime = createTime + return p.createTime, err +} + +func calculatePercent(t1, t2 *cpu.TimesStat, delta float64, numcpu int) float64 { + if delta == 0 { + return 0 + } + // https://github.com/giampaolo/psutil/blob/c034e6692cf736b5e87d14418a8153bb03f6cf42/psutil/__init__.py#L1064 + deltaProc := (t2.User - t1.User) + (t2.System - t1.System) + if deltaProc <= 0 { + return 0 + } + overallPercent := ((deltaProc / delta) * 100) * float64(numcpu) + return overallPercent +} + +// MemoryPercent returns how many percent of the total RAM this process uses +func (p *Process) MemoryPercent() (float32, error) { + return p.MemoryPercentWithContext(context.Background()) +} + +func (p *Process) MemoryPercentWithContext(ctx context.Context) (float32, error) { + machineMemory, err := mem.VirtualMemoryWithContext(ctx) + if err != nil { + return 0, err + } + total := machineMemory.Total + + processMemory, err := p.MemoryInfoWithContext(ctx) + if err != nil { + return 0, err + } + used := processMemory.RSS + + return (100 * float32(used) / float32(total)), nil +} + +// CPUPercent returns how many percent of the CPU time this process uses +func (p *Process) CPUPercent() (float64, error) { + return p.CPUPercentWithContext(context.Background()) +} + +func (p *Process) CPUPercentWithContext(ctx context.Context) (float64, error) { + createTime, err := p.createTimeWithContext(ctx) + if err != nil { + return 0, err + } + + cput, err := p.TimesWithContext(ctx) + if err != nil { + return 0, err + } + + created := time.Unix(0, createTime*int64(time.Millisecond)) + totalTime := time.Since(created).Seconds() + if totalTime <= 0 { + return 0, nil + } + + return 100 * cput.Total() / totalTime, nil +} + +// Groups returns all group IDs(include supplementary groups) of the process as a slice of the int +func (p *Process) Groups() ([]uint32, error) { + return p.GroupsWithContext(context.Background()) +} + +// Ppid returns Parent Process ID of the process. +func (p *Process) Ppid() (int32, error) { + return p.PpidWithContext(context.Background()) +} + +// Name returns name of the process. +func (p *Process) Name() (string, error) { + return p.NameWithContext(context.Background()) +} + +// Exe returns executable path of the process. +func (p *Process) Exe() (string, error) { + return p.ExeWithContext(context.Background()) +} + +// Cmdline returns the command line arguments of the process as a string with +// each argument separated by 0x20 ascii character. +func (p *Process) Cmdline() (string, error) { + return p.CmdlineWithContext(context.Background()) +} + +// CmdlineSlice returns the command line arguments of the process as a slice with each +// element being an argument. +// +// On Windows, this assumes the command line is encoded according to the convention accepted by +// [golang.org/x/sys/windows.CmdlineToArgv] (the most common convention). If this is not suitable, +// you should instead use [Process.Cmdline] and parse the command line according to your specific +// requirements. +func (p *Process) CmdlineSlice() ([]string, error) { + return p.CmdlineSliceWithContext(context.Background()) +} + +// Cwd returns current working directory of the process. +func (p *Process) Cwd() (string, error) { + return p.CwdWithContext(context.Background()) +} + +// Parent returns parent Process of the process. +func (p *Process) Parent() (*Process, error) { + return p.ParentWithContext(context.Background()) +} + +// ParentWithContext returns parent Process of the process. +func (p *Process) ParentWithContext(ctx context.Context) (*Process, error) { + ppid, err := p.PpidWithContext(ctx) + if err != nil { + return nil, err + } + return NewProcessWithContext(ctx, ppid) +} + +// Status returns the process status. +// Return value could be one of these. +// R: Running S: Sleep T: Stop I: Idle +// Z: Zombie W: Wait L: Lock +// The character is same within all supported platforms. +func (p *Process) Status() ([]string, error) { + return p.StatusWithContext(context.Background()) +} + +// Foreground returns true if the process is in foreground, false otherwise. +func (p *Process) Foreground() (bool, error) { + return p.ForegroundWithContext(context.Background()) +} + +// Uids returns user ids of the process as a slice of the int +func (p *Process) Uids() ([]uint32, error) { + return p.UidsWithContext(context.Background()) +} + +// Gids returns group ids of the process as a slice of the int +func (p *Process) Gids() ([]uint32, error) { + return p.GidsWithContext(context.Background()) +} + +// Terminal returns a terminal which is associated with the process. +func (p *Process) Terminal() (string, error) { + return p.TerminalWithContext(context.Background()) +} + +// Nice returns a nice value (priority). +func (p *Process) Nice() (int32, error) { + return p.NiceWithContext(context.Background()) +} + +// IOnice returns process I/O nice value (priority). +func (p *Process) IOnice() (int32, error) { + return p.IOniceWithContext(context.Background()) +} + +// Rlimit returns Resource Limits. +func (p *Process) Rlimit() ([]RlimitStat, error) { + return p.RlimitWithContext(context.Background()) +} + +// RlimitUsage returns Resource Limits. +// If gatherUsed is true, the currently used value will be gathered and added +// to the resulting RlimitStat. +func (p *Process) RlimitUsage(gatherUsed bool) ([]RlimitStat, error) { + return p.RlimitUsageWithContext(context.Background(), gatherUsed) +} + +// IOCounters returns IO Counters. +func (p *Process) IOCounters() (*IOCountersStat, error) { + return p.IOCountersWithContext(context.Background()) +} + +// NumCtxSwitches returns the number of the context switches of the process. +func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) { + return p.NumCtxSwitchesWithContext(context.Background()) +} + +// NumFDs returns the number of File Descriptors used by the process. +func (p *Process) NumFDs() (int32, error) { + return p.NumFDsWithContext(context.Background()) +} + +// NumThreads returns the number of threads used by the process. +func (p *Process) NumThreads() (int32, error) { + return p.NumThreadsWithContext(context.Background()) +} + +func (p *Process) Threads() (map[int32]*cpu.TimesStat, error) { + return p.ThreadsWithContext(context.Background()) +} + +// Times returns CPU times of the process. +func (p *Process) Times() (*cpu.TimesStat, error) { + return p.TimesWithContext(context.Background()) +} + +// CPUAffinity returns CPU affinity of the process. +func (p *Process) CPUAffinity() ([]int32, error) { + return p.CPUAffinityWithContext(context.Background()) +} + +// MemoryInfo returns generic process memory information, +// such as RSS and VMS. +func (p *Process) MemoryInfo() (*MemoryInfoStat, error) { + return p.MemoryInfoWithContext(context.Background()) +} + +// MemoryInfoEx returns platform-specific process memory information. +func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) { + return p.MemoryInfoExWithContext(context.Background()) +} + +// PageFaults returns the process's page fault counters. +func (p *Process) PageFaults() (*PageFaultsStat, error) { + return p.PageFaultsWithContext(context.Background()) +} + +// Children returns the children of the process represented as a slice +// of pointers to Process type. +func (p *Process) Children() ([]*Process, error) { + return p.ChildrenWithContext(context.Background()) +} + +// OpenFiles returns a slice of OpenFilesStat opend by the process. +// OpenFilesStat includes a file path and file descriptor. +func (p *Process) OpenFiles() ([]OpenFilesStat, error) { + return p.OpenFilesWithContext(context.Background()) +} + +// Connections returns a slice of net.ConnectionStat used by the process. +// This returns all kind of the connection. This means TCP, UDP or UNIX. +func (p *Process) Connections() ([]net.ConnectionStat, error) { + return p.ConnectionsWithContext(context.Background()) +} + +// ConnectionsMax returns a slice of net.ConnectionStat used by the process at most `max`. +func (p *Process) ConnectionsMax(maxConn int) ([]net.ConnectionStat, error) { + return p.ConnectionsMaxWithContext(context.Background(), maxConn) +} + +// MemoryMaps get memory maps from /proc/(pid)/smaps +func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) { + return p.MemoryMapsWithContext(context.Background(), grouped) +} + +// Tgid returns thread group id of the process. +func (p *Process) Tgid() (int32, error) { + return p.TgidWithContext(context.Background()) +} + +// SendSignal sends a unix.Signal to the process. +func (p *Process) SendSignal(sig Signal) error { + return p.SendSignalWithContext(context.Background(), sig) +} + +// Suspend sends SIGSTOP to the process. +func (p *Process) Suspend() error { + return p.SuspendWithContext(context.Background()) +} + +// Resume sends SIGCONT to the process. +func (p *Process) Resume() error { + return p.ResumeWithContext(context.Background()) +} + +// Terminate sends SIGTERM to the process. +func (p *Process) Terminate() error { + return p.TerminateWithContext(context.Background()) +} + +// Kill sends SIGKILL to the process. +func (p *Process) Kill() error { + return p.KillWithContext(context.Background()) +} + +// Username returns a username of the process. +func (p *Process) Username() (string, error) { + return p.UsernameWithContext(context.Background()) +} + +// Environ returns the environment variables of the process. +func (p *Process) Environ() ([]string, error) { + return p.EnvironWithContext(context.Background()) +} + +// convertStatusChar as reported by the ps command across different platforms. +func convertStatusChar(letter string) string { + // Sources + // Darwin: http://www.mywebuniversity.com/Man_Pages/Darwin/man_ps.html + // FreeBSD: https://www.freebsd.org/cgi/man.cgi?ps + // Linux https://man7.org/linux/man-pages/man1/ps.1.html + // OpenBSD: https://man.openbsd.org/ps.1#state + // Solaris: https://github.com/collectd/collectd/blob/1da3305c10c8ff9a63081284cf3d4bb0f6daffd8/src/processes.c#L2115 + switch letter { + case "A": + return Daemon + case "D", "U": + return Blocked + case "E": + return Detached + case "I": + return Idle + case "L": + return Lock + case "O": + return Orphan + case "R": + return Running + case "S": + return Sleep + case "T", "t": + // "t" is used by Linux to signal stopped by the debugger during tracing + return Stop + case "W": + return Wait + case "Y": + return System + case "Z": + return Zombie + default: + return UnknownState + } +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_bsd.go b/vendor/github.com/shirou/gopsutil/v4/process/process_bsd.go new file mode 100644 index 00000000..d094d389 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_bsd.go @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin || freebsd || openbsd + +package process + +import ( + "bytes" + "context" + "encoding/binary" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" +) + +type MemoryInfoExStat struct{} + +type MemoryMapsStat struct{} + +func (*Process) TgidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) IOniceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) EnvironWithContext(_ context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +func parseKinfoProc(buf []byte) (KinfoProc, error) { + var k KinfoProc + br := bytes.NewReader(buf) + err := binary.Read(br, binary.LittleEndian, &k) + return k, err +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go new file mode 100644 index 00000000..35c34adb --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go @@ -0,0 +1,523 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin + +package process + +import ( + "bytes" + "context" + "encoding/binary" + "errors" + "fmt" + "path/filepath" + "runtime" + "sort" + "strconv" + "strings" + "unsafe" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/net" +) + +// copied from sys/sysctl.h +const ( + CTLKern = 1 // "high kernel": proc, limits + KernProc = 14 // struct: process entries + KernProcPID = 1 // by process id + KernProcProc = 8 // only return procs + KernProcAll = 0 // everything + KernProcPathname = 12 // path to executable +) + +type _Ctype_struct___0 struct { //nolint:revive //FIXME + Pad uint64 +} + +func pidsWithContext(_ context.Context) ([]int32, error) { + var ret []int32 + + kprocs, err := unix.SysctlKinfoProcSlice("kern.proc.all") + if err != nil { + return ret, err + } + + for i := range kprocs { + proc := &kprocs[i] + ret = append(ret, int32(proc.Proc.P_pid)) + } + + return ret, nil +} + +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Eproc.Ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + + name := common.ByteToString(k.Proc.P_comm[:]) + + if len(name) >= 15 { + cmdName, err := p.cmdNameWithContext(ctx) + if err != nil { + return "", err + } + if cmdName != "" { + extendedName := filepath.Base(cmdName) + if strings.HasPrefix(extendedName, p.name) { + name = extendedName + } + } + } + + return name, nil +} + +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Proc.P_starttime.Sec*1000 + int64(k.Proc.P_starttime.Usec)/1000, nil +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + r, err := callPsWithContext(ctx, "state", p.Pid, false, false) + if err != nil { + return []string{""}, err + } + status := convertStatusChar(r[0][0][0:1]) + return []string{status}, err +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + out, err := invoke.CommandWithContext(ctx, "ps", "-o", "stat=", "-p", strconv.Itoa(int(pid))) + if err != nil { + return false, err + } + return strings.IndexByte(string(out), '+') != -1, nil +} + +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + // See: http://unix.superglobalmegacorp.com/Net2/newsrc/sys/ucred.h.html + userEffectiveUID := uint32(k.Eproc.Ucred.Uid) + + return []uint32{userEffectiveUID}, nil +} + +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + gids := make([]uint32, 0, 3) + gids = append(gids, uint32(k.Eproc.Pcred.P_rgid), uint32(k.Eproc.Ucred.Groups[0]), uint32(k.Eproc.Pcred.P_svgid)) + + return gids, nil +} + +func (*Process) GroupsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError + // k, err := p.getKProc() + // if err != nil { + // return nil, err + // } + + // groups := make([]int32, k.Eproc.Ucred.Ngroups) + // for i := int16(0); i < k.Eproc.Ucred.Ngroups; i++ { + // groups[i] = int32(k.Eproc.Ucred.Groups[i]) + // } + + // return groups, nil +} + +func (*Process) TerminalWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError + /* + k, err := p.getKProc() + if err != nil { + return "", err + } + + ttyNr := uint64(k.Eproc.Tdev) + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + + return termmap[ttyNr], nil + */ +} + +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int32(k.Proc.P_nice), nil +} + +func (*Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + procs, err := ProcessesWithContext(ctx) + if err != nil { + return nil, nil + } + ret := make([]*Process, 0, len(procs)) + for _, proc := range procs { + ppid, err := proc.PpidWithContext(ctx) + if err != nil { + continue + } + if ppid == p.Pid { + ret = append(ret, proc) + } + } + sort.Slice(ret, func(i, j int) bool { return ret[i].Pid < ret[j].Pid }) + return ret, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { + return net.ConnectionsPidMaxWithContext(ctx, "all", p.Pid, maxConn) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, err + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +// Returns a proc as defined here: +// http://unix.superglobalmegacorp.com/Net2/newsrc/sys/kinfo_proc.h.html +func (p *Process) getKProc() (*unix.KinfoProc, error) { + return unix.SysctlKinfoProc("kern.proc.pid", int(p.Pid)) +} + +// call ps command. +// Return value deletes Header line(you must not input wrong arg). +// And split by Space. Caller have responsibility to manage. +// If passed arg pid is 0, get information from all process. +func callPsWithContext(ctx context.Context, arg string, pid int32, threadOption, nameOption bool) ([][]string, error) { + var cmd []string + switch { + case pid == 0: // will get from all processes. + cmd = []string{"-ax", "-o", arg} + case threadOption: + cmd = []string{"-x", "-o", arg, "-M", "-p", strconv.Itoa(int(pid))} + default: + cmd = []string{"-x", "-o", arg, "-p", strconv.Itoa(int(pid))} + } + if nameOption { + cmd = append(cmd, "-c") + } + out, err := invoke.CommandWithContext(ctx, "ps", cmd...) + if err != nil { + return [][]string{}, err + } + lines := strings.Split(string(out), "\n") + + var ret [][]string + for _, l := range lines[1:] { + var lr []string + if nameOption { + lr = append(lr, l) + } else { + for _, r := range strings.Split(l, " ") { + if r == "" { + continue + } + lr = append(lr, strings.TrimSpace(r)) + } + } + if len(lr) != 0 { + ret = append(ret, lr) + } + } + + return ret, nil +} + +type dlFuncs struct { + lib *common.SystemLib +} + +func loadProcFuncs() (*dlFuncs, error) { + lib, err := common.NewSystemLib() + if err != nil { + return nil, err + } + return &dlFuncs{lib}, err +} + +func (f *dlFuncs) getTimeScaleToNanoSeconds() float64 { + var timeBaseInfo common.MachTimeBaseInfo + + f.lib.MachTimeBaseInfo(uintptr(unsafe.Pointer(&timeBaseInfo))) + + return float64(timeBaseInfo.Numer) / float64(timeBaseInfo.Denom) +} + +func (f *dlFuncs) Close() { + f.lib.Close() +} + +func (p *Process) ExeWithContext(_ context.Context) (string, error) { + funcs, err := loadProcFuncs() + if err != nil { + return "", err + } + defer funcs.Close() + + buf := common.NewCStr(common.PROC_PIDPATHINFO_MAXSIZE) + ret := funcs.lib.ProcPidPath(p.Pid, buf.Addr(), common.PROC_PIDPATHINFO_MAXSIZE) + + if ret <= 0 { + return "", fmt.Errorf("unknown error: proc_pidpath returned %d", ret) + } + + return buf.GoString(), nil +} + +// CwdWithContext retrieves the Current Working Directory for the given process. +// It uses the proc_pidinfo from libproc and will only work for processes the +// EUID can access. Otherwise "operation not permitted" will be returned as the +// error. +// Note: This might also work for other *BSD OSs. +func (p *Process) CwdWithContext(_ context.Context) (string, error) { + funcs, err := loadProcFuncs() + if err != nil { + return "", err + } + defer funcs.Close() + + // Lock OS thread to ensure the errno does not change + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + var vpi vnodePathInfo + const vpiSize = int32(unsafe.Sizeof(vpi)) + ret := funcs.lib.ProcPidInfo(p.Pid, common.PROC_PIDVNODEPATHINFO, 0, uintptr(unsafe.Pointer(&vpi)), vpiSize) + errno, _ := funcs.lib.Dlsym("errno") + err = *(**unix.Errno)(unsafe.Pointer(&errno)) + if errors.Is(err, unix.EPERM) { + return "", ErrorNotPermitted + } + + if ret <= 0 { + return "", fmt.Errorf("unknown error: proc_pidinfo returned %d", ret) + } + + if ret != vpiSize { + return "", fmt.Errorf("too few bytes; expected %d, got %d", vpiSize, ret) + } + return common.GoString((*byte)(unsafe.Pointer(&vpi.Cdir.Path[0]))), nil +} + +func procArgs(pid int32) ([]byte, int, error) { + procargs, err := unix.SysctlRaw("kern.procargs2", int(pid)) + if err != nil { + return nil, 0, err + } + + // The first 4 bytes indicate the number of arguments. + nargs := procargs[:4] + return procargs, int(binary.LittleEndian.Uint32(nargs)), nil +} + +func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { + return p.cmdlineSlice() +} + +func (p *Process) cmdlineSlice() ([]string, error) { + pargs, nargs, err := procArgs(p.Pid) + if err != nil { + return nil, err + } + // The first bytes hold the nargs int, skip it. + args := bytes.Split((pargs)[unsafe.Sizeof(int(0)):], []byte{0}) + var argStr string + // The first element is the actual binary/command path. + // command := args[0] + var argSlice []string + // var envSlice []string + // All other, non-zero elements are arguments. The first "nargs" elements + // are the arguments. Everything else in the slice is then the environment + // of the process. + for _, arg := range args[1:] { + argStr = string(arg) + if argStr != "" { + if nargs > 0 { + argSlice = append(argSlice, argStr) + nargs-- + continue + } + break + // envSlice = append(envSlice, argStr) + } + } + return argSlice, err +} + +// cmdNameWithContext returns the command name (including spaces) without any arguments +func (p *Process) cmdNameWithContext(_ context.Context) (string, error) { + r, err := p.cmdlineSlice() + if err != nil { + return "", err + } + + if len(r) == 0 { + return "", nil + } + + return r[0], err +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + r, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + return strings.Join(r, " "), err +} + +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { + funcs, err := loadProcFuncs() + if err != nil { + return 0, err + } + defer funcs.Close() + + var ti ProcTaskInfo + funcs.lib.ProcPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), int32(unsafe.Sizeof(ti))) + + return int32(ti.Threadnum), nil +} + +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { + funcs, err := loadProcFuncs() + if err != nil { + return nil, err + } + defer funcs.Close() + + var ti ProcTaskInfo + funcs.lib.ProcPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), int32(unsafe.Sizeof(ti))) + + timescaleToNanoSeconds := funcs.getTimeScaleToNanoSeconds() + ret := &cpu.TimesStat{ + CPU: "cpu", + User: float64(ti.Total_user) * timescaleToNanoSeconds / 1e9, + System: float64(ti.Total_system) * timescaleToNanoSeconds / 1e9, + } + return ret, nil +} + +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { + funcs, err := loadProcFuncs() + if err != nil { + return nil, err + } + defer funcs.Close() + + var ti ProcTaskInfo + funcs.lib.ProcPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), int32(unsafe.Sizeof(ti))) + + ret := &MemoryInfoStat{ + RSS: uint64(ti.Resident_size), + VMS: uint64(ti.Virtual_size), + } + return ret, nil +} + +// procFDInfo represents a file descriptor entry from sys/proc_info.h +type procFDInfo struct { + ProcFd int32 + ProcFdtype uint32 +} + +// NumFDsWithContext returns the number of file descriptors used by the process. +// It uses proc_pidinfo with PROC_PIDLISTFDS to query the kernel for the count +// of open file descriptors. The method makes a single syscall and calculates +// the count from the buffer size returned by the kernel. +func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) { + funcs, err := loadProcFuncs() + if err != nil { + return 0, err + } + defer funcs.Close() + + // First call: get required buffer size + bufferSize := funcs.lib.ProcPidInfo( + p.Pid, + common.PROC_PIDLISTFDS, + 0, + 0, // NULL buffer + 0, // 0 size + ) + if bufferSize <= 0 { + return 0, fmt.Errorf("unknown error: proc_pidinfo returned %d", bufferSize) + } + + // Allocate buffer of the required size + const sizeofProcFDInfo = int32(unsafe.Sizeof(procFDInfo{})) + numEntries := bufferSize / sizeofProcFDInfo + buf := make([]procFDInfo, numEntries) + + // Second call: get actual data + ret := funcs.lib.ProcPidInfo( + p.Pid, + common.PROC_PIDLISTFDS, + 0, + uintptr(unsafe.Pointer(&buf[0])), // Real buffer + bufferSize, // Size from first call + ) + if ret <= 0 { + return 0, fmt.Errorf("unknown error: proc_pidinfo returned %d", ret) + } + + // Calculate actual number of FDs returned + numFDs := ret / sizeofProcFDInfo + return numFDs, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_darwin_amd64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin_amd64.go new file mode 100644 index 00000000..a40f9619 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin_amd64.go @@ -0,0 +1,303 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_darwin.go + +package process + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type UGid_t uint32 + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Eproc struct { + Paddr *uint64 + Sess *Session + Pcred Upcred + Ucred Uucred + Pad_cgo_0 [4]byte + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Pad_cgo_1 [2]byte + Tdev int32 + Tpgid int32 + Pad_cgo_2 [4]byte + Tsess *Session + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Pad_cgo_3 [2]byte + Flag int32 + Login [12]int8 + Spare [4]int32 + Pad_cgo_4 [4]byte +} + +type Proc struct{} + +type Session struct{} + +type ucred struct { + Link _Ctype_struct___0 + Ref uint64 + Posix Posix_cred + Label *Label + Audit Au_session +} + +type Uucred struct { + Ref int32 + UID uint32 + Ngroups int16 + Pad_cgo_0 [2]byte + Groups [16]uint32 +} + +type Upcred struct { + Pc_lock [72]int8 + Pc_ucred *ucred + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + Pad_cgo_0 [4]byte +} + +type Vmspace struct { + Dummy int32 + Pad_cgo_0 [4]byte + Dummy2 *int8 + Dummy3 [5]int32 + Pad_cgo_1 [4]byte + Dummy4 [3]*int8 +} + +type Sigacts struct{} + +type ExternProc struct { + P_un [16]byte + P_vmspace uint64 + P_sigacts uint64 + Pad_cgo_0 [3]byte + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + Pad_cgo_1 [4]byte + User_stack uint64 + Exit_thread uint64 + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + Pad_cgo_2 [4]byte + P_wchan uint64 + P_wmesg uint64 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + Pad_cgo_3 [4]byte + P_tracep uint64 + P_siglist int32 + Pad_cgo_4 [4]byte + P_textvp uint64 + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + Pad_cgo_5 [4]byte + P_pgrp uint64 + P_addr uint64 + P_xstat uint16 + P_acflag uint16 + Pad_cgo_6 [4]byte + P_ru uint64 +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type Vnode struct{} + +type Pgrp struct{} + +type UserStruct struct{} + +type Au_session struct { + Aia_p *AuditinfoAddr + Mask AuMask +} + +type Posix_cred struct { + UID uint32 + Ruid uint32 + Svuid uint32 + Ngroups int16 + Pad_cgo_0 [2]byte + Groups [16]uint32 + Rgid uint32 + Svgid uint32 + Gmuid uint32 + Flags int32 +} + +type Label struct{} + +type ProcTaskInfo struct { + Virtual_size uint64 + Resident_size uint64 + Total_user uint64 + Total_system uint64 + Threads_user uint64 + Threads_system uint64 + Policy int32 + Faults int32 + Pageins int32 + Cow_faults int32 + Messages_sent int32 + Messages_received int32 + Syscalls_mach int32 + Syscalls_unix int32 + Csw int32 + Threadnum int32 + Numrunning int32 + Priority int32 +} + +type vinfoStat struct { + Dev uint32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Atime int64 + Atimensec int64 + Mtime int64 + Mtimensec int64 + Ctime int64 + Ctimensec int64 + Birthtime int64 + Birthtimensec int64 + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Rdev uint32 + Qspare [2]int64 +} + +type fsid struct { + Val [2]int32 +} + +type vnodeInfo struct { + Stat vinfoStat + Type int32 + Pad int32 + Fsid fsid +} + +type vnodeInfoPath struct { + Vi vnodeInfo + Path [1024]int8 +} + +type vnodePathInfo struct { + Cdir vnodeInfoPath + Rdir vnodeInfoPath +} + +type AuditinfoAddr struct { + Auid uint32 + Mask AuMask + Termid AuTidAddr + Asid int32 + Flags uint64 +} + +type AuMask struct { + Success uint32 + Failure uint32 +} + +type AuTidAddr struct { + Port int32 + Type uint32 + Addr [4]uint32 +} + +type UcredQueue struct { + Next *ucred + Prev **ucred +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_darwin_arm64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin_arm64.go new file mode 100644 index 00000000..7ab1afb1 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin_arm64.go @@ -0,0 +1,279 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build darwin && arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_darwin.go + +package process + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type UGid_t uint32 + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Eproc struct { + Paddr *Proc + Sess *Session + Pcred Upcred + Ucred Uucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess *Session + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + Pad_cgo_0 [4]byte +} + +type Proc struct{} + +type Session struct{} + +type ucred struct{} + +type Uucred struct { + Ref int32 + UID uint32 + Ngroups int16 + Groups [16]uint32 +} + +type Upcred struct { + Pc_lock [72]int8 + Pc_ucred *ucred + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + Pad_cgo_0 [4]byte +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Sigacts struct{} + +type ExternProc struct { + P_un [16]byte + P_vmspace uint64 + P_sigacts uint64 + Pad_cgo_0 [3]byte + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + Pad_cgo_1 [4]byte + User_stack uint64 + Exit_thread uint64 + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + Pad_cgo_2 [4]byte + P_wchan uint64 + P_wmesg uint64 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + Pad_cgo_3 [4]byte + P_tracep uint64 + P_siglist int32 + Pad_cgo_4 [4]byte + P_textvp uint64 + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + Pad_cgo_5 [4]byte + P_pgrp uint64 + P_addr uint64 + P_xstat uint16 + P_acflag uint16 + Pad_cgo_6 [4]byte + P_ru uint64 +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type Vnode struct{} + +type Pgrp struct{} + +type UserStruct struct{} + +type Au_session struct { + Aia_p *AuditinfoAddr + Mask AuMask +} + +type Posix_cred struct{} + +type Label struct{} + +type ProcTaskInfo struct { + Virtual_size uint64 + Resident_size uint64 + Total_user uint64 + Total_system uint64 + Threads_user uint64 + Threads_system uint64 + Policy int32 + Faults int32 + Pageins int32 + Cow_faults int32 + Messages_sent int32 + Messages_received int32 + Syscalls_mach int32 + Syscalls_unix int32 + Csw int32 + Threadnum int32 + Numrunning int32 + Priority int32 +} + +type vinfoStat struct { + Dev uint32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Atime int64 + Atimensec int64 + Mtime int64 + Mtimensec int64 + Ctime int64 + Ctimensec int64 + Birthtime int64 + Birthtimensec int64 + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Rdev uint32 + Qspare [2]int64 +} + +type fsid struct { + Val [2]int32 +} + +type vnodeInfo struct { + Stat vinfoStat + Type int32 + Pad int32 + Fsid fsid +} + +type vnodeInfoPath struct { + Vi vnodeInfo + Path [1024]int8 +} + +type vnodePathInfo struct { + Cdir vnodeInfoPath + Rdir vnodeInfoPath +} + +type AuditinfoAddr struct { + Auid uint32 + Mask AuMask + Termid AuTidAddr + Asid int32 + Flags uint64 +} +type AuMask struct { + Success uint32 + Failure uint32 +} +type AuTidAddr struct { + Port int32 + Type uint32 + Addr [4]uint32 +} + +type UcredQueue struct { + Next *ucred + Prev **ucred +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_fallback.go b/vendor/github.com/shirou/gopsutil/v4/process/process_fallback.go new file mode 100644 index 00000000..699311a9 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_fallback.go @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build !darwin && !linux && !freebsd && !openbsd && !windows && !solaris && !plan9 + +package process + +import ( + "context" + "syscall" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/net" +) + +type Signal = syscall.Signal + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +type MemoryInfoExStat struct{} + +func pidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func ProcessesWithContext(_ context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func PidExistsWithContext(_ context.Context, _ int32) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (*Process) PpidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) NameWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) TgidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) ExeWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) CmdlineWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) createTimeWithContext(_ context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) CwdWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) StatusWithContext(_ context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (*Process) ForegroundWithContext(_ context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (*Process) UidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GroupsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) TerminalWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) NiceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) IOniceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) NumFDsWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) NumThreadsWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ChildrenWithContext(_ context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) SendSignalWithContext(_ context.Context, _ Signal) error { + return common.ErrNotImplementedError +} + +func (*Process) SuspendWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) ResumeWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) TerminateWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) KillWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) UsernameWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) EnvironWithContext(_ context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go new file mode 100644 index 00000000..283af9bb --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go @@ -0,0 +1,367 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build freebsd + +package process + +import ( + "bytes" + "context" + "encoding/binary" + "errors" + "path/filepath" + "sort" + "strconv" + "strings" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/net" +) + +func pidsWithContext(ctx context.Context) ([]int32, error) { + var ret []int32 + procs, err := ProcessesWithContext(ctx) + if err != nil { + return ret, nil + } + + for _, p := range procs { + ret = append(ret, p.Pid) + } + + return ret, nil +} + +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + name := common.IntToString(k.Comm[:]) + + if len(name) >= 15 { + cmdlineSlice, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + if len(cmdlineSlice) > 0 { + extendedName := filepath.Base(cmdlineSlice[0]) + if strings.HasPrefix(extendedName, p.name) { + name = extendedName + } + } + } + + return name, nil +} + +func (p *Process) CwdWithContext(_ context.Context) (string, error) { + mib := []int32{CTLKern, KernProc, KernProcCwd, p.Pid} + buf, length, err := common.CallSyscall(mib) + if err != nil { + return "", err + } + + if length != sizeOfKinfoFile { + return "", errors.New("unexpected size of KinfoFile") + } + + var k kinfoFile + br := bytes.NewReader(buf) + if err := binary.Read(br, binary.LittleEndian, &k); err != nil { + return "", err + } + cwd := common.IntToString(k.Path[:]) + + return cwd, nil +} + +func (p *Process) ExeWithContext(_ context.Context) (string, error) { + mib := []int32{CTLKern, KernProc, KernProcPathname, p.Pid} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return "", err + } + + return strings.Trim(string(buf), "\x00"), nil +} + +func (p *Process) CmdlineWithContext(_ context.Context) (string, error) { + mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return "", err + } + ret := strings.FieldsFunc(string(buf), func(r rune) bool { + return r == '\u0000' + }) + + return strings.Join(ret, " "), nil +} + +func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { + mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + if len(buf) == 0 { + return nil, nil + } + if buf[len(buf)-1] == 0 { + buf = buf[:len(buf)-1] + } + parts := bytes.Split(buf, []byte{0}) + var strParts []string + for _, p := range parts { + strParts = append(strParts, string(p)) + } + + return strParts, nil +} + +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int64(k.Start.Sec)*1000 + int64(k.Start.Usec)/1000, nil +} + +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { + k, err := p.getKProc() + if err != nil { + return []string{""}, err + } + var s string + switch k.Stat { + case SIDL: + s = Idle + case SRUN: + s = Running + case SSLEEP: + s = Sleep + case SSTOP: + s = Stop + case SZOMB: + s = Zombie + case SWAIT: + s = Wait + case SLOCK: + s = Lock + } + + return []string{s}, nil +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + out, err := invoke.CommandWithContext(ctx, "ps", "-o", "stat=", "-p", strconv.Itoa(int(pid))) + if err != nil { + return false, err + } + return strings.IndexByte(string(out), '+') != -1, nil +} + +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + uids := make([]uint32, 0, 3) + + uids = append(uids, uint32(k.Ruid), uint32(k.Uid), uint32(k.Svuid)) + + return uids, nil +} + +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + gids := make([]uint32, 0, 3) + gids = append(gids, uint32(k.Rgid), uint32(k.Ngroups), uint32(k.Svgid)) + + return gids, nil +} + +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + groups := make([]uint32, k.Ngroups) + for i := int16(0); i < k.Ngroups; i++ { + groups[i] = uint32(k.Groups[i]) + } + + return groups, nil +} + +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + + ttyNr := uint64(k.Tdev) + + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + + return termmap[ttyNr], nil +} + +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int32(k.Nice), nil +} + +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &IOCountersStat{ + ReadCount: uint64(k.Rusage.Inblock), + WriteCount: uint64(k.Rusage.Oublock), + }, nil +} + +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Numthreads, nil +} + +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &cpu.TimesStat{ + CPU: "cpu", + User: float64(k.Rusage.Utime.Sec) + float64(k.Rusage.Utime.Usec)/1000000, + System: float64(k.Rusage.Stime.Sec) + float64(k.Rusage.Stime.Usec)/1000000, + }, nil +} + +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + v, err := unix.Sysctl("vm.stats.vm.v_page_size") + if err != nil { + return nil, err + } + pageSize := binary.LittleEndian.Uint16([]byte(v)) + + return &MemoryInfoStat{ + RSS: uint64(k.Rssize) * uint64(pageSize), + VMS: uint64(k.Size), + }, nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + procs, err := ProcessesWithContext(ctx) + if err != nil { + return nil, nil + } + ret := make([]*Process, 0, len(procs)) + for _, proc := range procs { + ppid, err := proc.PpidWithContext(ctx) + if err != nil { + continue + } + if ppid == p.Pid { + ret = append(ret, proc) + } + } + sort.Slice(ret, func(i, j int) bool { return ret[i].Pid < ret[j].Pid }) + return ret, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { + return net.ConnectionsPidMaxWithContext(ctx, "all", p.Pid, maxConn) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + results := []*Process{} + + mib := []int32{CTLKern, KernProc, KernProcProc, 0} + buf, length, err := common.CallSyscall(mib) + if err != nil { + return results, err + } + + // get kinfo_proc size + count := int(length / uint64(sizeOfKinfoProc)) + + // parse buf to procs + for i := 0; i < count; i++ { + b := buf[i*sizeOfKinfoProc : (i+1)*sizeOfKinfoProc] + k, err := parseKinfoProc(b) + if err != nil { + continue + } + p, err := NewProcessWithContext(ctx, int32(k.Pid)) + if err != nil { + continue + } + + results = append(results, p) + } + + return results, nil +} + +func (*Process) NumFDsWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) getKProc() (*KinfoProc, error) { + mib := []int32{CTLKern, KernProc, KernProcPID, p.Pid} + + buf, length, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + if length != sizeOfKinfoProc { + return nil, errors.New("unexpected size of KinfoProc") + } + + k, err := parseKinfoProc(buf) + if err != nil { + return nil, err + } + return &k, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go new file mode 100644 index 00000000..0193ba25 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go @@ -0,0 +1,218 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 + KernProcCwd = 42 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x300 + sizeOfKinfoFile = 0x570 // TODO: should be changed by running on the target machine +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int32 + Nsec int32 +} + +type Timeval struct { + Sec int32 + Usec int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args int32 /* pargs */ + Paddr int32 /* proc */ + Addr int32 /* user */ + Tracep int32 /* vnode */ + Textvp int32 /* vnode */ + Fd int32 /* filedesc */ + Vmspace int32 /* vmspace */ + Wchan int32 + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint32 + Rssize int32 + Swrss int32 + Tsize int32 + Dsize int32 + Ssize int32 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int32 + Kiflag int32 + Traceflag int32 + Stat int8 + Nice int8 + Lock int8 + Rqindex int8 + Oncpu uint8 + Lastcpu uint8 + Tdname [17]int8 + Wmesg [9]int8 + Login [18]int8 + Lockname [9]int8 + Comm [20]int8 + Emul [17]int8 + Loginclass [18]int8 + Sparestrings [50]int8 + Spareints [7]int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb int32 /* pcb */ + Kstack int32 + Udata int32 + Tdaddr int32 /* thread */ + Spareptrs [6]int32 + Sparelongs [12]int32 + Sflag int32 + Tdflags int32 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev uint32 + Vn_mode uint16 + Status uint16 + X_kve_ispare [12]int32 + Path [1024]int8 +} + +// TODO: should be changed by running on the target machine +type kinfoFile struct { + Structsize int32 + Type int32 + Fd int32 + Ref_count int32 + Flags int32 + Pad0 int32 + Offset int64 + Anon0 [304]byte + Status uint16 + Pad1 uint16 + X_kf_ispare0 int32 + Cap_rights capRights + X_kf_cap_spare uint64 + Path [1024]int8 // changed from uint8 by hand +} + +// TODO: should be changed by running on the target machine +type capRights struct { + Rights [2]uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go new file mode 100644 index 00000000..67970f64 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 + KernProcCwd = 42 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x440 + sizeOfKinfoFile = 0x570 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args int64 /* pargs */ + Paddr int64 /* proc */ + Addr int64 /* user */ + Tracep int64 /* vnode */ + Textvp int64 /* vnode */ + Fd int64 /* filedesc */ + Vmspace int64 /* vmspace */ + Wchan int64 + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev_freebsd11 uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint64 + Rssize int64 + Swrss int64 + Tsize int64 + Dsize int64 + Ssize int64 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int64 + Kiflag int64 + Traceflag int32 + Stat int8 + Nice int8 + Lock int8 + Rqindex int8 + Oncpu_old uint8 + Lastcpu_old uint8 + Tdname [17]int8 + Wmesg [9]int8 + Login [18]int8 + Lockname [9]int8 + Comm [20]int8 + Emul [17]int8 + Loginclass [18]int8 + Moretdname [4]int8 + Sparestrings [46]int8 + Spareints [2]int32 + Tdev uint64 + Oncpu int32 + Lastcpu int32 + Tracer int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb int64 /* pcb */ + Kstack int64 + Udata int64 + Tdaddr int64 /* thread */ + Pd int64 /* pwddesc, not accurate */ + Spareptrs [5]int64 + Sparelongs [12]int64 + Sflag int64 + Tdflags int64 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid_freebsd11 uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev_freebsd11 uint32 + Vn_mode uint16 + Status uint16 + Type_spec [8]byte + Vn_rdev uint64 + X_kve_ispare [8]int32 + Path [1024]int8 +} + +type kinfoFile struct { + Structsize int32 + Type int32 + Fd int32 + Ref_count int32 + Flags int32 + Pad0 int32 + Offset int64 + Anon0 [304]byte + Status uint16 + Pad1 uint16 + X_kf_ispare0 int32 + Cap_rights capRights + X_kf_cap_spare uint64 + Path [1024]int8 +} + +type capRights struct { + Rights [2]uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go new file mode 100644 index 00000000..6c4fbf69 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go @@ -0,0 +1,218 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 + KernProcCwd = 42 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x440 + sizeOfKinfoFile = 0x570 // TODO: should be changed by running on the target machine +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur int32 + Max int32 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args int32 /* pargs */ + Paddr int32 /* proc */ + Addr int32 /* user */ + Tracep int32 /* vnode */ + Textvp int32 /* vnode */ + Fd int32 /* filedesc */ + Vmspace int32 /* vmspace */ + Wchan int32 + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint32 + Rssize int32 + Swrss int32 + Tsize int32 + Dsize int32 + Ssize int32 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int32 + Kiflag int32 + Traceflag int32 + Stat int8 + Nice int8 + Lock int8 + Rqindex int8 + Oncpu uint8 + Lastcpu uint8 + Tdname [17]int8 + Wmesg [9]int8 + Login [18]int8 + Lockname [9]int8 + Comm [20]int8 + Emul [17]int8 + Loginclass [18]int8 + Sparestrings [50]int8 + Spareints [4]int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb int32 /* pcb */ + Kstack int32 + Udata int32 + Tdaddr int32 /* thread */ + Spareptrs [6]int64 + Sparelongs [12]int64 + Sflag int64 + Tdflags int64 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev uint32 + Vn_mode uint16 + Status uint16 + X_kve_ispare [12]int32 + Path [1024]int8 +} + +// TODO: should be changed by running on the target machine +type kinfoFile struct { + Structsize int32 + Type int32 + Fd int32 + Ref_count int32 + Flags int32 + Pad0 int32 + Offset int64 + Anon0 [304]byte + Status uint16 + Pad1 uint16 + X_kf_ispare0 int32 + Cap_rights capRights + X_kf_cap_spare uint64 + Path [1024]int8 // changed from uint8 by hand +} + +// TODO: should be changed by running on the target machine +type capRights struct { + Rights [2]uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go new file mode 100644 index 00000000..dabdc3e3 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build freebsd && arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 + KernProcCwd = 42 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x440 + sizeOfKinfoFile = 0x570 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args int64 /* pargs */ + Paddr int64 /* proc */ + Addr int64 /* user */ + Tracep int64 /* vnode */ + Textvp int64 /* vnode */ + Fd int64 /* filedesc */ + Vmspace int64 /* vmspace */ + Wchan int64 + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev_freebsd11 uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint64 + Rssize int64 + Swrss int64 + Tsize int64 + Dsize int64 + Ssize int64 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int64 + Kiflag int64 + Traceflag int32 + Stat uint8 + Nice int8 + Lock uint8 + Rqindex uint8 + Oncpu_old uint8 + Lastcpu_old uint8 + Tdname [17]uint8 + Wmesg [9]uint8 + Login [18]uint8 + Lockname [9]uint8 + Comm [20]int8 // changed from uint8 by hand + Emul [17]uint8 + Loginclass [18]uint8 + Moretdname [4]uint8 + Sparestrings [46]uint8 + Spareints [2]int32 + Tdev uint64 + Oncpu int32 + Lastcpu int32 + Tracer int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb int64 /* pcb */ + Kstack int64 + Udata int64 + Tdaddr int64 /* thread */ + Pd int64 /* pwddesc, not accurate */ + Spareptrs [5]int64 + Sparelongs [12]int64 + Sflag int64 + Tdflags int64 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid_freebsd11 uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev_freebsd11 uint32 + Vn_mode uint16 + Status uint16 + Type_spec [8]byte + Vn_rdev uint64 + X_kve_ispare [8]int32 + Path [1024]uint8 +} + +type kinfoFile struct { + Structsize int32 + Type int32 + Fd int32 + Ref_count int32 + Flags int32 + Pad0 int32 + Offset int64 + Anon0 [304]byte + Status uint16 + Pad1 uint16 + X_kf_ispare0 int32 + Cap_rights capRights + X_kf_cap_spare uint64 + Path [1024]int8 // changed from uint8 by hand +} + +type capRights struct { + Rights [2]uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_linux.go b/vendor/github.com/shirou/gopsutil/v4/process/process_linux.go new file mode 100644 index 00000000..764523dc --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_linux.go @@ -0,0 +1,1204 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux + +package process + +import ( + "bufio" + "bytes" + "context" + "encoding/json" + "fmt" + "math" + "os" + "path/filepath" + "sort" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/net" +) + +var pageSize = uint64(os.Getpagesize()) + +const prioProcess = 0 // linux/resource.h + +var clockTicks = 100 // default value + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + clockTicks = int(clkTck) + } +} + +// MemoryInfoExStat is different between OSes +type MemoryInfoExStat struct { + RSS uint64 `json:"rss"` // bytes + VMS uint64 `json:"vms"` // bytes + Shared uint64 `json:"shared"` // bytes + Text uint64 `json:"text"` // bytes + Lib uint64 `json:"lib"` // bytes + Data uint64 `json:"data"` // bytes + Dirty uint64 `json:"dirty"` // bytes +} + +func (m MemoryInfoExStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +// String returns JSON value of the process. +func (m MemoryMapsStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + _, ppid, _, _, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return -1, err + } + return ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + if p.name == "" { + if err := p.fillNameWithContext(ctx); err != nil { + return "", err + } + } + return p.name, nil +} + +func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { + if p.tgid == 0 { + if err := p.fillFromStatusWithContext(ctx); err != nil { + return 0, err + } + } + return p.tgid, nil +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + return p.fillFromExeWithContext(ctx) +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + return p.fillFromCmdlineWithContext(ctx) +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + return p.fillSliceFromCmdlineWithContext(ctx) +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + _, _, _, createTime, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return 0, err + } + return createTime, nil +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return p.fillFromCwdWithContext(ctx) +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []string{""}, err + } + return []string{p.status}, nil +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "stat") + contents, err := os.ReadFile(statPath) + if err != nil { + return false, err + } + fields := strings.Fields(string(contents)) + if len(fields) < 8 { + return false, fmt.Errorf("insufficient data in %s", statPath) + } + pgid := fields[4] + tpgid := fields[7] + return pgid == tpgid, nil +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []uint32{}, err + } + return p.uids, nil +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []uint32{}, err + } + return p.gids, nil +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []uint32{}, err + } + return p.groups, nil +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + t, _, _, _, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return "", err + } + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + terminal := termmap[t] + return terminal, nil +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + _, _, _, _, _, nice, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return 0, err + } + return nice, nil +} + +func (*Process) IOniceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { + return p.RlimitUsageWithContext(ctx, false) +} + +func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { + rlimits, err := p.fillFromLimitsWithContext(ctx) + if !gatherUsed || err != nil { + return rlimits, err + } + + _, _, _, _, rtprio, nice, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return nil, err + } + if err := p.fillFromStatusWithContext(ctx); err != nil { + return nil, err + } + + for i := range rlimits { + rs := &rlimits[i] + switch rs.Resource { + case RLIMIT_CPU: + times, err := p.TimesWithContext(ctx) + if err != nil { + return nil, err + } + rs.Used = uint64(times.User + times.System) + case RLIMIT_DATA: + rs.Used = uint64(p.memInfo.Data) + case RLIMIT_STACK: + rs.Used = uint64(p.memInfo.Stack) + case RLIMIT_RSS: + rs.Used = uint64(p.memInfo.RSS) + case RLIMIT_NOFILE: + n, err := p.NumFDsWithContext(ctx) + if err != nil { + return nil, err + } + rs.Used = uint64(n) + case RLIMIT_MEMLOCK: + rs.Used = uint64(p.memInfo.Locked) + case RLIMIT_AS: + rs.Used = uint64(p.memInfo.VMS) + case RLIMIT_LOCKS: + // TODO we can get the used value from /proc/$pid/locks. But linux doesn't enforce it, so not a high priority. + case RLIMIT_SIGPENDING: + rs.Used = p.sigInfo.PendingProcess + case RLIMIT_NICE: + // The rlimit for nice is a little unusual, in that 0 means the niceness cannot be decreased beyond the current value, but it can be increased. + // So effectively: if rs.Soft == 0 { rs.Soft = rs.Used } + rs.Used = uint64(nice) + case RLIMIT_RTPRIO: + rs.Used = uint64(rtprio) + } + } + + return rlimits, err +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + return p.fillFromIOWithContext(ctx) +} + +func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return nil, err + } + return p.numCtxSwitches, nil +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + _, fnames, err := p.fillFromfdListWithContext(ctx) + return int32(len(fnames)), err +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return 0, err + } + return p.numThreads, nil +} + +func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { + ret := make(map[int32]*cpu.TimesStat) + taskPath := common.HostProcWithContext(ctx, strconv.Itoa(int(p.Pid)), "task") + + tids, err := readPidsFromDir(taskPath) + if err != nil { + return nil, err + } + + for _, tid := range tids { + _, _, cpuTimes, _, _, _, _, err := p.fillFromTIDStatWithContext(ctx, tid) + if err != nil { + return nil, err + } + ret[tid] = cpuTimes + } + + return ret, nil +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + _, _, cpuTimes, _, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return nil, err + } + return cpuTimes, nil +} + +func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + meminfo, _, err := p.fillFromStatmWithContext(ctx) + if err != nil { + return nil, err + } + return meminfo, nil +} + +func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { + _, memInfoEx, err := p.fillFromStatmWithContext(ctx) + if err != nil { + return nil, err + } + return memInfoEx, nil +} + +func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { + _, _, _, _, _, _, pageFaults, err := p.fillFromStatWithContext(ctx) + if err != nil { + return nil, err + } + return pageFaults, nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + statFiles, err := filepath.Glob(common.HostProcWithContext(ctx, "[0-9]*/stat")) + if err != nil { + return nil, err + } + ret := make([]*Process, 0, len(statFiles)) + for _, statFile := range statFiles { + statContents, err := os.ReadFile(statFile) + if err != nil || len(statContents) == 0 { + continue + } + fields := splitProcStat(statContents) + pid, err := strconv.ParseInt(fields[1], 10, 32) + if err != nil { + continue + } + ppid, err := strconv.ParseInt(fields[4], 10, 32) + if err != nil { + continue + } + if ppid == int64(p.Pid) { + np, err := NewProcessWithContext(ctx, int32(pid)) + if err != nil { + continue + } + ret = append(ret, np) + } + } + sort.Slice(ret, func(i, j int) bool { return ret[i].Pid < ret[j].Pid }) + return ret, nil +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + _, ofs, err := p.fillFromfdWithContext(ctx) + return ofs, err +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { + return net.ConnectionsPidMaxWithContext(ctx, "all", p.Pid, maxConn) +} + +func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { + pid := p.Pid + var ret []MemoryMapsStat + smapsPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "smaps") + if grouped { + ret = make([]MemoryMapsStat, 1) + // If smaps_rollup exists (require kernel >= 4.15), then we will use it + // for pre-summed memory information for a process. + smapsRollupPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "smaps_rollup") + if _, err := os.Stat(smapsRollupPath); !os.IsNotExist(err) { + smapsPath = smapsRollupPath + } + } + contents, err := os.ReadFile(smapsPath) + if err != nil { + return nil, err + } + lines := strings.Split(string(contents), "\n") + + // function of parsing a block + getBlock := func(firstLine []string, block []string) (MemoryMapsStat, error) { + m := MemoryMapsStat{} + if len(firstLine) >= 6 { + m.Path = strings.Join(firstLine[5:], " ") + } + + for _, line := range block { + if strings.Contains(line, "VmFlags") { + continue + } + field := strings.Split(line, ":") + if len(field) < 2 { + continue + } + v := strings.Trim(field[1], "kB") // remove last "kB" + v = strings.TrimSpace(v) + t, err := strconv.ParseUint(v, 10, 64) + if err != nil { + return m, err + } + + switch field[0] { + case "Size": + m.Size = t + case "Rss": + m.Rss = t + case "Pss": + m.Pss = t + case "Shared_Clean": + m.SharedClean = t + case "Shared_Dirty": + m.SharedDirty = t + case "Private_Clean": + m.PrivateClean = t + case "Private_Dirty": + m.PrivateDirty = t + case "Referenced": + m.Referenced = t + case "Anonymous": + m.Anonymous = t + case "Swap": + m.Swap = t + } + } + return m, nil + } + + var firstLine []string + blocks := make([]string, 0, 16) + + for i, line := range lines { + fields := strings.Fields(line) + if (len(fields) > 0 && !strings.HasSuffix(fields[0], ":")) || i == len(lines)-1 { + // new block section + if len(firstLine) > 0 && len(blocks) > 0 { + g, err := getBlock(firstLine, blocks) + if err != nil { + return &ret, err + } + if grouped { + ret[0].Size += g.Size + ret[0].Rss += g.Rss + ret[0].Pss += g.Pss + ret[0].SharedClean += g.SharedClean + ret[0].SharedDirty += g.SharedDirty + ret[0].PrivateClean += g.PrivateClean + ret[0].PrivateDirty += g.PrivateDirty + ret[0].Referenced += g.Referenced + ret[0].Anonymous += g.Anonymous + ret[0].Swap += g.Swap + } else { + ret = append(ret, g) + } + } + // starts new block + blocks = make([]string, 0, 16) + firstLine = fields + } else { + blocks = append(blocks, line) + } + } + + return &ret, nil +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + environPath := common.HostProcWithContext(ctx, strconv.Itoa(int(p.Pid)), "environ") + + environContent, err := os.ReadFile(environPath) + if err != nil { + return nil, err + } + + return strings.Split(string(environContent), "\000"), nil +} + +/** +** Internal functions +**/ + +func limitToUint(val string) (uint64, error) { + if val == "unlimited" { + return math.MaxUint64, nil + } + res, err := strconv.ParseUint(val, 10, 64) + if err != nil { + return 0, err + } + return res, nil +} + +// Get num_fds from /proc/(pid)/limits +func (p *Process) fillFromLimitsWithContext(ctx context.Context) ([]RlimitStat, error) { + pid := p.Pid + limitsFile := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "limits") + d, err := os.Open(limitsFile) + if err != nil { + return nil, err + } + defer d.Close() + + var limitStats []RlimitStat + + limitsScanner := bufio.NewScanner(d) + for limitsScanner.Scan() { + var statItem RlimitStat + + str := strings.Fields(limitsScanner.Text()) + + // Remove the header line + if strings.Contains(str[len(str)-1], "Units") { + continue + } + + // Assert that last item is a Hard limit + statItem.Hard, err = limitToUint(str[len(str)-1]) + if err != nil { + // On error remove last item and try once again since it can be unit or header line + str = str[:len(str)-1] + statItem.Hard, err = limitToUint(str[len(str)-1]) + if err != nil { + return nil, err + } + } + // Remove last item from string + str = str[:len(str)-1] + + // Now last item is a Soft limit + statItem.Soft, err = limitToUint(str[len(str)-1]) + if err != nil { + return nil, err + } + // Remove last item from string + str = str[:len(str)-1] + + // The rest is a stats name + resourceName := strings.Join(str, " ") + switch resourceName { + case "Max cpu time": + statItem.Resource = RLIMIT_CPU + case "Max file size": + statItem.Resource = RLIMIT_FSIZE + case "Max data size": + statItem.Resource = RLIMIT_DATA + case "Max stack size": + statItem.Resource = RLIMIT_STACK + case "Max core file size": + statItem.Resource = RLIMIT_CORE + case "Max resident set": + statItem.Resource = RLIMIT_RSS + case "Max processes": + statItem.Resource = RLIMIT_NPROC + case "Max open files": + statItem.Resource = RLIMIT_NOFILE + case "Max locked memory": + statItem.Resource = RLIMIT_MEMLOCK + case "Max address space": + statItem.Resource = RLIMIT_AS + case "Max file locks": + statItem.Resource = RLIMIT_LOCKS + case "Max pending signals": + statItem.Resource = RLIMIT_SIGPENDING + case "Max msgqueue size": + statItem.Resource = RLIMIT_MSGQUEUE + case "Max nice priority": + statItem.Resource = RLIMIT_NICE + case "Max realtime priority": + statItem.Resource = RLIMIT_RTPRIO + case "Max realtime timeout": + statItem.Resource = RLIMIT_RTTIME + default: + continue + } + + limitStats = append(limitStats, statItem) + } + + if err := limitsScanner.Err(); err != nil { + return nil, err + } + + return limitStats, nil +} + +// Get list of /proc/(pid)/fd files +func (p *Process) fillFromfdListWithContext(ctx context.Context) (string, []string, error) { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "fd") + d, err := os.Open(statPath) + if err != nil { + return statPath, []string{}, err + } + defer d.Close() + fnames, err := d.Readdirnames(-1) + return statPath, fnames, err +} + +// Get num_fds from /proc/(pid)/fd +func (p *Process) fillFromfdWithContext(ctx context.Context) (int32, []OpenFilesStat, error) { + statPath, fnames, err := p.fillFromfdListWithContext(ctx) + if err != nil { + return 0, nil, err + } + numFDs := int32(len(fnames)) + + openfiles := make([]OpenFilesStat, 0, numFDs) + for _, fd := range fnames { + fpath := filepath.Join(statPath, fd) + path, err := common.Readlink(fpath) + if err != nil { + continue + } + t, err := strconv.ParseUint(fd, 10, 64) + if err != nil { + return numFDs, openfiles, err + } + o := OpenFilesStat{ + Path: path, + Fd: t, + } + openfiles = append(openfiles, o) + } + + return numFDs, openfiles, nil +} + +// Get cwd from /proc/(pid)/cwd +func (p *Process) fillFromCwdWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cwdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cwd") + cwd, err := os.Readlink(cwdPath) + if err != nil { + return "", err + } + return string(cwd), nil +} + +// Get exe from /proc/(pid)/exe +func (p *Process) fillFromExeWithContext(ctx context.Context) (string, error) { + pid := p.Pid + exePath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "exe") + exe, err := os.Readlink(exePath) + if err != nil { + return "", err + } + return string(exe), nil +} + +// Get cmdline from /proc/(pid)/cmdline +func (p *Process) fillFromCmdlineWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return "", err + } + ret := strings.FieldsFunc(string(cmdline), func(r rune) bool { + return r == '\u0000' + }) + + return strings.Join(ret, " "), nil +} + +func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return nil, err + } + if len(cmdline) == 0 { + return nil, nil + } + + cmdline = bytes.TrimRight(cmdline, "\x00") + + parts := bytes.Split(cmdline, []byte{0}) + var strParts []string + for _, p := range parts { + strParts = append(strParts, string(p)) + } + + return strParts, nil +} + +// Get IO status from /proc/(pid)/io +func (p *Process) fillFromIOWithContext(ctx context.Context) (*IOCountersStat, error) { + pid := p.Pid + ioPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "io") + ioline, err := os.ReadFile(ioPath) + if err != nil { + return nil, err + } + lines := strings.Split(string(ioline), "\n") + ret := &IOCountersStat{} + + for _, line := range lines { + field := strings.Fields(line) + if len(field) < 2 { + continue + } + t, err := strconv.ParseUint(field[1], 10, 64) + if err != nil { + return nil, err + } + param := strings.TrimSuffix(field[0], ":") + switch param { + case "syscr": + ret.ReadCount = t + case "syscw": + ret.WriteCount = t + case "read_bytes": + ret.DiskReadBytes = t + case "write_bytes": + ret.DiskWriteBytes = t + case "rchar": + ret.ReadBytes = t + case "wchar": + ret.WriteBytes = t + } + } + + return ret, nil +} + +// Get memory info from /proc/(pid)/statm +func (p *Process) fillFromStatmWithContext(ctx context.Context) (*MemoryInfoStat, *MemoryInfoExStat, error) { + pid := p.Pid + memPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "statm") + contents, err := os.ReadFile(memPath) + if err != nil { + return nil, nil, err + } + fields := strings.Split(string(contents), " ") + + vms, err := strconv.ParseUint(fields[0], 10, 64) + if err != nil { + return nil, nil, err + } + rss, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return nil, nil, err + } + memInfo := &MemoryInfoStat{ + RSS: rss * pageSize, + VMS: vms * pageSize, + } + + shared, err := strconv.ParseUint(fields[2], 10, 64) + if err != nil { + return nil, nil, err + } + text, err := strconv.ParseUint(fields[3], 10, 64) + if err != nil { + return nil, nil, err + } + lib, err := strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, nil, err + } + dirty, err := strconv.ParseUint(fields[5], 10, 64) + if err != nil { + return nil, nil, err + } + + memInfoEx := &MemoryInfoExStat{ + RSS: rss * pageSize, + VMS: vms * pageSize, + Shared: shared * pageSize, + Text: text * pageSize, + Lib: lib * pageSize, + Dirty: dirty * pageSize, + } + + return memInfo, memInfoEx, nil +} + +// Get name from /proc/(pid)/comm or /proc/(pid)/status +func (p *Process) fillNameWithContext(ctx context.Context) error { + err := p.fillFromCommWithContext(ctx) + if err == nil && p.name != "" && len(p.name) < 15 { + return nil + } + return p.fillFromStatusWithContext(ctx) +} + +// Get name from /proc/(pid)/comm +func (p *Process) fillFromCommWithContext(ctx context.Context) error { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "comm") + contents, err := os.ReadFile(statPath) + if err != nil { + return err + } + + p.name = strings.TrimSuffix(string(contents), "\n") + return nil +} + +// Get various status from /proc/(pid)/status +func (p *Process) fillFromStatus() error { + return p.fillFromStatusWithContext(context.Background()) +} + +func (p *Process) fillFromStatusWithContext(ctx context.Context) error { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "status") + contents, err := os.ReadFile(statPath) + if err != nil { + return err + } + lines := strings.Split(string(contents), "\n") + p.numCtxSwitches = &NumCtxSwitchesStat{} + p.memInfo = &MemoryInfoStat{} + p.sigInfo = &SignalInfoStat{} + for _, line := range lines { + tabParts := strings.SplitN(line, "\t", 2) + if len(tabParts) < 2 { + continue + } + value := tabParts[1] + switch strings.TrimRight(tabParts[0], ":") { + case "Name": + p.name = strings.Trim(value, " \t") + if len(p.name) >= 15 { + cmdlineSlice, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return err + } + if len(cmdlineSlice) > 0 { + extendedName := filepath.Base(cmdlineSlice[0]) + if strings.HasPrefix(extendedName, p.name) { + p.name = extendedName + } + } + } + // Ensure we have a copy and not reference into slice + p.name = string([]byte(p.name)) + case "State": + p.status = convertStatusChar(value[0:1]) + // Ensure we have a copy and not reference into slice + p.status = string([]byte(p.status)) + case "PPid", "Ppid": + pval, err := strconv.ParseInt(value, 10, 32) + if err != nil { + return err + } + p.parent = int32(pval) + case "Tgid": + pval, err := strconv.ParseInt(value, 10, 32) + if err != nil { + return err + } + p.tgid = int32(pval) + case "Uid": + p.uids = make([]uint32, 0, 4) + for _, i := range strings.Split(value, "\t") { + v, err := strconv.ParseUint(i, 10, 32) + if err != nil { + return err + } + p.uids = append(p.uids, uint32(v)) + } + case "Gid": + p.gids = make([]uint32, 0, 4) + for _, i := range strings.Split(value, "\t") { + v, err := strconv.ParseUint(i, 10, 32) + if err != nil { + return err + } + p.gids = append(p.gids, uint32(v)) + } + case "Groups": + groups := strings.Fields(value) + p.groups = make([]uint32, 0, len(groups)) + for _, i := range groups { + v, err := strconv.ParseUint(i, 10, 32) + if err != nil { + return err + } + p.groups = append(p.groups, uint32(v)) + } + case "Threads": + v, err := strconv.ParseInt(value, 10, 32) + if err != nil { + return err + } + p.numThreads = int32(v) + case "voluntary_ctxt_switches": + v, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return err + } + p.numCtxSwitches.Voluntary = v + case "nonvoluntary_ctxt_switches": + v, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return err + } + p.numCtxSwitches.Involuntary = v + case "VmRSS": + value = strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.RSS = v * 1024 + case "VmSize": + value = strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.VMS = v * 1024 + case "VmSwap": + value = strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Swap = v * 1024 + case "VmHWM": + value = strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.HWM = v * 1024 + case "VmData": + value = strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Data = v * 1024 + case "VmStk": + value = strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Stack = v * 1024 + case "VmLck": + value = strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Locked = v * 1024 + case "SigPnd": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.PendingThread = v + case "ShdPnd": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.PendingProcess = v + case "SigBlk": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.Blocked = v + case "SigIgn": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.Ignored = v + case "SigCgt": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.Caught = v + } + + } + return nil +} + +func (p *Process) fillFromTIDStat(tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) { + return p.fillFromTIDStatWithContext(context.Background(), tid) +} + +func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) { + pid := p.Pid + var statPath string + + if tid == -1 { + statPath = common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "stat") + } else { + statPath = common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "task", strconv.Itoa(int(tid)), "stat") + } + + contents, err := os.ReadFile(statPath) + if err == nil && len(contents) == 0 { + err = fmt.Errorf("process %d: stat file is empty, process may have terminated", pid) + } + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + // Indexing from one, as described in `man proc` about the file /proc/[pid]/stat + fields := splitProcStat(contents) + + terminal, err := strconv.ParseUint(fields[7], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + ppid, err := strconv.ParseInt(fields[4], 10, 32) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + utime, err := strconv.ParseFloat(fields[14], 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + stime, err := strconv.ParseFloat(fields[15], 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + // There is no such thing as iotime in stat file. As an approximation, we + // will use delayacct_blkio_ticks (aggregated block I/O delays, as per Linux + // docs). Note: I am assuming at least Linux 2.6.18 + var iotime float64 + if len(fields) > 42 { + iotime, err = strconv.ParseFloat(fields[42], 64) + if err != nil { + iotime = 0 // Ancient linux version, most likely + } + } else { + iotime = 0 // e.g. SmartOS containers + } + + cpuTimes := &cpu.TimesStat{ + CPU: "cpu", + User: utime / float64(clockTicks), + System: stime / float64(clockTicks), + Iowait: iotime / float64(clockTicks), + } + + bootTime, _ := common.BootTimeWithContext(ctx, enableBootTimeCache) + t, err := strconv.ParseUint(fields[22], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + createTime := int64((t * 1000 / uint64(clockTicks)) + uint64(bootTime*1000)) + + rtpriority, err := strconv.ParseInt(fields[18], 10, 32) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + if rtpriority < 0 { + rtpriority = rtpriority*-1 - 1 + } else { + rtpriority = 0 + } + + // p.Nice = mustParseInt32(fields[18]) + // use syscall instead of parse Stat file + snice, _ := unix.Getpriority(prioProcess, int(pid)) + nice := int32(snice) // FIXME: is this true? + + minFault, err := strconv.ParseUint(fields[10], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + cMinFault, err := strconv.ParseUint(fields[11], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + majFault, err := strconv.ParseUint(fields[12], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + cMajFault, err := strconv.ParseUint(fields[13], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + faults := &PageFaultsStat{ + MinorFaults: minFault, + MajorFaults: majFault, + ChildMinorFaults: cMinFault, + ChildMajorFaults: cMajFault, + } + + return terminal, int32(ppid), cpuTimes, createTime, uint32(rtpriority), nice, faults, nil +} + +func (p *Process) fillFromStatWithContext(ctx context.Context) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) { + return p.fillFromTIDStatWithContext(ctx, -1) +} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + return readPidsFromDir(common.HostProcWithContext(ctx)) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, err + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +func readPidsFromDir(path string) ([]int32, error) { + var ret []int32 + + d, err := os.Open(path) + if err != nil { + return nil, err + } + defer d.Close() + + fnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, fname := range fnames { + if !strictIntPtrn.MatchString(fname) { + continue + } + pid, err := strconv.ParseInt(fname, 10, 32) + if err != nil { + // if not numeric name, just skip + continue + } + ret = append(ret, int32(pid)) + } + + return ret, nil +} + +func splitProcStat(content []byte) []string { + nameStart := bytes.IndexByte(content, '(') + nameEnd := bytes.LastIndexByte(content, ')') + restFields := strings.Fields(string(content[nameEnd+2:])) // +2 skip ') ' + name := content[nameStart+1 : nameEnd] + pid := strings.TrimSpace(string(content[:nameStart])) + fields := make([]string, 3, len(restFields)+3) + fields[1] = string(pid) + fields[2] = string(name) + fields = append(fields, restFields...) + return fields +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd.go b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd.go new file mode 100644 index 00000000..31fdb85b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd.go @@ -0,0 +1,401 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd + +package process + +import ( + "bytes" + "context" + "encoding/binary" + "errors" + "io" + "path/filepath" + "sort" + "strconv" + "strings" + "unsafe" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/mem" + "github.com/shirou/gopsutil/v4/net" +) + +func pidsWithContext(ctx context.Context) ([]int32, error) { + var ret []int32 + procs, err := ProcessesWithContext(ctx) + if err != nil { + return ret, nil + } + + for _, p := range procs { + ret = append(ret, p.Pid) + } + + return ret, nil +} + +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + name := common.IntToString(k.Comm[:]) + + if len(name) >= 15 { + cmdlineSlice, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + if len(cmdlineSlice) > 0 { + extendedName := filepath.Base(cmdlineSlice[0]) + if strings.HasPrefix(extendedName, p.name) { + name = extendedName + } + } + } + + return name, nil +} + +func (p *Process) CwdWithContext(_ context.Context) (string, error) { + mib := []int32{CTLKern, KernProcCwd, p.Pid} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return "", err + } + return common.ByteToString(buf), nil +} + +func (*Process) ExeWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { + mib := []int32{CTLKern, KernProcArgs, p.Pid, KernProcArgv} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + + /* From man sysctl(2): + The buffer pointed to by oldp is filled with an array of char + pointers followed by the strings themselves. The last char + pointer is a NULL pointer. */ + var strParts []string + r := bytes.NewReader(buf) + baseAddr := uintptr(unsafe.Pointer(&buf[0])) + for { + argvp, err := readPtr(r) + if err != nil { + return nil, err + } + if argvp == 0 { // check for a NULL pointer + break + } + offset := argvp - baseAddr + length := uintptr(bytes.IndexByte(buf[offset:], 0)) + str := string(buf[offset : offset+length]) + strParts = append(strParts, str) + } + + return strParts, nil +} + +// readPtr reads a pointer data from a given reader. WARNING: only little +// endian architectures are supported. +func readPtr(r io.Reader) (uintptr, error) { + switch sizeofPtr { + case 4: + var p uint32 + if err := binary.Read(r, binary.LittleEndian, &p); err != nil { + return 0, err + } + return uintptr(p), nil + case 8: + var p uint64 + if err := binary.Read(r, binary.LittleEndian, &p); err != nil { + return 0, err + } + return uintptr(p), nil + default: + return 0, errors.New("unsupported pointer size") + } +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + argv, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + return strings.Join(argv, " "), nil +} + +func (*Process) createTimeWithContext(_ context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { + k, err := p.getKProc() + if err != nil { + return []string{""}, err + } + var s string + switch k.Stat { + case SIDL: + case SRUN: + case SONPROC: + s = Running + case SSLEEP: + s = Sleep + case SSTOP: + s = Stop + case SDEAD: + s = Zombie + } + + return []string{s}, nil +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + out, err := invoke.CommandWithContext(ctx, "ps", "-o", "stat=", "-p", strconv.Itoa(int(pid))) + if err != nil { + return false, err + } + return strings.IndexByte(string(out), '+') != -1, nil +} + +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + uids := make([]uint32, 0, 3) + + uids = append(uids, uint32(k.Ruid), uint32(k.Uid), uint32(k.Svuid)) + + return uids, nil +} + +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + gids := make([]uint32, 0, 3) + gids = append(gids, uint32(k.Rgid), uint32(k.Ngroups), uint32(k.Svgid)) + + return gids, nil +} + +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + groups := make([]uint32, k.Ngroups) + for i := int16(0); i < k.Ngroups; i++ { + groups[i] = uint32(k.Groups[i]) + } + + return groups, nil +} + +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + + ttyNr := uint64(k.Tdev) + + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + + return termmap[ttyNr], nil +} + +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int32(k.Nice), nil +} + +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &IOCountersStat{ + ReadCount: uint64(k.Uru_inblock), + WriteCount: uint64(k.Uru_oublock), + }, nil +} + +func (*Process) NumThreadsWithContext(_ context.Context) (int32, error) { + /* not supported, just return 1 */ + return 1, nil +} + +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &cpu.TimesStat{ + CPU: "cpu", + User: float64(k.Uutime_sec) + float64(k.Uutime_usec)/1000000, + System: float64(k.Ustime_sec) + float64(k.Ustime_usec)/1000000, + }, nil +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + pageSize, err := mem.GetPageSizeWithContext(ctx) + if err != nil { + return nil, err + } + + return &MemoryInfoStat{ + RSS: uint64(k.Vm_rssize) * pageSize, + VMS: uint64(k.Vm_tsize) + uint64(k.Vm_dsize) + + uint64(k.Vm_ssize), + }, nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + procs, err := ProcessesWithContext(ctx) + if err != nil { + return nil, nil + } + ret := make([]*Process, 0, len(procs)) + for _, proc := range procs { + ppid, err := proc.PpidWithContext(ctx) + if err != nil { + continue + } + if ppid == p.Pid { + ret = append(ret, proc) + } + } + sort.Slice(ret, func(i, j int) bool { return ret[i].Pid < ret[j].Pid }) + return ret, nil +} + +func (*Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + results := []*Process{} + + buf, length, err := callKernProcSyscall(KernProcAll, 0) + if err != nil { + return results, err + } + + // get kinfo_proc size + count := int(length / uint64(sizeOfKinfoProc)) + + // parse buf to procs + for i := 0; i < count; i++ { + b := buf[i*sizeOfKinfoProc : (i+1)*sizeOfKinfoProc] + k, err := parseKinfoProc(b) + if err != nil { + continue + } + p, err := NewProcessWithContext(ctx, int32(k.Pid)) + if err != nil { + continue + } + + results = append(results, p) + } + + return results, nil +} + +func (*Process) NumFDsWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) getKProc() (*KinfoProc, error) { + buf, length, err := callKernProcSyscall(KernProcPID, p.Pid) + if err != nil { + return nil, err + } + if length != sizeOfKinfoProc { + return nil, errors.New("unexpected size of KinfoProc") + } + + k, err := parseKinfoProc(buf) + if err != nil { + return nil, err + } + return &k, nil +} + +func callKernProcSyscall(op, arg int32) ([]byte, uint64, error) { + mib := []int32{CTLKern, KernProc, op, arg, sizeOfKinfoProc, 0} + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return nil, length, err + } + + count := int32(length / uint64(sizeOfKinfoProc)) + mib = []int32{CTLKern, KernProc, op, arg, sizeOfKinfoProc, count} + mibptr = unsafe.Pointer(&mib[0]) + miblen = uint64(len(mib)) + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_386.go b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_386.go new file mode 100644 index 00000000..5b84706a --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_386.go @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && 386 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcCwd = 78 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x38 + sizeOfKinfoProc = 0x264 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int32 +} + +type Timeval struct { + Sec int64 + Usec int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]int8 + Wchan uint64 + Login [32]int8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags int32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]int8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint32 + End uint32 + Guard uint32 + Fspace uint32 + Fspace_augment uint32 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [3]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_amd64.go new file mode 100644 index 00000000..3229bb32 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_amd64.go @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcCwd = 78 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x50 + sizeOfKinfoProc = 0x268 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]int8 + Wchan uint64 + Login [32]int8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Pad_cgo_0 [4]byte + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags int32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]int8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint64 + End uint64 + Guard uint64 + Fspace uint64 + Fspace_augment uint64 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [7]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm.go b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm.go new file mode 100644 index 00000000..6f74ce75 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm.go @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && arm + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcCwd = 78 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x38 + sizeOfKinfoProc = 0x264 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int32 +} + +type Timeval struct { + Sec int64 + Usec int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]int8 + Wchan uint64 + Login [32]int8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags int32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]int8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint32 + End uint32 + Guard uint32 + Fspace uint32 + Fspace_augment uint32 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [3]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm64.go new file mode 100644 index 00000000..91045456 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm64.go @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcCwd = 78 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x50 + sizeOfKinfoProc = 0x270 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]uint8 + Wchan uint64 + Login [32]uint8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags uint32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]uint8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 + Pledge uint64 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint64 + End uint64 + Guard uint64 + Fspace uint64 + Fspace_augment uint64 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [7]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_riscv64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_riscv64.go new file mode 100644 index 00000000..e3e0d36a --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_riscv64.go @@ -0,0 +1,205 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build openbsd && riscv64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcCwd = 78 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x50 + sizeOfKinfoProc = 0x288 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Spare uint16 + Comm [24]int8 + Wmesg [8]uint8 + Wchan uint64 + Login [32]uint8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags uint32 + Acflag uint32 + Svuid uint32 + Svgid uint32 + Emul [8]uint8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 + Pledge uint64 + Name [24]uint8 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint64 + End uint64 + Guard uint64 + Fspace uint64 + Fspace_augment uint64 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [7]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_plan9.go b/vendor/github.com/shirou/gopsutil/v4/process/process_plan9.go new file mode 100644 index 00000000..bdb07ff2 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_plan9.go @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build plan9 + +package process + +import ( + "context" + "syscall" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/net" +) + +type Signal = syscall.Note + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +type MemoryInfoExStat struct{} + +func pidsWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func ProcessesWithContext(_ context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func PidExistsWithContext(_ context.Context, _ int32) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (*Process) PpidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) NameWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) TgidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) ExeWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) CmdlineWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) createTimeWithContext(_ context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) CwdWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) StatusWithContext(_ context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (*Process) ForegroundWithContext(_ context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (*Process) UidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GroupsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) TerminalWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) NiceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) IOniceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) NumFDsWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) NumThreadsWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ChildrenWithContext(_ context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) SendSignalWithContext(_ context.Context, _ Signal) error { + return common.ErrNotImplementedError +} + +func (*Process) SuspendWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) ResumeWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) TerminateWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) KillWithContext(_ context.Context) error { + return common.ErrNotImplementedError +} + +func (*Process) UsernameWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) EnvironWithContext(_ context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go b/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go new file mode 100644 index 00000000..9f0e93f3 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go @@ -0,0 +1,187 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build linux || freebsd || openbsd || darwin || solaris + +package process + +import ( + "context" + "errors" + "fmt" + "os" + "os/user" + "path/filepath" + "strconv" + "strings" + "syscall" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +type Signal = syscall.Signal + +// POSIX +func getTerminalMap() (map[uint64]string, error) { + ret := make(map[uint64]string) + var termfiles []string + + devPath := common.HostDev() + + d, err := os.Open(devPath) + if err != nil { + return nil, err + } + defer d.Close() + + devnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, devname := range devnames { + if strings.HasPrefix(devname, "tty") { + termfiles = append(termfiles, filepath.Join(devPath, devname)) + } + } + + var ptsnames []string + ptsPath := filepath.Join(devPath, "pts") + ptsd, err := os.Open(ptsPath) + if err != nil { + ptsnames, _ = filepath.Glob(filepath.Join(devPath, "ttyp*")) + if ptsnames == nil { + return nil, err + } + termfiles = append(termfiles, ptsnames...) + } else { + defer ptsd.Close() + ptsnames, err = ptsd.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, ptsname := range ptsnames { + termfiles = append(termfiles, filepath.Join(ptsPath, ptsname)) + } + } + + for _, name := range termfiles { + stat := unix.Stat_t{} + err = unix.Stat(name, &stat) + if err != nil { + return nil, err + } + rdev := uint64(stat.Rdev) + ret[rdev] = strings.TrimPrefix(name, devPath+string(os.PathSeparator)) + } + return ret, nil +} + +// isMount is a port of python's os.path.ismount() +// https://github.com/python/cpython/blob/08ff4369afca84587b1c82034af4e9f64caddbf2/Lib/posixpath.py#L186-L216 +// https://docs.python.org/3/library/os.path.html#os.path.ismount +func isMount(path string) bool { + // Check symlinkness with os.Lstat; unix.DT_LNK is not portable + fileInfo, err := os.Lstat(path) + if err != nil { + return false + } + if fileInfo.Mode()&os.ModeSymlink != 0 { + return false + } + var stat1 unix.Stat_t + if err := unix.Lstat(path, &stat1); err != nil { + return false + } + parent := filepath.Join(path, "..") + var stat2 unix.Stat_t + if err := unix.Lstat(parent, &stat2); err != nil { + return false + } + return stat1.Dev != stat2.Dev || stat1.Ino == stat2.Ino +} + +func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { + if pid <= 0 { + return false, fmt.Errorf("invalid pid %v", pid) + } + proc, err := os.FindProcess(int(pid)) + if err != nil { + return false, err + } + defer proc.Release() + + if isMount(common.HostProcWithContext(ctx)) { // if //proc exists and is mounted, check if //proc/ folder exists + _, err := os.Stat(common.HostProcWithContext(ctx, strconv.Itoa(int(pid)))) + if os.IsNotExist(err) { + return false, nil + } + return err == nil, err + } + + // procfs does not exist or is not mounted, check PID existence by signalling the pid + err = proc.Signal(syscall.Signal(0)) + if err == nil { + return true, nil + } + if errors.Is(err, os.ErrProcessDone) { + return false, nil + } + var errno syscall.Errno + if !errors.As(err, &errno) { + return false, err + } + switch errno { + case syscall.ESRCH: + return false, nil + case syscall.EPERM: + return true, nil + } + + return false, err +} + +func (p *Process) SendSignalWithContext(_ context.Context, sig syscall.Signal) error { + process, err := os.FindProcess(int(p.Pid)) + if err != nil { + return err + } + defer process.Release() + + err = process.Signal(sig) + if err != nil { + return err + } + + return nil +} + +func (p *Process) SuspendWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGSTOP) +} + +func (p *Process) ResumeWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGCONT) +} + +func (p *Process) TerminateWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGTERM) +} + +func (p *Process) KillWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGKILL) +} + +func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { + uids, err := p.UidsWithContext(ctx) + if err != nil { + return "", err + } + if len(uids) > 0 { + u, err := user.LookupId(strconv.Itoa(int(uids[0]))) + if err != nil { + return "", err + } + return u.Username, nil + } + return "", nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go b/vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go new file mode 100644 index 00000000..547d2287 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go @@ -0,0 +1,304 @@ +// SPDX-License-Identifier: BSD-3-Clause +package process + +import ( + "bytes" + "context" + "os" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/net" +) + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +type MemoryInfoExStat struct{} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + return readPidsFromDir(common.HostProcWithContext(ctx)) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, err + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +func (*Process) PpidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) NameWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) TgidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + exe, err := p.fillFromPathAOutWithContext(ctx) + if os.IsNotExist(err) { + exe, err = p.fillFromExecnameWithContext(ctx) + } + return exe, err +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + return p.fillFromCmdlineWithContext(ctx) +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + return p.fillSliceFromCmdlineWithContext(ctx) +} + +func (*Process) createTimeWithContext(_ context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return p.fillFromPathCwdWithContext(ctx) +} + +func (*Process) StatusWithContext(_ context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (*Process) ForegroundWithContext(_ context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (*Process) UidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GroupsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) TerminalWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (*Process) NiceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) IOniceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + _, fnames, err := p.fillFromfdListWithContext(ctx) + return int32(len(fnames)), err +} + +func (*Process) NumThreadsWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ChildrenWithContext(_ context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) EnvironWithContext(_ context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +/** +** Internal functions +**/ + +func (p *Process) fillFromfdListWithContext(ctx context.Context) (string, []string, error) { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "fd") + d, err := os.Open(statPath) + if err != nil { + return statPath, []string{}, err + } + defer d.Close() + fnames, err := d.Readdirnames(-1) + return statPath, fnames, err +} + +func (p *Process) fillFromPathCwdWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cwdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "path", "cwd") + cwd, err := os.Readlink(cwdPath) + if err != nil { + return "", err + } + return cwd, nil +} + +func (p *Process) fillFromPathAOutWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cwdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "path", "a.out") + exe, err := os.Readlink(cwdPath) + if err != nil { + return "", err + } + return exe, nil +} + +func (p *Process) fillFromExecnameWithContext(ctx context.Context) (string, error) { + pid := p.Pid + execNamePath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "execname") + exe, err := os.ReadFile(execNamePath) + if err != nil { + return "", err + } + return string(exe), nil +} + +func (p *Process) fillFromCmdlineWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return "", err + } + ret := strings.FieldsFunc(string(cmdline), func(r rune) bool { + return r == '\u0000' + }) + + return strings.Join(ret, " "), nil +} + +func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return nil, err + } + if len(cmdline) == 0 { + return nil, nil + } + if cmdline[len(cmdline)-1] == 0 { + cmdline = cmdline[:len(cmdline)-1] + } + parts := bytes.Split(cmdline, []byte{0}) + var strParts []string + for _, p := range parts { + strParts = append(strParts, string(p)) + } + + return strParts, nil +} + +func readPidsFromDir(path string) ([]int32, error) { + var ret []int32 + + d, err := os.Open(path) + if err != nil { + return nil, err + } + defer d.Close() + + fnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, fname := range fnames { + if !strictIntPtrn.MatchString(fname) { + continue + } + pid, err := strconv.ParseInt(fname, 10, 32) + if err != nil { + // if not numeric name, just skip + continue + } + ret = append(ret, int32(pid)) + } + + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go b/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go new file mode 100644 index 00000000..a1e28be6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go @@ -0,0 +1,1213 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build windows + +package process + +import ( + "bufio" + "context" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "reflect" + "syscall" + "time" + "unicode/utf16" + "unsafe" + + "golang.org/x/sys/windows" + + "github.com/shirou/gopsutil/v4/cpu" + "github.com/shirou/gopsutil/v4/internal/common" + "github.com/shirou/gopsutil/v4/net" +) + +type Signal = syscall.Signal + +var ( + modntdll = windows.NewLazySystemDLL("ntdll.dll") + procNtResumeProcess = modntdll.NewProc("NtResumeProcess") + procNtSuspendProcess = modntdll.NewProc("NtSuspendProcess") + + modpsapi = windows.NewLazySystemDLL("psapi.dll") + procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo") + procGetProcessImageFileNameW = modpsapi.NewProc("GetProcessImageFileNameW") + + advapi32 = windows.NewLazySystemDLL("advapi32.dll") + procLookupPrivilegeValue = advapi32.NewProc("LookupPrivilegeValueW") + procAdjustTokenPrivileges = advapi32.NewProc("AdjustTokenPrivileges") + + procQueryFullProcessImageNameW = common.Modkernel32.NewProc("QueryFullProcessImageNameW") + procGetPriorityClass = common.Modkernel32.NewProc("GetPriorityClass") + procGetProcessIoCounters = common.Modkernel32.NewProc("GetProcessIoCounters") + procGetNativeSystemInfo = common.Modkernel32.NewProc("GetNativeSystemInfo") + procGetProcessHandleCount = common.Modkernel32.NewProc("GetProcessHandleCount") + + processorArchitecture uint +) + +const processQueryInformation = windows.PROCESS_QUERY_LIMITED_INFORMATION + +type systemProcessorInformation struct { + ProcessorArchitecture uint16 + ProcessorLevel uint16 + ProcessorRevision uint16 + Reserved uint16 + ProcessorFeatureBits uint16 +} + +type systemInfo struct { + wProcessorArchitecture uint16 + wReserved uint16 + dwpageSize uint32 + lpMinimumApplicationAddress uintptr + lpMaximumApplicationAddress uintptr + dwActiveProcessorMask uintptr + dwNumberOfProcessors uint32 + dwProcessorType uint32 + dwAllocationGranularity uint32 + wProcessorLevel uint16 + wProcessorRevision uint16 +} + +// Memory_info_ex is different between OSes +type MemoryInfoExStat struct{} + +type MemoryMapsStat struct{} + +// ioCounters is an equivalent representation of IO_COUNTERS in the Windows API. +// https://docs.microsoft.com/windows/win32/api/winnt/ns-winnt-io_counters +type ioCounters struct { + ReadOperationCount uint64 + WriteOperationCount uint64 + OtherOperationCount uint64 + ReadTransferCount uint64 + WriteTransferCount uint64 + OtherTransferCount uint64 +} + +type processBasicInformation32 struct { + Reserved1 uint32 + PebBaseAddress uint32 + Reserved2 uint32 + Reserved3 uint32 + UniqueProcessId uint32 + Reserved4 uint32 +} + +type processBasicInformation64 struct { + Reserved1 uint64 + PebBaseAddress uint64 + Reserved2 uint64 + Reserved3 uint64 + UniqueProcessId uint64 + Reserved4 uint64 +} + +type processEnvironmentBlock32 struct { + Reserved1 [2]uint8 + BeingDebugged uint8 + Reserved2 uint8 + Reserved3 [2]uint32 + Ldr uint32 + ProcessParameters uint32 + // More fields which we don't use so far +} + +type processEnvironmentBlock64 struct { + Reserved1 [2]uint8 + BeingDebugged uint8 + Reserved2 uint8 + _ [4]uint8 // padding, since we are 64 bit, the next pointer is 64 bit aligned (when compiling for 32 bit, this is not the case without manual padding) + Reserved3 [2]uint64 + Ldr uint64 + ProcessParameters uint64 + // More fields which we don't use so far +} + +type rtlUserProcessParameters32 struct { + Reserved1 [16]uint8 + ConsoleHandle uint32 + ConsoleFlags uint32 + StdInputHandle uint32 + StdOutputHandle uint32 + StdErrorHandle uint32 + CurrentDirectoryPathNameLength uint16 + _ uint16 // Max Length + CurrentDirectoryPathAddress uint32 + CurrentDirectoryHandle uint32 + DllPathNameLength uint16 + _ uint16 // Max Length + DllPathAddress uint32 + ImagePathNameLength uint16 + _ uint16 // Max Length + ImagePathAddress uint32 + CommandLineLength uint16 + _ uint16 // Max Length + CommandLineAddress uint32 + EnvironmentAddress uint32 + // More fields which we don't use so far +} + +type rtlUserProcessParameters64 struct { + Reserved1 [16]uint8 + ConsoleHandle uint64 + ConsoleFlags uint64 + StdInputHandle uint64 + StdOutputHandle uint64 + StdErrorHandle uint64 + CurrentDirectoryPathNameLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + CurrentDirectoryPathAddress uint64 + CurrentDirectoryHandle uint64 + DllPathNameLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + DllPathAddress uint64 + ImagePathNameLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + ImagePathAddress uint64 + CommandLineLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + CommandLineAddress uint64 + EnvironmentAddress uint64 + // More fields which we don't use so far +} + +type winLUID struct { + LowPart winDWord + HighPart winLong +} + +// LUID_AND_ATTRIBUTES +type winLUIDAndAttributes struct { + Luid winLUID + Attributes winDWord +} + +// TOKEN_PRIVILEGES +type winTokenPrivileges struct { + PrivilegeCount winDWord + Privileges [1]winLUIDAndAttributes +} + +type ( + winLong int32 + winDWord uint32 +) + +func init() { + var sInfo systemInfo + + procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sInfo))) + processorArchitecture = uint(sInfo.wProcessorArchitecture) + + // enable SeDebugPrivilege https://github.com/midstar/proci/blob/6ec79f57b90ba3d9efa2a7b16ef9c9369d4be875/proci_windows.go#L80-L119 + handle, err := syscall.GetCurrentProcess() + if err != nil { + return + } + + var token syscall.Token + err = syscall.OpenProcessToken(handle, 0x0028, &token) + if err != nil { + return + } + defer token.Close() + + tokenPrivileges := winTokenPrivileges{PrivilegeCount: 1} + lpName := syscall.StringToUTF16("SeDebugPrivilege") + ret, _, _ := procLookupPrivilegeValue.Call( + 0, + uintptr(unsafe.Pointer(&lpName[0])), + uintptr(unsafe.Pointer(&tokenPrivileges.Privileges[0].Luid))) + if ret == 0 { + return + } + + tokenPrivileges.Privileges[0].Attributes = 0x00000002 // SE_PRIVILEGE_ENABLED + + procAdjustTokenPrivileges.Call( + uintptr(token), + 0, + uintptr(unsafe.Pointer(&tokenPrivileges)), + uintptr(unsafe.Sizeof(tokenPrivileges)), + 0, + 0) +} + +func pidsWithContext(_ context.Context) ([]int32, error) { + // inspired by https://gist.github.com/henkman/3083408 + // and https://github.com/giampaolo/psutil/blob/1c3a15f637521ba5c0031283da39c733fda53e4c/psutil/arch/windows/process_info.c#L315-L329 + var ret []int32 + var read uint32 + var psSize uint32 = 1024 + const dwordSize uint32 = 4 + + for { + ps := make([]uint32, psSize) + if err := windows.EnumProcesses(ps, &read); err != nil { + return nil, err + } + if uint32(len(ps)) == read/dwordSize { // ps buffer was too small to host every results, retry with a bigger one + psSize += 1024 + continue + } + for _, pid := range ps[:read/dwordSize] { + ret = append(ret, int32(pid)) + } + return ret, nil + + } +} + +func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { + if pid == 0 { // special case for pid 0 System Idle Process + return true, nil + } + if pid < 0 { + return false, fmt.Errorf("invalid pid %v", pid) + } + if pid%4 != 0 { + // OpenProcess will succeed even on non-existing pid here https://devblogs.microsoft.com/oldnewthing/20080606-00/?p=22043 + // so we list every pid just to be sure and be future-proof + pids, err := PidsWithContext(ctx) + if err != nil { + return false, err + } + for _, i := range pids { + if i == pid { + return true, err + } + } + return false, err + } + h, err := windows.OpenProcess(windows.SYNCHRONIZE, false, uint32(pid)) + if errors.Is(err, windows.ERROR_ACCESS_DENIED) { + return true, nil + } + if errors.Is(err, windows.ERROR_INVALID_PARAMETER) { + return false, nil + } + if err != nil { + return false, err + } + defer windows.CloseHandle(h) + event, err := windows.WaitForSingleObject(h, 0) + return event == uint32(windows.WAIT_TIMEOUT), err +} + +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { + // if cached already, return from cache + cachedPpid := p.getPpid() + if cachedPpid != 0 { + return cachedPpid, nil + } + + ppid, _, _, err := getFromSnapProcess(p.Pid) + if err != nil { + return 0, err + } + + // no errors and not cached already, so cache it + p.setPpid(ppid) + + return ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + if p.Pid == 0 { + return "System Idle Process", nil + } + if p.Pid == 4 { + return "System", nil + } + + exe, err := p.ExeWithContext(ctx) + if err != nil { + return "", fmt.Errorf("could not get Name: %w", err) + } + + return filepath.Base(exe), nil +} + +func (*Process) TgidWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(_ context.Context) (string, error) { + c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) + if err != nil { + return "", err + } + defer windows.CloseHandle(c) + buf := make([]uint16, syscall.MAX_LONG_PATH) + size := uint32(syscall.MAX_LONG_PATH) + if err := procQueryFullProcessImageNameW.Find(); err == nil { // Vista+ + ret, _, err := procQueryFullProcessImageNameW.Call( + uintptr(c), + uintptr(0), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&size))) + if ret == 0 { + return "", err + } + return windows.UTF16ToString(buf), nil + } + // XP fallback + ret, _, err := procGetProcessImageFileNameW.Call(uintptr(c), uintptr(unsafe.Pointer(&buf[0])), uintptr(size)) + if ret == 0 { + return "", err + } + return common.ConvertDOSPath(windows.UTF16ToString(buf)), nil +} + +func (p *Process) CmdlineWithContext(_ context.Context) (string, error) { + cmdline, err := getProcessCommandLine(p.Pid) + if err != nil { + return "", fmt.Errorf("could not get CommandLine: %w", err) + } + return cmdline, nil +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + cmdline, err := p.CmdlineWithContext(ctx) + if err != nil { + return nil, err + } + return parseCmdline(cmdline) +} + +func parseCmdline(cmdline string) ([]string, error) { + cmdlineptr, err := windows.UTF16PtrFromString(cmdline) + if err != nil { + return nil, err + } + + var argc int32 + argvptr, err := windows.CommandLineToArgv(cmdlineptr, &argc) + if err != nil { + return nil, err + } + defer windows.LocalFree(windows.Handle(uintptr(unsafe.Pointer(argvptr)))) + + argv := make([]string, argc) + for i, v := range (*argvptr)[:argc] { + argv[i] = windows.UTF16ToString((*v)[:]) + } + return argv, nil +} + +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { + ru, err := getRusage(p.Pid) + if err != nil { + return 0, fmt.Errorf("could not get CreationDate: %w", err) + } + + return ru.CreationTime.Nanoseconds() / 1000000, nil +} + +func (p *Process) CwdWithContext(_ context.Context) (string, error) { + h, err := windows.OpenProcess(processQueryInformation|windows.PROCESS_VM_READ, false, uint32(p.Pid)) + if errors.Is(err, windows.ERROR_ACCESS_DENIED) || errors.Is(err, windows.ERROR_INVALID_PARAMETER) { + return "", nil + } + if err != nil { + return "", err + } + defer syscall.CloseHandle(syscall.Handle(h)) + + procIs32Bits := is32BitProcess(h) + + if procIs32Bits { + userProcParams, err := getUserProcessParams32(h) + if err != nil { + return "", err + } + if userProcParams.CurrentDirectoryPathNameLength > 0 { + cwd := readProcessMemory(syscall.Handle(h), procIs32Bits, uint64(userProcParams.CurrentDirectoryPathAddress), uint(userProcParams.CurrentDirectoryPathNameLength)) + if len(cwd) != int(userProcParams.CurrentDirectoryPathNameLength) { + return "", errors.New("cannot read current working directory") + } + + return convertUTF16ToString(cwd), nil + } + } else { + userProcParams, err := getUserProcessParams64(h) + if err != nil { + return "", err + } + if userProcParams.CurrentDirectoryPathNameLength > 0 { + cwd := readProcessMemory(syscall.Handle(h), procIs32Bits, userProcParams.CurrentDirectoryPathAddress, uint(userProcParams.CurrentDirectoryPathNameLength)) + if len(cwd) != int(userProcParams.CurrentDirectoryPathNameLength) { + return "", errors.New("cannot read current working directory") + } + + return convertUTF16ToString(cwd), nil + } + } + + // if we reach here, we have no cwd + return "", nil +} + +func (*Process) StatusWithContext(_ context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (*Process) ForegroundWithContext(_ context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (p *Process) UsernameWithContext(_ context.Context) (string, error) { + pid := p.Pid + c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return "", err + } + defer windows.CloseHandle(c) + + var token syscall.Token + err = syscall.OpenProcessToken(syscall.Handle(c), syscall.TOKEN_QUERY, &token) + if err != nil { + return "", err + } + defer token.Close() + tokenUser, err := token.GetTokenUser() + if err != nil { + return "", err + } + + user, domain, _, err := tokenUser.User.Sid.LookupAccount("") + return domain + "\\" + user, err +} + +func (*Process) UidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GidsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) GroupsWithContext(_ context.Context) ([]uint32, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) TerminalWithContext(_ context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +// priorityClasses maps a win32 priority class to its WMI equivalent Win32_Process.Priority +// https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getpriorityclass +// https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-process +var priorityClasses = map[int]int32{ + 0x00008000: 10, // ABOVE_NORMAL_PRIORITY_CLASS + 0x00004000: 6, // BELOW_NORMAL_PRIORITY_CLASS + 0x00000080: 13, // HIGH_PRIORITY_CLASS + 0x00000040: 4, // IDLE_PRIORITY_CLASS + 0x00000020: 8, // NORMAL_PRIORITY_CLASS + 0x00000100: 24, // REALTIME_PRIORITY_CLASS +} + +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { + c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) + if err != nil { + return 0, err + } + defer windows.CloseHandle(c) + ret, _, err := procGetPriorityClass.Call(uintptr(c)) + if ret == 0 { + return 0, err + } + priority, ok := priorityClasses[int(ret)] + if !ok { + return 0, fmt.Errorf("unknown priority class %v", ret) + } + return priority, nil +} + +func (*Process) IOniceWithContext(_ context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (*Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { + c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) + if err != nil { + return nil, err + } + defer windows.CloseHandle(c) + var counters ioCounters + ret, _, err := procGetProcessIoCounters.Call(uintptr(c), uintptr(unsafe.Pointer(&counters))) + if ret == 0 { + return nil, err + } + stats := &IOCountersStat{ + ReadCount: counters.ReadOperationCount, + ReadBytes: counters.ReadTransferCount, + WriteCount: counters.WriteOperationCount, + WriteBytes: counters.WriteTransferCount, + } + + return stats, nil +} + +func (*Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +// NumFDsWithContext returns the number of handles for a process on Windows, +// not the number of file descriptors (FDs). +func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) { + handle, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) + if err != nil { + return 0, err + } + defer windows.CloseHandle(handle) + + var handleCount uint32 + ret, _, err := procGetProcessHandleCount.Call(uintptr(handle), uintptr(unsafe.Pointer(&handleCount))) + if ret == 0 { + return 0, err + } + return int32(handleCount), nil +} + +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { + ppid, ret, _, err := getFromSnapProcess(p.Pid) + if err != nil { + return 0, err + } + + // if no errors and not cached already, cache ppid + p.parent = ppid + if p.getPpid() == 0 { + p.setPpid(ppid) + } + + return ret, nil +} + +func (*Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { + sysTimes, err := getProcessCPUTimes(p.Pid) + if err != nil { + return nil, err + } + + // User and kernel times are represented as a FILETIME structure + // which contains a 64-bit value representing the number of + // 100-nanosecond intervals since January 1, 1601 (UTC): + // http://msdn.microsoft.com/en-us/library/ms724284(VS.85).aspx + // To convert it into a float representing the seconds that the + // process has executed in user/kernel mode I borrowed the code + // below from psutil's _psutil_windows.c, and in turn from Python's + // Modules/posixmodule.c + + user := float64(sysTimes.UserTime.HighDateTime)*429.4967296 + float64(sysTimes.UserTime.LowDateTime)*1e-7 + kernel := float64(sysTimes.KernelTime.HighDateTime)*429.4967296 + float64(sysTimes.KernelTime.LowDateTime)*1e-7 + + return &cpu.TimesStat{ + User: user, + System: kernel, + }, nil +} + +func (*Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { + mem, err := getMemoryInfo(p.Pid) + if err != nil { + return nil, err + } + + ret := &MemoryInfoStat{ + RSS: uint64(mem.WorkingSetSize), + VMS: uint64(mem.PagefileUsage), + } + + return ret, nil +} + +func (*Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { + mem, err := getMemoryInfo(p.Pid) + if err != nil { + return nil, err + } + + ret := &PageFaultsStat{ + // Since Windows does not distinguish between Major and Minor faults, all faults are treated as Major + MajorFaults: uint64(mem.PageFaultCount), + } + + return ret, nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + snap, err := windows.CreateToolhelp32Snapshot(windows.TH32CS_SNAPPROCESS, uint32(0)) + if err != nil { + return out, err + } + defer windows.CloseHandle(snap) + var pe32 windows.ProcessEntry32 + pe32.Size = uint32(unsafe.Sizeof(pe32)) + if err := windows.Process32First(snap, &pe32); err != nil { + return out, err + } + for { + if pe32.ParentProcessID == uint32(p.Pid) { + p, err := NewProcessWithContext(ctx, int32(pe32.ProcessID)) + if err == nil { + out = append(out, p) + } + } + if err = windows.Process32Next(snap, &pe32); err != nil { + break + } + } + return out, nil +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + files := make([]OpenFilesStat, 0) + fileExists := make(map[string]bool) + + process, err := windows.OpenProcess(common.ProcessQueryInformation, false, uint32(p.Pid)) + if err != nil { + return nil, err + } + defer windows.CloseHandle(process) + + buffer := make([]byte, 1024) + var size uint32 + + st := common.CallWithExpandingBuffer( + func() common.NtStatus { + return common.NtQuerySystemInformation( + common.SystemExtendedHandleInformationClass, + &buffer[0], + uint32(len(buffer)), + &size, + ) + }, + &buffer, + &size, + ) + if st.IsError() { + return nil, st.Error() + } + + handlesList := (*common.SystemExtendedHandleInformation)(unsafe.Pointer(&buffer[0])) + handles := make([]common.SystemExtendedHandleTableEntryInformation, int(handlesList.NumberOfHandles)) + hdr := (*reflect.SliceHeader)(unsafe.Pointer(&handles)) + hdr.Data = uintptr(unsafe.Pointer(&handlesList.Handles[0])) + + currentProcess, err := windows.GetCurrentProcess() + if err != nil { + return nil, err + } + + for _, handle := range handles { + var file uintptr + if int32(handle.UniqueProcessId) != p.Pid { + continue + } + if windows.DuplicateHandle(process, windows.Handle(handle.HandleValue), currentProcess, (*windows.Handle)(&file), + 0, true, windows.DUPLICATE_SAME_ACCESS) != nil { + continue + } + // release the new handle + defer windows.CloseHandle(windows.Handle(file)) + + fileType, err := windows.GetFileType(windows.Handle(file)) + if err != nil || fileType != windows.FILE_TYPE_DISK { + continue + } + + var fileName string + ch := make(chan struct{}, 1) + + go func() { + defer close(ch) + var buf [syscall.MAX_LONG_PATH]uint16 + n, err := windows.GetFinalPathNameByHandle(windows.Handle(file), &buf[0], syscall.MAX_LONG_PATH, 0) + if err != nil { + return + } + + fileName = string(utf16.Decode(buf[:n])) + ch <- struct{}{} + }() + + select { + case <-time.NewTimer(100 * time.Millisecond).C: + continue + case <-ch: + fileInfo, err := os.Stat(fileName) + if err != nil || fileInfo.IsDir() { + continue + } + + if _, exists := fileExists[fileName]; !exists { + files = append(files, OpenFilesStat{ + Path: fileName, + Fd: uint64(file), + }) + fileExists[fileName] = true + } + case <-ctx.Done(): + return files, ctx.Err() + } + } + + return files, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (*Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (*Process) SendSignalWithContext(_ context.Context, _ syscall.Signal) error { + return common.ErrNotImplementedError +} + +func (p *Process) SuspendWithContext(_ context.Context) error { + c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) + if err != nil { + return err + } + defer windows.CloseHandle(c) + + r1, _, _ := procNtSuspendProcess.Call(uintptr(c)) + if r1 != 0 { + // See https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55 + return fmt.Errorf("NtStatus='0x%.8X'", r1) + } + + return nil +} + +func (p *Process) ResumeWithContext(_ context.Context) error { + c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) + if err != nil { + return err + } + defer windows.CloseHandle(c) + + r1, _, _ := procNtResumeProcess.Call(uintptr(c)) + if r1 != 0 { + // See https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55 + return fmt.Errorf("NtStatus='0x%.8X'", r1) + } + + return nil +} + +func (p *Process) TerminateWithContext(_ context.Context) error { + proc, err := windows.OpenProcess(windows.PROCESS_TERMINATE, false, uint32(p.Pid)) + if err != nil { + return err + } + err = windows.TerminateProcess(proc, 0) + windows.CloseHandle(proc) + return err +} + +func (p *Process) KillWithContext(_ context.Context) error { + process, err := os.FindProcess(int(p.Pid)) + if err != nil { + return err + } + defer process.Release() + return process.Kill() +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + envVars, err := getProcessEnvironmentVariables(ctx, p.Pid) + if err != nil { + return nil, fmt.Errorf("could not get environment variables: %w", err) + } + return envVars, nil +} + +// retrieve Ppid in a thread-safe manner +func (p *Process) getPpid() int32 { + p.parentMutex.RLock() + defer p.parentMutex.RUnlock() + return p.parent +} + +// cache Ppid in a thread-safe manner (WINDOWS ONLY) +// see https://psutil.readthedocs.io/en/latest/#psutil.Process.ppid +func (p *Process) setPpid(ppid int32) { + p.parentMutex.Lock() + defer p.parentMutex.Unlock() + p.parent = ppid +} + +func getFromSnapProcess(pid int32) (int32, int32, string, error) { //nolint:unparam //FIXME + snap, err := windows.CreateToolhelp32Snapshot(windows.TH32CS_SNAPPROCESS, uint32(pid)) + if err != nil { + return 0, 0, "", err + } + defer windows.CloseHandle(snap) + var pe32 windows.ProcessEntry32 + pe32.Size = uint32(unsafe.Sizeof(pe32)) + err = windows.Process32First(snap, &pe32) + if err != nil { + return 0, 0, "", err + } + for { + if pe32.ProcessID == uint32(pid) { + szexe := windows.UTF16ToString(pe32.ExeFile[:]) + return int32(pe32.ParentProcessID), int32(pe32.Threads), szexe, nil + } + if err = windows.Process32Next(snap, &pe32); err != nil { + break + } + } + return 0, 0, "", fmt.Errorf("couldn't find pid: %d", pid) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, fmt.Errorf("could not get Processes %w", err) + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +func getRusage(pid int32) (*windows.Rusage, error) { + var CPU windows.Rusage + + c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return nil, err + } + defer windows.CloseHandle(c) + + if err := windows.GetProcessTimes(c, &CPU.CreationTime, &CPU.ExitTime, &CPU.KernelTime, &CPU.UserTime); err != nil { + return nil, err + } + + return &CPU, nil +} + +func getMemoryInfo(pid int32) (PROCESS_MEMORY_COUNTERS, error) { + var mem PROCESS_MEMORY_COUNTERS + c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return mem, err + } + defer windows.CloseHandle(c) + if err := getProcessMemoryInfo(c, &mem); err != nil { + return mem, err + } + + return mem, err +} + +func getProcessMemoryInfo(h windows.Handle, mem *PROCESS_MEMORY_COUNTERS) (err error) { + r1, _, e1 := syscall.Syscall(procGetProcessMemoryInfo.Addr(), 3, uintptr(h), uintptr(unsafe.Pointer(mem)), uintptr(unsafe.Sizeof(*mem))) + if r1 == 0 { + if e1 != 0 { + err = error(e1) + } else { + err = syscall.EINVAL + } + } + return err +} + +type SYSTEM_TIMES struct { //nolint:revive //FIXME + CreateTime syscall.Filetime + ExitTime syscall.Filetime + KernelTime syscall.Filetime + UserTime syscall.Filetime +} + +func getProcessCPUTimes(pid int32) (SYSTEM_TIMES, error) { + var times SYSTEM_TIMES + + h, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return times, err + } + defer windows.CloseHandle(h) + + err = syscall.GetProcessTimes( + syscall.Handle(h), + ×.CreateTime, + ×.ExitTime, + ×.KernelTime, + ×.UserTime, + ) + + return times, err +} + +func getUserProcessParams32(handle windows.Handle) (rtlUserProcessParameters32, error) { + pebAddress, err := queryPebAddress(syscall.Handle(handle), true) + if err != nil { + return rtlUserProcessParameters32{}, fmt.Errorf("cannot locate process PEB: %w", err) + } + + buf := readProcessMemory(syscall.Handle(handle), true, pebAddress, uint(unsafe.Sizeof(processEnvironmentBlock32{}))) + if len(buf) != int(unsafe.Sizeof(processEnvironmentBlock32{})) { + return rtlUserProcessParameters32{}, errors.New("cannot read process PEB") + } + peb := (*processEnvironmentBlock32)(unsafe.Pointer(&buf[0])) + userProcessAddress := uint64(peb.ProcessParameters) + buf = readProcessMemory(syscall.Handle(handle), true, userProcessAddress, uint(unsafe.Sizeof(rtlUserProcessParameters32{}))) + if len(buf) != int(unsafe.Sizeof(rtlUserProcessParameters32{})) { + return rtlUserProcessParameters32{}, errors.New("cannot read user process parameters") + } + return *(*rtlUserProcessParameters32)(unsafe.Pointer(&buf[0])), nil +} + +func getUserProcessParams64(handle windows.Handle) (rtlUserProcessParameters64, error) { + pebAddress, err := queryPebAddress(syscall.Handle(handle), false) + if err != nil { + return rtlUserProcessParameters64{}, fmt.Errorf("cannot locate process PEB: %w", err) + } + + buf := readProcessMemory(syscall.Handle(handle), false, pebAddress, uint(unsafe.Sizeof(processEnvironmentBlock64{}))) + if len(buf) != int(unsafe.Sizeof(processEnvironmentBlock64{})) { + return rtlUserProcessParameters64{}, errors.New("cannot read process PEB") + } + peb := (*processEnvironmentBlock64)(unsafe.Pointer(&buf[0])) + userProcessAddress := peb.ProcessParameters + buf = readProcessMemory(syscall.Handle(handle), false, userProcessAddress, uint(unsafe.Sizeof(rtlUserProcessParameters64{}))) + if len(buf) != int(unsafe.Sizeof(rtlUserProcessParameters64{})) { + return rtlUserProcessParameters64{}, errors.New("cannot read user process parameters") + } + return *(*rtlUserProcessParameters64)(unsafe.Pointer(&buf[0])), nil +} + +func is32BitProcess(h windows.Handle) bool { + const ( + PROCESSOR_ARCHITECTURE_INTEL = 0 + PROCESSOR_ARCHITECTURE_ARM = 5 + PROCESSOR_ARCHITECTURE_ARM64 = 12 + PROCESSOR_ARCHITECTURE_IA64 = 6 + PROCESSOR_ARCHITECTURE_AMD64 = 9 + ) + + var procIs32Bits bool + switch processorArchitecture { + case PROCESSOR_ARCHITECTURE_INTEL, PROCESSOR_ARCHITECTURE_ARM: + procIs32Bits = true + case PROCESSOR_ARCHITECTURE_ARM64, PROCESSOR_ARCHITECTURE_IA64, PROCESSOR_ARCHITECTURE_AMD64: + var wow64 uint + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(h), + uintptr(common.ProcessWow64Information), + uintptr(unsafe.Pointer(&wow64)), + uintptr(unsafe.Sizeof(wow64)), + uintptr(0), + ) + if int(ret) >= 0 { + if wow64 != 0 { + procIs32Bits = true + } + } else { + // if the OS does not support the call, we fallback into the bitness of the app + if unsafe.Sizeof(wow64) == 4 { + procIs32Bits = true + } + } + + default: + // for other unknown platforms, we rely on process platform + if unsafe.Sizeof(processorArchitecture) == 8 { + procIs32Bits = false + } else { + procIs32Bits = true + } + } + return procIs32Bits +} + +func getProcessEnvironmentVariables(ctx context.Context, pid int32) ([]string, error) { + h, err := windows.OpenProcess(processQueryInformation|windows.PROCESS_VM_READ, false, uint32(pid)) + if errors.Is(err, windows.ERROR_ACCESS_DENIED) || errors.Is(err, windows.ERROR_INVALID_PARAMETER) { + return nil, nil + } + if err != nil { + return nil, err + } + defer syscall.CloseHandle(syscall.Handle(h)) + + procIs32Bits := is32BitProcess(h) + + var processParameterBlockAddress uint64 + + if procIs32Bits { + peb, err := getUserProcessParams32(h) + if err != nil { + return nil, err + } + processParameterBlockAddress = uint64(peb.EnvironmentAddress) + } else { + peb, err := getUserProcessParams64(h) + if err != nil { + return nil, err + } + processParameterBlockAddress = peb.EnvironmentAddress + } + envvarScanner := bufio.NewScanner(&processReader{ + processHandle: h, + is32BitProcess: procIs32Bits, + offset: processParameterBlockAddress, + }) + envvarScanner.Split(func(data []byte, atEOF bool) (advance int, token []byte, err error) { + if atEOF && len(data) == 0 { + return 0, nil, nil + } + // Check for UTF-16 zero character + for i := 0; i < len(data)-1; i += 2 { + if data[i] == 0 && data[i+1] == 0 { + return i + 2, data[0:i], nil + } + } + if atEOF { + return len(data), data, nil + } + // Request more data + return 0, nil, nil + }) + var envVars []string + for envvarScanner.Scan() { + entry := envvarScanner.Bytes() + if len(entry) == 0 { + break // Block is finished + } + envVars = append(envVars, convertUTF16ToString(entry)) + select { + case <-ctx.Done(): + break + default: + continue + } + } + if err := envvarScanner.Err(); err != nil { + return nil, err + } + return envVars, nil +} + +type processReader struct { + processHandle windows.Handle + is32BitProcess bool + offset uint64 +} + +func (p *processReader) Read(buf []byte) (int, error) { + processMemory := readProcessMemory(syscall.Handle(p.processHandle), p.is32BitProcess, p.offset, uint(len(buf))) + if len(processMemory) == 0 { + return 0, io.EOF + } + copy(buf, processMemory) + p.offset += uint64(len(processMemory)) + return len(processMemory), nil +} + +func getProcessCommandLine(pid int32) (string, error) { + h, err := windows.OpenProcess(processQueryInformation|windows.PROCESS_VM_READ, false, uint32(pid)) + if errors.Is(err, windows.ERROR_ACCESS_DENIED) || errors.Is(err, windows.ERROR_INVALID_PARAMETER) { + return "", nil + } + if err != nil { + return "", err + } + defer syscall.CloseHandle(syscall.Handle(h)) + + procIs32Bits := is32BitProcess(h) + + if procIs32Bits { + userProcParams, err := getUserProcessParams32(h) + if err != nil { + return "", err + } + if userProcParams.CommandLineLength > 0 { + cmdLine := readProcessMemory(syscall.Handle(h), procIs32Bits, uint64(userProcParams.CommandLineAddress), uint(userProcParams.CommandLineLength)) + if len(cmdLine) != int(userProcParams.CommandLineLength) { + return "", errors.New("cannot read cmdline") + } + + return convertUTF16ToString(cmdLine), nil + } + } else { + userProcParams, err := getUserProcessParams64(h) + if err != nil { + return "", err + } + if userProcParams.CommandLineLength > 0 { + cmdLine := readProcessMemory(syscall.Handle(h), procIs32Bits, userProcParams.CommandLineAddress, uint(userProcParams.CommandLineLength)) + if len(cmdLine) != int(userProcParams.CommandLineLength) { + return "", errors.New("cannot read cmdline") + } + + return convertUTF16ToString(cmdLine), nil + } + } + + // if we reach here, we have no command line + return "", nil +} + +func convertUTF16ToString(src []byte) string { + srcLen := len(src) / 2 + + codePoints := make([]uint16, srcLen) + + srcIdx := 0 + for i := 0; i < srcLen; i++ { + codePoints[i] = uint16(src[srcIdx]) | uint16(src[srcIdx+1])<<8 + srcIdx += 2 + } + return syscall.UTF16ToString(codePoints) +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_windows_32bit.go b/vendor/github.com/shirou/gopsutil/v4/process/process_windows_32bit.go new file mode 100644 index 00000000..911351b1 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_windows_32bit.go @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build (windows && 386) || (windows && arm) + +package process + +import ( + "errors" + "syscall" + "unsafe" + + "golang.org/x/sys/windows" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +type PROCESS_MEMORY_COUNTERS struct { //nolint:revive //FIXME + CB uint32 + PageFaultCount uint32 + PeakWorkingSetSize uint32 + WorkingSetSize uint32 + QuotaPeakPagedPoolUsage uint32 + QuotaPagedPoolUsage uint32 + QuotaPeakNonPagedPoolUsage uint32 + QuotaNonPagedPoolUsage uint32 + PagefileUsage uint32 + PeakPagefileUsage uint32 +} + +func queryPebAddress(procHandle syscall.Handle, is32BitProcess bool) (uint64, error) { + if is32BitProcess { + // we are on a 32-bit process reading an external 32-bit process + var info processBasicInformation32 + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(procHandle), + uintptr(common.ProcessBasicInformation), + uintptr(unsafe.Pointer(&info)), + uintptr(unsafe.Sizeof(info)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return uint64(info.PebBaseAddress), nil + } + return 0, windows.NTStatus(ret) + } + // we are on a 32-bit process reading an external 64-bit process + if common.ProcNtWow64QueryInformationProcess64.Find() != nil { + return 0, errors.New("can't find API to query 64 bit process from 32 bit") + } + // avoid panic + var info processBasicInformation64 + + ret, _, _ := common.ProcNtWow64QueryInformationProcess64.Call( + uintptr(procHandle), + uintptr(common.ProcessBasicInformation), + uintptr(unsafe.Pointer(&info)), + uintptr(unsafe.Sizeof(info)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return info.PebBaseAddress, nil + } + return 0, windows.NTStatus(ret) +} + +func readProcessMemory(h syscall.Handle, is32BitProcess bool, address uint64, size uint) []byte { + if is32BitProcess { + var read uint + + buffer := make([]byte, size) + + ret, _, _ := common.ProcNtReadVirtualMemory.Call( + uintptr(h), + uintptr(address), + uintptr(unsafe.Pointer(&buffer[0])), + uintptr(size), + uintptr(unsafe.Pointer(&read)), + ) + if int(ret) >= 0 && read > 0 { + return buffer[:read] + } + // reading a 64-bit process from a 32-bit one + } else if common.ProcNtWow64ReadVirtualMemory64.Find() == nil { // avoid panic + var read uint64 + + buffer := make([]byte, size) + + ret, _, _ := common.ProcNtWow64ReadVirtualMemory64.Call( + uintptr(h), + uintptr(address&0xFFFFFFFF), // the call expects a 64-bit value + uintptr(address>>32), + uintptr(unsafe.Pointer(&buffer[0])), + uintptr(size), // the call expects a 64-bit value + uintptr(0), // but size is 32-bit so pass zero as the high dword + uintptr(unsafe.Pointer(&read)), + ) + if int(ret) >= 0 && read > 0 { + return buffer[:uint(read)] + } + } + + // if we reach here, an error happened + return nil +} diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_windows_64bit.go b/vendor/github.com/shirou/gopsutil/v4/process/process_windows_64bit.go new file mode 100644 index 00000000..8cc26c37 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_windows_64bit.go @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build (windows && amd64) || (windows && arm64) + +package process + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +type PROCESS_MEMORY_COUNTERS struct { //nolint:revive //FIXME + CB uint32 + PageFaultCount uint32 + PeakWorkingSetSize uint64 + WorkingSetSize uint64 + QuotaPeakPagedPoolUsage uint64 + QuotaPagedPoolUsage uint64 + QuotaPeakNonPagedPoolUsage uint64 + QuotaNonPagedPoolUsage uint64 + PagefileUsage uint64 + PeakPagefileUsage uint64 +} + +func queryPebAddress(procHandle syscall.Handle, is32BitProcess bool) (uint64, error) { + if is32BitProcess { + // we are on a 64-bit process reading an external 32-bit process + var wow64 uint + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(procHandle), + uintptr(common.ProcessWow64Information), + uintptr(unsafe.Pointer(&wow64)), + uintptr(unsafe.Sizeof(wow64)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return uint64(wow64), nil + } + return 0, windows.NTStatus(ret) + } + // we are on a 64-bit process reading an external 64-bit process + var info processBasicInformation64 + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(procHandle), + uintptr(common.ProcessBasicInformation), + uintptr(unsafe.Pointer(&info)), + uintptr(unsafe.Sizeof(info)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return info.PebBaseAddress, nil + } + return 0, windows.NTStatus(ret) +} + +func readProcessMemory(procHandle syscall.Handle, _ bool, address uint64, size uint) []byte { + var read uint + + buffer := make([]byte, size) + + ret, _, _ := common.ProcNtReadVirtualMemory.Call( + uintptr(procHandle), + uintptr(address), + uintptr(unsafe.Pointer(&buffer[0])), + uintptr(size), + uintptr(unsafe.Pointer(&read)), + ) + if int(ret) >= 0 && read > 0 { + return buffer[:read] + } + return nil +} diff --git a/vendor/github.com/tklauser/go-sysconf/.cirrus.yml b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml new file mode 100644 index 00000000..61724abe --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml @@ -0,0 +1,23 @@ +env: + CIRRUS_CLONE_DEPTH: 1 + GO_VERSION: go1.25.0 + +freebsd_13_task: + freebsd_instance: + image_family: freebsd-13-5 + install_script: | + pkg install -y go + GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest + bin/${GO_VERSION} download + build_script: bin/${GO_VERSION} build -v ./... + test_script: bin/${GO_VERSION} test -race ./... + +freebsd_14_task: + freebsd_instance: + image_family: freebsd-14-2 + install_script: | + pkg install -y go + GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest + bin/${GO_VERSION} download + build_script: bin/${GO_VERSION} build -v ./... + test_script: bin/${GO_VERSION} test -race ./... diff --git a/vendor/github.com/tklauser/go-sysconf/.gitignore b/vendor/github.com/tklauser/go-sysconf/.gitignore new file mode 100644 index 00000000..e4827159 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/.gitignore @@ -0,0 +1 @@ +_obj/ diff --git a/vendor/github.com/tklauser/go-sysconf/LICENSE b/vendor/github.com/tklauser/go-sysconf/LICENSE new file mode 100644 index 00000000..73c6b899 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2018-2022, Tobias Klauser +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/tklauser/go-sysconf/README.md b/vendor/github.com/tklauser/go-sysconf/README.md new file mode 100644 index 00000000..b83d5abf --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/README.md @@ -0,0 +1,46 @@ +# go-sysconf + +[![Go Reference](https://pkg.go.dev/badge/github.com/tklauser/go-sysconf.svg)](https://pkg.go.dev/github.com/tklauser/go-sysconf) +[![GitHub Action Status](https://github.com/tklauser/go-sysconf/workflows/Tests/badge.svg)](https://github.com/tklauser/go-sysconf/actions?query=workflow%3ATests) + +`sysconf` for Go, without using cgo or external binaries (e.g. getconf). + +Supported operating systems: Linux, macOS, DragonflyBSD, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos. + +All POSIX.1 and POSIX.2 variables are supported, see [References](#references) for a complete list. + +Additionally, the following non-standard variables are supported on some operating systems: + +| Variable | Supported on | +|---|---| +| `SC_PHYS_PAGES` | Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos | +| `SC_AVPHYS_PAGES` | Linux, OpenBSD, Solaris/Illumos | +| `SC_NPROCESSORS_CONF` | Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos | +| `SC_NPROCESSORS_ONLN` | Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos | +| `SC_UIO_MAXIOV` | Linux | + +## Usage + +```Go +package main + +import ( + "fmt" + + "github.com/tklauser/go-sysconf" +) + +func main() { + // get clock ticks, this will return the same as C.sysconf(C._SC_CLK_TCK) + clktck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + if err == nil { + fmt.Printf("SC_CLK_TCK: %v\n", clktck) + } +} +``` + +## References + +* [POSIX documenation for `sysconf`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html) +* [Linux manpage for `sysconf(3)`](http://man7.org/linux/man-pages/man3/sysconf.3.html) +* [glibc constants for `sysconf` parameters](https://www.gnu.org/software/libc/manual/html_node/Constants-for-Sysconf.html) diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf.go b/vendor/github.com/tklauser/go-sysconf/sysconf.go new file mode 100644 index 00000000..9d674930 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf.go @@ -0,0 +1,21 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sysconf implements the sysconf(3) function and provides the +// associated SC_* constants to query system configuration values. +package sysconf + +import "errors" + +//go:generate go run mksysconf.go + +var errInvalid = errors.New("invalid parameter value") + +// Sysconf returns the value of a sysconf(3) runtime system parameter. +// The name parameter should be a SC_* constant define in this package. The +// implementation is GOOS-specific and certain SC_* constants might not be +// defined for all GOOSes. +func Sysconf(name int) (int64, error) { + return sysconf(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go new file mode 100644 index 00000000..ec81c02a --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go @@ -0,0 +1,37 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || dragonfly || freebsd || netbsd || openbsd + +package sysconf + +import "golang.org/x/sys/unix" + +func pathconf(path string, name int) int64 { + if val, err := unix.Pathconf(path, name); err == nil { + return int64(val) + } + return -1 +} + +func sysctl32(name string) int64 { + if val, err := unix.SysctlUint32(name); err == nil { + return int64(val) + } + return -1 +} + +func sysctl64(name string) int64 { + if val, err := unix.SysctlUint64(name); err == nil { + return int64(val) + } + return -1 +} + +func yesno(val int64) int64 { + if val == 0 { + return -1 + } + return val +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go b/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go new file mode 100644 index 00000000..b471ec10 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go @@ -0,0 +1,307 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import ( + "strconv" + "strings" + "sync" + + "golang.org/x/sys/unix" +) + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN - 1 + _LOGIN_NAME_MAX = _MAXLOGNAME + _SYMLOOP_MAX = _MAXSYMLINKS + + // _PTHREAD_STACK_MIN changed in macOS 14 + _PTHREAD_STACK_MIN_LT_MACOS14 = 0x2000 + _PTHREAD_STACK_MIN_GE_MACOS14 = 0x4000 +) + +var uname struct { + sync.Once + macOSMajor int +} + +func getMacOSMajor() int { + uname.Once.Do(func() { + var u unix.Utsname + err := unix.Uname(&u) + if err != nil { + return + } + rel := unix.ByteSliceToString(u.Release[:]) + ver := strings.Split(rel, ".") + maj, _ := strconv.Atoi(ver[0]) + uname.macOSMajor = maj + }) + return uname.macOSMajor +} + +// sysconf implements sysconf(4) as in the Darwin libc (derived from the FreeBSD +// libc), version 1534.81.1. +// See https://github.com/apple-oss-distributions/Libc/tree/Libc-1534.81.1. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + fallthrough + case SC_AIO_MAX: + return sysctl32("kern.aiomax"), nil + case SC_AIO_PRIO_DELTA_MAX: + return -1, nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return _INT_MAX, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return -1, nil + case SC_GETGR_R_SIZE_MAX: + return 4096, nil + case SC_GETPW_R_SIZE_MAX: + return 4096, nil + case SC_IOV_MAX: + return _IOV_MAX, nil + case SC_MQ_OPEN_MAX: + return -1, nil + case SC_MQ_PRIO_MAX: + return -1, nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX, SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err != nil { + return -1, nil + } + if rlim.Cur > unix.RLIM_INFINITY { + return -1, nil + } + if rlim.Cur > _LONG_MAX { + return -1, unix.EOVERFLOW + } + return int64(rlim.Cur), nil + case SC_RTSIG_MAX: + return -1, nil + case SC_SEM_NSEMS_MAX: + return sysctl32("kern.sysv.semmns"), nil + case SC_SEM_VALUE_MAX: + return _POSIX_SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + return -1, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + if getMacOSMajor() < 23 { + return _PTHREAD_STACK_MIN_LT_MACOS14, nil + } + return _PTHREAD_STACK_MIN_GE_MACOS14, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return -1, nil + case SC_TTY_NAME_MAX: + // should be _PATH_DEV instead of "/" + return pathconf("/", _PC_NAME_MAX), nil + case SC_TZNAME_MAX: + return pathconf(_PATH_ZONEINFO, _PC_NAME_MAX), nil + + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_MESSAGE_PASSING: + if _POSIX_MESSAGE_PASSING == 0 { + return yesno(sysctl32("p1003_1b.message_passing")), nil + } + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + if _POSIX_PRIORITIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.prioritized_io")), nil + } + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + if _POSIX_PRIORITY_SCHEDULING == 0 { + return yesno(sysctl32("p1003_1b.priority_scheduling")), nil + } + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_REALTIME_SIGNALS: + if _POSIX_REALTIME_SIGNALS == 0 { + return yesno(sysctl32("p1003_1b.realtime_signals")), nil + } + return _POSIX_REALTIME_SIGNALS, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_SEMAPHORES: + if _POSIX_SEMAPHORES == 0 { + return yesno(sysctl32("p1003_1b.semaphores")), nil + } + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + if getMacOSMajor() < 22 { + return -1, nil + } + // macOS 13 (Ventura) and later + return 200112, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SS_REPL_MAX: + return _POSIX_SS_REPL_MAX, nil + case SC_SYNCHRONIZED_IO: + if _POSIX_SYNCHRONIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.synchronized_io")), nil + } + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_TIMERS: + if _POSIX_TIMERS == 0 { + return yesno(sysctl32("p1003_1b.timers")), nil + } + return _POSIX_TIMERS, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TRACE_EVENT_FILTER: + return _POSIX_TRACE_EVENT_FILTER, nil + case SC_TRACE_EVENT_NAME_MAX: + return _POSIX_TRACE_EVENT_NAME_MAX, nil + case SC_TRACE_INHERIT: + return _POSIX_TRACE_INHERIT, nil + case SC_TRACE_LOG: + return _POSIX_TRACE_LOG, nil + case SC_TRACE_NAME_MAX: + return _POSIX_TRACE_NAME_MAX, nil + case SC_TRACE_SYS_MAX: + return _POSIX_TRACE_SYS_MAX, nil + case SC_TRACE_USER_EVENT_MAX: + return _POSIX_TRACE_USER_EVENT_MAX, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + case SC_VERSION: + // TODO(tk): darwin libc uses sysctl(CTL_KERN, KERN_POSIX1) + return _POSIX_VERSION, nil + + case SC_V6_ILP32_OFF32: + if _V6_ILP32_OFF32 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofInt == unix.SizeofLong && + unix.SizeofLong == unix.SizeofPtr && + unix.SizeofPtr == sizeofOffT { + return 1, nil + } + return -1, nil + } + return _V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + if _V6_ILP32_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofInt == unix.SizeofLong && + unix.SizeofLong == unix.SizeofPtr && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + if _V6_LP64_OFF64 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 64 && + unix.SizeofLong == unix.SizeofPtr && + unix.SizeofPtr == sizeofOffT { + return 1, nil + } + return -1, nil + } + return _V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + if _V6_LPBIG_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT >= 32 && + unix.SizeofLong*_CHAR_BIT >= 64 && + unix.SizeofPtr*_CHAR_BIT >= 64 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _V6_LPBIG_OFFBIG, nil + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + case SC_XOPEN_VERSION: + return _XOPEN_VERSION, nil + case SC_XOPEN_XCU_VERSION: + return _XOPEN_XCU_VERSION, nil + + case SC_PHYS_PAGES: + return sysctl64("hw.memsize") / int64(unix.Getpagesize()), nil + case SC_NPROCESSORS_CONF: + fallthrough + case SC_NPROCESSORS_ONLN: + return sysctl32("hw.ncpu"), nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_dragonfly.go b/vendor/github.com/tklauser/go-sysconf/sysconf_dragonfly.go new file mode 100644 index 00000000..c2ed8d12 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_dragonfly.go @@ -0,0 +1,220 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN - 1 + _LOGIN_NAME_MAX = _MAXLOGNAME + _SYMLOOP_MAX = _MAXSYMLINKS +) + +// sysconf implements sysconf(3) as in the FreeBSD 12 libc. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + return sysctl32("p1003_1b.aio_listio_max"), nil + case SC_AIO_MAX: + return sysctl32("p1003_1b.aio_max"), nil + case SC_AIO_PRIO_DELTA_MAX: + return sysctl32("p1003_1b.aio_prio_delta_max"), nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return _ATEXIT_SIZE, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return yesno(sysctl32("p1003_1b.delaytimer_max")), nil + case SC_GETGR_R_SIZE_MAX, SC_GETPW_R_SIZE_MAX: + return -1, nil + case SC_IOV_MAX: + return sysctl32("kern.iov_max"), nil + case SC_MQ_OPEN_MAX: + return sysctl32("kern.mqueue.mq_open_max"), nil + case SC_MQ_PRIO_MAX: + return sysctl32("kern.mqueue.mq_prio_max"), nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_RTSIG_MAX: + return yesno(sysctl32("p1003_1b.rtsig_max")), nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return -1, nil + case SC_SIGQUEUE_MAX: + return yesno(sysctl32("p1003_1b.sigqueue_max")), nil + case SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return yesno(sysctl32("p1003_1b.timer_max")), nil + case SC_TTY_NAME_MAX: + return pathconf(_PATH_DEV, _PC_NAME_MAX), nil + case SC_TZNAME_MAX: + return pathconf(_PATH_ZONEINFO, _PC_NAME_MAX), nil + + case SC_ASYNCHRONOUS_IO: + if _POSIX_ASYNCHRONOUS_IO == 0 { + return sysctl64("p1003_1b.asynchronous_io"), nil + } + return _POSIX_ASYNCHRONOUS_IO, nil + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_MESSAGE_PASSING: + if _POSIX_MESSAGE_PASSING == 0 { + return yesno(sysctl32("p1003_1b.message_passing")), nil + } + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + if _POSIX_PRIORITIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.prioritized_io")), nil + } + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + if _POSIX_PRIORITY_SCHEDULING == 0 { + return yesno(sysctl32("p1003_1b.priority_scheduling")), nil + } + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_REALTIME_SIGNALS: + if _POSIX_REALTIME_SIGNALS == 0 { + return yesno(sysctl32("p1003_1b.realtime_signals")), nil + } + return _POSIX_REALTIME_SIGNALS, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_SEMAPHORES: + if _POSIX_SEMAPHORES == 0 { + return yesno(sysctl32("p1003_1b.semaphores")), nil + } + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + if _POSIX_SYNCHRONIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.synchronized_io")), nil + } + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_TIMERS: + if _POSIX_TIMERS == 0 { + return yesno(sysctl32("p1003_1b.timers")), nil + } + return _POSIX_TIMERS, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + case SC_VERSION: + // TODO(tk): FreeBSD libc uses sysctl(CTL_KERN, KERN_POSIX1) + return _POSIX_VERSION, nil + + /* TODO(tk): these need GOARCH-dependent integer size checks + case SC_V6_ILP32_OFF32: + return _V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + return _V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + return _V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + return _V6_LPBIG_OFFBIG, nil + */ + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + + case SC_PHYS_PAGES: + return sysctl64("hw.availpages"), nil + case SC_NPROCESSORS_CONF: + fallthrough + case SC_NPROCESSORS_ONLN: + return sysctl32("hw.ncpu"), nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_freebsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_freebsd.go new file mode 100644 index 00000000..b7939888 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_freebsd.go @@ -0,0 +1,226 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN - 1 + _LOGIN_NAME_MAX = _MAXLOGNAME + _SYMLOOP_MAX = _MAXSYMLINKS +) + +// sysconf implements sysconf(3) as in the FreeBSD 12 libc. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + return sysctl32("p1003_1b.aio_listio_max"), nil + case SC_AIO_MAX: + return sysctl32("p1003_1b.aio_max"), nil + case SC_AIO_PRIO_DELTA_MAX: + return sysctl32("p1003_1b.aio_prio_delta_max"), nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return _ATEXIT_SIZE, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return sysctl32("p1003_1b.delaytimer_max"), nil + case SC_GETGR_R_SIZE_MAX, SC_GETPW_R_SIZE_MAX: + return -1, nil + case SC_IOV_MAX: + return sysctl32("kern.iov_max"), nil + case SC_MQ_OPEN_MAX: + return yesno(sysctl32("p1003_1b.mq_open_max")), nil + case SC_MQ_PRIO_MAX: + return _MQ_PRIO_MAX, nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_RTSIG_MAX: + return sysctl32("p1003_1b.rtsig_max"), nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return _SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + return sysctl32("p1003_1b.sigqueue_max"), nil + case SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err != nil { + return -1, nil + } + if rlim.Cur == unix.RLIM_INFINITY { + return -1, nil + } + if rlim.Cur > _LONG_MAX { + return -1, unix.EOVERFLOW + } + if rlim.Cur > _SHRT_MAX { + return _SHRT_MAX, nil + } + return rlim.Cur, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return yesno(sysctl32("p1003_1b.timer_max")), nil + case SC_TTY_NAME_MAX: + return pathconf(_PATH_DEV, _PC_NAME_MAX), nil + case SC_TZNAME_MAX: + return pathconf(_PATH_ZONEINFO, _PC_NAME_MAX), nil + + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_MESSAGE_PASSING: + if _POSIX_MESSAGE_PASSING == 0 { + return yesno(sysctl32("p1003_1b.message_passing")), nil + } + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + if _POSIX_PRIORITIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.prioritized_io")), nil + } + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + if _POSIX_PRIORITY_SCHEDULING == 0 { + return yesno(sysctl32("p1003_1b.priority_scheduling")), nil + } + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_REALTIME_SIGNALS: + if _POSIX_REALTIME_SIGNALS == 0 { + return yesno(sysctl32("p1003_1b.realtime_signals")), nil + } + return _POSIX_REALTIME_SIGNALS, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_SEMAPHORES: + if _POSIX_SEMAPHORES == 0 { + return yesno(sysctl32("p1003_1b.semaphores")), nil + } + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + if _POSIX_SYNCHRONIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.synchronized_io")), nil + } + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_TIMERS: + if _POSIX_TIMERS == 0 { + return yesno(sysctl32("p1003_1b.timers")), nil + } + return _POSIX_TIMERS, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + case SC_VERSION: + // TODO(tk): FreeBSD libc uses sysctl(CTL_KERN, KERN_POSIX1) + return _POSIX_VERSION, nil + + /* TODO(tk): these need GOARCH-dependent integer size checks + case SC_V6_ILP32_OFF32: + return _V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + return _V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + return _V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + return _V6_LPBIG_OFFBIG, nil + */ + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + + case SC_PHYS_PAGES: + if val, err := unix.SysctlUint64("hw.availpages"); err == nil { + return int64(val), nil + } + return -1, nil + case SC_NPROCESSORS_CONF: + fallthrough + case SC_NPROCESSORS_ONLN: + if val, err := unix.SysctlUint32("hw.ncpu"); err == nil { + return int64(val), nil + } + return -1, nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go b/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go new file mode 100644 index 00000000..7dcc6f4c --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go @@ -0,0 +1,45 @@ +// Copyright 2021 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd + +package sysconf + +import "os" + +func sysconfGeneric(name int) (int64, error) { + // POSIX default values + if sc, err := sysconfPOSIX(name); err == nil { + return sc, nil + } + + switch name { + case SC_BC_BASE_MAX: + return _BC_BASE_MAX, nil + case SC_BC_DIM_MAX: + return _BC_DIM_MAX, nil + case SC_BC_SCALE_MAX: + return _BC_SCALE_MAX, nil + case SC_BC_STRING_MAX: + return _BC_STRING_MAX, nil + case SC_COLL_WEIGHTS_MAX: + return _COLL_WEIGHTS_MAX, nil + case SC_EXPR_NEST_MAX: + return _EXPR_NEST_MAX, nil + case SC_HOST_NAME_MAX: + return _HOST_NAME_MAX, nil + case SC_LINE_MAX: + return _LINE_MAX, nil + case SC_LOGIN_NAME_MAX: + return _LOGIN_NAME_MAX, nil + case SC_PAGESIZE: // same as SC_PAGE_SIZE + return int64(os.Getpagesize()), nil + case SC_RE_DUP_MAX: + return _RE_DUP_MAX, nil + case SC_SYMLOOP_MAX: + return _SYMLOOP_MAX, nil + } + + return -1, errInvalid +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go b/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go new file mode 100644 index 00000000..9af70070 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go @@ -0,0 +1,353 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import ( + "bufio" + "os" + "runtime" + "strconv" + "strings" + + "github.com/tklauser/numcpus" + "golang.org/x/sys/unix" +) + +const ( + // CLK_TCK is a constant on Linux for all architectures except alpha and ia64. + // See e.g. + // https://git.musl-libc.org/cgit/musl/tree/src/conf/sysconf.c#n30 + // https://github.com/containerd/cgroups/pull/12 + // https://lore.kernel.org/lkml/agtlq6$iht$1@penguin.transmeta.com/ + _SYSTEM_CLK_TCK = 100 +) + +func readProcFsInt64(path string, fallback int64) int64 { + data, err := os.ReadFile(path) + if err != nil { + return fallback + } + i, err := strconv.ParseInt(string(data[:len(data)-1]), 0, 64) + if err != nil { + return fallback + } + return i +} + +// getMemPages computes mem*unit/os.Getpagesize(), but avoids overflowing int64. +func getMemPages(mem uint64, unit uint32) int64 { + pageSize := os.Getpagesize() + for unit > 1 && pageSize > 1 { + unit >>= 1 + pageSize >>= 1 + } + mem *= uint64(unit) + for pageSize > 1 { + pageSize >>= 1 + mem >>= 1 + } + return int64(mem) +} + +func getPhysPages() int64 { + var si unix.Sysinfo_t + err := unix.Sysinfo(&si) + if err != nil { + return int64(0) + } + return getMemPages(uint64(si.Totalram), si.Unit) +} + +func getAvPhysPages() int64 { + var si unix.Sysinfo_t + err := unix.Sysinfo(&si) + if err != nil { + return int64(0) + } + return getMemPages(uint64(si.Freeram), si.Unit) +} + +func getNprocsSysfs() (int64, error) { + n, err := numcpus.GetOnline() + return int64(n), err +} + +func getNprocsProcStat() (int64, error) { + f, err := os.Open("/proc/stat") + if err != nil { + return -1, err + } + defer f.Close() + + count := int64(0) + s := bufio.NewScanner(f) + for s.Scan() { + if line := strings.TrimSpace(s.Text()); strings.HasPrefix(line, "cpu") { + cpu, _, found := strings.Cut(line, " ") + if found { + // skip first line with accumulated values + if cpu == "cpu" { + continue + } + _, err := strconv.ParseInt(cpu[len("cpu"):], 10, 64) + if err == nil { + count++ + } + } + } else { + // The current format of /proc/stat has all the + // cpu* lines at the beginning. Assume this + // stays this way. + break + } + } + if err := s.Err(); err != nil { + return -1, err + } + return count, nil +} + +func getNprocs() int64 { + count, err := getNprocsSysfs() + if err == nil { + return count + } + + count, err = getNprocsProcStat() + if err == nil { + return count + } + + // default to the value determined at runtime startup if all else fails + return int64(runtime.NumCPU()) +} + +func getNprocsConf() int64 { + count, err := numcpus.GetConfigured() + if err == nil { + return int64(count) + } + + // TODO(tk): fall back to reading /proc/cpuinfo on legacy systems + // without sysfs? + + return getNprocs() +} + +func hasClock(clockid int32) bool { + var res unix.Timespec + if err := unix.ClockGetres(clockid, &res); err != nil { + return false + } + return true +} + +func max(a, b int64) int64 { + if a > b { + return a + } + return b +} + +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + return -1, nil + case SC_AIO_MAX: + return -1, nil + case SC_AIO_PRIO_DELTA_MAX: + return _AIO_PRIO_DELTA_MAX, nil + case SC_ARG_MAX: + argMax := int64(_POSIX_ARG_MAX) + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_STACK, &rlim); err == nil { + argMax = max(argMax, int64(rlim.Cur/4)) + } + return argMax, nil + case SC_ATEXIT_MAX: + return _INT_MAX, nil + case SC_CHILD_MAX: + childMax := int64(-1) + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil && rlim.Cur != unix.RLIM_INFINITY { + childMax = int64(rlim.Cur) + } + return childMax, nil + case SC_CLK_TCK: + return _SYSTEM_CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return _DELAYTIMER_MAX, nil + case SC_GETGR_R_SIZE_MAX: + return _NSS_BUFLEN_GROUP, nil + case SC_GETPW_R_SIZE_MAX: + return _NSS_BUFLEN_PASSWD, nil + case SC_MQ_OPEN_MAX: + return -1, nil + case SC_MQ_PRIO_MAX: + return _MQ_PRIO_MAX, nil + case SC_NGROUPS_MAX: + return readProcFsInt64("/proc/sys/kernel/ngroups_max", _NGROUPS_MAX), nil + case SC_OPEN_MAX: + openMax := int64(_OPEN_MAX) + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + openMax = int64(rlim.Cur) + } + return openMax, nil + case SC_RTSIG_MAX: + return _RTSIG_MAX, nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return _SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_SIGPENDING, &rlim); err == nil { + return int64(rlim.Cur), nil + } + return readProcFsInt64("/proc/sys/kernel/rtsig-max", _POSIX_SIGQUEUE_MAX), nil + case SC_STREAM_MAX: + return _STREAM_MAX, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _POSIX_THREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return -1, nil + case SC_TTY_NAME_MAX: + return _TTY_NAME_MAX, nil + case SC_TZNAME_MAX: + return -1, nil + + case SC_CPUTIME: + if hasClock(unix.CLOCK_PROCESS_CPUTIME_ID) { + return _POSIX_VERSION, nil + } + return -1, nil + case SC_MONOTONIC_CLOCK: + if hasClock(unix.CLOCK_MONOTONIC) { + return _POSIX_VERSION, nil + } + return -1, nil + case SC_SAVED_IDS: + return _POSIX_SAVED_IDS, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + if hasClock(unix.CLOCK_THREAD_CPUTIME_ID) { + return _POSIX_VERSION, nil + } + return -1, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TRACE_EVENT_FILTER: + return _POSIX_TRACE_EVENT_FILTER, nil + case SC_TRACE_EVENT_NAME_MAX: + return -1, nil + case SC_TRACE_INHERIT: + return _POSIX_TRACE_INHERIT, nil + case SC_TRACE_LOG: + return _POSIX_TRACE_LOG, nil + case SC_TRACE_NAME_MAX: + return -1, nil + case SC_TRACE_SYS_MAX: + return -1, nil + case SC_TRACE_USER_EVENT_MAX: + return -1, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + + case SC_V7_ILP32_OFF32: + return _POSIX_V7_ILP32_OFF32, nil + case SC_V7_ILP32_OFFBIG: + return _POSIX_V7_ILP32_OFFBIG, nil + case SC_V7_LP64_OFF64: + return _POSIX_V7_LP64_OFF64, nil + case SC_V7_LPBIG_OFFBIG: + return _POSIX_V7_LPBIG_OFFBIG, nil + + case SC_V6_ILP32_OFF32: + return _POSIX_V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + return _POSIX_V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + return _POSIX_V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + return _POSIX_V6_LPBIG_OFFBIG, nil + + case SC_2_C_VERSION: + return _POSIX2_C_VERSION, nil + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return -1, nil + case SC_2_UPE: + return -1, nil + + case SC_XOPEN_CRYPT: + // removed in glibc 2.28 + return -1, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + case SC_XOPEN_VERSION: + return _XOPEN_VERSION, nil + case SC_XOPEN_XCU_VERSION: + return _XOPEN_XCU_VERSION, nil + + case SC_PHYS_PAGES: + return getPhysPages(), nil + case SC_AVPHYS_PAGES: + return getAvPhysPages(), nil + case SC_NPROCESSORS_CONF: + return getNprocsConf(), nil + case SC_NPROCESSORS_ONLN: + return getNprocs(), nil + case SC_UIO_MAXIOV: // same as _SC_IOV_MAX + return _UIO_MAXIOV, nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go new file mode 100644 index 00000000..87cf6a10 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go @@ -0,0 +1,246 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import ( + "sync" + + "golang.org/x/sys/unix" +) + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN + _LOGIN_NAME_MAX = _MAXLOGNAME + 1 + _SYMLOOP_MAX = _MAXSYMLINKS + + _POSIX2_C_BIND = 1 + _POSIX2_C_DEV = -1 + _POSIX2_CHAR_TERM = -1 + _POSIX2_FORT_DEV = -1 + _POSIX2_FORT_RUN = -1 + _POSIX2_LOCALEDEF = -1 + _POSIX2_SW_DEV = -1 + _POSIX2_UPE = -1 +) + +var clktck = sync.OnceValue(func() int64 { + ci, err := unix.SysctlClockinfo("kern.clockrate") + if err != nil { + return -1 + } + return int64(ci.Hz) +}) + +func sysconfPOSIX(name int) (int64, error) { + // NetBSD does not define all _POSIX_* values used in sysconf_posix.go + // The supported ones are handled in sysconf below. + return -1, errInvalid +} + +func sysconf(name int) (int64, error) { + // NetBSD uses sysctl to get some of these values. For the user.* namespace, + // calls get handled by user_sysctl in /usr/src/lib/libc/gen/sysctl.c + // Duplicate the relevant values here. + + switch name { + // 1003.1 + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_CLK_TCK: + return clktck(), nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_JOB_CONTROL: + return sysctl32("kern.job_control"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + return int64(rlim.Cur), nil + } + return -1, nil + case SC_STREAM_MAX: + // sysctl("user.stream_max") + return _FOPEN_MAX, nil + case SC_TZNAME_MAX: + // sysctl("user.tzname_max") + return _NAME_MAX, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_VERSION: + return sysctl32("kern.posix1version"), nil + + // 1003.1b + case SC_FSYNC: + return sysctl32("kern.fsync"), nil + case SC_SYNCHRONIZED_IO: + return sysctl32("kern.synchronized_io"), nil + case SC_MAPPED_FILES: + return sysctl32("kern.mapped_files"), nil + case SC_MEMLOCK: + return sysctl32("kern.memlock"), nil + case SC_MEMLOCK_RANGE: + return sysctl32("kern.memlock_range"), nil + case SC_MEMORY_PROTECTION: + return sysctl32("kern.memory_protection"), nil + case SC_MONOTONIC_CLOCK: + return sysctl32("kern.monotonic_clock"), nil + case SC_SEMAPHORES: + return sysctl32("kern.posix_semaphores"), nil + case SC_TIMERS: + return sysctl32("kern.posix_timers"), nil + + // 1003.1c + case SC_LOGIN_NAME_MAX: + return sysctl32("kern.login_name_max"), nil + case SC_THREADS: + return sysctl32("kern.posix_threads"), nil + + // 1003.1j + case SC_BARRIERS: + return yesno(sysctl32("kern.posix_barriers")), nil + case SC_SPIN_LOCKS: + return yesno(sysctl32("kern.posix_spin_locks")), nil + case SC_READER_WRITER_LOCKS: + return yesno(sysctl32("kern.posix_reader_writer_locks")), nil + + // 1003.2 + case SC_2_VERSION: + // sysctl user.posix2_version + return _POSIX2_VERSION, nil + case SC_2_C_BIND: + // sysctl user.posix2_c_bind + return _POSIX2_C_BIND, nil + case SC_2_C_DEV: + // sysctl user.posix2_c_dev + return _POSIX2_C_DEV, nil + case SC_2_CHAR_TERM: + // sysctl user.posix2_char_term + return _POSIX2_CHAR_TERM, nil + case SC_2_FORT_DEV: + // sysctl user.posix2_fort_dev + return _POSIX2_FORT_DEV, nil + case SC_2_FORT_RUN: + // sysctl user.posix2_fort_run + return _POSIX2_FORT_RUN, nil + case SC_2_LOCALEDEF: + // sysctl user.posix2_localedef + return _POSIX2_LOCALEDEF, nil + case SC_2_SW_DEV: + // sysctl user.posix2_sw_dev + return _POSIX2_SW_DEV, nil + case SC_2_UPE: + // sysctl user.posix2_upe + return _POSIX2_UPE, nil + + // XPG 4.2 + case SC_IOV_MAX: + return sysctl32("kern.iov_max"), nil + case SC_XOPEN_SHM: + return yesno(sysctl32("kern.ipc.sysvshm")), nil + + // 1003.1-2001, XSI Option Group + case SC_AIO_LISTIO_MAX: + return sysctl32("kern.aio_listio_max"), nil + case SC_AIO_MAX: + return sysctl32("kern.aio_max"), nil + case SC_ASYNCHRONOUS_IO: + return yesno(sysctl32("kern.posix_aio")), nil + case SC_MESSAGE_PASSING: + return yesno(sysctl32("kern.posix_msg")), nil + case SC_MQ_OPEN_MAX: + return sysctl32("kern.mqueue.mq_open_max"), nil + case SC_MQ_PRIO_MAX: + return sysctl32("kern.mqueue.mq_prio_max"), nil + case SC_PRIORITY_SCHEDULING: + return yesno(sysctl32("kern.posix_sched")), nil + case SC_ATEXIT_MAX: + // sysctl("user.atexit_max") + return -1, nil // TODO + + // 1003.1-2001, TSF + case SC_GETGR_R_SIZE_MAX: + return _GETGR_R_SIZE_MAX, nil + case SC_GETPW_R_SIZE_MAX: + return _GETPW_R_SIZE_MAX, nil + + // Unsorted + case SC_HOST_NAME_MAX: + return _MAXHOSTNAMELEN, nil + case SC_PASS_MAX: + return _PASSWORD_LEN, nil + case SC_REGEXP: + return _POSIX_REGEXP, nil + case SC_SHARED_MEMORY_OBJECTS: + return _POSIX_SHARED_MEMORY_OBJECTS, nil + case SC_SHELL: + return _POSIX_SHELL, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + + // Extensions + case SC_NPROCESSORS_CONF: + return sysctl32("hw.ncpu"), nil + case SC_NPROCESSORS_ONLN: + return sysctl32("hw.ncpuonline"), nil + + // Linux/Solaris + case SC_PHYS_PAGES: + return sysctl64("hw.physmem64") / int64(unix.Getpagesize()), nil + + // Native + case SC_SCHED_RT_TS: + return sysctl32("kern.sched.rtts"), nil + case SC_SCHED_PRI_MIN: + return sysctl32("kern.sched.pri_min"), nil + case SC_SCHED_PRI_MAX: + return sysctl32("kern.sched.pri_max"), nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _POSIX_THREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _POSIX_THREAD_KEYS_MAX, nil + case SC_THREAD_STACK_MIN: + return int64(unix.Getpagesize()), nil + case SC_THREAD_THREADS_MAX: + return sysctl32("kern.maxproc"), nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_PRIORITY_SCHEDULING, + SC_THREAD_PRIO_INHERIT, + SC_THREAD_PROCESS_SHARED: + return -1, nil + case SC_TTY_NAME_MAX: + return pathconf(_PATH_DEV, _PC_NAME_MAX), nil + case SC_TIMER_MAX: + return _POSIX_TIMER_MAX, nil + case SC_SEM_NSEMS_MAX: + return _LONG_MAX, nil + case SC_CPUTIME: + return _POSIX_CPUTIME, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_DELAYTIMER_MAX: + return _POSIX_DELAYTIMER_MAX, nil + case SC_SIGQUEUE_MAX: + return _POSIX_SIGQUEUE_MAX, nil + case SC_REALTIME_SIGNALS: + return 200112, nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_openbsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_openbsd.go new file mode 100644 index 00000000..c0c394ab --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_openbsd.go @@ -0,0 +1,271 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +// sysconf implements sysconf(3) as in the OpenBSD 6.3 libc. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX, + SC_AIO_MAX, + SC_AIO_PRIO_DELTA_MAX: + return -1, nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return -1, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return -1, nil + case SC_GETGR_R_SIZE_MAX: + return _GR_BUF_LEN, nil + case SC_GETPW_R_SIZE_MAX: + return _PW_BUF_LEN, nil + case SC_IOV_MAX: + return _IOV_MAX, nil + case SC_LOGIN_NAME_MAX: + return _LOGIN_NAME_MAX, nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return _SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + return -1, nil + case SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + if rlim.Cur > _SHRT_MAX { + return _SHRT_MAX, nil + } + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return -1, nil + case SC_TTY_NAME_MAX: + return _TTY_NAME_MAX, nil + case SC_TZNAME_MAX: + return _NAME_MAX, nil + + case SC_BARRIERS: + return _POSIX_BARRIERS, nil + case SC_FSYNC: + return _POSIX_FSYNC, nil + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_JOB_CONTROL: + return _POSIX_JOB_CONTROL, nil + case SC_MAPPED_FILES: + return _POSIX_MAPPED_FILES, nil + case SC_MONOTONIC_CLOCK: + return _POSIX_MONOTONIC_CLOCK, nil + case SC_SAVED_IDS: + return _POSIX_SAVED_IDS, nil + case SC_SEMAPHORES: + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_ROBUST_PRIO_INHERIT: + return _POSIX_THREAD_ROBUST_PRIO_INHERIT, nil + case SC_THREAD_ROBUST_PRIO_PROTECT: + return _POSIX_THREAD_ROBUST_PRIO_PROTECT, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_THREADS: + return _POSIX_THREADS, nil + case SC_TIMEOUTS: + return _POSIX_TIMEOUTS, nil + case SC_TIMERS: + return _POSIX_TIMERS, nil + case SC_TRACE, + SC_TRACE_EVENT_FILTER, + SC_TRACE_EVENT_NAME_MAX, + SC_TRACE_INHERIT, + SC_TRACE_LOG: + return _POSIX_TRACE, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + + case SC_V7_ILP32_OFF32: + return _POSIX_V7_ILP32_OFF32, nil + case SC_V7_ILP32_OFFBIG: + if _POSIX_V7_ILP32_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 32 && + unix.SizeofPtr*_CHAR_BIT == 32 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V7_ILP32_OFFBIG, nil + case SC_V7_LP64_OFF64: + if _POSIX_V7_LP64_OFF64 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 64 && + unix.SizeofPtr*_CHAR_BIT == 64 && + sizeofOffT*_CHAR_BIT == 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V7_LP64_OFF64, nil + case SC_V7_LPBIG_OFFBIG: + if _POSIX_V7_LPBIG_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT >= 32 && + unix.SizeofLong*_CHAR_BIT >= 64 && + unix.SizeofPtr*_CHAR_BIT >= 64 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V7_LPBIG_OFFBIG, nil + + case SC_V6_ILP32_OFF32: + return _POSIX_V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + if _POSIX_V6_ILP32_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 32 && + unix.SizeofPtr*_CHAR_BIT == 32 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + if _POSIX_V6_LP64_OFF64 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 64 && + unix.SizeofPtr*_CHAR_BIT == 64 && + sizeofOffT*_CHAR_BIT == 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + if _POSIX_V6_LPBIG_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT >= 32 && + unix.SizeofLong*_CHAR_BIT >= 64 && + unix.SizeofPtr*_CHAR_BIT >= 64 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V6_LPBIG_OFFBIG, nil + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + case SC_2_VERSION: + return _POSIX2_VERSION, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return _XOPEN_STREAMS, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + case SC_XOPEN_UUCP: + return _XOPEN_UUCP, nil + + case SC_AVPHYS_PAGES: + if uvm, err := unix.SysctlUvmexp("vm.uvmexp"); err == nil { + return int64(uvm.Free), nil + } + return -1, nil + case SC_PHYS_PAGES: + return sysctl64("hw.physmem") / int64(unix.Getpagesize()), nil + case SC_NPROCESSORS_CONF: + return sysctl32("hw.ncpu"), nil + case SC_NPROCESSORS_ONLN: + if val, err := unix.SysctlUint32("hw.ncpuonline"); err == nil { + return int64(val), nil + } + return sysctl32("hw.ncpu"), nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go b/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go new file mode 100644 index 00000000..830d8220 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go @@ -0,0 +1,82 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || dragonfly || freebsd || linux || openbsd + +package sysconf + +func sysconfPOSIX(name int) (int64, error) { + switch name { + case SC_ADVISORY_INFO: + return _POSIX_ADVISORY_INFO, nil + case SC_ASYNCHRONOUS_IO: + return _POSIX_ASYNCHRONOUS_IO, nil + case SC_BARRIERS: + return _POSIX_BARRIERS, nil + case SC_CLOCK_SELECTION: + return _POSIX_CLOCK_SELECTION, nil + case SC_CPUTIME: + return _POSIX_CPUTIME, nil + case SC_FSYNC: + return _POSIX_FSYNC, nil + case SC_IPV6: + return _POSIX_IPV6, nil + case SC_JOB_CONTROL: + return _POSIX_JOB_CONTROL, nil + case SC_MAPPED_FILES: + return _POSIX_MAPPED_FILES, nil + case SC_MEMLOCK: + return _POSIX_MEMLOCK, nil + case SC_MEMLOCK_RANGE: + return _POSIX_MEMLOCK_RANGE, nil + case SC_MONOTONIC_CLOCK: + return _POSIX_MONOTONIC_CLOCK, nil + case SC_MEMORY_PROTECTION: + return _POSIX_MEMORY_PROTECTION, nil + case SC_MESSAGE_PASSING: + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_RAW_SOCKETS: + return _POSIX_RAW_SOCKETS, nil + case SC_READER_WRITER_LOCKS: + return _POSIX_READER_WRITER_LOCKS, nil + case SC_REALTIME_SIGNALS: + return _POSIX_REALTIME_SIGNALS, nil + case SC_REGEXP: + return _POSIX_REGEXP, nil + case SC_SEMAPHORES: + return _POSIX_SEMAPHORES, nil + case SC_SHARED_MEMORY_OBJECTS: + return _POSIX_SHARED_MEMORY_OBJECTS, nil + case SC_SHELL: + return _POSIX_SHELL, nil + case SC_THREADS: + return _POSIX_THREADS, nil + case SC_TIMEOUTS: + return _POSIX_TIMEOUTS, nil + case SC_TIMERS: + return _POSIX_TIMERS, nil + case SC_VERSION: + return _POSIX_VERSION, nil + + case SC_2_C_BIND: + return _POSIX2_C_BIND, nil + case SC_2_C_DEV: + return _POSIX2_C_DEV, nil + case SC_2_FORT_DEV: + return -1, nil + case SC_2_FORT_RUN: + return -1, nil + case SC_2_LOCALEDEF: + return _POSIX2_LOCALEDEF, nil + case SC_2_SW_DEV: + return _POSIX2_SW_DEV, nil + case SC_2_VERSION: + return _POSIX2_VERSION, nil + } + return -1, errInvalid +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_solaris.go b/vendor/github.com/tklauser/go-sysconf/sysconf_solaris.go new file mode 100644 index 00000000..443b2143 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_solaris.go @@ -0,0 +1,14 @@ +// Copyright 2021 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +func sysconf(name int) (int64, error) { + if name < 0 { + return -1, errInvalid + } + return unix.Sysconf(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go b/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go new file mode 100644 index 00000000..5aa9119d --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go @@ -0,0 +1,16 @@ +// Copyright 2021 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris + +package sysconf + +import ( + "fmt" + "runtime" +) + +func sysconf(name int) (int64, error) { + return -1, fmt.Errorf("unsupported on %s", runtime.GOOS) +} diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go new file mode 100644 index 00000000..80b64393 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go @@ -0,0 +1,252 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_darwin.go + +//go:build darwin + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x6b + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x2d + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x46 + SC_GETPW_R_SIZE_MAX = 0x47 + SC_HOST_NAME_MAX = 0x48 + SC_IOV_MAX = 0x38 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x49 + SC_MQ_OPEN_MAX = 0x2e + SC_MQ_PRIO_MAX = 0x4b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x1d + SC_PAGESIZE = 0x1d + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x55 + SC_THREAD_KEYS_MAX = 0x56 + SC_THREAD_STACK_MIN = 0x5d + SC_THREAD_THREADS_MAX = 0x5e + SC_RE_DUP_MAX = 0x10 + SC_RTSIG_MAX = 0x30 + SC_SEM_NSEMS_MAX = 0x31 + SC_SEM_VALUE_MAX = 0x32 + SC_SIGQUEUE_MAX = 0x33 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x78 + SC_TIMER_MAX = 0x34 + SC_TTY_NAME_MAX = 0x65 + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x41 + SC_ASYNCHRONOUS_IO = 0x1c + SC_BARRIERS = 0x42 + SC_CLOCK_SELECTION = 0x43 + SC_CPUTIME = 0x44 + SC_FSYNC = 0x26 + SC_IPV6 = 0x76 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x2f + SC_MEMLOCK = 0x1e + SC_MEMLOCK_RANGE = 0x1f + SC_MEMORY_PROTECTION = 0x20 + SC_MESSAGE_PASSING = 0x21 + SC_MONOTONIC_CLOCK = 0x4a + SC_PRIORITIZED_IO = 0x22 + SC_PRIORITY_SCHEDULING = 0x23 + SC_RAW_SOCKETS = 0x77 + SC_READER_WRITER_LOCKS = 0x4c + SC_REALTIME_SIGNALS = 0x24 + SC_REGEXP = 0x4d + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x25 + SC_SHARED_MEMORY_OBJECTS = 0x27 + SC_SHELL = 0x4e + SC_SPAWN = 0x4f + SC_SPIN_LOCKS = 0x50 + SC_SPORADIC_SERVER = 0x51 + SC_SS_REPL_MAX = 0x7e + SC_SYNCHRONIZED_IO = 0x28 + SC_THREAD_ATTR_STACKADDR = 0x52 + SC_THREAD_ATTR_STACKSIZE = 0x53 + SC_THREAD_CPUTIME = 0x54 + SC_THREAD_PRIO_INHERIT = 0x57 + SC_THREAD_PRIO_PROTECT = 0x58 + SC_THREAD_PRIORITY_SCHEDULING = 0x59 + SC_THREAD_PROCESS_SHARED = 0x5a + SC_THREAD_SAFE_FUNCTIONS = 0x5b + SC_THREAD_SPORADIC_SERVER = 0x5c + SC_THREADS = 0x60 + SC_TIMEOUTS = 0x5f + SC_TIMERS = 0x29 + SC_TRACE = 0x61 + SC_TRACE_EVENT_FILTER = 0x62 + SC_TRACE_EVENT_NAME_MAX = 0x7f + SC_TRACE_INHERIT = 0x63 + SC_TRACE_LOG = 0x64 + SC_TRACE_NAME_MAX = 0x80 + SC_TRACE_SYS_MAX = 0x81 + SC_TRACE_USER_EVENT_MAX = 0x82 + SC_TYPED_MEMORY_OBJECTS = 0x66 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x67 + SC_V6_ILP32_OFFBIG = 0x68 + SC_V6_LP64_OFF64 = 0x69 + SC_V6_LPBIG_OFFBIG = 0x6a + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x3b + SC_2_PBS_ACCOUNTING = 0x3c + SC_2_PBS_CHECKPOINT = 0x3d + SC_2_PBS_LOCATE = 0x3e + SC_2_PBS_MESSAGE = 0x3f + SC_2_PBS_TRACK = 0x40 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x6c + SC_XOPEN_ENH_I18N = 0x6d + SC_XOPEN_REALTIME = 0x6f + SC_XOPEN_REALTIME_THREADS = 0x70 + SC_XOPEN_SHM = 0x71 + SC_XOPEN_STREAMS = 0x72 + SC_XOPEN_UNIX = 0x73 + SC_XOPEN_VERSION = 0x74 + SC_XOPEN_XCU_VERSION = 0x79 + + SC_PHYS_PAGES = 0xc8 + SC_NPROCESSORS_CONF = 0x39 + SC_NPROCESSORS_ONLN = 0x3a +) + +const ( + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0x2 + _EXPR_NEST_MAX = 0x20 + _IOV_MAX = 0x400 + _LINE_MAX = 0x800 + _NAME_MAX = 0xff + _RE_DUP_MAX = 0xff + + _CLK_TCK = 0x64 + + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0xff + _MAXSYMLINKS = 0x20 + + _POSIX_ADVISORY_INFO = -0x1 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = -0x1 + _POSIX_BARRIERS = -0x1 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = -0x1 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x30db0 + _POSIX_JOB_CONTROL = 0x30db0 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = -0x1 + _POSIX_MEMLOCK_RANGE = -0x1 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = -0x1 + _POSIX_MONOTONIC_CLOCK = -0x1 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = -0x1 + _POSIX_RAW_SOCKETS = -0x1 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = -0x1 + _POSIX_REGEXP = 0x30db0 + _POSIX_SEM_VALUE_MAX = 0x7fff + _POSIX_SEMAPHORES = -0x1 + _POSIX_SHARED_MEMORY_OBJECTS = -0x1 + _POSIX_SHELL = 0x30db0 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPIN_LOCKS = -0x1 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SS_REPL_MAX = 0x4 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = -0x1 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_KEYS_MAX = 0x80 + _POSIX_THREAD_PRIO_INHERIT = -0x1 + _POSIX_THREAD_PRIO_PROTECT = -0x1 + _POSIX_THREAD_PRIORITY_SCHEDULING = -0x1 + _POSIX_THREAD_PROCESS_SHARED = 0x30db0 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x30db0 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMEOUTS = -0x1 + _POSIX_TIMERS = -0x1 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_EVENT_NAME_MAX = 0x1e + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TRACE_NAME_MAX = 0x8 + _POSIX_TRACE_SYS_MAX = 0x8 + _POSIX_TRACE_USER_EVENT_MAX = 0x20 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x30db0 + + _V6_ILP32_OFF32 = -0x1 + _V6_ILP32_OFFBIG = -0x1 + _V6_LP64_OFF64 = 0x1 + _V6_LPBIG_OFFBIG = 0x1 + + _POSIX2_C_BIND = 0x30db0 + _POSIX2_C_DEV = 0x30db0 + _POSIX2_CHAR_TERM = 0x30db0 + _POSIX2_LOCALEDEF = 0x30db0 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = 0x30db0 + _POSIX2_UPE = 0x30db0 + _POSIX2_VERSION = 0x30db0 + + _XOPEN_CRYPT = 0x1 + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x258 + _XOPEN_XCU_VERSION = 0x4 + + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x200 +) + +const ( + _PC_NAME_MAX = 0x4 + + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) + +const ( + _CHAR_BIT = 0x8 + + _INT_MAX = 0x7fffffff + _LONG_MAX = 0x7fffffffffffffff + + sizeofOffT = 0x8 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go new file mode 100644 index 00000000..dae56570 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go @@ -0,0 +1,227 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_dragonfly.go + +//go:build dragonfly + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x6b + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x2d + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x46 + SC_GETPW_R_SIZE_MAX = 0x47 + SC_HOST_NAME_MAX = 0x48 + SC_IOV_MAX = 0x38 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x49 + SC_MQ_OPEN_MAX = 0x2e + SC_MQ_PRIO_MAX = 0x4b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x2f + SC_PAGESIZE = 0x2f + SC_RE_DUP_MAX = 0x10 + SC_RTSIG_MAX = 0x30 + SC_SEM_NSEMS_MAX = 0x31 + SC_SEM_VALUE_MAX = 0x32 + SC_SIGQUEUE_MAX = 0x33 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x78 + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x55 + SC_THREAD_KEYS_MAX = 0x56 + SC_THREAD_STACK_MIN = 0x5d + SC_THREAD_THREADS_MAX = 0x5e + SC_TIMER_MAX = 0x34 + SC_TTY_NAME_MAX = 0x65 + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x41 + SC_ASYNCHRONOUS_IO = 0x1c + SC_BARRIERS = 0x42 + SC_CLOCK_SELECTION = 0x43 + SC_CPUTIME = 0x44 + SC_FSYNC = 0x26 + SC_IPV6 = 0x76 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x1d + SC_MEMLOCK = 0x1e + SC_MEMLOCK_RANGE = 0x1f + SC_MEMORY_PROTECTION = 0x20 + SC_MESSAGE_PASSING = 0x21 + SC_MONOTONIC_CLOCK = 0x4a + SC_PRIORITIZED_IO = 0x22 + SC_PRIORITY_SCHEDULING = 0x23 + SC_RAW_SOCKETS = 0x77 + SC_READER_WRITER_LOCKS = 0x4c + SC_REALTIME_SIGNALS = 0x24 + SC_REGEXP = 0x4d + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x25 + SC_SHARED_MEMORY_OBJECTS = 0x27 + SC_SHELL = 0x4e + SC_SPAWN = 0x4f + SC_SPIN_LOCKS = 0x50 + SC_SPORADIC_SERVER = 0x51 + SC_SYNCHRONIZED_IO = 0x28 + SC_THREAD_ATTR_STACKADDR = 0x52 + SC_THREAD_ATTR_STACKSIZE = 0x53 + SC_THREAD_CPUTIME = 0x54 + SC_THREAD_PRIO_INHERIT = 0x57 + SC_THREAD_PRIO_PROTECT = 0x58 + SC_THREAD_PRIORITY_SCHEDULING = 0x59 + SC_THREAD_PROCESS_SHARED = 0x5a + SC_THREAD_SAFE_FUNCTIONS = 0x5b + SC_THREAD_SPORADIC_SERVER = 0x5c + SC_THREADS = 0x60 + SC_TIMEOUTS = 0x5f + SC_TIMERS = 0x29 + SC_TRACE = 0x61 + SC_TRACE_EVENT_FILTER = 0x62 + SC_TRACE_INHERIT = 0x63 + SC_TRACE_LOG = 0x64 + SC_TYPED_MEMORY_OBJECTS = 0x66 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x67 + SC_V6_ILP32_OFFBIG = 0x68 + SC_V6_LP64_OFF64 = 0x69 + SC_V6_LPBIG_OFFBIG = 0x6a + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x3b + SC_2_PBS_ACCOUNTING = 0x3c + SC_2_PBS_CHECKPOINT = 0x3d + SC_2_PBS_LOCATE = 0x3e + SC_2_PBS_MESSAGE = 0x3f + SC_2_PBS_TRACK = 0x40 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x6c + SC_XOPEN_ENH_I18N = 0x6d + SC_XOPEN_REALTIME = 0x6f + SC_XOPEN_REALTIME_THREADS = 0x70 + SC_XOPEN_SHM = 0x71 + SC_XOPEN_STREAMS = 0x72 + SC_XOPEN_UNIX = 0x73 + SC_XOPEN_VERSION = 0x74 + SC_XOPEN_XCU_VERSION = 0x75 + + SC_PHYS_PAGES = 0x79 + SC_NPROCESSORS_CONF = 0x39 + SC_NPROCESSORS_ONLN = 0x3a +) + +const ( + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xa + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + _RE_DUP_MAX = 0xff + + _CLK_TCK = 0x80 + + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0x11 + _MAXSYMLINKS = 0x20 + _ATEXIT_SIZE = 0x20 + + _POSIX_ADVISORY_INFO = -0x1 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x0 + _POSIX_BARRIERS = 0x30db0 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = 0x30db0 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x0 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = -0x1 + _POSIX_MEMLOCK_RANGE = 0x30db0 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = 0x30db0 + _POSIX_MONOTONIC_CLOCK = 0x30db0 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_RAW_SOCKETS = 0x30db0 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = 0x30db0 + _POSIX_REGEXP = 0x1 + _POSIX_SEM_VALUE_MAX = 0x7fff + _POSIX_SEMAPHORES = 0x30db0 + _POSIX_SHARED_MEMORY_OBJECTS = 0x30db0 + _POSIX_SHELL = 0x1 + _POSIX_SPAWN = 0x30db0 + _POSIX_SPIN_LOCKS = 0x30db0 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x30db0 + _POSIX_THREAD_PRIO_INHERIT = 0x30db0 + _POSIX_THREAD_PRIO_PROTECT = 0x30db0 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_THREAD_PROCESS_SHARED = -0x1 + _POSIX_THREAD_SAFE_FUNCTIONS = -0x1 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMEOUTS = 0x30db0 + _POSIX_TIMERS = 0x30db0 + _POSIX_TRACE = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x30db0 + + _V6_ILP32_OFF32 = -0x1 + _V6_ILP32_OFFBIG = 0x0 + _V6_LP64_OFF64 = 0x0 + _V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_CHAR_TERM = 0x1 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_UPE = 0x31069 + _POSIX2_VERSION = 0x30a2c + + _XOPEN_CRYPT = -0x1 + _XOPEN_ENH_I18N = -0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = -0x1 + + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x100 + _PTHREAD_STACK_MIN = 0x4000 +) + +const ( + _PC_NAME_MAX = 0x4 + + _PATH_DEV = "/dev/" + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go new file mode 100644 index 00000000..068f8a7e --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go @@ -0,0 +1,228 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_freebsd.go + +//go:build freebsd + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x6b + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x2d + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x46 + SC_GETPW_R_SIZE_MAX = 0x47 + SC_HOST_NAME_MAX = 0x48 + SC_IOV_MAX = 0x38 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x49 + SC_MQ_OPEN_MAX = 0x2e + SC_MQ_PRIO_MAX = 0x4b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x2f + SC_PAGESIZE = 0x2f + SC_RE_DUP_MAX = 0x10 + SC_RTSIG_MAX = 0x30 + SC_SEM_NSEMS_MAX = 0x31 + SC_SEM_VALUE_MAX = 0x32 + SC_SIGQUEUE_MAX = 0x33 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x78 + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x55 + SC_THREAD_KEYS_MAX = 0x56 + SC_THREAD_STACK_MIN = 0x5d + SC_THREAD_THREADS_MAX = 0x5e + SC_TIMER_MAX = 0x34 + SC_TTY_NAME_MAX = 0x65 + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x41 + SC_ASYNCHRONOUS_IO = 0x1c + SC_BARRIERS = 0x42 + SC_CLOCK_SELECTION = 0x43 + SC_CPUTIME = 0x44 + SC_FSYNC = 0x26 + SC_IPV6 = 0x76 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x1d + SC_MEMLOCK = 0x1e + SC_MEMLOCK_RANGE = 0x1f + SC_MEMORY_PROTECTION = 0x20 + SC_MESSAGE_PASSING = 0x21 + SC_MONOTONIC_CLOCK = 0x4a + SC_PRIORITIZED_IO = 0x22 + SC_PRIORITY_SCHEDULING = 0x23 + SC_RAW_SOCKETS = 0x77 + SC_READER_WRITER_LOCKS = 0x4c + SC_REALTIME_SIGNALS = 0x24 + SC_REGEXP = 0x4d + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x25 + SC_SHARED_MEMORY_OBJECTS = 0x27 + SC_SHELL = 0x4e + SC_SPAWN = 0x4f + SC_SPIN_LOCKS = 0x50 + SC_SPORADIC_SERVER = 0x51 + SC_SYNCHRONIZED_IO = 0x28 + SC_THREAD_ATTR_STACKADDR = 0x52 + SC_THREAD_ATTR_STACKSIZE = 0x53 + SC_THREAD_CPUTIME = 0x54 + SC_THREAD_PRIO_INHERIT = 0x57 + SC_THREAD_PRIO_PROTECT = 0x58 + SC_THREAD_PRIORITY_SCHEDULING = 0x59 + SC_THREAD_PROCESS_SHARED = 0x5a + SC_THREAD_SAFE_FUNCTIONS = 0x5b + SC_THREAD_SPORADIC_SERVER = 0x5c + SC_THREADS = 0x60 + SC_TIMEOUTS = 0x5f + SC_TIMERS = 0x29 + SC_TRACE = 0x61 + SC_TRACE_EVENT_FILTER = 0x62 + SC_TRACE_INHERIT = 0x63 + SC_TRACE_LOG = 0x64 + SC_TYPED_MEMORY_OBJECTS = 0x66 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x67 + SC_V6_ILP32_OFFBIG = 0x68 + SC_V6_LP64_OFF64 = 0x69 + SC_V6_LPBIG_OFFBIG = 0x6a + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x3b + SC_2_PBS_ACCOUNTING = 0x3c + SC_2_PBS_CHECKPOINT = 0x3d + SC_2_PBS_LOCATE = 0x3e + SC_2_PBS_MESSAGE = 0x3f + SC_2_PBS_TRACK = 0x40 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x6c + SC_XOPEN_ENH_I18N = 0x6d + SC_XOPEN_REALTIME = 0x6f + SC_XOPEN_REALTIME_THREADS = 0x70 + SC_XOPEN_SHM = 0x71 + SC_XOPEN_STREAMS = 0x72 + SC_XOPEN_UNIX = 0x73 + SC_XOPEN_VERSION = 0x74 + SC_XOPEN_XCU_VERSION = 0x75 + + SC_PHYS_PAGES = 0x79 + SC_NPROCESSORS_CONF = 0x39 + SC_NPROCESSORS_ONLN = 0x3a +) + +const ( + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xa + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + _MQ_PRIO_MAX = 0x40 + _RE_DUP_MAX = 0xff + _SEM_VALUE_MAX = 0x7fffffff + + _CLK_TCK = 0x80 + + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0x21 + _MAXSYMLINKS = 0x20 + _ATEXIT_SIZE = 0x20 + + _POSIX_ADVISORY_INFO = 0x30db0 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x30db0 + _POSIX_BARRIERS = 0x30db0 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = 0x30db0 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x0 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = -0x1 + _POSIX_MEMLOCK_RANGE = 0x30db0 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = 0x30db0 + _POSIX_MONOTONIC_CLOCK = 0x30db0 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = 0x0 + _POSIX_RAW_SOCKETS = 0x30db0 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = 0x30db0 + _POSIX_REGEXP = 0x1 + _POSIX_SEM_VALUE_MAX = 0x7fff + _POSIX_SEMAPHORES = 0x30db0 + _POSIX_SHARED_MEMORY_OBJECTS = 0x30db0 + _POSIX_SHELL = 0x1 + _POSIX_SPAWN = 0x30db0 + _POSIX_SPIN_LOCKS = 0x30db0 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x30db0 + _POSIX_THREAD_PRIO_INHERIT = 0x30db0 + _POSIX_THREAD_PRIO_PROTECT = 0x30db0 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_THREAD_PROCESS_SHARED = 0x30db0 + _POSIX_THREAD_SAFE_FUNCTIONS = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMEOUTS = 0x30db0 + _POSIX_TIMERS = 0x30db0 + _POSIX_TRACE = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x30db0 + + _V6_ILP32_OFF32 = -0x1 + _V6_ILP32_OFFBIG = 0x0 + _V6_LP64_OFF64 = 0x0 + _V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x30db0 + _POSIX2_C_DEV = -0x1 + _POSIX2_CHAR_TERM = 0x1 + _POSIX2_LOCALEDEF = -0x1 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = -0x1 + _POSIX2_UPE = 0x30db0 + _POSIX2_VERSION = 0x30a2c + + _XOPEN_CRYPT = -0x1 + _XOPEN_ENH_I18N = -0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = -0x1 + + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x100 + _PTHREAD_STACK_MIN = 0x800 +) + +const ( + _PC_NAME_MAX = 0x4 + + _PATH_DEV = "/dev/" + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go new file mode 100644 index 00000000..12f289d7 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go @@ -0,0 +1,146 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_linux.go + +//go:build linux + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x17 + SC_AIO_MAX = 0x18 + SC_AIO_PRIO_DELTA_MAX = 0x19 + SC_ARG_MAX = 0x0 + SC_ATEXIT_MAX = 0x57 + SC_BC_BASE_MAX = 0x24 + SC_BC_DIM_MAX = 0x25 + SC_BC_SCALE_MAX = 0x26 + SC_BC_STRING_MAX = 0x27 + SC_CHILD_MAX = 0x1 + SC_CLK_TCK = 0x2 + SC_COLL_WEIGHTS_MAX = 0x28 + SC_DELAYTIMER_MAX = 0x1a + SC_EXPR_NEST_MAX = 0x2a + SC_GETGR_R_SIZE_MAX = 0x45 + SC_GETPW_R_SIZE_MAX = 0x46 + SC_HOST_NAME_MAX = 0xb4 + SC_IOV_MAX = 0x3c + SC_LINE_MAX = 0x2b + SC_LOGIN_NAME_MAX = 0x47 + SC_MQ_OPEN_MAX = 0x1b + SC_MQ_PRIO_MAX = 0x1c + SC_NGROUPS_MAX = 0x3 + SC_OPEN_MAX = 0x4 + SC_PAGE_SIZE = 0x1e + SC_PAGESIZE = 0x1e + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x49 + SC_THREAD_KEYS_MAX = 0x4a + SC_THREAD_STACK_MIN = 0x4b + SC_THREAD_THREADS_MAX = 0x4c + SC_RE_DUP_MAX = 0x2c + SC_RTSIG_MAX = 0x1f + SC_SEM_NSEMS_MAX = 0x20 + SC_SEM_VALUE_MAX = 0x21 + SC_SIGQUEUE_MAX = 0x22 + SC_STREAM_MAX = 0x5 + SC_SYMLOOP_MAX = 0xad + SC_TIMER_MAX = 0x23 + SC_TTY_NAME_MAX = 0x48 + SC_TZNAME_MAX = 0x6 + + SC_ADVISORY_INFO = 0x84 + SC_ASYNCHRONOUS_IO = 0xc + SC_BARRIERS = 0x85 + SC_CLOCK_SELECTION = 0x89 + SC_CPUTIME = 0x8a + SC_FSYNC = 0xf + SC_IPV6 = 0xeb + SC_JOB_CONTROL = 0x7 + SC_MAPPED_FILES = 0x10 + SC_MEMLOCK = 0x11 + SC_MEMLOCK_RANGE = 0x12 + SC_MEMORY_PROTECTION = 0x13 + SC_MESSAGE_PASSING = 0x14 + SC_MONOTONIC_CLOCK = 0x95 + SC_PRIORITIZED_IO = 0xd + SC_PRIORITY_SCHEDULING = 0xa + SC_RAW_SOCKETS = 0xec + SC_READER_WRITER_LOCKS = 0x99 + SC_REALTIME_SIGNALS = 0x9 + SC_REGEXP = 0x9b + SC_SAVED_IDS = 0x8 + SC_SEMAPHORES = 0x15 + SC_SHARED_MEMORY_OBJECTS = 0x16 + SC_SHELL = 0x9d + SC_SPAWN = 0x9f + SC_SPIN_LOCKS = 0x9a + SC_SPORADIC_SERVER = 0xa0 + SC_SS_REPL_MAX = 0xf1 + SC_SYNCHRONIZED_IO = 0xe + SC_THREAD_ATTR_STACKADDR = 0x4d + SC_THREAD_ATTR_STACKSIZE = 0x4e + SC_THREAD_CPUTIME = 0x8b + SC_THREAD_PRIO_INHERIT = 0x50 + SC_THREAD_PRIO_PROTECT = 0x51 + SC_THREAD_PRIORITY_SCHEDULING = 0x4f + SC_THREAD_PROCESS_SHARED = 0x52 + SC_THREAD_ROBUST_PRIO_INHERIT = 0xf7 + SC_THREAD_ROBUST_PRIO_PROTECT = 0xf8 + SC_THREAD_SAFE_FUNCTIONS = 0x44 + SC_THREAD_SPORADIC_SERVER = 0xa1 + SC_THREADS = 0x43 + SC_TIMEOUTS = 0xa4 + SC_TIMERS = 0xb + SC_TRACE = 0xb5 + SC_TRACE_EVENT_FILTER = 0xb6 + SC_TRACE_EVENT_NAME_MAX = 0xf2 + SC_TRACE_INHERIT = 0xb7 + SC_TRACE_LOG = 0xb8 + SC_TRACE_NAME_MAX = 0xf3 + SC_TRACE_SYS_MAX = 0xf4 + SC_TRACE_USER_EVENT_MAX = 0xf5 + SC_TYPED_MEMORY_OBJECTS = 0xa5 + SC_VERSION = 0x1d + + SC_V7_ILP32_OFF32 = 0xed + SC_V7_ILP32_OFFBIG = 0xee + SC_V7_LP64_OFF64 = 0xef + SC_V7_LPBIG_OFFBIG = 0xf0 + + SC_V6_ILP32_OFF32 = 0xb0 + SC_V6_ILP32_OFFBIG = 0xb1 + SC_V6_LP64_OFF64 = 0xb2 + SC_V6_LPBIG_OFFBIG = 0xb3 + + SC_2_C_BIND = 0x2f + SC_2_C_DEV = 0x30 + SC_2_C_VERSION = 0x60 + SC_2_CHAR_TERM = 0x5f + SC_2_FORT_DEV = 0x31 + SC_2_FORT_RUN = 0x32 + SC_2_LOCALEDEF = 0x34 + SC_2_PBS = 0xa8 + SC_2_PBS_ACCOUNTING = 0xa9 + SC_2_PBS_CHECKPOINT = 0xaf + SC_2_PBS_LOCATE = 0xaa + SC_2_PBS_MESSAGE = 0xab + SC_2_PBS_TRACK = 0xac + SC_2_SW_DEV = 0x33 + SC_2_UPE = 0x61 + SC_2_VERSION = 0x2e + + SC_XOPEN_CRYPT = 0x5c + SC_XOPEN_ENH_I18N = 0x5d + SC_XOPEN_REALTIME = 0x82 + SC_XOPEN_REALTIME_THREADS = 0x83 + SC_XOPEN_SHM = 0x5e + SC_XOPEN_STREAMS = 0xf6 + SC_XOPEN_UNIX = 0x5b + SC_XOPEN_VERSION = 0x59 + SC_XOPEN_XCU_VERSION = 0x5a + + SC_PHYS_PAGES = 0x55 + SC_AVPHYS_PAGES = 0x56 + SC_NPROCESSORS_CONF = 0x53 + SC_NPROCESSORS_ONLN = 0x54 + SC_UIO_MAXIOV = 0x3c +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go new file mode 100644 index 00000000..772af475 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go @@ -0,0 +1,163 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_netbsd.go + +//go:build netbsd + +package sysconf + +const ( + SC_ARG_MAX = 0x1 + SC_CHILD_MAX = 0x2 + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_JOB_CONTROL = 0x6 + SC_SAVED_IDS = 0x7 + SC_VERSION = 0x8 + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_COLL_WEIGHTS_MAX = 0xd + SC_EXPR_NEST_MAX = 0xe + SC_LINE_MAX = 0xf + SC_RE_DUP_MAX = 0x10 + SC_2_VERSION = 0x11 + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_STREAM_MAX = 0x1a + SC_TZNAME_MAX = 0x1b + SC_PAGESIZE = 0x1c + SC_PAGE_SIZE = 0x1c + SC_FSYNC = 0x1d + SC_XOPEN_SHM = 0x1e + SC_SYNCHRONIZED_IO = 0x1f + SC_IOV_MAX = 0x20 + SC_MAPPED_FILES = 0x21 + SC_MEMLOCK = 0x22 + SC_MEMLOCK_RANGE = 0x23 + SC_MEMORY_PROTECTION = 0x24 + SC_LOGIN_NAME_MAX = 0x25 + SC_MONOTONIC_CLOCK = 0x26 + SC_CLK_TCK = 0x27 + SC_ATEXIT_MAX = 0x28 + SC_THREADS = 0x29 + SC_SEMAPHORES = 0x2a + SC_BARRIERS = 0x2b + SC_TIMERS = 0x2c + SC_SPIN_LOCKS = 0x2d + SC_READER_WRITER_LOCKS = 0x2e + SC_GETGR_R_SIZE_MAX = 0x2f + SC_GETPW_R_SIZE_MAX = 0x30 + SC_CLOCK_SELECTION = 0x31 + SC_ASYNCHRONOUS_IO = 0x32 + SC_AIO_LISTIO_MAX = 0x33 + SC_AIO_MAX = 0x34 + SC_MESSAGE_PASSING = 0x35 + SC_MQ_OPEN_MAX = 0x36 + SC_MQ_PRIO_MAX = 0x37 + SC_PRIORITY_SCHEDULING = 0x38 + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x39 + SC_THREAD_KEYS_MAX = 0x3a + SC_THREAD_STACK_MIN = 0x3b + SC_THREAD_THREADS_MAX = 0x3c + SC_THREAD_ATTR_STACKADDR = 0x3d + SC_THREAD_ATTR_STACKSIZE = 0x3e + SC_THREAD_PRIORITY_SCHEDULING = 0x3f + SC_THREAD_PRIO_INHERIT = 0x40 + SC_THREAD_PRIO_PROTECT = 0x41 + SC_THREAD_PROCESS_SHARED = 0x42 + SC_THREAD_SAFE_FUNCTIONS = 0x43 + SC_TTY_NAME_MAX = 0x44 + SC_HOST_NAME_MAX = 0x45 + SC_PASS_MAX = 0x46 + SC_REGEXP = 0x47 + SC_SHELL = 0x48 + SC_SYMLOOP_MAX = 0x49 + + SC_V6_ILP32_OFF32 = 0x4a + SC_V6_ILP32_OFFBIG = 0x4b + SC_V6_LP64_OFF64 = 0x4c + SC_V6_LPBIG_OFFBIG = 0x4d + SC_2_PBS = 0x50 + SC_2_PBS_ACCOUNTING = 0x51 + SC_2_PBS_CHECKPOINT = 0x52 + SC_2_PBS_LOCATE = 0x53 + SC_2_PBS_MESSAGE = 0x54 + SC_2_PBS_TRACK = 0x55 + + SC_SPAWN = 0x56 + SC_SHARED_MEMORY_OBJECTS = 0x57 + + SC_TIMER_MAX = 0x58 + SC_SEM_NSEMS_MAX = 0x59 + SC_CPUTIME = 0x5a + SC_THREAD_CPUTIME = 0x5b + SC_DELAYTIMER_MAX = 0x5c + SC_SIGQUEUE_MAX = 0x5d + SC_REALTIME_SIGNALS = 0x5e + + SC_PHYS_PAGES = 0x79 + + SC_NPROCESSORS_CONF = 0x3e9 + SC_NPROCESSORS_ONLN = 0x3ea + + SC_SCHED_RT_TS = 0x7d1 + SC_SCHED_PRI_MIN = 0x7d2 + SC_SCHED_PRI_MAX = 0x7d3 +) + +const ( + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0x10 + _MAXSYMLINKS = 0x20 + + _POSIX_ARG_MAX = 0x1000 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CPUTIME = 0x30db0 + _POSIX_DELAYTIMER_MAX = 0x20 + _POSIX_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_REGEXP = 0x1 + _POSIX_SHARED_MEMORY_OBJECTS = 0x0 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x30db0 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_KEYS_MAX = 0x80 + _POSIX_THREAD_PRIO_PROTECT = 0x30db0 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x30db0 + _POSIX_TIMER_MAX = 0x20 + _POSIX_VERSION = 0x30db0 + + _POSIX2_VERSION = 0x30db0 + + _FOPEN_MAX = 0x14 + _NAME_MAX = 0x1ff + _RE_DUP_MAX = 0xff + + _BC_BASE_MAX = 0x7fffffff + _BC_DIM_MAX = 0xffff + _BC_SCALE_MAX = 0x7fffffff + _BC_STRING_MAX = 0x7fffffff + _COLL_WEIGHTS_MAX = 0x2 + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + + _GETGR_R_SIZE_MAX = 0x400 + _GETPW_R_SIZE_MAX = 0x400 + + _PATH_DEV = "/dev/" + _PATH_ZONEINFO = "/usr/share/zoneinfo" + + _PASSWORD_LEN = 0x80 +) + +const _PC_NAME_MAX = 0x4 diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go new file mode 100644 index 00000000..625b098f --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go @@ -0,0 +1,262 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_openbsd.go + +//go:build openbsd + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x2e + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x32 + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x64 + SC_GETPW_R_SIZE_MAX = 0x65 + SC_HOST_NAME_MAX = 0x21 + SC_IOV_MAX = 0x33 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x66 + SC_MQ_OPEN_MAX = 0x3a + SC_MQ_PRIO_MAX = 0x3b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x1c + SC_PAGESIZE = 0x1c + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x50 + SC_THREAD_KEYS_MAX = 0x51 + SC_THREAD_STACK_MIN = 0x59 + SC_THREAD_THREADS_MAX = 0x5a + SC_RE_DUP_MAX = 0x10 + SC_SEM_NSEMS_MAX = 0x1f + SC_SEM_VALUE_MAX = 0x20 + SC_SIGQUEUE_MAX = 0x46 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x4c + SC_TIMER_MAX = 0x5d + SC_TTY_NAME_MAX = 0x6b + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x29 + SC_ASYNCHRONOUS_IO = 0x2d + SC_BARRIERS = 0x2f + SC_CLOCK_SELECTION = 0x30 + SC_CPUTIME = 0x31 + SC_FSYNC = 0x1d + SC_IPV6 = 0x34 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x35 + SC_MEMLOCK = 0x36 + SC_MEMLOCK_RANGE = 0x37 + SC_MEMORY_PROTECTION = 0x38 + SC_MESSAGE_PASSING = 0x39 + SC_MONOTONIC_CLOCK = 0x22 + SC_PRIORITIZED_IO = 0x3c + SC_PRIORITY_SCHEDULING = 0x3d + SC_RAW_SOCKETS = 0x3e + SC_READER_WRITER_LOCKS = 0x3f + SC_REALTIME_SIGNALS = 0x40 + SC_REGEXP = 0x41 + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x43 + SC_SHARED_MEMORY_OBJECTS = 0x44 + SC_SHELL = 0x45 + SC_SPAWN = 0x47 + SC_SPIN_LOCKS = 0x48 + SC_SPORADIC_SERVER = 0x49 + SC_SS_REPL_MAX = 0x4a + SC_SYNCHRONIZED_IO = 0x4b + SC_THREAD_ATTR_STACKADDR = 0x4d + SC_THREAD_ATTR_STACKSIZE = 0x4e + SC_THREAD_CPUTIME = 0x4f + SC_THREAD_PRIO_INHERIT = 0x52 + SC_THREAD_PRIO_PROTECT = 0x53 + SC_THREAD_PRIORITY_SCHEDULING = 0x54 + SC_THREAD_PROCESS_SHARED = 0x55 + SC_THREAD_ROBUST_PRIO_INHERIT = 0x56 + SC_THREAD_ROBUST_PRIO_PROTECT = 0x57 + SC_THREAD_SAFE_FUNCTIONS = 0x67 + SC_THREAD_SPORADIC_SERVER = 0x58 + SC_THREADS = 0x5b + SC_TIMEOUTS = 0x5c + SC_TIMERS = 0x5e + SC_TRACE = 0x5f + SC_TRACE_EVENT_FILTER = 0x60 + SC_TRACE_EVENT_NAME_MAX = 0x61 + SC_TRACE_INHERIT = 0x62 + SC_TRACE_LOG = 0x63 + SC_TRACE_NAME_MAX = 0x68 + SC_TRACE_SYS_MAX = 0x69 + SC_TRACE_USER_EVENT_MAX = 0x6a + SC_TYPED_MEMORY_OBJECTS = 0x6c + SC_VERSION = 0x8 + + SC_V7_ILP32_OFF32 = 0x71 + SC_V7_ILP32_OFFBIG = 0x72 + SC_V7_LP64_OFF64 = 0x73 + SC_V7_LPBIG_OFFBIG = 0x74 + + SC_V6_ILP32_OFF32 = 0x6d + SC_V6_ILP32_OFFBIG = 0x6e + SC_V6_LP64_OFF64 = 0x6f + SC_V6_LPBIG_OFFBIG = 0x70 + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x23 + SC_2_PBS_ACCOUNTING = 0x24 + SC_2_PBS_CHECKPOINT = 0x25 + SC_2_PBS_LOCATE = 0x26 + SC_2_PBS_MESSAGE = 0x27 + SC_2_PBS_TRACK = 0x28 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x75 + SC_XOPEN_ENH_I18N = 0x76 + SC_XOPEN_REALTIME = 0x78 + SC_XOPEN_REALTIME_THREADS = 0x79 + SC_XOPEN_SHM = 0x1e + SC_XOPEN_STREAMS = 0x7a + SC_XOPEN_UNIX = 0x7b + SC_XOPEN_UUCP = 0x7c + SC_XOPEN_VERSION = 0x7d + + SC_AVPHYS_PAGES = 0x1f5 + SC_PHYS_PAGES = 0x1f4 + SC_NPROCESSORS_CONF = 0x1f6 + SC_NPROCESSORS_ONLN = 0x1f7 +) + +const ( + _HOST_NAME_MAX = 0xff + _IOV_MAX = 0x400 + _LOGIN_NAME_MAX = 0x20 + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x100 + _PTHREAD_STACK_MIN = 0x1000 + _PTHREAD_THREADS_MAX = 0xffffffffffffffff + _SEM_VALUE_MAX = 0xffffffff + _SYMLOOP_MAX = 0x20 + _TTY_NAME_MAX = 0x104 + + _GR_BUF_LEN = 0xa40 + _PW_BUF_LEN = 0x400 + + _CLK_TCK = 0x64 + + _POSIX_ADVISORY_INFO = -0x1 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = -0x1 + _POSIX_BARRIERS = 0x30db0 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = 0x31069 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x0 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = 0x30db0 + _POSIX_MEMLOCK_RANGE = 0x30db0 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = -0x1 + _POSIX_MONOTONIC_CLOCK = 0x30db0 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = -0x1 + _POSIX_RAW_SOCKETS = 0x30db0 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = -0x1 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x30db0 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SPAWN = 0x30db0 + _POSIX_SPIN_LOCKS = 0x30db0 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x31069 + _POSIX_THREAD_KEYS_MAX = 0x80 + _POSIX_THREAD_PRIO_INHERIT = -0x1 + _POSIX_THREAD_PRIO_PROTECT = -0x1 + _POSIX_THREAD_PRIORITY_SCHEDULING = -0x1 + _POSIX_THREAD_PROCESS_SHARED = -0x1 + _POSIX_THREAD_ROBUST_PRIO_INHERIT = -0x1 + _POSIX_THREAD_ROBUST_PRIO_PROTECT = -0x1 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x30db0 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMERS = -0x1 + _POSIX_TIMEOUTS = 0x30db0 + _POSIX_TRACE = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = 0x0 + _POSIX_V7_LP64_OFF64 = 0x0 + _POSIX_V7_LPBIG_OFFBIG = 0x0 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = 0x0 + _POSIX_V6_LP64_OFF64 = 0x0 + _POSIX_V6_LPBIG_OFFBIG = 0x0 + + _POSIX2_C_BIND = 0x30db0 + _POSIX2_C_DEV = -0x1 + _POSIX2_CHAR_TERM = 0x1 + _POSIX2_LOCALEDEF = -0x1 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = 0x30db0 + _POSIX2_UPE = 0x30db0 + _POSIX2_VERSION = 0x31069 + + _XOPEN_CRYPT = 0x1 + _XOPEN_ENH_I18N = -0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_STREAMS = -0x1 + _XOPEN_UNIX = -0x1 + _XOPEN_UUCP = -0x1 + + _FOPEN_MAX = 0x14 + _NAME_MAX = 0xff + _RE_DUP_MAX = 0xff + + _BC_BASE_MAX = 0x7fffffff + _BC_DIM_MAX = 0xffff + _BC_SCALE_MAX = 0x7fffffff + _BC_STRING_MAX = 0x7fffffff + _COLL_WEIGHTS_MAX = 0x2 + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + + _SHRT_MAX = 0x7fff + + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) + +const ( + _CHAR_BIT = 0x8 + + _INT_MAX = 0x7fffffff + + sizeofOffT = 0x8 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go new file mode 100644 index 00000000..c155cf57 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go @@ -0,0 +1,138 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_solaris.go + +//go:build solaris + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x12 + SC_AIO_MAX = 0x13 + SC_AIO_PRIO_DELTA_MAX = 0x14 + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x4c + SC_BC_BASE_MAX = 0x36 + SC_BC_DIM_MAX = 0x37 + SC_BC_SCALE_MAX = 0x38 + SC_BC_STRING_MAX = 0x39 + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0x3a + SC_DELAYTIMER_MAX = 0x16 + SC_EXPR_NEST_MAX = 0x3b + SC_GETGR_R_SIZE_MAX = 0x239 + SC_GETPW_R_SIZE_MAX = 0x23a + SC_HOST_NAME_MAX = 0x2df + SC_IOV_MAX = 0x4d + SC_LINE_MAX = 0x3c + SC_LOGIN_NAME_MAX = 0x23b + SC_MQ_OPEN_MAX = 0x1d + SC_MQ_PRIO_MAX = 0x1e + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0xb + SC_PAGESIZE = 0xb + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x238 + SC_THREAD_KEYS_MAX = 0x23c + SC_THREAD_STACK_MIN = 0x23d + SC_THREAD_THREADS_MAX = 0x23e + SC_RE_DUP_MAX = 0x3d + SC_RTSIG_MAX = 0x22 + SC_SEM_NSEMS_MAX = 0x24 + SC_SEM_VALUE_MAX = 0x25 + SC_SIGQUEUE_MAX = 0x27 + SC_STREAM_MAX = 0x10 + SC_SYMLOOP_MAX = 0x2e8 + SC_TIMER_MAX = 0x2c + SC_TTY_NAME_MAX = 0x23f + SC_TZNAME_MAX = 0x11 + + SC_ADVISORY_INFO = 0x2db + SC_ASYNCHRONOUS_IO = 0x15 + SC_BARRIERS = 0x2dc + SC_CLOCK_SELECTION = 0x2dd + SC_CPUTIME = 0x2de + SC_FSYNC = 0x17 + SC_IPV6 = 0x2fa + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x18 + SC_MEMLOCK = 0x19 + SC_MEMLOCK_RANGE = 0x1a + SC_MEMORY_PROTECTION = 0x1b + SC_MESSAGE_PASSING = 0x1c + SC_MONOTONIC_CLOCK = 0x2e0 + SC_PRIORITIZED_IO = 0x1f + SC_PRIORITY_SCHEDULING = 0x20 + SC_RAW_SOCKETS = 0x2fb + SC_READER_WRITER_LOCKS = 0x2e1 + SC_REALTIME_SIGNALS = 0x21 + SC_REGEXP = 0x2e2 + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x23 + SC_SHARED_MEMORY_OBJECTS = 0x26 + SC_SHELL = 0x2e3 + SC_SPAWN = 0x2e4 + SC_SPIN_LOCKS = 0x2e5 + SC_SPORADIC_SERVER = 0x2e6 + SC_SS_REPL_MAX = 0x2e7 + SC_SYNCHRONIZED_IO = 0x2a + SC_THREAD_ATTR_STACKADDR = 0x241 + SC_THREAD_ATTR_STACKSIZE = 0x242 + SC_THREAD_CPUTIME = 0x2e9 + SC_THREAD_PRIO_INHERIT = 0x244 + SC_THREAD_PRIO_PROTECT = 0x245 + SC_THREAD_PRIORITY_SCHEDULING = 0x243 + SC_THREAD_PROCESS_SHARED = 0x246 + SC_THREAD_SAFE_FUNCTIONS = 0x247 + SC_THREAD_SPORADIC_SERVER = 0x2ea + SC_THREADS = 0x240 + SC_TIMEOUTS = 0x2eb + SC_TIMERS = 0x2b + SC_TRACE = 0x2ec + SC_TRACE_EVENT_FILTER = 0x2ed + SC_TRACE_EVENT_NAME_MAX = 0x2ee + SC_TRACE_INHERIT = 0x2ef + SC_TRACE_LOG = 0x2f0 + SC_TRACE_NAME_MAX = 0x2f1 + SC_TRACE_SYS_MAX = 0x2f2 + SC_TRACE_USER_EVENT_MAX = 0x2f3 + SC_TYPED_MEMORY_OBJECTS = 0x2f4 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x2f5 + SC_V6_ILP32_OFFBIG = 0x2f6 + SC_V6_LP64_OFF64 = 0x2f7 + SC_V6_LPBIG_OFFBIG = 0x2f8 + + SC_2_C_BIND = 0x2d + SC_2_C_DEV = 0x2e + SC_2_C_VERSION = 0x2f + SC_2_CHAR_TERM = 0x42 + SC_2_FORT_DEV = 0x30 + SC_2_FORT_RUN = 0x31 + SC_2_LOCALEDEF = 0x32 + SC_2_PBS = 0x2d4 + SC_2_PBS_ACCOUNTING = 0x2d5 + SC_2_PBS_CHECKPOINT = 0x2d6 + SC_2_PBS_LOCATE = 0x2d8 + SC_2_PBS_MESSAGE = 0x2d9 + SC_2_PBS_TRACK = 0x2da + SC_2_SW_DEV = 0x33 + SC_2_UPE = 0x34 + SC_2_VERSION = 0x35 + + SC_XOPEN_CRYPT = 0x3e + SC_XOPEN_ENH_I18N = 0x3f + SC_XOPEN_REALTIME = 0x2ce + SC_XOPEN_REALTIME_THREADS = 0x2cf + SC_XOPEN_SHM = 0x40 + SC_XOPEN_STREAMS = 0x2f9 + SC_XOPEN_UNIX = 0x4e + SC_XOPEN_VERSION = 0xc + SC_XOPEN_XCU_VERSION = 0x43 + + SC_PHYS_PAGES = 0x1f4 + SC_AVPHYS_PAGES = 0x1f5 + SC_NPROCESSORS_CONF = 0xe + SC_NPROCESSORS_ONLN = 0xf +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go new file mode 100644 index 00000000..b5d48074 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && 386 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go new file mode 100644 index 00000000..89c880aa --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && amd64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go new file mode 100644 index 00000000..7b65fdd6 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && arm + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go new file mode 100644 index 00000000..a86cb32b --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && arm64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go new file mode 100644 index 00000000..6c847aee --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && riscv64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go new file mode 100644 index 00000000..90963eb4 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && 386 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go new file mode 100644 index 00000000..28ad6f18 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && amd64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go new file mode 100644 index 00000000..ffbcf37d --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && arm + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go new file mode 100644 index 00000000..cc9f4d88 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && arm64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go new file mode 100644 index 00000000..f62b15a6 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && loong64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go new file mode 100644 index 00000000..37f492a8 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mips + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go new file mode 100644 index 00000000..ae7b7f9c --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mips64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go new file mode 100644 index 00000000..fe14670f --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mips64le + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go new file mode 100644 index 00000000..d204585b --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mipsle + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go new file mode 100644 index 00000000..9ec78d33 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && ppc64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go new file mode 100644 index 00000000..a5420672 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && ppc64le + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go new file mode 100644 index 00000000..bfb92392 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && riscv64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go new file mode 100644 index 00000000..6e935c87 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go @@ -0,0 +1,113 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && s390x + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go new file mode 100644 index 00000000..ea0b24a8 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go @@ -0,0 +1,10 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && 386 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go new file mode 100644 index 00000000..2d377e25 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go @@ -0,0 +1,10 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && amd64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go new file mode 100644 index 00000000..4a6d8367 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go @@ -0,0 +1,10 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && arm + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go new file mode 100644 index 00000000..49fb6725 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go @@ -0,0 +1,10 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && arm64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff +) diff --git a/vendor/github.com/tklauser/numcpus/.cirrus.yml b/vendor/github.com/tklauser/numcpus/.cirrus.yml new file mode 100644 index 00000000..61724abe --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/.cirrus.yml @@ -0,0 +1,23 @@ +env: + CIRRUS_CLONE_DEPTH: 1 + GO_VERSION: go1.25.0 + +freebsd_13_task: + freebsd_instance: + image_family: freebsd-13-5 + install_script: | + pkg install -y go + GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest + bin/${GO_VERSION} download + build_script: bin/${GO_VERSION} build -v ./... + test_script: bin/${GO_VERSION} test -race ./... + +freebsd_14_task: + freebsd_instance: + image_family: freebsd-14-2 + install_script: | + pkg install -y go + GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest + bin/${GO_VERSION} download + build_script: bin/${GO_VERSION} build -v ./... + test_script: bin/${GO_VERSION} test -race ./... diff --git a/vendor/github.com/tklauser/numcpus/LICENSE b/vendor/github.com/tklauser/numcpus/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/tklauser/numcpus/README.md b/vendor/github.com/tklauser/numcpus/README.md new file mode 100644 index 00000000..23612c54 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/README.md @@ -0,0 +1,52 @@ +# numcpus + +[![Go Reference](https://pkg.go.dev/badge/github.com/tklauser/numcpus.svg)](https://pkg.go.dev/github.com/tklauser/numcpus) +[![GitHub Action Status](https://github.com/tklauser/numcpus/workflows/Tests/badge.svg)](https://github.com/tklauser/numcpus/actions?query=workflow%3ATests) + +Package numcpus provides information about the number of CPUs in the system. + +It gets the number of CPUs (online, offline, present, possible, configured or +kernel maximum) on Linux, Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD or +Solaris/Illumos systems. + +On Linux, the information is retrieved by reading the corresponding CPU +topology files in `/sys/devices/system/cpu`. + +On BSD systems, the information is retrieved using the `hw.ncpu` and +`hw.ncpuonline` sysctls, if supported. + +Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD, +DragonflyBSD and Solaris/Illumos. ErrNotSupported is returned in case a +function is not supported on a particular platform. + +## Usage + +```Go +package main + +import ( + "fmt" + "os" + + "github.com/tklauser/numcpus" +) + +func main() { + online, err := numcpus.GetOnline() + if err != nil { + fmt.Fprintf(os.Stderr, "GetOnline: %v\n", err) + } + fmt.Printf("online CPUs: %v\n", online) + + possible, err := numcpus.GetPossible() + if err != nil { + fmt.Fprintf(os.Stderr, "GetPossible: %v\n", err) + } + fmt.Printf("possible CPUs: %v\n", possible) +} +``` + +## References + +* [Linux kernel sysfs documentation for CPU attributes](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu) +* [Linux kernel CPU topology documentation](https://www.kernel.org/doc/Documentation/cputopology.txt) diff --git a/vendor/github.com/tklauser/numcpus/numcpus.go b/vendor/github.com/tklauser/numcpus/numcpus.go new file mode 100644 index 00000000..de206f06 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus.go @@ -0,0 +1,98 @@ +// Copyright 2018-2022 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package numcpus provides information about the number of CPUs in the system. +// +// It gets the number of CPUs (online, offline, present, possible or kernel +// maximum) on Linux, Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD, +// Solaris/Illumos or Windows systems. +// +// On Linux, the information is retrieved by reading the corresponding CPU +// topology files in /sys/devices/system/cpu. +// +// On BSD systems, the information is retrieved using the hw.ncpu and +// hw.ncpuonline sysctls, if supported. +// +// On Windows systems, the information is retrieved using the +// GetActiveProcessorCount and GetMaximumProcessorCount functions, respectively. +// +// Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD, +// DragonflyBSD, Solaris/Illumos and Windows. ErrNotSupported is returned in +// case a function is not supported on a particular platform. +package numcpus + +import "errors" + +// ErrNotSupported is the error returned when the function is not supported. +var ErrNotSupported = errors.New("function not supported") + +// GetConfigured returns the number of CPUs configured on the system. This +// function should return the same value as `getconf _SC_NPROCESSORS_CONF` on a +// unix system. +func GetConfigured() (int, error) { + return getConfigured() +} + +// GetKernelMax returns the maximum number of CPUs allowed by the kernel +// configuration. This function is only supported on Linux and Windows systems. +func GetKernelMax() (int, error) { + return getKernelMax() +} + +// GetOffline returns the number of offline CPUs, i.e. CPUs that are not online +// because they have been hotplugged off or exceed the limit of CPUs allowed by +// the kernel configuration (see GetKernelMax). This function is only supported +// on Linux systems. +func GetOffline() (int, error) { + return getOffline() +} + +// GetOnline returns the number of CPUs that are online and being scheduled. +func GetOnline() (int, error) { + return getOnline() +} + +// GetPossible returns the number of possible CPUs, i.e. CPUs that +// have been allocated resources and can be brought online if they are present. +func GetPossible() (int, error) { + return getPossible() +} + +// GetPresent returns the number of CPUs present in the system. +func GetPresent() (int, error) { + return getPresent() +} + +// ListOffline returns the list of offline CPUs. See [GetOffline] for details on +// when a CPU is considered offline. +func ListOffline() ([]int, error) { + return listOffline() +} + +// ListOnline returns the list of CPUs that are online and being scheduled. +func ListOnline() ([]int, error) { + return listOnline() +} + +// ListPossible returns the list of possible CPUs. See [GetPossible] for +// details on when a CPU is considered possible. +func ListPossible() ([]int, error) { + return listPossible() +} + +// ListPresent returns the list of present CPUs. See [GetPresent] for +// details on when a CPU is considered present. +func ListPresent() ([]int, error) { + return listPresent() +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_bsd.go b/vendor/github.com/tklauser/numcpus/numcpus_bsd.go new file mode 100644 index 00000000..efd8db0f --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_bsd.go @@ -0,0 +1,65 @@ +// Copyright 2018 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build darwin || dragonfly || freebsd || netbsd || openbsd + +package numcpus + +import ( + "runtime" + + "golang.org/x/sys/unix" +) + +func getConfigured() (int, error) { + n, err := unix.SysctlUint32("hw.ncpu") + return int(n), err +} + +func getKernelMax() (int, error) { + if runtime.GOOS == "freebsd" { + n, err := unix.SysctlUint32("kern.smp.maxcpus") + return int(n), err + } + return 0, ErrNotSupported +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + var n uint32 + var err error + switch runtime.GOOS { + case "netbsd", "openbsd": + n, err = unix.SysctlUint32("hw.ncpuonline") + if err != nil { + n, err = unix.SysctlUint32("hw.ncpu") + } + default: + n, err = unix.SysctlUint32("hw.ncpu") + } + return int(n), err +} + +func getPossible() (int, error) { + n, err := unix.SysctlUint32("hw.ncpu") + return int(n), err +} + +func getPresent() (int, error) { + n, err := unix.SysctlUint32("hw.ncpu") + return int(n), err +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_linux.go b/vendor/github.com/tklauser/numcpus/numcpus_linux.go new file mode 100644 index 00000000..d05ee982 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_linux.go @@ -0,0 +1,192 @@ +// Copyright 2018 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package numcpus + +import ( + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + + "golang.org/x/sys/unix" +) + +const ( + sysfsCPUBasePath = "/sys/devices/system/cpu" + + offline = "offline" + online = "online" + possible = "possible" + present = "present" +) + +func getFromCPUAffinity() (int, error) { + var cpuSet unix.CPUSet + if err := unix.SchedGetaffinity(0, &cpuSet); err != nil { + return 0, err + } + return cpuSet.Count(), nil +} + +func readCPURangeWith[T any](file string, f func(cpus string) (T, error)) (T, error) { + var zero T + buf, err := os.ReadFile(filepath.Join(sysfsCPUBasePath, file)) + if err != nil { + return zero, err + } + return f(string(buf)) +} + +func countCPURange(cpus string) (int, error) { + cpus = strings.Trim(cpus, "\n ") + + // Treat empty file as valid. This might be the case if there are no offline CPUs in which + // case /sys/devices/system/cpu/offline is empty. + if cpus == "" { + return 0, nil + } + + n := int(0) + for cpuRange := range strings.SplitSeq(cpus, ",") { + if cpuRange == "" { + return 0, fmt.Errorf("empty CPU range in CPU string %q", cpus) + } + from, to, found := strings.Cut(cpuRange, "-") + first, err := strconv.ParseUint(from, 10, 32) + if err != nil { + return 0, err + } + if !found { + n++ + continue + } + last, err := strconv.ParseUint(to, 10, 32) + if err != nil { + return 0, err + } + if last < first { + return 0, fmt.Errorf("last CPU in range (%d) less than first (%d)", last, first) + } + n += int(last - first + 1) + } + return n, nil +} + +func listCPURange(cpus string) ([]int, error) { + cpus = strings.Trim(cpus, "\n ") + + // See comment in countCPURange. + if cpus == "" { + return []int{}, nil + } + + list := []int{} + for cpuRange := range strings.SplitSeq(cpus, ",") { + if cpuRange == "" { + return nil, fmt.Errorf("empty CPU range in CPU string %q", cpus) + } + from, to, found := strings.Cut(cpuRange, "-") + first, err := strconv.ParseUint(from, 10, 32) + if err != nil { + return nil, err + } + if !found { + // range containing a single element + list = append(list, int(first)) + continue + } + last, err := strconv.ParseUint(to, 10, 32) + if err != nil { + return nil, err + } + if last < first { + return nil, fmt.Errorf("last CPU in range (%d) less than first (%d)", last, first) + } + for cpu := int(first); cpu <= int(last); cpu++ { + list = append(list, cpu) + } + } + return list, nil +} + +func getConfigured() (int, error) { + d, err := os.Open(sysfsCPUBasePath) + if err != nil { + return 0, err + } + defer d.Close() + fis, err := d.Readdir(-1) + if err != nil { + return 0, err + } + count := 0 + for _, fi := range fis { + if name := fi.Name(); fi.IsDir() && strings.HasPrefix(name, "cpu") { + _, err := strconv.ParseInt(name[3:], 10, 64) + if err == nil { + count++ + } + } + } + return count, nil +} + +func getKernelMax() (int, error) { + buf, err := os.ReadFile(filepath.Join(sysfsCPUBasePath, "kernel_max")) + if err != nil { + return 0, err + } + n, err := strconv.ParseInt(strings.Trim(string(buf), "\n "), 10, 32) + if err != nil { + return 0, err + } + return int(n), nil +} + +func getOffline() (int, error) { + return readCPURangeWith(offline, countCPURange) +} + +func getOnline() (int, error) { + if n, err := getFromCPUAffinity(); err == nil { + return n, nil + } + return readCPURangeWith(online, countCPURange) +} + +func getPossible() (int, error) { + return readCPURangeWith(possible, countCPURange) +} + +func getPresent() (int, error) { + return readCPURangeWith(present, countCPURange) +} + +func listOffline() ([]int, error) { + return readCPURangeWith(offline, listCPURange) +} + +func listOnline() ([]int, error) { + return readCPURangeWith(online, listCPURange) +} + +func listPossible() ([]int, error) { + return readCPURangeWith(possible, listCPURange) +} + +func listPresent() ([]int, error) { + return readCPURangeWith(present, listCPURange) +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go b/vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go new file mode 100644 index 00000000..af4efeac --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go @@ -0,0 +1,33 @@ +// Copyright 2024 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !linux + +package numcpus + +func listOffline() ([]int, error) { + return nil, ErrNotSupported +} + +func listOnline() ([]int, error) { + return nil, ErrNotSupported +} + +func listPossible() ([]int, error) { + return nil, ErrNotSupported +} + +func listPresent() ([]int, error) { + return nil, ErrNotSupported +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_solaris.go b/vendor/github.com/tklauser/numcpus/numcpus_solaris.go new file mode 100644 index 00000000..f3b632fe --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_solaris.go @@ -0,0 +1,55 @@ +// Copyright 2021 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build solaris + +package numcpus + +import "golang.org/x/sys/unix" + +// taken from /usr/include/sys/unistd.h +const ( + _SC_NPROCESSORS_CONF = 14 + _SC_NPROCESSORS_ONLN = 15 + _SC_NPROCESSORS_MAX = 516 +) + +func getConfigured() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_CONF) + return int(n), err +} + +func getKernelMax() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_MAX) + return int(n), err +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_ONLN) + return int(n), err +} + +func getPossible() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_CONF) + return int(n), err +} + +func getPresent() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_CONF) + return int(n), err +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go b/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go new file mode 100644 index 00000000..e72355ec --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go @@ -0,0 +1,41 @@ +// Copyright 2021 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows + +package numcpus + +func getConfigured() (int, error) { + return 0, ErrNotSupported +} + +func getKernelMax() (int, error) { + return 0, ErrNotSupported +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + return 0, ErrNotSupported +} + +func getPossible() (int, error) { + return 0, ErrNotSupported +} + +func getPresent() (int, error) { + return 0, ErrNotSupported +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_windows.go b/vendor/github.com/tklauser/numcpus/numcpus_windows.go new file mode 100644 index 00000000..f7d5b402 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_windows.go @@ -0,0 +1,41 @@ +// Copyright 2022 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package numcpus + +import "golang.org/x/sys/windows" + +func getConfigured() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getKernelMax() (int, error) { + return int(windows.GetMaximumProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getPossible() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getPresent() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} diff --git a/vendor/github.com/yusufpapurcu/wmi/LICENSE b/vendor/github.com/yusufpapurcu/wmi/LICENSE new file mode 100644 index 00000000..ae80b672 --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Stack Exchange + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/yusufpapurcu/wmi/README.md b/vendor/github.com/yusufpapurcu/wmi/README.md new file mode 100644 index 00000000..426d1a46 --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/README.md @@ -0,0 +1,6 @@ +wmi +=== + +Package wmi provides a WQL interface to Windows WMI. + +Note: It interfaces with WMI on the local machine, therefore it only runs on Windows. diff --git a/vendor/github.com/yusufpapurcu/wmi/swbemservices.go b/vendor/github.com/yusufpapurcu/wmi/swbemservices.go new file mode 100644 index 00000000..a250c846 --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/swbemservices.go @@ -0,0 +1,261 @@ +//go:build windows +// +build windows + +package wmi + +import ( + "fmt" + "reflect" + "runtime" + "sync" + + "github.com/go-ole/go-ole" + "github.com/go-ole/go-ole/oleutil" +) + +// SWbemServices is used to access wmi. See https://msdn.microsoft.com/en-us/library/aa393719(v=vs.85).aspx +type SWbemServices struct { + //TODO: track namespace. Not sure if we can re connect to a different namespace using the same instance + cWMIClient *Client //This could also be an embedded struct, but then we would need to branch on Client vs SWbemServices in the Query method + sWbemLocatorIUnknown *ole.IUnknown + sWbemLocatorIDispatch *ole.IDispatch + queries chan *queryRequest + closeError chan error + lQueryorClose sync.Mutex +} + +type queryRequest struct { + query string + dst interface{} + args []interface{} + finished chan error +} + +// InitializeSWbemServices will return a new SWbemServices object that can be used to query WMI +func InitializeSWbemServices(c *Client, connectServerArgs ...interface{}) (*SWbemServices, error) { + //fmt.Println("InitializeSWbemServices: Starting") + //TODO: implement connectServerArgs as optional argument for init with connectServer call + s := new(SWbemServices) + s.cWMIClient = c + s.queries = make(chan *queryRequest) + initError := make(chan error) + go s.process(initError) + + err, ok := <-initError + if ok { + return nil, err //Send error to caller + } + //fmt.Println("InitializeSWbemServices: Finished") + return s, nil +} + +// Close will clear and release all of the SWbemServices resources +func (s *SWbemServices) Close() error { + s.lQueryorClose.Lock() + if s == nil || s.sWbemLocatorIDispatch == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices is not Initialized") + } + if s.queries == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices has been closed") + } + //fmt.Println("Close: sending close request") + var result error + ce := make(chan error) + s.closeError = ce //Race condition if multiple callers to close. May need to lock here + close(s.queries) //Tell background to shut things down + s.lQueryorClose.Unlock() + err, ok := <-ce + if ok { + result = err + } + //fmt.Println("Close: finished") + return result +} + +func (s *SWbemServices) process(initError chan error) { + //fmt.Println("process: starting background thread initialization") + //All OLE/WMI calls must happen on the same initialized thead, so lock this goroutine + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + err := ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED) + if err != nil { + oleCode := err.(*ole.OleError).Code() + if oleCode != ole.S_OK && oleCode != S_FALSE { + initError <- fmt.Errorf("ole.CoInitializeEx error: %v", err) + return + } + } + defer ole.CoUninitialize() + + unknown, err := oleutil.CreateObject("WbemScripting.SWbemLocator") + if err != nil { + initError <- fmt.Errorf("CreateObject SWbemLocator error: %v", err) + return + } else if unknown == nil { + initError <- ErrNilCreateObject + return + } + defer unknown.Release() + s.sWbemLocatorIUnknown = unknown + + dispatch, err := s.sWbemLocatorIUnknown.QueryInterface(ole.IID_IDispatch) + if err != nil { + initError <- fmt.Errorf("SWbemLocator QueryInterface error: %v", err) + return + } + defer dispatch.Release() + s.sWbemLocatorIDispatch = dispatch + + // we can't do the ConnectServer call outside the loop unless we find a way to track and re-init the connectServerArgs + //fmt.Println("process: initialized. closing initError") + close(initError) + //fmt.Println("process: waiting for queries") + for q := range s.queries { + //fmt.Printf("process: new query: len(query)=%d\n", len(q.query)) + errQuery := s.queryBackground(q) + //fmt.Println("process: s.queryBackground finished") + if errQuery != nil { + q.finished <- errQuery + } + close(q.finished) + } + //fmt.Println("process: queries channel closed") + s.queries = nil //set channel to nil so we know it is closed + //TODO: I think the Release/Clear calls can panic if things are in a bad state. + //TODO: May need to recover from panics and send error to method caller instead. + close(s.closeError) +} + +// Query runs the WQL query using a SWbemServices instance and appends the values to dst. +// +// dst must have type *[]S or *[]*S, for some struct type S. Fields selected in +// the query must have the same name in dst. Supported types are all signed and +// unsigned integers, time.Time, string, bool, or a pointer to one of those. +// Array types are not supported. +// +// By default, the local machine and default namespace are used. These can be +// changed using connectServerArgs. See +// http://msdn.microsoft.com/en-us/library/aa393720.aspx for details. +func (s *SWbemServices) Query(query string, dst interface{}, connectServerArgs ...interface{}) error { + s.lQueryorClose.Lock() + if s == nil || s.sWbemLocatorIDispatch == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices is not Initialized") + } + if s.queries == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices has been closed") + } + + //fmt.Println("Query: Sending query request") + qr := queryRequest{ + query: query, + dst: dst, + args: connectServerArgs, + finished: make(chan error), + } + s.queries <- &qr + s.lQueryorClose.Unlock() + err, ok := <-qr.finished + if ok { + //fmt.Println("Query: Finished with error") + return err //Send error to caller + } + //fmt.Println("Query: Finished") + return nil +} + +func (s *SWbemServices) queryBackground(q *queryRequest) error { + if s == nil || s.sWbemLocatorIDispatch == nil { + return fmt.Errorf("SWbemServices is not Initialized") + } + wmi := s.sWbemLocatorIDispatch //Should just rename in the code, but this will help as we break things apart + //fmt.Println("queryBackground: Starting") + + dv := reflect.ValueOf(q.dst) + if dv.Kind() != reflect.Ptr || dv.IsNil() { + return ErrInvalidEntityType + } + dv = dv.Elem() + mat, elemType := checkMultiArg(dv) + if mat == multiArgTypeInvalid { + return ErrInvalidEntityType + } + + // service is a SWbemServices + serviceRaw, err := oleutil.CallMethod(wmi, "ConnectServer", q.args...) + if err != nil { + return err + } + service := serviceRaw.ToIDispatch() + defer serviceRaw.Clear() + + // result is a SWBemObjectSet + resultRaw, err := oleutil.CallMethod(service, "ExecQuery", q.query) + if err != nil { + return err + } + result := resultRaw.ToIDispatch() + defer resultRaw.Clear() + + count, err := oleInt64(result, "Count") + if err != nil { + return err + } + + enumProperty, err := result.GetProperty("_NewEnum") + if err != nil { + return err + } + defer enumProperty.Clear() + + enum, err := enumProperty.ToIUnknown().IEnumVARIANT(ole.IID_IEnumVariant) + if err != nil { + return err + } + if enum == nil { + return fmt.Errorf("can't get IEnumVARIANT, enum is nil") + } + defer enum.Release() + + // Initialize a slice with Count capacity + dv.Set(reflect.MakeSlice(dv.Type(), 0, int(count))) + + var errFieldMismatch error + for itemRaw, length, err := enum.Next(1); length > 0; itemRaw, length, err = enum.Next(1) { + if err != nil { + return err + } + + err := func() error { + // item is a SWbemObject, but really a Win32_Process + item := itemRaw.ToIDispatch() + defer item.Release() + + ev := reflect.New(elemType) + if err = s.cWMIClient.loadEntity(ev.Interface(), item); err != nil { + if _, ok := err.(*ErrFieldMismatch); ok { + // We continue loading entities even in the face of field mismatch errors. + // If we encounter any other error, that other error is returned. Otherwise, + // an ErrFieldMismatch is returned. + errFieldMismatch = err + } else { + return err + } + } + if mat != multiArgTypeStructPtr { + ev = ev.Elem() + } + dv.Set(reflect.Append(dv, ev)) + return nil + }() + if err != nil { + return err + } + } + //fmt.Println("queryBackground: Finished") + return errFieldMismatch +} diff --git a/vendor/github.com/yusufpapurcu/wmi/wmi.go b/vendor/github.com/yusufpapurcu/wmi/wmi.go new file mode 100644 index 00000000..03f386ed --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/wmi.go @@ -0,0 +1,603 @@ +//go:build windows +// +build windows + +/* +Package wmi provides a WQL interface for WMI on Windows. + +Example code to print names of running processes: + + type Win32_Process struct { + Name string + } + + func main() { + var dst []Win32_Process + q := wmi.CreateQuery(&dst, "") + err := wmi.Query(q, &dst) + if err != nil { + log.Fatal(err) + } + for i, v := range dst { + println(i, v.Name) + } + } +*/ +package wmi + +import ( + "bytes" + "errors" + "fmt" + "log" + "os" + "reflect" + "runtime" + "strconv" + "strings" + "sync" + "time" + + "github.com/go-ole/go-ole" + "github.com/go-ole/go-ole/oleutil" +) + +var l = log.New(os.Stdout, "", log.LstdFlags) + +var ( + ErrInvalidEntityType = errors.New("wmi: invalid entity type") + // ErrNilCreateObject is the error returned if CreateObject returns nil even + // if the error was nil. + ErrNilCreateObject = errors.New("wmi: create object returned nil") + lock sync.Mutex +) + +// S_FALSE is returned by CoInitializeEx if it was already called on this thread. +const S_FALSE = 0x00000001 + +// QueryNamespace invokes Query with the given namespace on the local machine. +func QueryNamespace(query string, dst interface{}, namespace string) error { + return Query(query, dst, nil, namespace) +} + +// Query runs the WQL query and appends the values to dst. +// +// dst must have type *[]S or *[]*S, for some struct type S. Fields selected in +// the query must have the same name in dst. Supported types are all signed and +// unsigned integers, time.Time, string, bool, or a pointer to one of those. +// Array types are not supported. +// +// By default, the local machine and default namespace are used. These can be +// changed using connectServerArgs. See +// https://docs.microsoft.com/en-us/windows/desktop/WmiSdk/swbemlocator-connectserver +// for details. +// +// Query is a wrapper around DefaultClient.Query. +func Query(query string, dst interface{}, connectServerArgs ...interface{}) error { + if DefaultClient.SWbemServicesClient == nil { + return DefaultClient.Query(query, dst, connectServerArgs...) + } + return DefaultClient.SWbemServicesClient.Query(query, dst, connectServerArgs...) +} + +// CallMethod calls a method named methodName on an instance of the class named +// className, with the given params. +// +// CallMethod is a wrapper around DefaultClient.CallMethod. +func CallMethod(connectServerArgs []interface{}, className, methodName string, params []interface{}) (int32, error) { + return DefaultClient.CallMethod(connectServerArgs, className, methodName, params) +} + +// A Client is an WMI query client. +// +// Its zero value (DefaultClient) is a usable client. +type Client struct { + // NonePtrZero specifies if nil values for fields which aren't pointers + // should be returned as the field types zero value. + // + // Setting this to true allows stucts without pointer fields to be used + // without the risk failure should a nil value returned from WMI. + NonePtrZero bool + + // PtrNil specifies if nil values for pointer fields should be returned + // as nil. + // + // Setting this to true will set pointer fields to nil where WMI + // returned nil, otherwise the types zero value will be returned. + PtrNil bool + + // AllowMissingFields specifies that struct fields not present in the + // query result should not result in an error. + // + // Setting this to true allows custom queries to be used with full + // struct definitions instead of having to define multiple structs. + AllowMissingFields bool + + // SWbemServiceClient is an optional SWbemServices object that can be + // initialized and then reused across multiple queries. If it is null + // then the method will initialize a new temporary client each time. + SWbemServicesClient *SWbemServices +} + +// DefaultClient is the default Client and is used by Query, QueryNamespace, and CallMethod. +var DefaultClient = &Client{} + +// coinitService coinitializes WMI service. If no error is returned, a cleanup function +// is returned which must be executed (usually deferred) to clean up allocated resources. +func (c *Client) coinitService(connectServerArgs ...interface{}) (*ole.IDispatch, func(), error) { + var unknown *ole.IUnknown + var wmi *ole.IDispatch + var serviceRaw *ole.VARIANT + + // be sure teardown happens in the reverse + // order from that which they were created + deferFn := func() { + if serviceRaw != nil { + serviceRaw.Clear() + } + if wmi != nil { + wmi.Release() + } + if unknown != nil { + unknown.Release() + } + ole.CoUninitialize() + } + + // if we error'ed here, clean up immediately + var err error + defer func() { + if err != nil { + deferFn() + } + }() + + err = ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED) + if err != nil { + oleCode := err.(*ole.OleError).Code() + if oleCode != ole.S_OK && oleCode != S_FALSE { + return nil, nil, err + } + } + + unknown, err = oleutil.CreateObject("WbemScripting.SWbemLocator") + if err != nil { + return nil, nil, err + } else if unknown == nil { + return nil, nil, ErrNilCreateObject + } + + wmi, err = unknown.QueryInterface(ole.IID_IDispatch) + if err != nil { + return nil, nil, err + } + + // service is a SWbemServices + serviceRaw, err = oleutil.CallMethod(wmi, "ConnectServer", connectServerArgs...) + if err != nil { + return nil, nil, err + } + + return serviceRaw.ToIDispatch(), deferFn, nil +} + +// CallMethod calls a WMI method named methodName on an instance +// of the class named className. It passes in the arguments given +// in params. Use connectServerArgs to customize the machine and +// namespace; by default, the local machine and default namespace +// are used. See +// https://docs.microsoft.com/en-us/windows/desktop/WmiSdk/swbemlocator-connectserver +// for details. +func (c *Client) CallMethod(connectServerArgs []interface{}, className, methodName string, params []interface{}) (int32, error) { + service, cleanup, err := c.coinitService(connectServerArgs...) + if err != nil { + return 0, fmt.Errorf("coinit: %v", err) + } + defer cleanup() + + // Get class + classRaw, err := oleutil.CallMethod(service, "Get", className) + if err != nil { + return 0, fmt.Errorf("CallMethod Get class %s: %v", className, err) + } + class := classRaw.ToIDispatch() + defer classRaw.Clear() + + // Run method + resultRaw, err := oleutil.CallMethod(class, methodName, params...) + if err != nil { + return 0, fmt.Errorf("CallMethod %s.%s: %v", className, methodName, err) + } + resultInt, ok := resultRaw.Value().(int32) + if !ok { + return 0, fmt.Errorf("return value was not an int32: %v (%T)", resultRaw, resultRaw) + } + + return resultInt, nil +} + +// Query runs the WQL query and appends the values to dst. +// +// dst must have type *[]S or *[]*S, for some struct type S. Fields selected in +// the query must have the same name in dst. Supported types are all signed and +// unsigned integers, time.Time, string, bool, or a pointer to one of those. +// Array types are not supported. +// +// By default, the local machine and default namespace are used. These can be +// changed using connectServerArgs. See +// https://docs.microsoft.com/en-us/windows/desktop/WmiSdk/swbemlocator-connectserver +// for details. +func (c *Client) Query(query string, dst interface{}, connectServerArgs ...interface{}) error { + dv := reflect.ValueOf(dst) + if dv.Kind() != reflect.Ptr || dv.IsNil() { + return ErrInvalidEntityType + } + dv = dv.Elem() + mat, elemType := checkMultiArg(dv) + if mat == multiArgTypeInvalid { + return ErrInvalidEntityType + } + + lock.Lock() + defer lock.Unlock() + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + service, cleanup, err := c.coinitService(connectServerArgs...) + if err != nil { + return err + } + defer cleanup() + + // result is a SWBemObjectSet + resultRaw, err := oleutil.CallMethod(service, "ExecQuery", query) + if err != nil { + return err + } + result := resultRaw.ToIDispatch() + defer resultRaw.Clear() + + count, err := oleInt64(result, "Count") + if err != nil { + return err + } + + enumProperty, err := result.GetProperty("_NewEnum") + if err != nil { + return err + } + defer enumProperty.Clear() + + enum, err := enumProperty.ToIUnknown().IEnumVARIANT(ole.IID_IEnumVariant) + if err != nil { + return err + } + if enum == nil { + return fmt.Errorf("can't get IEnumVARIANT, enum is nil") + } + defer enum.Release() + + // Initialize a slice with Count capacity + dv.Set(reflect.MakeSlice(dv.Type(), 0, int(count))) + + var errFieldMismatch error + for itemRaw, length, err := enum.Next(1); length > 0; itemRaw, length, err = enum.Next(1) { + if err != nil { + return err + } + + err := func() error { + // item is a SWbemObject, but really a Win32_Process + item := itemRaw.ToIDispatch() + defer item.Release() + + ev := reflect.New(elemType) + if err = c.loadEntity(ev.Interface(), item); err != nil { + if _, ok := err.(*ErrFieldMismatch); ok { + // We continue loading entities even in the face of field mismatch errors. + // If we encounter any other error, that other error is returned. Otherwise, + // an ErrFieldMismatch is returned. + errFieldMismatch = err + } else { + return err + } + } + if mat != multiArgTypeStructPtr { + ev = ev.Elem() + } + dv.Set(reflect.Append(dv, ev)) + return nil + }() + if err != nil { + return err + } + } + return errFieldMismatch +} + +// ErrFieldMismatch is returned when a field is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. +// StructType is the type of the struct pointed to by the destination argument. +type ErrFieldMismatch struct { + StructType reflect.Type + FieldName string + Reason string +} + +func (e *ErrFieldMismatch) Error() string { + return fmt.Sprintf("wmi: cannot load field %q into a %q: %s", + e.FieldName, e.StructType, e.Reason) +} + +var timeType = reflect.TypeOf(time.Time{}) + +// loadEntity loads a SWbemObject into a struct pointer. +func (c *Client) loadEntity(dst interface{}, src *ole.IDispatch) (errFieldMismatch error) { + v := reflect.ValueOf(dst).Elem() + for i := 0; i < v.NumField(); i++ { + f := v.Field(i) + of := f + isPtr := f.Kind() == reflect.Ptr + n := v.Type().Field(i).Name + if n[0] < 'A' || n[0] > 'Z' { + continue + } + if !f.CanSet() { + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "CanSet() is false", + } + } + prop, err := oleutil.GetProperty(src, n) + if err != nil { + if !c.AllowMissingFields { + errFieldMismatch = &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "no such struct field", + } + } + continue + } + defer prop.Clear() + + if isPtr && !(c.PtrNil && prop.VT == 0x1) { + ptr := reflect.New(f.Type().Elem()) + f.Set(ptr) + f = f.Elem() + } + + if prop.VT == 0x1 { //VT_NULL + continue + } + + switch val := prop.Value().(type) { + case int8, int16, int32, int64, int: + v := reflect.ValueOf(val).Int() + switch f.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + f.SetInt(v) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + f.SetUint(uint64(v)) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not an integer class", + } + } + case uint8, uint16, uint32, uint64: + v := reflect.ValueOf(val).Uint() + switch f.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + f.SetInt(int64(v)) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + f.SetUint(v) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not an integer class", + } + } + case string: + switch f.Kind() { + case reflect.String: + f.SetString(val) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + iv, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return err + } + f.SetInt(iv) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + uv, err := strconv.ParseUint(val, 10, 64) + if err != nil { + return err + } + f.SetUint(uv) + case reflect.Struct: + switch f.Type() { + case timeType: + if len(val) == 25 { + mins, err := strconv.Atoi(val[22:]) + if err != nil { + return err + } + val = val[:22] + fmt.Sprintf("%02d%02d", mins/60, mins%60) + } + t, err := time.Parse("20060102150405.000000-0700", val) + if err != nil { + return err + } + f.Set(reflect.ValueOf(t)) + } + } + case bool: + switch f.Kind() { + case reflect.Bool: + f.SetBool(val) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not a bool", + } + } + case float32: + switch f.Kind() { + case reflect.Float32: + f.SetFloat(float64(val)) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not a Float32", + } + } + case float64: + switch f.Kind() { + case reflect.Float32, reflect.Float64: + f.SetFloat(val) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not a Float64", + } + } + + default: + if f.Kind() == reflect.Slice { + switch f.Type().Elem().Kind() { + case reflect.String: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetString(v.(string)) + } + f.Set(fArr) + } + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetUint(reflect.ValueOf(v).Uint()) + } + f.Set(fArr) + } + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetInt(reflect.ValueOf(v).Int()) + } + f.Set(fArr) + } + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: fmt.Sprintf("unsupported slice type (%T)", val), + } + } + } else { + typeof := reflect.TypeOf(val) + if typeof == nil && (isPtr || c.NonePtrZero) { + if (isPtr && c.PtrNil) || (!isPtr && c.NonePtrZero) { + of.Set(reflect.Zero(of.Type())) + } + break + } + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: fmt.Sprintf("unsupported type (%T)", val), + } + } + } + } + return errFieldMismatch +} + +type multiArgType int + +const ( + multiArgTypeInvalid multiArgType = iota + multiArgTypeStruct + multiArgTypeStructPtr +) + +// checkMultiArg checks that v has type []S, []*S for some struct type S. +// +// It returns what category the slice's elements are, and the reflect.Type +// that represents S. +func checkMultiArg(v reflect.Value) (m multiArgType, elemType reflect.Type) { + if v.Kind() != reflect.Slice { + return multiArgTypeInvalid, nil + } + elemType = v.Type().Elem() + switch elemType.Kind() { + case reflect.Struct: + return multiArgTypeStruct, elemType + case reflect.Ptr: + elemType = elemType.Elem() + if elemType.Kind() == reflect.Struct { + return multiArgTypeStructPtr, elemType + } + } + return multiArgTypeInvalid, nil +} + +func oleInt64(item *ole.IDispatch, prop string) (int64, error) { + v, err := oleutil.GetProperty(item, prop) + if err != nil { + return 0, err + } + defer v.Clear() + + i := int64(v.Val) + return i, nil +} + +// CreateQuery returns a WQL query string that queries all columns of src. where +// is an optional string that is appended to the query, to be used with WHERE +// clauses. In such a case, the "WHERE" string should appear at the beginning. +// The wmi class is obtained by the name of the type. You can pass a optional +// class throught the variadic class parameter which is useful for anonymous +// structs. +func CreateQuery(src interface{}, where string, class ...string) string { + var b bytes.Buffer + b.WriteString("SELECT ") + s := reflect.Indirect(reflect.ValueOf(src)) + t := s.Type() + if s.Kind() == reflect.Slice { + t = t.Elem() + } + if t.Kind() != reflect.Struct { + return "" + } + var fields []string + for i := 0; i < t.NumField(); i++ { + fields = append(fields, t.Field(i).Name) + } + b.WriteString(strings.Join(fields, ", ")) + b.WriteString(" FROM ") + if len(class) > 0 { + b.WriteString(class[0]) + } else { + b.WriteString(t.Name()) + } + b.WriteString(" " + where) + return b.String() +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go index af2aa99f..6d8eb784 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -47,7 +47,7 @@ func archInit() { switch runtime.GOOS { case "freebsd": readARM64Registers() - case "linux", "netbsd", "openbsd": + case "linux", "netbsd", "openbsd", "windows": doinit() default: // Many platforms don't seem to allow reading these registers. diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go index 5341e7f8..ff74d7af 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !linux && !netbsd && !openbsd && arm64 +//go:build !linux && !netbsd && !openbsd && !windows && arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go new file mode 100644 index 00000000..d09e85a3 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go @@ -0,0 +1,42 @@ +// Copyright 2026 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +import ( + "golang.org/x/sys/windows" +) + +func doinit() { + // set HasASIMD and HasFP to true as per + // https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#base-requirements + // + // The ARM64 version of Windows always presupposes that it's running on an ARMv8 or later architecture. + // Both floating-point and NEON support are presumed to be present in hardware. + // + ARM64.HasASIMD = true + ARM64.HasFP = true + + if windows.IsProcessorFeaturePresent(windows.PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) { + ARM64.HasAES = true + ARM64.HasPMULL = true + ARM64.HasSHA1 = true + ARM64.HasSHA2 = true + } + ARM64.HasSHA3 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE) + ARM64.HasCRC32 = windows.IsProcessorFeaturePresent(windows.PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) + ARM64.HasSHA512 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE) + ARM64.HasATOMICS = windows.IsProcessorFeaturePresent(windows.PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) + if windows.IsProcessorFeaturePresent(windows.PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) { + ARM64.HasASIMDDP = true + ARM64.HasASIMDRDM = true + } + if windows.IsProcessorFeaturePresent(windows.PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE) { + ARM64.HasLRCPC = true + ARM64.HasSM3 = true + } + ARM64.HasSVE = windows.IsProcessorFeaturePresent(windows.PF_ARM_SVE_INSTRUCTIONS_AVAILABLE) + ARM64.HasSVE2 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE) + ARM64.HasJSCVT = windows.IsProcessorFeaturePresent(windows.PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE) +} diff --git a/vendor/golang.org/x/sys/unix/ioctl_signed.go b/vendor/golang.org/x/sys/unix/ioctl_signed.go index 5b0759bd..be0f3fba 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_signed.go +++ b/vendor/golang.org/x/sys/unix/ioctl_signed.go @@ -6,9 +6,7 @@ package unix -import ( - "unsafe" -) +import "unsafe" // ioctl itself should not be exposed directly, but additional get/set // functions for specific types are permissible. @@ -28,6 +26,13 @@ func IoctlSetPointerInt(fd int, req int, value int) error { return ioctlPtr(fd, req, unsafe.Pointer(&v)) } +// IoctlSetString performs an ioctl operation which sets a string value +// on fd, using the specified request number. +func IoctlSetString(fd int, req int, value string) error { + bs := append([]byte(value), 0) + return ioctlPtr(fd, req, unsafe.Pointer(&bs[0])) +} + // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. // // To change fd's window size, the req argument should be TIOCSWINSZ. diff --git a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go index 20f470b9..f0c28213 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go +++ b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go @@ -6,9 +6,7 @@ package unix -import ( - "unsafe" -) +import "unsafe" // ioctl itself should not be exposed directly, but additional get/set // functions for specific types are permissible. @@ -28,6 +26,13 @@ func IoctlSetPointerInt(fd int, req uint, value int) error { return ioctlPtr(fd, req, unsafe.Pointer(&v)) } +// IoctlSetString performs an ioctl operation which sets a string value +// on fd, using the specified request number. +func IoctlSetString(fd int, req uint, value string) error { + bs := append([]byte(value), 0) + return ioctlPtr(fd, req, unsafe.Pointer(&bs[0])) +} + // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. // // To change fd's window size, the req argument should be TIOCSWINSZ. diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 18a3d9bd..a6a2ea0c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -1052,14 +1052,6 @@ func IoctlSetIntRetInt(fd int, req int, arg int) (int, error) { return ioctlRet(fd, req, uintptr(arg)) } -func IoctlSetString(fd int, req int, val string) error { - bs := make([]byte, len(val)+1) - copy(bs[:len(bs)-1], val) - err := ioctlPtr(fd, req, unsafe.Pointer(&bs[0])) - runtime.KeepAlive(&bs[0]) - return err -} - // Lifreq Helpers func (l *Lifreq) SetName(name string) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 4e92e5aa..de6fccf9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -367,7 +367,9 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from iov[0].SetLen(len(p)) } var rsa RawSockaddrAny - n, oobn, recvflags, err = recvmsgRaw(fd, iov[:], oob, flags, &rsa) + if n, oobn, recvflags, err = recvmsgRaw(fd, iov[:], oob, flags, &rsa); err != nil { + return + } // source address is only specified if the socket is unconnected if rsa.Addr.Family != AF_UNSPEC { from, err = anyToSockaddr(fd, &rsa) @@ -389,8 +391,10 @@ func RecvmsgBuffers(fd int, buffers [][]byte, oob []byte, flags int) (n, oobn in } } var rsa RawSockaddrAny - n, oobn, recvflags, err = recvmsgRaw(fd, iov, oob, flags, &rsa) - if err == nil && rsa.Addr.Family != AF_UNSPEC { + if n, oobn, recvflags, err = recvmsgRaw(fd, iov, oob, flags, &rsa); err != nil { + return + } + if rsa.Addr.Family != AF_UNSPEC { from, err = anyToSockaddr(fd, &rsa) } return diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 69439df2..738a9f21 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -900,6 +900,7 @@ const socket_error = uintptr(^uint32(0)) //sys NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyRouteChange2 //sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange //sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2 +//sys IsProcessorFeaturePresent(ProcessorFeature uint32) (ret bool) = kernel32.IsProcessorFeaturePresent // For testing: clients can set this flag to force // creation of IPv6 sockets to return EAFNOSUPPORT. diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 6e4f50eb..d5658a13 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -3938,3 +3938,88 @@ const ( MOUSE_EVENT = 0x0002 WINDOW_BUFFER_SIZE_EVENT = 0x0004 ) + +// The processor features to be tested for IsProcessorFeaturePresent, see +// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent +const ( + PF_ARM_64BIT_LOADSTORE_ATOMIC = 25 + PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE = 24 + PF_ARM_EXTERNAL_CACHE_AVAILABLE = 26 + PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE = 27 + PF_ARM_VFP_32_REGISTERS_AVAILABLE = 18 + PF_3DNOW_INSTRUCTIONS_AVAILABLE = 7 + PF_CHANNELS_ENABLED = 16 + PF_COMPARE_EXCHANGE_DOUBLE = 2 + PF_COMPARE_EXCHANGE128 = 14 + PF_COMPARE64_EXCHANGE128 = 15 + PF_FASTFAIL_AVAILABLE = 23 + PF_FLOATING_POINT_EMULATED = 1 + PF_FLOATING_POINT_PRECISION_ERRATA = 0 + PF_MMX_INSTRUCTIONS_AVAILABLE = 3 + PF_NX_ENABLED = 12 + PF_PAE_ENABLED = 9 + PF_RDTSC_INSTRUCTION_AVAILABLE = 8 + PF_RDWRFSGSBASE_AVAILABLE = 22 + PF_SECOND_LEVEL_ADDRESS_TRANSLATION = 20 + PF_SSE3_INSTRUCTIONS_AVAILABLE = 13 + PF_SSSE3_INSTRUCTIONS_AVAILABLE = 36 + PF_SSE4_1_INSTRUCTIONS_AVAILABLE = 37 + PF_SSE4_2_INSTRUCTIONS_AVAILABLE = 38 + PF_AVX_INSTRUCTIONS_AVAILABLE = 39 + PF_AVX2_INSTRUCTIONS_AVAILABLE = 40 + PF_AVX512F_INSTRUCTIONS_AVAILABLE = 41 + PF_VIRT_FIRMWARE_ENABLED = 21 + PF_XMMI_INSTRUCTIONS_AVAILABLE = 6 + PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10 + PF_XSAVE_ENABLED = 17 + PF_ARM_V8_INSTRUCTIONS_AVAILABLE = 29 + PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE = 30 + PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE = 31 + PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE = 34 + PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE = 43 + PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE = 44 + PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE = 45 + PF_ARM_SVE_INSTRUCTIONS_AVAILABLE = 46 + PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE = 47 + PF_ARM_SVE2_1_INSTRUCTIONS_AVAILABLE = 48 + PF_ARM_SVE_AES_INSTRUCTIONS_AVAILABLE = 49 + PF_ARM_SVE_PMULL128_INSTRUCTIONS_AVAILABLE = 50 + PF_ARM_SVE_BITPERM_INSTRUCTIONS_AVAILABLE = 51 + PF_ARM_SVE_BF16_INSTRUCTIONS_AVAILABLE = 52 + PF_ARM_SVE_EBF16_INSTRUCTIONS_AVAILABLE = 53 + PF_ARM_SVE_B16B16_INSTRUCTIONS_AVAILABLE = 54 + PF_ARM_SVE_SHA3_INSTRUCTIONS_AVAILABLE = 55 + PF_ARM_SVE_SM4_INSTRUCTIONS_AVAILABLE = 56 + PF_ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE = 57 + PF_ARM_SVE_F32MM_INSTRUCTIONS_AVAILABLE = 58 + PF_ARM_SVE_F64MM_INSTRUCTIONS_AVAILABLE = 59 + PF_BMI2_INSTRUCTIONS_AVAILABLE = 60 + PF_MOVDIR64B_INSTRUCTION_AVAILABLE = 61 + PF_ARM_LSE2_AVAILABLE = 62 + PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE = 64 + PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE = 65 + PF_ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE = 66 + PF_ARM_V82_FP16_INSTRUCTIONS_AVAILABLE = 67 + PF_ARM_V86_BF16_INSTRUCTIONS_AVAILABLE = 68 + PF_ARM_V86_EBF16_INSTRUCTIONS_AVAILABLE = 69 + PF_ARM_SME_INSTRUCTIONS_AVAILABLE = 70 + PF_ARM_SME2_INSTRUCTIONS_AVAILABLE = 71 + PF_ARM_SME2_1_INSTRUCTIONS_AVAILABLE = 72 + PF_ARM_SME2_2_INSTRUCTIONS_AVAILABLE = 73 + PF_ARM_SME_AES_INSTRUCTIONS_AVAILABLE = 74 + PF_ARM_SME_SBITPERM_INSTRUCTIONS_AVAILABLE = 75 + PF_ARM_SME_SF8MM4_INSTRUCTIONS_AVAILABLE = 76 + PF_ARM_SME_SF8MM8_INSTRUCTIONS_AVAILABLE = 77 + PF_ARM_SME_SF8DP2_INSTRUCTIONS_AVAILABLE = 78 + PF_ARM_SME_SF8DP4_INSTRUCTIONS_AVAILABLE = 79 + PF_ARM_SME_SF8FMA_INSTRUCTIONS_AVAILABLE = 80 + PF_ARM_SME_F8F32_INSTRUCTIONS_AVAILABLE = 81 + PF_ARM_SME_F8F16_INSTRUCTIONS_AVAILABLE = 82 + PF_ARM_SME_F16F16_INSTRUCTIONS_AVAILABLE = 83 + PF_ARM_SME_B16B16_INSTRUCTIONS_AVAILABLE = 84 + PF_ARM_SME_F64F64_INSTRUCTIONS_AVAILABLE = 85 + PF_ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE = 86 + PF_ARM_SME_LUTv2_INSTRUCTIONS_AVAILABLE = 87 + PF_ARM_SME_FA64_INSTRUCTIONS_AVAILABLE = 88 + PF_UMONITOR_INSTRUCTION_AVAILABLE = 89 +) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index f25b7308..fe7a4ea1 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -320,6 +320,7 @@ var ( procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW") procGetWindowsDirectoryW = modkernel32.NewProc("GetWindowsDirectoryW") procInitializeProcThreadAttributeList = modkernel32.NewProc("InitializeProcThreadAttributeList") + procIsProcessorFeaturePresent = modkernel32.NewProc("IsProcessorFeaturePresent") procIsWow64Process = modkernel32.NewProc("IsWow64Process") procIsWow64Process2 = modkernel32.NewProc("IsWow64Process2") procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW") @@ -2786,6 +2787,12 @@ func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrco return } +func IsProcessorFeaturePresent(ProcessorFeature uint32) (ret bool) { + r0, _, _ := syscall.SyscallN(procIsProcessorFeaturePresent.Addr(), uintptr(ProcessorFeature)) + ret = r0 != 0 + return +} + func IsWow64Process(handle Handle, isWow64 *bool) (err error) { var _p0 uint32 if *isWow64 { diff --git a/vendor/modules.txt b/vendor/modules.txt index baf3cb3f..9db15073 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -22,6 +22,13 @@ github.com/cpuguy83/go-md2man/v2/md2man # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew +# github.com/ebitengine/purego v0.10.0 +## explicit; go 1.18 +github.com/ebitengine/purego +github.com/ebitengine/purego/internal/cgo +github.com/ebitengine/purego/internal/fakecgo +github.com/ebitengine/purego/internal/strings +github.com/ebitengine/purego/internal/xreflect # github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 ## explicit # github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 @@ -73,6 +80,10 @@ github.com/go-logr/logr/funcr # github.com/go-logr/stdr v1.2.2 ## explicit; go 1.16 github.com/go-logr/stdr +# github.com/go-ole/go-ole v1.2.6 +## explicit; go 1.12 +github.com/go-ole/go-ole +github.com/go-ole/go-ole/oleutil # github.com/go-playground/validator/v10 v10.15.1 ## explicit; go 1.18 # github.com/go-task/slim-sprig/v3 v3.0.0 @@ -118,6 +129,9 @@ github.com/klauspost/compress/flate github.com/klauspost/compress/internal/le # github.com/klauspost/cpuid/v2 v2.2.5 ## explicit; go 1.15 +# github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 +## explicit; go 1.16 +github.com/lufia/plan9stats # github.com/mattn/go-colorable v0.1.13 ## explicit; go 1.15 github.com/mattn/go-colorable @@ -162,6 +176,9 @@ github.com/pkg/errors # github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 ## explicit github.com/pmezard/go-difflib/difflib +# github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 +## explicit; go 1.14 +github.com/power-devops/perfstat # github.com/prometheus/client_golang v1.22.0 ## explicit; go 1.22 github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil @@ -207,6 +224,14 @@ github.com/rs/zerolog/log # github.com/russross/blackfriday/v2 v2.1.0 ## explicit github.com/russross/blackfriday/v2 +# github.com/shirou/gopsutil/v4 v4.26.3 +## explicit; go 1.24.0 +github.com/shirou/gopsutil/v4/common +github.com/shirou/gopsutil/v4/cpu +github.com/shirou/gopsutil/v4/internal/common +github.com/shirou/gopsutil/v4/mem +github.com/shirou/gopsutil/v4/net +github.com/shirou/gopsutil/v4/process # github.com/stretchr/testify v1.11.1 ## explicit; go 1.17 github.com/stretchr/testify/assert @@ -214,10 +239,19 @@ github.com/stretchr/testify/assert/yaml github.com/stretchr/testify/require # github.com/tinylib/msgp v1.6.3 ## explicit; go 1.24 +# github.com/tklauser/go-sysconf v0.3.16 +## explicit; go 1.24.0 +github.com/tklauser/go-sysconf +# github.com/tklauser/numcpus v0.11.0 +## explicit; go 1.24.0 +github.com/tklauser/numcpus # github.com/urfave/cli/v2 v2.3.0 => github.com/ipostelnik/cli/v2 v2.3.1-0.20210324024421-b6ea8234fe3d ## explicit; go 1.11 github.com/urfave/cli/v2 github.com/urfave/cli/v2/altsrc +# github.com/yusufpapurcu/wmi v1.2.4 +## explicit; go 1.16 +github.com/yusufpapurcu/wmi # go.opentelemetry.io/auto/sdk v1.2.1 ## explicit; go 1.24.0 go.opentelemetry.io/auto/sdk @@ -332,7 +366,7 @@ golang.org/x/oauth2/internal # golang.org/x/sync v0.14.0 ## explicit; go 1.23.0 golang.org/x/sync/errgroup -# golang.org/x/sys v0.40.0 +# golang.org/x/sys v0.41.0 ## explicit; go 1.24.0 golang.org/x/sys/cpu golang.org/x/sys/execabs