1 // syscall_aix_ppc.go -- AIX 32-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 uint64(r
.Iar
) }
25 func (r
*PtraceRegs
) SetPC(pc
uint64) { r
.Iar
= uint32(pc
) }
27 func PtraceGetRegs(pid
int, regsout
*PtraceRegs
) (err error
) {
28 ptrace(_PT_REGSET
, pid
, uintptr(unsafe
.Pointer(®sout
.Gpr
[0])), 0, 0)
29 regsout
.Iar
= uint32(ptrace(_PT_READ_GPR
, pid
, 128, 0, 0))
30 regsout
.Msr
= uint32(ptrace(_PT_READ_GPR
, pid
, 129, 0, 0))
31 regsout
.Cr
= uint32(ptrace(_PT_READ_GPR
, pid
, 130, 0, 0))
32 regsout
.Lr
= uint32(ptrace(_PT_READ_GPR
, pid
, 131, 0, 0))
33 regsout
.Ctr
= uint32(ptrace(_PT_READ_GPR
, pid
, 132, 0, 0))
34 regsout
.Xer
= uint32(ptrace(_PT_READ_GPR
, pid
, 133, 0, 0))
38 func PtraceSetRegs(pid
int, regs
*PtraceRegs
) (err error
) {
39 for i
:= 0; i
< len(regs
.Gpr
); i
++ {
40 ptrace(_PT_WRITE_GPR
, pid
, uintptr(i
), int(regs
.Gpr
[i
]), 0)
42 ptrace(_PT_WRITE_GPR
, pid
, 128, int(regs
.Iar
), 0)
43 ptrace(_PT_WRITE_GPR
, pid
, 129, int(regs
.Msr
), 0)
44 ptrace(_PT_WRITE_GPR
, pid
, 130, int(regs
.Cr
), 0)
45 ptrace(_PT_WRITE_GPR
, pid
, 131, int(regs
.Lr
), 0)
46 ptrace(_PT_WRITE_GPR
, pid
, 132, int(regs
.Ctr
), 0)
47 ptrace(_PT_WRITE_GPR
, pid
, 133, int(regs
.Xer
), 0)