qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 5/5] target/sh4: fix RTE instruction delay slot


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 5/5] target/sh4: fix RTE instruction delay slot
Date: Wed, 24 May 2017 16:11:55 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 05/16/2017 03:47 PM, Aurelien Jarno wrote:
The ReTurn from Exception (RTE) instruction loads the system register
(SR) with the saved system register (SSR). It has a delay slot, and
behaves specially according to the SH4 manual:

   The SR value accessed by the instruction in the RTE delay slot is the
   value restored from SSR by the RTE instruction. The SR and MD values
   defined prior to RTE execution are used to fetch the instruction in
   the RTE delay slot.

The instruction in the delay slot being often a NOP, it doesn't cause
any issue most of the time except in some rare cases where the NOP is
being splitted in a different TB (for example when the TCG op buffer
is full). In that case the NOP is fetched with the user permissions
and causes an instruction TLB protection violation exception.

This patches fixes that by introducing a new delay slot flag for the
RTE instruction. Given it's a privileged instruction, the RTE delay
slot instruction is always fetched in privileged mode. It is therefore
enough to to check for this flag in cpu_mmu_index.

Signed-off-by: Aurelien Jarno<address@hidden>
---
  target/sh4/cpu.h       | 13 ++++++++++---
  target/sh4/translate.c |  8 ++++++--
  2 files changed, 16 insertions(+), 5 deletions(-)

Reviewed-by: Richard Henderson <address@hidden>


r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]