Patch "MIPS: unaligned: Fix regular load/store instruction emulation for EVA" has been added to the 4.0-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
MIPS: unaligned: Fix regular load/store instruction emulation for EVA
to the 4.0-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mips-unaligned-fix-regular-load-store-instruction-emulation-for-eva.patch
and it can be found in the queue-4.0 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
6eae35485b26f9e51ab896eb8a936bed9908fdf6Mon Sep 17 00:00:00 2001
From: Markos Chandras <[email protected]>
Date: Mon, 9 Mar 2015 14:54:52 +0000
Subject: MIPS: unaligned: Fix regular load/store instruction emulation for EVA
From: Markos Chandras <[email protected]>
commit 6eae35485b26f9e51ab896eb8a936bed9908fdf6 upstream.
When emulating a regular lh/lw/lhu/sh/sw we need to use the appropriate instruction if we are in EVA mode. This is necessary for userspace applications which trigger alignment exceptions. In such case, the userspace load/store instruction needs to be emulated with the correct eva/non-eva instruction by the kernel emulator.
Patchwork: https://patchwork.linux-mips.org/patch/9503/
--- arch/mips/kernel/unaligned.c | 52 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-)
arch/mips/kernel/unaligned.c +47 -5
@@ -1023,7 +1023,15 @@ static void emulate_load_store_insn(struif (!access_ok (VERIFY_READ , addr,2 )) goto sigbus; -LoadHW (addr, value, res); +if (config_enabled (CONFIG_EVA )) { +if (segment_eq (get_fs (),get_ds ())) +LoadHW (addr, value, res); +else +LoadHWE (addr, value, res); + }else { +LoadHW (addr, value, res); + } +if (res) goto fault;compute_return_epc (regs);
@@ -1034,7 +1042,15 @@ static void emulate_load_store_insn(struif (!access_ok (VERIFY_READ , addr,4 )) goto sigbus; -LoadW (addr, value, res); +if (config_enabled (CONFIG_EVA )) { +if (segment_eq (get_fs (),get_ds ())) +LoadW (addr, value, res); +else +LoadWE (addr, value, res); + }else { +LoadW (addr, value, res); + } +if (res) goto fault;compute_return_epc (regs);
@@ -1045,7 +1061,15 @@ static void emulate_load_store_insn(struif (!access_ok (VERIFY_READ , addr,2 )) goto sigbus; -LoadHWU (addr, value, res); +if (config_enabled (CONFIG_EVA )) { +if (segment_eq (get_fs (),get_ds ())) +LoadHWU (addr, value, res); +else +LoadHWUE (addr, value, res); + }else { +LoadHWU (addr, value, res); + } +if (res) goto fault;compute_return_epc (regs);
@@ -1104,7 +1128,16 @@ static void emulate_load_store_insn(strucompute_return_epc (regs); value = regs->regs[insn.i_format.rt]; -StoreHW (addr, value, res); + +if (config_enabled (CONFIG_EVA )) { +if (segment_eq (get_fs (),get_ds ())) +StoreHW (addr, value, res); +else +StoreHWE (addr, value, res); + }else { +StoreHW (addr, value, res); + } +if (res) goto fault;break ;
@@ -1115,7 +1148,16 @@ static void emulate_load_store_insn(strucompute_return_epc (regs); value = regs->regs[insn.i_format.rt]; -StoreW (addr, value, res); + +if (config_enabled (CONFIG_EVA )) { +if (segment_eq (get_fs (),get_ds ())) +StoreW (addr, value, res); +else +StoreWE (addr, value, res); + }else { +StoreW (addr, value, res); + } +if (res) goto fault;break ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.0/mips-unaligned-fix-regular-load-store-instruction-emulation-for-eva.patch queue-4.0/mips-unaligned-prevent-eva-instructions-on-kernel-unaligned-accesses.patch queue-4.0/mips-malta-detect-and-fix-bad-memsize-values.patch queue-4.0/mips-unaligned-surround-load-store-macros-in-do-while-statements.patch queue-4.0/mips-asm-asm-eva-introduce-kernel-load-store-variants.patch