1 /* $NetBSD: process_machdep.c,v 1.1 2002/06/05 01:04:20 fredette Exp $ */ 2 3 /* $OpenBSD: process_machdep.c,v 1.3 1999/06/18 05:19:52 mickey Exp $ */ 4 5 /* 6 * Copyright (c) 1999 Michael Shalayeff 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by Michael Shalayeff. 20 * 4. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 36 #include <sys/param.h> 37 #include <sys/systm.h> 38 #include <sys/proc.h> 39 #include <sys/ptrace.h> 40 #include <sys/user.h> 41 42 int 43 process_read_regs(p, regs) 44 struct proc *p; 45 struct reg *regs; 46 { 47 bcopy (p->p_md.md_regs, regs, sizeof(*regs)); 48 regs->r_regs[0] = 0; 49 return 0; 50 } 51 52 int 53 process_write_regs(p, regs) 54 struct proc *p; 55 struct reg *regs; 56 { 57 bcopy (®s[1], &p->p_md.md_regs->tf_r1, sizeof(*regs) - sizeof(*regs)); 58 return 0; 59 } 60 61 int 62 process_read_fpregs(p, fpregs) 63 struct proc *p; 64 struct fpreg *fpregs; 65 { 66 bcopy (p->p_addr->u_pcb.pcb_fpregs, fpregs, sizeof(*fpregs)); 67 return 0; 68 } 69 70 int 71 process_write_fpregs(p, fpregs) 72 struct proc *p; 73 struct fpreg *fpregs; 74 { 75 bcopy (fpregs, p->p_addr->u_pcb.pcb_fpregs, sizeof(*fpregs)); 76 return 0; 77 } 78 79 int 80 process_sstep(p, sstep) 81 struct proc *p; 82 int sstep; 83 { 84 /* TODO */ 85 return EINVAL; 86 } 87 88 int 89 process_set_pc(p, addr) 90 struct proc *p; 91 caddr_t addr; 92 { 93 if (!USERMODE(addr)) /* XXX */ 94 return EINVAL; 95 p->p_md.md_regs->tf_iioq_head = (register_t)addr; 96 return 0; 97 } 98 99