Commit 156c5a2d authored by James Cowgill's avatar James Cowgill Committed by Ian Lance Taylor

unix: use struct pt_regs for PtraceRegs on mips

On mips, "struct user" bears no relation to the actual structure used by
PTRACE_GETREGS. The real structure is "struct pt_regs" which is declared
in asm/ptrace.h

Fixes golang/go#20338.

Change-Id: I604d27bd2b0a0903784380cbd3fa2fd9b9811fa5
Reviewed-on: https://go-review.googlesource.com/43431Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 6b706892
......@@ -163,10 +163,8 @@ struct my_sockaddr_un {
typedef struct user_regs PtraceRegs;
#elif defined(__aarch64__)
typedef struct user_pt_regs PtraceRegs;
#elif defined(__powerpc64__)
#elif defined(__mips__) || defined(__powerpc64__)
typedef struct pt_regs PtraceRegs;
#elif defined(__mips__)
typedef struct user PtraceRegs;
#elif defined(__s390x__)
typedef struct _user_regs_struct PtraceRegs;
#elif defined(__sparc__)
......
......@@ -183,9 +183,9 @@ func fillStat_t(s *Stat_t, st *stat_t) {
s.Blocks = st.Blocks
}
func (r *PtraceRegs) PC() uint64 { return r.Regs[64] }
func (r *PtraceRegs) PC() uint64 { return r.Epc }
func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = pc }
func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
func (iov *Iovec) SetLen(length int) {
iov.Len = uint64(length)
......
......@@ -211,9 +211,9 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) {
return setrlimit(resource, &rl)
}
func (r *PtraceRegs) PC() uint64 { return uint64(r.Regs[64]) }
func (r *PtraceRegs) PC() uint64 { return r.Epc }
func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = uint32(pc) }
func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
func (iov *Iovec) SetLen(length int) {
iov.Len = uint32(length)
......
......@@ -568,17 +568,13 @@ type InotifyEvent struct {
const SizeofInotifyEvent = 0x10
type PtraceRegs struct {
Regs [109]uint32
U_tsize uint32
U_dsize uint32
U_ssize uint32
Start_code uint32
Start_data uint32
Start_stack uint32
Signal int32
U_ar0 *byte
Magic uint32
U_comm [32]int8
Regs [32]uint64
Lo uint64
Hi uint64
Epc uint64
Badvaddr uint64
Status uint64
Cause uint64
}
type FdSet struct {
......
......@@ -570,17 +570,13 @@ type InotifyEvent struct {
const SizeofInotifyEvent = 0x10
type PtraceRegs struct {
Regs [102]uint64
U_tsize uint64
U_dsize uint64
U_ssize uint64
Start_code uint64
Start_data uint64
Start_stack uint64
Signal int64
U_ar0 uint64
Magic uint64
U_comm [32]int8
Regs [32]uint64
Lo uint64
Hi uint64
Epc uint64
Badvaddr uint64
Status uint64
Cause uint64
}
type FdSet struct {
......
......@@ -570,17 +570,13 @@ type InotifyEvent struct {
const SizeofInotifyEvent = 0x10
type PtraceRegs struct {
Regs [102]uint64
U_tsize uint64
U_dsize uint64
U_ssize uint64
Start_code uint64
Start_data uint64
Start_stack uint64
Signal int64
U_ar0 uint64
Magic uint64
U_comm [32]int8
Regs [32]uint64
Lo uint64
Hi uint64
Epc uint64
Badvaddr uint64
Status uint64
Cause uint64
}
type FdSet struct {
......
......@@ -568,17 +568,13 @@ type InotifyEvent struct {
const SizeofInotifyEvent = 0x10
type PtraceRegs struct {
Regs [109]uint32
U_tsize uint32
U_dsize uint32
U_ssize uint32
Start_code uint32
Start_data uint32
Start_stack uint32
Signal int32
U_ar0 *byte
Magic uint32
U_comm [32]int8
Regs [32]uint64
Lo uint64
Hi uint64
Epc uint64
Badvaddr uint64
Status uint64
Cause uint64
}
type FdSet struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment