[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 27/32] s390x/tcg: Provide probe_write helper
From: |
David Hildenbrand |
Subject: |
Re: [Qemu-devel] [PATCH v2 27/32] s390x/tcg: Provide probe_write helper |
Date: |
Mon, 4 Mar 2019 09:59:41 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 01.03.19 18:54, Richard Henderson wrote:
> On 3/1/19 3:54 AM, David Hildenbrand wrote:
>> Instead of checking e.g. the first access on every touched page, we should
>> check the actual access, otherwise we might get false positives when Low
>> Address Protection (LAP) is active. As probe_write() can only deal with
>> accesses to one page, we have to loop.
>>
>> Use i64 for the length, although not needed - easier to reuse
>> TCG temps we already have in the translation functions where this will
>> be used. Also allow it to be used from other helpers.
>>
>> Signed-off-by: David Hildenbrand <address@hidden>
>> ---
>> target/s390x/helper.h | 1 +
>> target/s390x/internal.h | 2 ++
>> target/s390x/mem_helper.c | 21 +++++++++++++++++++++
>> 3 files changed, 24 insertions(+)
>>
>> diff --git a/target/s390x/helper.h b/target/s390x/helper.h
>> index 577edb384f..e2710f4fb3 100644
>> --- a/target/s390x/helper.h
>> +++ b/target/s390x/helper.h
>> @@ -123,6 +123,7 @@ DEF_HELPER_4(cu42, i32, env, i32, i32, i32)
>> DEF_HELPER_5(msa, i32, env, i32, i32, i32, i32)
>> DEF_HELPER_FLAGS_1(stpt, TCG_CALL_NO_RWG, i64, env)
>> DEF_HELPER_FLAGS_1(stck, TCG_CALL_NO_RWG_SE, i64, env)
>> +DEF_HELPER_FLAGS_3(probe_write_access, TCG_CALL_NO_WG, void, env, i64, i64)
>>
>> /* === Vector Support Instructions === */
>> DEF_HELPER_FLAGS_4(vll, TCG_CALL_NO_WG, void, env, ptr, i64, i64)
>> diff --git a/target/s390x/internal.h b/target/s390x/internal.h
>> index 7baf0e2404..848d6c36d0 100644
>> --- a/target/s390x/internal.h
>> +++ b/target/s390x/internal.h
>> @@ -386,6 +386,8 @@ void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1,
>> uintptr_t ra);
>>
>> /* mem_helper.c */
>> target_ulong mmu_real2abs(CPUS390XState *env, target_ulong raddr);
>> +void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len,
>> + uintptr_t ra);
>>
>>
>> /* mmu_helper.c */
>> diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
>> index a506d9ef99..efd5256ebf 100644
>> --- a/target/s390x/mem_helper.c
>> +++ b/target/s390x/mem_helper.c
>> @@ -2623,3 +2623,24 @@ uint32_t HELPER(cu42)(CPUS390XState *env, uint32_t
>> r1, uint32_t r2, uint32_t m3)
>> return convert_unicode(env, r1, r2, m3, GETPC(),
>> decode_utf32, encode_utf16);
>> }
>> +
>> +void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len,
>> + uintptr_t ra)
>> +{
>> +#ifndef CONFIG_USER_ONLY
>> + /* test the actual access, not just any access to the page due to LAP */
>> + while (len) {
>> + uint64_t curlen = MIN(TARGET_PAGE_SIZE - (addr % TARGET_PAGE_SIZE),
>> + len);
>
> pagelen = -(addr | TARGET_PAGE_MASK);
BTW, I think you meant "pagelen = -(addr | -TARGET_PAGE_MASK);" if I am
not mistaking
--
Thanks,
David / dhildenb
- Re: [Qemu-devel] [PATCH v2 22/32] s390x/tcg: Implement VECTOR REPLICATE, (continued)
- [Qemu-devel] [PATCH v2 23/32] s390x/tcg: Implement VECTOR REPLICATE IMMEDIATE, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 24/32] s390x/tcg: Implement VECTOR SCATTER ELEMENT, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 25/32] s390x/tcg: Implement VECTOR SELECT, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 26/32] s390x/tcg: Implement VECTOR SIGN EXTEND TO DOUBLEWORD, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 27/32] s390x/tcg: Provide probe_write helper, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 28/32] s390x/tcg: Implement VECTOR STORE, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 29/32] s390x/tcg: Implement VECTOR STORE ELEMENT, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 30/32] s390x/tcg: Implement VECTOR STORE MULTIPLE, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 31/32] s390x/tcg: Implement VECTOR STORE WITH LENGTH, David Hildenbrand, 2019/03/01
- [Qemu-devel] [PATCH v2 32/32] s390x/tcg: Implement VECTOR UNPACK *, David Hildenbrand, 2019/03/01
- Re: [Qemu-devel] [PATCH v2 00/32] s390x/tcg: Vector Instruction Support Part 1, no-reply, 2019/03/01
- Re: [Qemu-devel] [PATCH v2 00/32] s390x/tcg: Vector Instruction Support Part 1, no-reply, 2019/03/01
- Re: [Qemu-devel] [PATCH v2 00/32] s390x/tcg: Vector Instruction Support Part 1, no-reply, 2019/03/01
- Re: [Qemu-devel] [PATCH v2 00/32] s390x/tcg: Vector Instruction Support Part 1, no-reply, 2019/03/01
- Re: [Qemu-devel] [PATCH v2 00/32] s390x/tcg: Vector Instruction Support Part 1, no-reply, 2019/03/01