* cp-tree.h (build_noexcept_spec, add_exception_specifier): Adjust
[official-gcc.git] / libgo / go / syscall / syscall_aix_ppc.go
blob83ed1e64c3a3544efcfa0e7ccd09e0ecaa3c9f85
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.
7 package syscall
9 import "unsafe"
11 // AIX does not define a specific structure but instead uses separate
12 // ptrace calls for the different registers.
13 type PtraceRegs struct {
14 Gpr [32]uint32
15 Iar uint32
16 Msr uint32
17 Cr uint32
18 Lr uint32
19 Ctr uint32
20 Xer uint32
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(&regsout.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))
35 return nil
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)
48 return nil