diff mbox

[21/31] target/s390x: Use unwind data for helper_tre

Message ID 20170523030312.6360-22-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson May 23, 2017, 3:03 a.m. UTC
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target/s390x/mem_helper.c | 15 ++++++++-------
 target/s390x/translate.c  |  1 -
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Thomas Huth May 23, 2017, 10:26 a.m. UTC | #1
On 23.05.2017 05:03, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target/s390x/mem_helper.c | 15 ++++++++-------
>  target/s390x/translate.c  |  1 -
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
> index 748a6e8..4c6c6ee 100644
> --- a/target/s390x/mem_helper.c
> +++ b/target/s390x/mem_helper.c
> @@ -720,8 +720,10 @@ void HELPER(tr)(CPUS390XState *env, uint32_t len, uint64_t array,
>  uint64_t HELPER(tre)(CPUS390XState *env, uint64_t array,
>                       uint64_t len, uint64_t trans)
>  {
> +    uintptr_t ra = GETPC();
>      uint8_t end = env->regs[0] & 0xff;
>      uint64_t l = len;
> +    uint32_t cc = 0;
>      uint64_t i;
>  
>      if (!(env->psw.mask & PSW_MASK_64)) {
> @@ -733,25 +735,24 @@ uint64_t HELPER(tre)(CPUS390XState *env, uint64_t array,
>         amount of work we're willing to do.  For now, let's cap at 8k.  */
>      if (l > 0x2000) {
>          l = 0x2000;
> -        env->cc_op = 3;
> -    } else {
> -        env->cc_op = 0;
> +        cc = 3;
>      }
>  
>      for (i = 0; i < l; i++) {
>          uint8_t byte, new_byte;
>  
> -        byte = cpu_ldub_data(env, array + i);
> +        byte = cpu_ldub_data_ra(env, array + i, ra);
>  
>          if (byte == end) {
> -            env->cc_op = 1;
> +            cc = 1;
>              break;
>          }
>  
> -        new_byte = cpu_ldub_data(env, trans + byte);
> -        cpu_stb_data(env, array + i, new_byte);
> +        new_byte = cpu_ldub_data_ra(env, trans + byte, ra);
> +        cpu_stb_data_ra(env, array + i, new_byte, ra);
>      }
>  
> +    env->cc_op = cc;
>      env->retxl = len - i;
>      return array + i;
>  }

I think you should mention in the patch description that you've changed
the behavior of the CC settings here, too (it's not changed anymore in
case of exceptions).

Apart from that:

Reviewed-by: Thomas Huth <thuth@redhat.com>
Aurelien Jarno May 23, 2017, 11:02 a.m. UTC | #2
On 2017-05-22 20:03, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target/s390x/mem_helper.c | 15 ++++++++-------
>  target/s390x/translate.c  |  1 -
>  2 files changed, 8 insertions(+), 8 deletions(-)

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
diff mbox

Patch

diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 748a6e8..4c6c6ee 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -720,8 +720,10 @@  void HELPER(tr)(CPUS390XState *env, uint32_t len, uint64_t array,
 uint64_t HELPER(tre)(CPUS390XState *env, uint64_t array,
                      uint64_t len, uint64_t trans)
 {
+    uintptr_t ra = GETPC();
     uint8_t end = env->regs[0] & 0xff;
     uint64_t l = len;
+    uint32_t cc = 0;
     uint64_t i;
 
     if (!(env->psw.mask & PSW_MASK_64)) {
@@ -733,25 +735,24 @@  uint64_t HELPER(tre)(CPUS390XState *env, uint64_t array,
        amount of work we're willing to do.  For now, let's cap at 8k.  */
     if (l > 0x2000) {
         l = 0x2000;
-        env->cc_op = 3;
-    } else {
-        env->cc_op = 0;
+        cc = 3;
     }
 
     for (i = 0; i < l; i++) {
         uint8_t byte, new_byte;
 
-        byte = cpu_ldub_data(env, array + i);
+        byte = cpu_ldub_data_ra(env, array + i, ra);
 
         if (byte == end) {
-            env->cc_op = 1;
+            cc = 1;
             break;
         }
 
-        new_byte = cpu_ldub_data(env, trans + byte);
-        cpu_stb_data(env, array + i, new_byte);
+        new_byte = cpu_ldub_data_ra(env, trans + byte, ra);
+        cpu_stb_data_ra(env, array + i, new_byte, ra);
     }
 
+    env->cc_op = cc;
     env->retxl = len - i;
     return array + i;
 }
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index b506cee..ecef71c 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -4078,7 +4078,6 @@  static ExitStatus op_tr(DisasContext *s, DisasOps *o)
 
 static ExitStatus op_tre(DisasContext *s, DisasOps *o)
 {
-    potential_page_fault(s);
     gen_helper_tre(o->out, cpu_env, o->out, o->out2, o->in2);
     return_low128(o->out2);
     set_cc_static(s);