summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorssouhlal <ssouhlal@FreeBSD.org>2004-07-29 13:34:50 +0000
committerssouhlal <ssouhlal@FreeBSD.org>2004-07-29 13:34:50 +0000
commiteb5ea5dd290e369c6ffac3ac518bc61822a2dc66 (patch)
tree0d13c1f213f86f57c187df24f8831b9e59bae28c /sys/powerpc
parent545b74a7862d8f94d2067891fe8bfea269fa14d3 (diff)
downloadFreeBSD-src-eb5ea5dd290e369c6ffac3ac518bc61822a2dc66.zip
FreeBSD-src-eb5ea5dd290e369c6ffac3ac518bc61822a2dc66.tar.gz
Implement MD parts of ptrace.
Approved by: grehan (mentor)
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/aim/machdep.c56
-rw-r--r--sys/powerpc/powerpc/machdep.c56
2 files changed, 86 insertions, 26 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index 6bdacf3..1a1e661 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -772,71 +772,101 @@ exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
td->td_pcb->pcb_flags = 0;
}
-/* XXX: dummy {fill,set}_[fp]regs */
int
fill_regs(struct thread *td, struct reg *regs)
{
+ struct trapframe *tf;
- return (ENOSYS);
+ tf = td->td_frame;
+ memcpy(regs, tf, sizeof(struct reg));
+
+ return (0);
}
int
fill_dbregs(struct thread *td, struct dbreg *dbregs)
{
-
+ /* No debug registers on PowerPC */
return (ENOSYS);
}
int
fill_fpregs(struct thread *td, struct fpreg *fpregs)
{
+ struct pcb *pcb;
- return (ENOSYS);
+ pcb = td->td_pcb;
+
+ if ((pcb->pcb_flags & PCB_FPU) == 0)
+ memset(fpregs, 0, sizeof(struct fpreg));
+ else
+ memcpy(fpregs, &pcb->pcb_fpu, sizeof(struct fpreg));
+
+ return (0);
}
int
set_regs(struct thread *td, struct reg *regs)
{
+ struct trapframe *tf;
- return (ENOSYS);
+ tf = td->td_frame;
+ memcpy(tf, regs, sizeof(struct reg));
+
+ return (0);
}
int
set_dbregs(struct thread *td, struct dbreg *dbregs)
{
-
+ /* No debug registers on PowerPC */
return (ENOSYS);
}
int
set_fpregs(struct thread *td, struct fpreg *fpregs)
{
+ struct pcb *pcb;
- return (ENOSYS);
+ pcb = td->td_pcb;
+ if ((pcb->pcb_flags & PCB_FPU) == 0)
+ enable_fpu(td);
+ memcpy(&pcb->pcb_fpu, fpregs, sizeof(struct fpreg));
+
+ return (0);
}
int
ptrace_set_pc(struct thread *td, unsigned long addr)
{
+ struct trapframe *tf;
- /* XXX: coming soon... */
- return (ENOSYS);
+ tf = td->td_frame;
+ tf->srr0 = (register_t)addr;
+
+ return (0);
}
int
ptrace_single_step(struct thread *td)
{
+ struct trapframe *tf;
+
+ tf = td->td_frame;
+ tf->srr1 |= PSL_SE;
- /* XXX: coming soon... */
- return (ENOSYS);
+ return (0);
}
int
ptrace_clear_single_step(struct thread *td)
{
+ struct trapframe *tf;
- /* XXX: coming soon... */
- return (ENOSYS);
+ tf = td->td_frame;
+ tf->srr1 &= ~PSL_SE;
+
+ return (0);
}
/*
diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c
index 6bdacf3..1a1e661 100644
--- a/sys/powerpc/powerpc/machdep.c
+++ b/sys/powerpc/powerpc/machdep.c
@@ -772,71 +772,101 @@ exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
td->td_pcb->pcb_flags = 0;
}
-/* XXX: dummy {fill,set}_[fp]regs */
int
fill_regs(struct thread *td, struct reg *regs)
{
+ struct trapframe *tf;
- return (ENOSYS);
+ tf = td->td_frame;
+ memcpy(regs, tf, sizeof(struct reg));
+
+ return (0);
}
int
fill_dbregs(struct thread *td, struct dbreg *dbregs)
{
-
+ /* No debug registers on PowerPC */
return (ENOSYS);
}
int
fill_fpregs(struct thread *td, struct fpreg *fpregs)
{
+ struct pcb *pcb;
- return (ENOSYS);
+ pcb = td->td_pcb;
+
+ if ((pcb->pcb_flags & PCB_FPU) == 0)
+ memset(fpregs, 0, sizeof(struct fpreg));
+ else
+ memcpy(fpregs, &pcb->pcb_fpu, sizeof(struct fpreg));
+
+ return (0);
}
int
set_regs(struct thread *td, struct reg *regs)
{
+ struct trapframe *tf;
- return (ENOSYS);
+ tf = td->td_frame;
+ memcpy(tf, regs, sizeof(struct reg));
+
+ return (0);
}
int
set_dbregs(struct thread *td, struct dbreg *dbregs)
{
-
+ /* No debug registers on PowerPC */
return (ENOSYS);
}
int
set_fpregs(struct thread *td, struct fpreg *fpregs)
{
+ struct pcb *pcb;
- return (ENOSYS);
+ pcb = td->td_pcb;
+ if ((pcb->pcb_flags & PCB_FPU) == 0)
+ enable_fpu(td);
+ memcpy(&pcb->pcb_fpu, fpregs, sizeof(struct fpreg));
+
+ return (0);
}
int
ptrace_set_pc(struct thread *td, unsigned long addr)
{
+ struct trapframe *tf;
- /* XXX: coming soon... */
- return (ENOSYS);
+ tf = td->td_frame;
+ tf->srr0 = (register_t)addr;
+
+ return (0);
}
int
ptrace_single_step(struct thread *td)
{
+ struct trapframe *tf;
+
+ tf = td->td_frame;
+ tf->srr1 |= PSL_SE;
- /* XXX: coming soon... */
- return (ENOSYS);
+ return (0);
}
int
ptrace_clear_single_step(struct thread *td)
{
+ struct trapframe *tf;
- /* XXX: coming soon... */
- return (ENOSYS);
+ tf = td->td_frame;
+ tf->srr1 &= ~PSL_SE;
+
+ return (0);
}
/*
OpenPOWER on IntegriCloud