diff mbox

[v1,4/6] target/s390x: move wrap_address to cpu.h

Message ID 20170721125609.11117-5-david@redhat.com
State New
Headers show

Commit Message

David Hildenbrand July 21, 2017, 12:56 p.m. UTC
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/cpu.h        | 14 ++++++++++++++
 target/s390x/mem_helper.c | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)

Comments

Richard Henderson July 24, 2017, 4:40 a.m. UTC | #1
On 07/21/2017 05:56 AM, David Hildenbrand wrote:
> Signed-off-by: David Hildenbrand<david@redhat.com>
> ---
>   target/s390x/cpu.h        | 14 ++++++++++++++
>   target/s390x/mem_helper.c | 14 --------------
>   2 files changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>

Although another header, private to the helpers, might be better...


r~
David Hildenbrand July 24, 2017, 5:38 p.m. UTC | #2
On 24.07.2017 06:40, Richard Henderson wrote:
> On 07/21/2017 05:56 AM, David Hildenbrand wrote:
>> Signed-off-by: David Hildenbrand<david@redhat.com>
>> ---
>>   target/s390x/cpu.h        | 14 ++++++++++++++
>>   target/s390x/mem_helper.c | 14 --------------
>>   2 files changed, 14 insertions(+), 14 deletions(-)
> 
> Reviewed-by: Richard Henderson <rth@twiddle.net>
> 
> Although another header, private to the helpers, might be better...
> 

Question is if we should have a new header for stuff really only used
locally in target/s390x - in contrast to say cpu.h, which is included
from various other places. So not only a header for helpers, but also
used for e.g. kvm.c.

This header could e.g. be called cpu_helper.h and would not included in
cpu.h

Opinions?
Richard Henderson July 24, 2017, 6 p.m. UTC | #3
On 07/24/2017 10:38 AM, David Hildenbrand wrote:
> On 24.07.2017 06:40, Richard Henderson wrote:
>> On 07/21/2017 05:56 AM, David Hildenbrand wrote:
>>> Signed-off-by: David Hildenbrand<david@redhat.com>
>>> ---
>>>    target/s390x/cpu.h        | 14 ++++++++++++++
>>>    target/s390x/mem_helper.c | 14 --------------
>>>    2 files changed, 14 insertions(+), 14 deletions(-)
>>
>> Reviewed-by: Richard Henderson <rth@twiddle.net>
>>
>> Although another header, private to the helpers, might be better...
>>
> 
> Question is if we should have a new header for stuff really only used
> locally in target/s390x - in contrast to say cpu.h, which is included
> from various other places. So not only a header for helpers, but also
> used for e.g. kvm.c.
> 
> This header could e.g. be called cpu_helper.h and would not included in
> cpu.h

C.f. target/arm/internals.h, which is a bit better as a name, I think.
Perhaps something to wait for 2.11 tree though, and we'll do it proper.


r~
David Hildenbrand July 24, 2017, 6 p.m. UTC | #4
On 24.07.2017 20:00, Richard Henderson wrote:
> On 07/24/2017 10:38 AM, David Hildenbrand wrote:
>> On 24.07.2017 06:40, Richard Henderson wrote:
>>> On 07/21/2017 05:56 AM, David Hildenbrand wrote:
>>>> Signed-off-by: David Hildenbrand<david@redhat.com>
>>>> ---
>>>>    target/s390x/cpu.h        | 14 ++++++++++++++
>>>>    target/s390x/mem_helper.c | 14 --------------
>>>>    2 files changed, 14 insertions(+), 14 deletions(-)
>>>
>>> Reviewed-by: Richard Henderson <rth@twiddle.net>
>>>
>>> Although another header, private to the helpers, might be better...
>>>
>>
>> Question is if we should have a new header for stuff really only used
>> locally in target/s390x - in contrast to say cpu.h, which is included
>> from various other places. So not only a header for helpers, but also
>> used for e.g. kvm.c.
>>
>> This header could e.g. be called cpu_helper.h and would not included in
>> cpu.h
> 
> C.f. target/arm/internals.h, which is a bit better as a name, I think.
> Perhaps something to wait for 2.11 tree though, and we'll do it proper.
> 
> 
> r~
> 

Sounds good to me.
diff mbox

Patch

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 4f7c6b7..13df41c 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -409,6 +409,20 @@  static inline uint64_t cpu_mmu_idx_to_asc(int mmu_idx)
     }
 }
 
+static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a)
+{
+    if (!(env->psw.mask & PSW_MASK_64)) {
+        if (!(env->psw.mask & PSW_MASK_32)) {
+            /* 24-Bit mode */
+            a &= 0x00ffffff;
+        } else {
+            /* 31-Bit mode */
+            a &= 0x7fffffff;
+        }
+    }
+    return a;
+}
+
 static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *pc,
                                         target_ulong *cs_base, uint32_t *flags)
 {
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index cdc78aa..369d291 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -110,20 +110,6 @@  static inline void cpu_stsize_data_ra(CPUS390XState *env, uint64_t addr,
     }
 }
 
-static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a)
-{
-    if (!(env->psw.mask & PSW_MASK_64)) {
-        if (!(env->psw.mask & PSW_MASK_32)) {
-            /* 24-Bit mode */
-            a &= 0x00ffffff;
-        } else {
-            /* 31-Bit mode */
-            a &= 0x7fffffff;
-        }
-    }
-    return a;
-}
-
 static void fast_memset(CPUS390XState *env, uint64_t dest, uint8_t byte,
                         uint32_t l, uintptr_t ra)
 {