Implement `struct reg'.

This commit is contained in:
mycroft 1994-01-06 16:50:13 +00:00
parent 27710a7332
commit f76fdd7722
6 changed files with 75 additions and 213 deletions

View File

@ -37,48 +37,19 @@
*
* from: Utah Hdr: reg.h 1.1 90/07/09
* from: @(#)reg.h 7.2 (Berkeley) 11/3/90
* $Id: reg.h,v 1.4 1993/12/08 22:46:15 mycroft Exp $
* $Id: reg.h,v 1.5 1994/01/06 16:50:26 mycroft Exp $
*/
#ifndef _HP300_REG_H_
#define _HP300_REG_H_
/*
* Location of the users' stored
* registers relative to D0.
* Usage is u.u_ar0[XX].
* Register set accessible via /proc/$pid/reg and ptrace()
*/
#define D0 (0)
#define D1 (1)
#define D2 (2)
#define D3 (3)
#define D4 (4)
#define D5 (5)
#define D6 (6)
#define D7 (7)
#define A0 (8)
#define A1 (9)
#define A2 (10)
#define A3 (11)
#define A4 (12)
#define A5 (13)
#define A6 (14)
#define A7 (15)
struct reg {
int r_regs[16]; /* D0-D7/A0-A7 */
int r_pc;
int r_sr;
};
#define SP A7
#define PC (17)
#define PS (16)
#define NIPCREG 17
#ifdef IPCREG
int ipcreg[NIPCREG] =
{D0,D1,D2,D3,D4,D5,D6,D7,A0,A1,A2,A3,A4,A5,A6,A7,PC};
#endif
#ifdef KERNEL
/*
* Due to a mental lapse somewhere down the line, wait returns its values
* in strange registers. Kludge it up here so we don't have to in the
* machine-independent code.
*/
#define R0 D1
#define R1 A0
#endif
#endif /* !_HP300_REG_H_ */

View File

@ -37,7 +37,7 @@
*
* from: Utah Hdr: machdep.c 1.63 91/04/24
* from: @(#)machdep.c 7.16 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.14 1993/12/08 23:11:40 mycroft Exp $
* $Id: machdep.c,v 1.15 1994/01/06 16:50:13 mycroft Exp $
*/
#include "param.h"
@ -1626,7 +1626,9 @@ cpu_exec_aout_prep_oldzmagic(p, epp)
#endif /* COMPAT_NOMID */
int
ptrace_set_pc (struct proc *p, unsigned int addr)
ptrace_set_pc (p, addr)
struct proc *p;
int *addr;
{
struct frame *frame = (struct frame *)
((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack));
@ -1636,7 +1638,8 @@ ptrace_set_pc (struct proc *p, unsigned int addr)
}
int
ptrace_single_step (struct proc *p)
ptrace_single_step (p)
struct proc *p;
{
struct frame *frame = (struct frame *)
((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack));
@ -1646,31 +1649,35 @@ ptrace_single_step (struct proc *p)
}
int
ptrace_getregs (struct proc *p, unsigned int *addr)
ptrace_getregs (p, addr)
struct proc *p;
int *addr;
{
u_long ipcreg[NIPCREG];
struct reg ipcreg;
struct frame *frame = (struct frame *)
((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack));
bcopy(frame->f_regs, ipcreg, sizeof(frame->f_regs));
ipcreg[PS] = frame->f_sr;
ipcreg[PC] = frame->f_pc;
return copyout(ipcreg, addr, sizeof(ipcreg));
ipcreg.r_sr = frame->f_sr;
ipcreg.r_pc = frame->f_pc;
return copyout(reg, addr, sizeof(reg));
}
int
ptrace_setregs (struct proc *p, unsigned int *addr)
ptrace_setregs (p, addr)
struct proc *p;
int *addr;
{
int error;
u_long ipcreg[NIPCREG];
struct reg ipcreg;
struct frame *frame = (struct frame *)
((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack));
if (error = copyin(addr, ipcreg, sizeof(ipcreg)))
if (error = copyin(addr, reg, sizeof(reg)))
return error;
bcopy(ipcreg, frame->f_regs, sizeof(frame->f_regs));
frame->f_sr = (ipcreg[PS] | PSL_USERSET) & ~PSL_USERCLR;
frame->f_pc = ipcreg[PC];
frame->f_sr = (ipcreg.r_sr | PSL_USERSET) & ~PSL_USERCLR;
frame->f_pc = ipcreg.r_pc;
return 0;
}

View File

@ -37,48 +37,19 @@
*
* from: Utah Hdr: reg.h 1.1 90/07/09
* from: @(#)reg.h 7.2 (Berkeley) 11/3/90
* $Id: reg.h,v 1.4 1993/12/08 22:46:15 mycroft Exp $
* $Id: reg.h,v 1.5 1994/01/06 16:50:26 mycroft Exp $
*/
#ifndef _HP300_REG_H_
#define _HP300_REG_H_
/*
* Location of the users' stored
* registers relative to D0.
* Usage is u.u_ar0[XX].
* Register set accessible via /proc/$pid/reg and ptrace()
*/
#define D0 (0)
#define D1 (1)
#define D2 (2)
#define D3 (3)
#define D4 (4)
#define D5 (5)
#define D6 (6)
#define D7 (7)
#define A0 (8)
#define A1 (9)
#define A2 (10)
#define A3 (11)
#define A4 (12)
#define A5 (13)
#define A6 (14)
#define A7 (15)
struct reg {
int r_regs[16]; /* D0-D7/A0-A7 */
int r_pc;
int r_sr;
};
#define SP A7
#define PC (17)
#define PS (16)
#define NIPCREG 17
#ifdef IPCREG
int ipcreg[NIPCREG] =
{D0,D1,D2,D3,D4,D5,D6,D7,A0,A1,A2,A3,A4,A5,A6,A7,PC};
#endif
#ifdef KERNEL
/*
* Due to a mental lapse somewhere down the line, wait returns its values
* in strange registers. Kludge it up here so we don't have to in the
* machine-independent code.
*/
#define R0 D1
#define R1 A0
#endif
#endif /* !_HP300_REG_H_ */

View File

@ -37,48 +37,19 @@
*
* from: Utah Hdr: reg.h 1.1 90/07/09
* from: @(#)reg.h 7.2 (Berkeley) 11/3/90
* $Id: reg.h,v 1.4 1993/12/08 22:46:15 mycroft Exp $
* $Id: reg.h,v 1.5 1994/01/06 16:50:26 mycroft Exp $
*/
#ifndef _HP300_REG_H_
#define _HP300_REG_H_
/*
* Location of the users' stored
* registers relative to D0.
* Usage is u.u_ar0[XX].
* Register set accessible via /proc/$pid/reg and ptrace()
*/
#define D0 (0)
#define D1 (1)
#define D2 (2)
#define D3 (3)
#define D4 (4)
#define D5 (5)
#define D6 (6)
#define D7 (7)
#define A0 (8)
#define A1 (9)
#define A2 (10)
#define A3 (11)
#define A4 (12)
#define A5 (13)
#define A6 (14)
#define A7 (15)
struct reg {
int r_regs[16]; /* D0-D7/A0-A7 */
int r_pc;
int r_sr;
};
#define SP A7
#define PC (17)
#define PS (16)
#define NIPCREG 17
#ifdef IPCREG
int ipcreg[NIPCREG] =
{D0,D1,D2,D3,D4,D5,D6,D7,A0,A1,A2,A3,A4,A5,A6,A7,PC};
#endif
#ifdef KERNEL
/*
* Due to a mental lapse somewhere down the line, wait returns its values
* in strange registers. Kludge it up here so we don't have to in the
* machine-independent code.
*/
#define R0 D1
#define R1 A0
#endif
#endif /* !_HP300_REG_H_ */

View File

@ -37,48 +37,19 @@
*
* from: Utah Hdr: reg.h 1.1 90/07/09
* from: @(#)reg.h 7.2 (Berkeley) 11/3/90
* $Id: reg.h,v 1.4 1993/12/08 22:46:15 mycroft Exp $
* $Id: reg.h,v 1.5 1994/01/06 16:50:26 mycroft Exp $
*/
#ifndef _HP300_REG_H_
#define _HP300_REG_H_
/*
* Location of the users' stored
* registers relative to D0.
* Usage is u.u_ar0[XX].
* Register set accessible via /proc/$pid/reg and ptrace()
*/
#define D0 (0)
#define D1 (1)
#define D2 (2)
#define D3 (3)
#define D4 (4)
#define D5 (5)
#define D6 (6)
#define D7 (7)
#define A0 (8)
#define A1 (9)
#define A2 (10)
#define A3 (11)
#define A4 (12)
#define A5 (13)
#define A6 (14)
#define A7 (15)
struct reg {
int r_regs[16]; /* D0-D7/A0-A7 */
int r_pc;
int r_sr;
};
#define SP A7
#define PC (17)
#define PS (16)
#define NIPCREG 17
#ifdef IPCREG
int ipcreg[NIPCREG] =
{D0,D1,D2,D3,D4,D5,D6,D7,A0,A1,A2,A3,A4,A5,A6,A7,PC};
#endif
#ifdef KERNEL
/*
* Due to a mental lapse somewhere down the line, wait returns its values
* in strange registers. Kludge it up here so we don't have to in the
* machine-independent code.
*/
#define R0 D1
#define R1 A0
#endif
#endif /* !_HP300_REG_H_ */

View File

@ -37,48 +37,19 @@
*
* from: Utah Hdr: reg.h 1.1 90/07/09
* from: @(#)reg.h 7.2 (Berkeley) 11/3/90
* $Id: reg.h,v 1.4 1993/12/08 22:46:15 mycroft Exp $
* $Id: reg.h,v 1.5 1994/01/06 16:50:26 mycroft Exp $
*/
#ifndef _HP300_REG_H_
#define _HP300_REG_H_
/*
* Location of the users' stored
* registers relative to D0.
* Usage is u.u_ar0[XX].
* Register set accessible via /proc/$pid/reg and ptrace()
*/
#define D0 (0)
#define D1 (1)
#define D2 (2)
#define D3 (3)
#define D4 (4)
#define D5 (5)
#define D6 (6)
#define D7 (7)
#define A0 (8)
#define A1 (9)
#define A2 (10)
#define A3 (11)
#define A4 (12)
#define A5 (13)
#define A6 (14)
#define A7 (15)
struct reg {
int r_regs[16]; /* D0-D7/A0-A7 */
int r_pc;
int r_sr;
};
#define SP A7
#define PC (17)
#define PS (16)
#define NIPCREG 17
#ifdef IPCREG
int ipcreg[NIPCREG] =
{D0,D1,D2,D3,D4,D5,D6,D7,A0,A1,A2,A3,A4,A5,A6,A7,PC};
#endif
#ifdef KERNEL
/*
* Due to a mental lapse somewhere down the line, wait returns its values
* in strange registers. Kludge it up here so we don't have to in the
* machine-independent code.
*/
#define R0 D1
#define R1 A0
#endif
#endif /* !_HP300_REG_H_ */