syscall_linux_s390x.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // syscall_linux_s390x.go -- GNU/Linux s390x specific support
  2. // Copyright 2014 The Go Authors. All rights reserved.
  3. // Use of this source code is governed by a BSD-style
  4. // license that can be found in the LICENSE file.
  5. // The PtraceRegs struct generated for go looks like this:
  6. //
  7. // type PtraceRegs struct
  8. // {
  9. // Psw _psw_t;
  10. // Gprs [15+1]uint64;
  11. // Acrs [15+1]uint32;
  12. // Orig_gpr2 uint64;
  13. // Fp_regs _s390_fp_regs;
  14. // Per_info _per_struct;
  15. // Ieee_instruction_pointer uint64;
  16. // }
  17. //
  18. // The GETREGSET/SETREGSET ptrace commands on S/390 only read/write
  19. // the content up to Orig_gpr2. Hence, we use
  20. // PEEKUSR_AREA/POKEUSR_AREA like GDB does.
  21. package syscall
  22. import "unsafe"
  23. func (r *PtraceRegs) PC() uint64 { return r.Psw.addr }
  24. func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.addr = pc }
  25. func PtraceGetRegs(pid int, regs *PtraceRegs) (err error) {
  26. parea := _ptrace_area{
  27. _sizeof_ptrace_area,
  28. 0,
  29. uint64(uintptr(unsafe.Pointer(regs))),
  30. }
  31. return ptrace(PTRACE_PEEKUSR_AREA, pid, uintptr(unsafe.Pointer(&parea)), 0)
  32. }
  33. func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
  34. parea := _ptrace_area{
  35. _sizeof_ptrace_area,
  36. 0,
  37. uint64(uintptr(unsafe.Pointer(regs))),
  38. }
  39. return ptrace(PTRACE_POKEUSR_AREA, pid, uintptr(unsafe.Pointer(&parea)), 0)
  40. }
  41. func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno)