1 // syscall_aix_ppc64.go -- AIX 64-bit specific support
3 // Copyright 2017 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
11 // AIX does not define a specific structure but instead uses separate
12 // ptrace calls for the different registers.
13 type PtraceRegs
struct {
23 func (r
*PtraceRegs
) PC() uint64 { return r
.Iar
}
25 func (r
*PtraceRegs
) SetPC(pc
uint64) { r
.Iar
= pc
}
27 func PtraceGetRegs(pid
int, regsout
*PtraceRegs
) (err error
) {
28 ptrace64(_PT_REGSET
, int64(pid
), int64(uintptr(unsafe
.Pointer(®sout
.Gpr
[0]))), 0, 0)
29 ptrace64(_PT_READ_GPR
, int64(pid
), 128, 0, uintptr(unsafe
.Pointer(®sout
.Iar
)))
30 ptrace64(_PT_READ_GPR
, int64(pid
), 129, 0, uintptr(unsafe
.Pointer(®sout
.Msr
)))
31 ptrace64(_PT_READ_GPR
, int64(pid
), 130, 0, uintptr(unsafe
.Pointer(®sout
.Cr
)))
32 ptrace64(_PT_READ_GPR
, int64(pid
), 131, 0, uintptr(unsafe
.Pointer(®sout
.Lr
)))
33 ptrace64(_PT_READ_GPR
, int64(pid
), 132, 0, uintptr(unsafe
.Pointer(®sout
.Ctr
)))
34 ptrace64(_PT_READ_GPR
, int64(pid
), 133, 0, uintptr(unsafe
.Pointer(®sout
.Xer
)))
38 func PtraceSetRegs(pid
int, regs
*PtraceRegs
) (err error
) {
39 for i
:= 0; i
< len(regs
.Gpr
); i
++ {
40 ptrace64(_PT_WRITE_GPR
, int64(pid
), int64(i
), 0, uintptr(unsafe
.Pointer(®s
.Gpr
[i
])))
42 ptrace64(_PT_WRITE_GPR
, int64(pid
), 128, 0, uintptr(unsafe
.Pointer(®s
.Iar
)))
43 ptrace64(_PT_WRITE_GPR
, int64(pid
), 129, 0, uintptr(unsafe
.Pointer(®s
.Msr
)))
44 ptrace64(_PT_WRITE_GPR
, int64(pid
), 130, 0, uintptr(unsafe
.Pointer(®s
.Cr
)))
45 ptrace64(_PT_WRITE_GPR
, int64(pid
), 131, 0, uintptr(unsafe
.Pointer(®s
.Lr
)))
46 ptrace64(_PT_WRITE_GPR
, int64(pid
), 132, 0, uintptr(unsafe
.Pointer(®s
.Ctr
)))
47 ptrace64(_PT_WRITE_GPR
, int64(pid
), 133, 0, uintptr(unsafe
.Pointer(®s
.Xer
)))