Ian Lance Taylor | afaaddb | 2011-04-01 16:01:39 -0700 | [diff] [blame] | 1 | // syscall_linux_alpha.go -- GNU/Linux ALPHA specific support |
| 2 | |
| 3 | // Copyright 2011 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. |
| 6 | |
| 7 | package syscall |
| 8 | |
Ian Lance Taylor | bdafd5c | 2012-01-31 06:21:32 -0800 | [diff] [blame] | 9 | import "unsafe" |
| 10 | |
Ian Lance Taylor | 71101f3 | 2011-05-31 11:14:19 -0700 | [diff] [blame] | 11 | type PtraceRegs struct { |
Ian Lance Taylor | bdafd5c | 2012-01-31 06:21:32 -0800 | [diff] [blame] | 12 | R0 uint64 |
| 13 | R1 uint64 |
| 14 | R2 uint64 |
| 15 | R3 uint64 |
| 16 | R4 uint64 |
| 17 | R5 uint64 |
| 18 | R6 uint64 |
| 19 | R7 uint64 |
| 20 | R8 uint64 |
| 21 | R19 uint64 |
| 22 | R20 uint64 |
| 23 | R21 uint64 |
| 24 | R22 uint64 |
| 25 | R23 uint64 |
| 26 | R24 uint64 |
| 27 | R25 uint64 |
| 28 | R26 uint64 |
| 29 | R27 uint64 |
| 30 | R28 uint64 |
| 31 | Hae uint64 |
Ian Lance Taylor | 71101f3 | 2011-05-31 11:14:19 -0700 | [diff] [blame] | 32 | Trap_a0 uint64 |
| 33 | Trap_a1 uint64 |
| 34 | Trap_a2 uint64 |
Ian Lance Taylor | bdafd5c | 2012-01-31 06:21:32 -0800 | [diff] [blame] | 35 | Ps uint64 |
| 36 | Pc uint64 |
| 37 | Gp uint64 |
| 38 | R16 uint64 |
| 39 | R17 uint64 |
| 40 | R18 uint64 |
Ian Lance Taylor | 71101f3 | 2011-05-31 11:14:19 -0700 | [diff] [blame] | 41 | } |
| 42 | |
Ian Lance Taylor | afaaddb | 2011-04-01 16:01:39 -0700 | [diff] [blame] | 43 | func (r *PtraceRegs) PC() uint64 { |
Ian Lance Taylor | bdafd5c | 2012-01-31 06:21:32 -0800 | [diff] [blame] | 44 | return r.Pc |
Ian Lance Taylor | afaaddb | 2011-04-01 16:01:39 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | func (r *PtraceRegs) SetPC(pc uint64) { |
Ian Lance Taylor | bdafd5c | 2012-01-31 06:21:32 -0800 | [diff] [blame] | 48 | r.Pc = pc |
| 49 | } |
| 50 | |
| 51 | func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) { |
| 52 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) |
| 53 | } |
| 54 | |
| 55 | func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) { |
| 56 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) |
Ian Lance Taylor | afaaddb | 2011-04-01 16:01:39 -0700 | [diff] [blame] | 57 | } |