github.com/AESNooper/go/src@v0.0.0-20220218095104-b56a4ab1bbbb/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 7 package runtime 8 9 import "internal/abi" 10 11 // storeRegArgs sets up argument registers in the signal 12 // context state from an abi.RegArgs. 13 // 14 // Both src and dst must be non-nil. 15 func storeRegArgs(dst *sigcontext, src *abi.RegArgs) { 16 dst.rax = uint64(src.Ints[0]) 17 dst.rbx = uint64(src.Ints[1]) 18 dst.rcx = uint64(src.Ints[2]) 19 dst.rdi = uint64(src.Ints[3]) 20 dst.rsi = uint64(src.Ints[4]) 21 dst.r8 = uint64(src.Ints[5]) 22 dst.r9 = uint64(src.Ints[6]) 23 dst.r10 = uint64(src.Ints[7]) 24 dst.r11 = uint64(src.Ints[8]) 25 for i := range src.Floats { 26 dst.fpstate._xmm[i].element[0] = uint32(src.Floats[i] >> 0) 27 dst.fpstate._xmm[i].element[1] = uint32(src.Floats[i] >> 32) 28 } 29 } 30 31 func loadRegArgs(dst *abi.RegArgs, src *sigcontext) { 32 dst.Ints[0] = uintptr(src.rax) 33 dst.Ints[1] = uintptr(src.rbx) 34 dst.Ints[2] = uintptr(src.rcx) 35 dst.Ints[3] = uintptr(src.rdi) 36 dst.Ints[4] = uintptr(src.rsi) 37 dst.Ints[5] = uintptr(src.r8) 38 dst.Ints[6] = uintptr(src.r9) 39 dst.Ints[7] = uintptr(src.r10) 40 dst.Ints[8] = uintptr(src.r11) 41 for i := range dst.Floats { 42 dst.Floats[i] = uint64(src.fpstate._xmm[i].element[0]) << 0 43 dst.Floats[i] |= uint64(src.fpstate._xmm[i].element[1]) << 32 44 } 45 }