From 4b910401981cf78dae2615ce0ad234ec3e6ad255 Mon Sep 17 00:00:00 2001 From: Michael Shalayeff Date: Fri, 15 Mar 2002 19:02:55 +0000 Subject: regs get/set for pmdb --- sys/arch/hppa/hppa/process_machdep.c | 81 ++++++++++++++++++++++++++++++++---- sys/arch/hppa/include/reg.h | 7 ++-- 2 files changed, 78 insertions(+), 10 deletions(-) (limited to 'sys') diff --git a/sys/arch/hppa/hppa/process_machdep.c b/sys/arch/hppa/hppa/process_machdep.c index 324f5fec427..6edd17662f0 100644 --- a/sys/arch/hppa/hppa/process_machdep.c +++ b/sys/arch/hppa/hppa/process_machdep.c @@ -1,7 +1,7 @@ -/* $OpenBSD: process_machdep.c,v 1.4 2002/03/14 00:42:24 miod Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.5 2002/03/15 19:02:54 mickey Exp $ */ /* - * Copyright (c) 1999 Michael Shalayeff + * Copyright (c) 1999-2002 Michael Shalayeff * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -23,8 +23,8 @@ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF MIND, + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -42,8 +42,41 @@ process_read_regs(p, regs) struct proc *p; struct reg *regs; { - bcopy (p->p_md.md_regs, regs, sizeof(*regs)); - regs->r_regs[0] = 0; + regs->r_regs[ 0] = p->p_md.md_regs->tf_sar; + regs->r_regs[ 1] = p->p_md.md_regs->tf_r1; + regs->r_regs[ 2] = p->p_md.md_regs->tf_rp; + regs->r_regs[ 3] = p->p_md.md_regs->tf_r3; + regs->r_regs[ 4] = p->p_md.md_regs->tf_r4; + regs->r_regs[ 5] = p->p_md.md_regs->tf_r5; + regs->r_regs[ 6] = p->p_md.md_regs->tf_r6; + regs->r_regs[ 7] = p->p_md.md_regs->tf_r7; + regs->r_regs[ 8] = p->p_md.md_regs->tf_r8; + regs->r_regs[ 9] = p->p_md.md_regs->tf_r9; + regs->r_regs[10] = p->p_md.md_regs->tf_r10; + regs->r_regs[11] = p->p_md.md_regs->tf_r11; + regs->r_regs[12] = p->p_md.md_regs->tf_r12; + regs->r_regs[13] = p->p_md.md_regs->tf_r13; + regs->r_regs[14] = p->p_md.md_regs->tf_r14; + regs->r_regs[15] = p->p_md.md_regs->tf_r15; + regs->r_regs[16] = p->p_md.md_regs->tf_r16; + regs->r_regs[17] = p->p_md.md_regs->tf_r17; + regs->r_regs[18] = p->p_md.md_regs->tf_r18; + regs->r_regs[19] = p->p_md.md_regs->tf_t4; + regs->r_regs[20] = p->p_md.md_regs->tf_t3; + regs->r_regs[21] = p->p_md.md_regs->tf_t2; + regs->r_regs[22] = p->p_md.md_regs->tf_t1; + regs->r_regs[23] = p->p_md.md_regs->tf_arg3; + regs->r_regs[24] = p->p_md.md_regs->tf_arg2; + regs->r_regs[25] = p->p_md.md_regs->tf_arg1; + regs->r_regs[26] = p->p_md.md_regs->tf_arg0; + regs->r_regs[27] = p->p_md.md_regs->tf_dp; + regs->r_regs[28] = p->p_md.md_regs->tf_ret0; + regs->r_regs[29] = p->p_md.md_regs->tf_ret1; + regs->r_regs[30] = p->p_md.md_regs->tf_sp; + regs->r_regs[31] = p->p_md.md_regs->tf_r31; + regs->r_pc = p->p_md.md_regs->tf_iioq_head; + regs->r_npc = p->p_md.md_regs->tf_iioq_tail; + return 0; } @@ -63,7 +96,41 @@ process_write_regs(p, regs) struct proc *p; struct reg *regs; { - bcopy (®s[1], &p->p_md.md_regs->tf_r1, sizeof(*regs) - sizeof(*regs)); + p->p_md.md_regs->tf_sar = regs->r_regs[ 0]; + p->p_md.md_regs->tf_r1 = regs->r_regs[ 1]; + p->p_md.md_regs->tf_rp = regs->r_regs[ 2]; + p->p_md.md_regs->tf_r3 = regs->r_regs[ 3]; + p->p_md.md_regs->tf_r4 = regs->r_regs[ 4]; + p->p_md.md_regs->tf_r5 = regs->r_regs[ 5]; + p->p_md.md_regs->tf_r6 = regs->r_regs[ 6]; + p->p_md.md_regs->tf_r7 = regs->r_regs[ 7]; + p->p_md.md_regs->tf_r8 = regs->r_regs[ 8]; + p->p_md.md_regs->tf_r9 = regs->r_regs[ 9]; + p->p_md.md_regs->tf_r10 = regs->r_regs[10]; + p->p_md.md_regs->tf_r11 = regs->r_regs[11]; + p->p_md.md_regs->tf_r12 = regs->r_regs[12]; + p->p_md.md_regs->tf_r13 = regs->r_regs[13]; + p->p_md.md_regs->tf_r14 = regs->r_regs[14]; + p->p_md.md_regs->tf_r15 = regs->r_regs[15]; + p->p_md.md_regs->tf_r16 = regs->r_regs[16]; + p->p_md.md_regs->tf_r17 = regs->r_regs[17]; + p->p_md.md_regs->tf_r18 = regs->r_regs[18]; + p->p_md.md_regs->tf_t4 = regs->r_regs[19]; + p->p_md.md_regs->tf_t3 = regs->r_regs[20]; + p->p_md.md_regs->tf_t2 = regs->r_regs[21]; + p->p_md.md_regs->tf_t1 = regs->r_regs[22]; + p->p_md.md_regs->tf_arg3 = regs->r_regs[23]; + p->p_md.md_regs->tf_arg2 = regs->r_regs[24]; + p->p_md.md_regs->tf_arg1 = regs->r_regs[25]; + p->p_md.md_regs->tf_arg0 = regs->r_regs[26]; + p->p_md.md_regs->tf_dp = regs->r_regs[27]; + p->p_md.md_regs->tf_ret0 = regs->r_regs[28]; + p->p_md.md_regs->tf_ret1 = regs->r_regs[29]; + p->p_md.md_regs->tf_sp = regs->r_regs[30]; + p->p_md.md_regs->tf_r31 = regs->r_regs[31]; + p->p_md.md_regs->tf_iioq_head = regs->r_pc; + p->p_md.md_regs->tf_iioq_tail = regs->r_npc; + return 0; } diff --git a/sys/arch/hppa/include/reg.h b/sys/arch/hppa/include/reg.h index cfc4e2fe27d..fb5774ebc9b 100644 --- a/sys/arch/hppa/include/reg.h +++ b/sys/arch/hppa/include/reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reg.h,v 1.7 2000/06/15 17:00:37 mickey Exp $ */ +/* $OpenBSD: reg.h,v 1.8 2002/03/15 19:02:54 mickey Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -167,8 +167,9 @@ #ifndef _LOCORE struct reg { - u_int32_t r_regs[HPPA_NREGS]; - /* p'bably some cr* ? */ + u_int32_t r_regs[HPPA_NREGS]; /* r0 is sar */ + u_int32_t r_pc; + u_int32_t r_npc; }; struct fpreg { -- cgit v1.2.3