Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips Use the address of the instruction instea...



details:   https://anonhg.NetBSD.org/src/rev/cd475c89ee13
branches:  trunk
changeset: 755906:cd475c89ee13
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sun Jun 27 13:44:26 2010 +0000

description:
Use the address of the instruction instead of the contents of the
instruction to calculate a relative branch target address from that
instruction.

Not sure what the intention of this change was, or if it could possibly
have been tested.

Fixes awk on my dbau1500.

diffstat:

 sys/arch/mips/mips/mips_emul.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r 658f21c0a91b -r cd475c89ee13 sys/arch/mips/mips/mips_emul.c
--- a/sys/arch/mips/mips/mips_emul.c    Sun Jun 27 13:39:11 2010 +0000
+++ b/sys/arch/mips/mips/mips_emul.c    Sun Jun 27 13:44:26 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_emul.c,v 1.17 2009/12/14 00:46:06 matt Exp $ */
+/*     $NetBSD: mips_emul.c,v 1.18 2010/06/27 13:44:26 simonb Exp $ */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.17 2009/12/14 00:46:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.18 2010/06/27 13:44:26 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,7 +98,7 @@
 MachEmulateBranch(struct frame *f, vaddr_t instpc, unsigned fpuCSR,
     int allowNonBranch)
 {
-#define        BRANCHTARGET(i) (4 + ((i).word) + ((short)(i).IType.imm << 2))
+#define        BRANCHTARGET(p, i) (4 + (p) + ((short)(i).IType.imm << 2))
        InstFmt inst;
        vaddr_t nextpc;
 
@@ -125,7 +125,7 @@
                case OP_BLTZL:          /* squashed */
                case OP_BLTZALL:        /* squashed */
                        if ((int)(f->f_regs[inst.RType.rs]) < 0)
-                               nextpc = BRANCHTARGET(inst);
+                               nextpc = BRANCHTARGET(instpc, inst);
                        else
                                nextpc = instpc + 8;
                        break;
@@ -135,7 +135,7 @@
                case OP_BGEZL:          /* squashed */
                case OP_BGEZALL:        /* squashed */
                        if ((int)(f->f_regs[inst.RType.rs]) >= 0)
-                               nextpc = BRANCHTARGET(inst);
+                               nextpc = BRANCHTARGET(instpc, inst);
                        else
                                nextpc = instpc + 8;
                        break;
@@ -154,7 +154,7 @@
        case OP_BEQ:
        case OP_BEQL:   /* squashed */
                if (f->f_regs[inst.RType.rs] == f->f_regs[inst.RType.rt])
-                       nextpc = BRANCHTARGET(inst);
+                       nextpc = BRANCHTARGET(instpc, inst);
                else
                        nextpc = instpc + 8;
                break;
@@ -162,7 +162,7 @@
        case OP_BNE:
        case OP_BNEL:   /* squashed */
                if (f->f_regs[inst.RType.rs] != f->f_regs[inst.RType.rt])
-                       nextpc = BRANCHTARGET(inst);
+                       nextpc = BRANCHTARGET(instpc, inst);
                else
                        nextpc = instpc + 8;
                break;
@@ -170,7 +170,7 @@
        case OP_BLEZ:
        case OP_BLEZL:  /* squashed */
                if ((int)(f->f_regs[inst.RType.rs]) <= 0)
-                       nextpc = BRANCHTARGET(inst);
+                       nextpc = BRANCHTARGET(instpc, inst);
                else
                        nextpc = instpc + 8;
                break;
@@ -178,7 +178,7 @@
        case OP_BGTZ:
        case OP_BGTZL:  /* squashed */
                if ((int)(f->f_regs[inst.RType.rs]) > 0)
-                       nextpc = BRANCHTARGET(inst);
+                       nextpc = BRANCHTARGET(instpc, inst);
                else
                        nextpc = instpc + 8;
                break;
@@ -189,7 +189,7 @@
                        if ((inst.RType.rt & COPz_BC_TF_MASK) != COPz_BC_TRUE)
                                condition = !condition;
                        if (condition)
-                               nextpc = BRANCHTARGET(inst);
+                               nextpc = BRANCHTARGET(instpc, inst);
                        else
                                nextpc = instpc + 8;
                }



Home | Main Index | Thread Index | Old Index