All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, laurent@vivier.eu, riku.voipio@iki.fi,
	philippe.mathieu.daude@gmail.com, aurelien@aurel32.net,
	richard.henderson@linaro.org, amarkovic@wavecomp.com,
	smarkovic@wavecomp.com, pjovanovic@wavecomp.com,
	pburton@wavecomp.com
Subject: [Qemu-devel] [PATCH v8 13/87] target/mips: Check ELPA flag only in some cases of MFHC0 and MTHC0
Date: Mon, 13 Aug 2018 19:52:38 +0200	[thread overview]
Message-ID: <1534182832-554-14-git-send-email-aleksandar.markovic@rt-rk.com> (raw)
In-Reply-To: <1534182832-554-1-git-send-email-aleksandar.markovic@rt-rk.com>

From: Yongbok Kim <yongbok.kim@mips.com>

MFHC0 and MTHC0 used to handle EntryLo0 and EntryLo1 registers only,
and placing ELPA flag checks before switch statement were technically
correct. However, after adding handling more registers, these checks
should be moved to act only in cases of handling EntryLo0 and
EntryLo1.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
---
 target/mips/translate.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/mips/translate.c b/target/mips/translate.c
index 219de72..6740764 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -4938,12 +4938,11 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
 {
     const char *rn = "invalid";
 
-    CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
-
     switch (reg) {
     case 2:
         switch (sel) {
         case 0:
+            CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
             gen_mfhc0_entrylo(arg, offsetof(CPUMIPSState, CP0_EntryLo0));
             rn = "EntryLo0";
             break;
@@ -4954,6 +4953,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
     case 3:
         switch (sel) {
         case 0:
+            CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
             gen_mfhc0_entrylo(arg, offsetof(CPUMIPSState, CP0_EntryLo1));
             rn = "EntryLo1";
             break;
@@ -5006,12 +5006,11 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
     const char *rn = "invalid";
     uint64_t mask = ctx->PAMask >> 36;
 
-    CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
-
     switch (reg) {
     case 2:
         switch (sel) {
         case 0:
+            CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
             tcg_gen_andi_tl(arg, arg, mask);
             gen_mthc0_entrylo(arg, offsetof(CPUMIPSState, CP0_EntryLo0));
             rn = "EntryLo0";
@@ -5023,6 +5022,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
     case 3:
         switch (sel) {
         case 0:
+            CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
             tcg_gen_andi_tl(arg, arg, mask);
             gen_mthc0_entrylo(arg, offsetof(CPUMIPSState, CP0_EntryLo1));
             rn = "EntryLo1";
-- 
2.7.4

  parent reply	other threads:[~2018-08-13 17:54 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 17:52 [Qemu-devel] [PATCH v8 00/87] Add nanoMIPS support to QEMU Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 01/87] MAINTAINERS: Update target/mips maintainer's email addresses Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 02/87] target/mips: Avoid case statements formulated by ranges - part 1 Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 03/87] target/mips: Avoid case statements formulated by ranges - part 2 Aleksandar Markovic
2018-08-14 11:13   ` Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 04/87] target/mips: Mark switch fallthroughs with interpretable comments Aleksandar Markovic
2019-07-07 20:26   ` [Qemu-devel] Handling of fall through code (was: " Stefan Weil
2019-07-08  4:40     ` Markus Armbruster
2019-07-08  4:52       ` [Qemu-devel] Handling of fall through code Stefan Weil
2019-07-09  5:40         ` Markus Armbruster
2019-07-08  8:14     ` [Qemu-devel] Handling of fall through code (was: [PATCH v8 04/87] target/mips: Mark switch fallthroughs with interpretable comments Aleksandar Markovic
2019-07-08 12:04       ` Stefan Weil
2019-07-08 12:08         ` Daniel P. Berrangé
2019-07-08 19:39         ` Aleksandar Markovic
2019-07-09  8:25           ` Peter Maydell
2019-07-21 16:39             ` [Qemu-devel] Handling of fall through code Stefan Weil
2019-07-22  9:09               ` Peter Maydell
2019-07-08  8:42     ` [Qemu-devel] Handling of fall through code (was: [PATCH v8 04/87] target/mips: Mark switch fallthroughs with interpretable comments Peter Maydell
2019-07-09  5:42       ` Markus Armbruster
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 05/87] target/mips: Fix two instances of shadow variables Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 06/87] target/mips: Update some CP0 registers bit definitions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 07/87] target/mips: Add CP0 BadInstrX register Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 08/87] target/mips: Add support for availability control via bit XNP Aleksandar Markovic
2018-08-14 12:23   ` Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 09/87] target/mips: Add support for availability control via bit MT Aleksandar Markovic
2018-08-13 18:13   ` Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 10/87] target/mips: Fix MT ASE instructions' availability control Aleksandar Markovic
2018-08-13 18:23   ` Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 11/87] target/mips: Implement CP0 Config1.WR bit functionality Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 12/87] target/mips: Don't update BadVAddr register in Debug Mode Aleksandar Markovic
2018-08-13 17:52 ` Aleksandar Markovic [this message]
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 14/87] target/mips: Add gen_op_addr_addi() Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 15/87] elf: Remove duplicate preprocessor constant definition Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 16/87] elf: Add ELF flags for MIPS machine variants Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 17/87] linux-user: Update MIPS syscall numbers up to kernel 4.18 headers Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 18/87] linux-user: Add preprocessor availability control to some syscalls Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 19/87] qemu-doc: Amend MIPS-related items Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 20/87] target/mips: Add preprocessor constants for nanoMIPS Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 21/87] target/mips: Add nanoMIPS base instruction set opcodes Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 22/87] target/mips: Add nanoMIPS DSP ASE opcodes Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 23/87] target/mips: Add placeholder and invocation of decode_nanomips_opc() Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 24/87] target/mips: Add nanoMIPS decoding and extraction utilities Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 25/87] target/mips: Add emulation of nanoMIPS 16-bit arithmetic instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 26/87] target/mips: Add emulation of nanoMIPS 16-bit branch instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 27/87] target/mips: Add emulation of nanoMIPS 16-bit shift instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 28/87] target/mips: Add emulation of nanoMIPS 16-bit misc instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 29/87] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 30/87] target/mips: Add emulation of nanoMIPS 16-bit logic instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 31/87] target/mips: Add emulation of nanoMIPS 16-bit save and restore instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 32/87] target/mips: Add emulation of some common nanoMIPS 32-bit instructions Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 33/87] target/mips: Add emulation of nanoMIPS instructions MOVE.P and MOVE.PREV Aleksandar Markovic
2018-08-13 17:52 ` [Qemu-devel] [PATCH v8 34/87] target/mips: Add emulation of nanoMIPS 48-bit instructions Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 35/87] target/mips: Add emulation of nanoMIPS FP instructions Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 36/87] target/mips: Add emulation of misc nanoMIPS instructions (pool32a0) Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 37/87] target/mips: Add emulation of misc nanoMIPS instructions (pool32axf) Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 38/87] target/mips: Add emulation of misc nanoMIPS instructions (p_lsx) Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 39/87] target/mips: Implement emulation of nanoMIPS ROTX instruction Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 40/87] target/mips: Implement emulation of nanoMIPS EXTW instruction Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 41/87] target/mips: Add emulation of nanoMIPS 32-bit load and store instructions Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 42/87] target/mips: Implement emulation of nanoMIPS LLWP/SCWP pair Aleksandar Markovic
2018-08-14 12:20   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 43/87] target/mips: Add emulation of nanoMIPS 32-bit branch instructions Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 44/87] target/mips: Implement MT ASE support for nanoMIPS Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 45/87] target/mips: Add emulation of DSP ASE for nanoMIPS - part 1 Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 46/87] target/mips: Add emulation of DSP ASE for nanoMIPS - part 2 Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 47/87] target/mips: Add emulation of DSP ASE for nanoMIPS - part 3 Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 48/87] target/mips: Add emulation of DSP ASE for nanoMIPS - part 4 Aleksandar Markovic
2018-08-16 12:31   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 49/87] target/mips: Add emulation of DSP ASE for nanoMIPS - part 5 Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 50/87] target/mips: Add emulation of DSP ASE for nanoMIPS - part 6 Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 51/87] disas: Add support for microMIPS and nanoMIPS Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 52/87] target/mips: Add handling of branch delay slots for nanoMIPS Aleksandar Markovic
2018-08-16 13:01   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 53/87] target/mips: Add updating BadInstr, BadInstrP, BadInstrX " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 54/87] target/mips: Adjust exception_resume_pc() " Aleksandar Markovic
2018-08-16 12:56   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 55/87] target/mips: Adjust set_hflags_for_handler() " Aleksandar Markovic
2018-08-16 12:05   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 56/87] target/mips: Adjust set_pc() " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 57/87] target/mips: Fix ERET/ERETNC behavior related to ADEL exception Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 58/87] elf: Add EM_NANOMIPS value as a valid one for e_machine field Aleksandar Markovic
2018-08-16 12:55   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 59/87] elf: Relax MIPS' elf_check_arch() to accept EM_NANOMIPS too Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 60/87] elf: Don't check FCR31_NAN2008 bit for nanoMIPS Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 61/87] elf: On elf loading, treat both EM_MIPS and EM_NANOMIPS as legal for MIPS Aleksandar Markovic
2018-08-16 12:28   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 62/87] mips_malta: Add basic nanoMIPS boot code for Malta board Aleksandar Markovic
2018-08-16 11:59   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 63/87] mips_malta: Add setting up GT64120 BARs to the nanoMIPS bootloader Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 64/87] mips_malta: Fix semihosting argument passing for nanoMIPS bare metal Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 65/87] target/mips: Add definition of nanoMIPS I7200 CPU Aleksandar Markovic
2018-08-16 12:26   ` Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 66/87] elf: Add nanoMIPS specific variations in ELF header fields Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 67/87] linux-user: Add syscall numbers for nanoMIPS Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 68/87] linux-user: Add target_signal.h header " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 69/87] linux-user: Add termbits.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 70/87] linux-user: Update syscall_defs.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 71/87] linux-user: Add target_fcntl.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 72/87] linux-user: Add sockbits.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 73/87] linux-user: Add target_syscall.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 74/87] linux-user: Add target_cpu.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 75/87] linux-user: Add target_structs.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 76/87] linux-user: Add target_elf.h " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 77/87] linux-user: Add signal.c " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 78/87] linux-user: Add support for nanoMIPS signal trampoline Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 79/87] linux-user: Add cpu_loop.c for nanoMIPS Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 80/87] linux-user: Amend support for sigaction() syscall " Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 81/87] linux-user: Add support for statx() syscall for all platforms Aleksandar Markovic
2018-08-20  7:48   ` Timothy Baldwin
2018-08-20  9:45     ` Aleksandar Markovic
2018-08-29 15:38       ` Timothy Baldwin
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 82/87] linux-user: Add support for nanoMIPS core files Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 83/87] linux-user: Add nanoMIPS linux user mode configuration support Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 84/87] linux-user: Add nanoMIPS support in scripts/qemu-binfmt-conf.sh Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 85/87] gdbstub: Disable handling of nanoMIPS ISA bit in the MIPS gdbstub Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 86/87] gdbstub: Add XML support for GDB for nanoMIPS Aleksandar Markovic
2018-08-13 17:53 ` [Qemu-devel] [PATCH v8 87/87] qemu-doc: Add nanoMIPS-related items Aleksandar Markovic
2018-08-14 15:52 ` [Qemu-devel] [PATCH v8 00/87] Add nanoMIPS support to QEMU Aleksandar Markovic
2018-08-16  8:16 ` no-reply
2018-08-16 11:43   ` Aleksandar Markovic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1534182832-554-14-git-send-email-aleksandar.markovic@rt-rk.com \
    --to=aleksandar.markovic@rt-rk.com \
    --cc=amarkovic@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=laurent@vivier.eu \
    --cc=pburton@wavecomp.com \
    --cc=peter.maydell@linaro.org \
    --cc=philippe.mathieu.daude@gmail.com \
    --cc=pjovanovic@wavecomp.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=riku.voipio@iki.fi \
    --cc=smarkovic@wavecomp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.