[AArch64] Tighten address register subreg checks
[official-gcc.git] / libgo / go / syscall / syscall_linux_s390x.go
blob1767a6e5c616c9644df72b13686f50fc58c37495
1 // syscall_linux_s390x.go -- GNU/Linux s390x specific support
3 // Copyright 2014 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 // The PtraceRegs struct generated for go looks like this:
8 //
9 // type PtraceRegs struct
10 // {
11 // Psw _psw_t;
12 // Gprs [15+1]uint64;
13 // Acrs [15+1]uint32;
14 // Orig_gpr2 uint64;
15 // Fp_regs _s390_fp_regs;
16 // Per_info _per_struct;
17 // Ieee_instruction_pointer uint64;
18 // }
20 // The GETREGSET/SETREGSET ptrace commands on S/390 only read/write
21 // the content up to Orig_gpr2. Hence, we use
22 // PEEKUSR_AREA/POKEUSR_AREA like GDB does.
24 package syscall
26 import "unsafe"
28 func (r *PtraceRegs) PC() uint64 { return r.Psw.addr }
30 func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.addr = pc }
32 func PtraceGetRegs(pid int, regs *PtraceRegs) (err error) {
33 parea := _ptrace_area{
34 _sizeof_ptrace_area,
36 uint64(uintptr(unsafe.Pointer(regs))),
38 return ptrace(PTRACE_PEEKUSR_AREA, pid, uintptr(unsafe.Pointer(&parea)), 0)
41 func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
42 parea := _ptrace_area{
43 _sizeof_ptrace_area,
45 uint64(uintptr(unsafe.Pointer(regs))),
47 return ptrace(PTRACE_POKEUSR_AREA, pid, uintptr(unsafe.Pointer(&parea)), 0)