EMULATEBRANCH(3-BSD)RISC/os Reference ManualMULATEBRANCH(3-BSD)
NAME
emulate_branch - MIPS branch emulation
SYNOPSIS
#include <signal.h>
emulatebranch(scp, branchinstruction)
struct sigcontext *scp;
unsigned long branchinstruction;
executebranch(branchinstruction)
unsigned long branchinstruction;
DESCRIPTION
emulatebranch is passed a signal context structure and a
branch instruction. It emulates the branch based on the
register values in the signal context structure. It modi-
fies the value of the program counter in the signal context
structure (sc_pc) to the target of the branch instruction.
The program counter must initially be pointing at the branch
and the register values must be those at the time of the
branch. If the branch is not taken the program counter is
advanced to point to the instruction after the delay slot
(sc_pc += 8).
In the case the branch instruction is a branch on coproces-
sor 2 or 3 instruction, emulatebranch calls execute_branch
to execute the branch in data space to determine if it is
taken or not.
RETURN VALUE
emulatebranch returns a 0 if the branch was emulated suc-
cessfully. An non-zero value indicates the value passed as
a branch instruction was not a branch instruction.
execute_branch returns non-zero on taken branches and zero
on non-taken branches.
ALSO SEE
sigvec(2), cacheflush(3)
ERRORS
Since execute_branch in only intended to be used by
emulatebranch it does not check it's parameter to see if in
fact it is a branch instruction. It is really a stop gap in
case a coprocessor is added without the kernel fully sup-
porting it (which is unlikely).
Printed 1/15/91 Page 1