From d74cd05c88b5c2a88857cf558297d8d8b0a1f771 Mon Sep 17 00:00:00 2001 From: mycroft Date: Thu, 6 Jan 1994 23:55:17 +0000 Subject: [PATCH] Implement procfs stubs. --- sys/arch/hp300/hp300/procfs_machdep.c | 80 +++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sys/arch/hp300/hp300/procfs_machdep.c diff --git a/sys/arch/hp300/hp300/procfs_machdep.c b/sys/arch/hp300/hp300/procfs_machdep.c new file mode 100644 index 000000000000..4800f23f3ac0 --- /dev/null +++ b/sys/arch/hp300/hp300/procfs_machdep.c @@ -0,0 +1,80 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern char kstack[]; /* XXX */ + +int +procfs_sstep(p) + struct proc *p; +{ + struct frame *frame; + + if ((p->p_flag & SLOAD) == 0) + return EIO; + + frame = (struct frame *) + ((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack)); + + frame->f_sr |= PSL_T; + + return 0; +} + +int +procfs_fix_sstep(p) + struct proc *p; +{ + + return 0; +} + +int +procfs_read_regs(p, regs) + struct proc *p; + struct reg *regs; +{ + struct frame *frame; + + if ((p->p_flag & SLOAD) == 0) + return EIO; + + frame = (struct frame *) + ((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack)); + + bcopy(frame->f_regs, regs->r_regs, sizeof(frame->f_regs)); + regs->r_sr = frame->f_sr; + regs->r_pc = frame->f_pc; + + return 0; +} + +int +procfs_write_regs(p, regs) + struct proc *p; + struct reg *regs; +{ + struct frame *frame; + + if ((p->p_flag & SLOAD) == 0) + return EIO; + + frame = (struct frame *) + ((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack)); + + if ((regs->r_sr & PSL_USERCLR) != 0 || + (regs->r_sr & PSL_USERSET) != PSL_USERSET) + return EPERM; + + bcopy(regs->r_regs, frame->f_regs, sizeof(frame->f_regs)); + frame->f_sr = regs->r_sr; + frame->f_pc = regs->r_pc; + + return 0; +}