github.com/comwrg/go/src@v0.0.0-20220319063731-c238d0440370/runtime/export_debug_regabiargs_on_test.go (about) 1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build amd64 && linux && goexperiment.regabiargs 6 // +build amd64,linux,goexperiment.regabiargs 7 8 package runtime 9 10 import "internal/abi" 11 12 // storeRegArgs sets up argument registers in the signal 13 // context state from an abi.RegArgs. 14 // 15 // Both src and dst must be non-nil. 16 func storeRegArgs(dst *sigcontext, src *abi.RegArgs) { 17 dst.rax = uint64(src.Ints[0]) 18 dst.rbx = uint64(src.Ints[1]) 19 dst.rcx = uint64(src.Ints[2]) 20 dst.rdi = uint64(src.Ints[3]) 21 dst.rsi = uint64(src.Ints[4]) 22 dst.r8 = uint64(src.Ints[5]) 23 dst.r9 = uint64(src.Ints[6]) 24 dst.r10 = uint64(src.Ints[7]) 25 dst.r11 = uint64(src.Ints[8]) 26 for i := range src.Floats { 27 dst.fpstate._xmm[i].element[0] = uint32(src.Floats[i] >> 0) 28 dst.fpstate._xmm[i].element[1] = uint32(src.Floats[i] >> 32) 29 } 30 } 31 32 func loadRegArgs(dst *abi.RegArgs, src *sigcontext) { 33 dst.Ints[0] = uintptr(src.rax) 34 dst.Ints[1] = uintptr(src.rbx) 35 dst.Ints[2] = uintptr(src.rcx) 36 dst.Ints[3] = uintptr(src.rdi) 37 dst.Ints[4] = uintptr(src.rsi) 38 dst.Ints[5] = uintptr(src.r8) 39 dst.Ints[6] = uintptr(src.r9) 40 dst.Ints[7] = uintptr(src.r10) 41 dst.Ints[8] = uintptr(src.r11) 42 for i := range dst.Floats { 43 dst.Floats[i] = uint64(src.fpstate._xmm[i].element[0]) << 0 44 dst.Floats[i] |= uint64(src.fpstate._xmm[i].element[1]) << 32 45 } 46 }