Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2018 09:51:31 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Jan Mazur <dingorth@gmail.com>
Cc:        "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject:   Re: What is the purpose of MipsEmulateBranch function?
Message-ID:  <CANCZdfqYwKxWfOaSrZGuWqxoD6-XaCKG1%2BeK4qBnhEXpfngoNw@mail.gmail.com>
In-Reply-To: <CADGEm4doaap9T-pJ8HBAT_=ZVgNhuo=Lqu3Vunc6E8%2BRJTPu8A@mail.gmail.com>
References:  <CADGEm4doaap9T-pJ8HBAT_=ZVgNhuo=Lqu3Vunc6E8%2BRJTPu8A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 26, 2018 at 4:01 AM, Jan Mazur <dingorth@gmail.com> wrote:

> Hi
>
> I'm wondering why FreeBSD has to simulate branches when the faulting
> instruction is in the branch delay slot.
> I'm curious about MipsEmulateBranch function, which is defined in
> http://bxr.su/FreeBSD/sys/mips/mips/trap.c#MipsEmulateBranch
>
> Why can't you just restart execution from the branch instruction?
>

You can't restart a branch in the delay slot, so you have to emulate the
branch. It's used in various places to adjust the return PC of the trap
frame data when an instruction in the delay slot causes a fault.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqYwKxWfOaSrZGuWqxoD6-XaCKG1%2BeK4qBnhEXpfngoNw>