diff mbox

[v1,10/11] target/s390x: use trigger_pgm_exception() in s390_cpu_handle_mmu_fault()

Message ID 20170830170601.15855-11-david@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Hildenbrand Aug. 30, 2017, 5:06 p.m. UTC
This looks cleaner.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/excp_helper.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Thomas Huth Aug. 30, 2017, 7:11 p.m. UTC | #1
On 30.08.2017 19:06, David Hildenbrand wrote:
> This looks cleaner.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/excp_helper.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
> index 2ac36535f7..f5f5967833 100644
> --- a/target/s390x/excp_helper.c
> +++ b/target/s390x/excp_helper.c
> @@ -59,8 +59,7 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
>  {
>      S390CPU *cpu = S390_CPU(cs);
>  
> -    cs->exception_index = EXCP_PGM;
> -    cpu->env.int_pgm_code = PGM_ADDRESSING;
> +    trigger_pgm_exception(&cpu->env, PGM_ADDRESSING, ILEN_AUTO);
>      /* On real machines this value is dropped into LowMem.  Since this
>         is userland, simply put this someplace that cpu_loop can find it.  */
>      cpu->env.__excp_addr = address;

trigger_pgm_exception() additionally sets int_pgm_ilen ... I assume
that's OK here? A comment in the patch description would be helpful.

 Thomas
David Hildenbrand Aug. 31, 2017, 1:34 p.m. UTC | #2
On 30.08.2017 21:11, Thomas Huth wrote:
> On 30.08.2017 19:06, David Hildenbrand wrote:
>> This looks cleaner.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>  target/s390x/excp_helper.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
>> index 2ac36535f7..f5f5967833 100644
>> --- a/target/s390x/excp_helper.c
>> +++ b/target/s390x/excp_helper.c
>> @@ -59,8 +59,7 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
>>  {
>>      S390CPU *cpu = S390_CPU(cs);
>>  
>> -    cs->exception_index = EXCP_PGM;
>> -    cpu->env.int_pgm_code = PGM_ADDRESSING;
>> +    trigger_pgm_exception(&cpu->env, PGM_ADDRESSING, ILEN_AUTO);
>>      /* On real machines this value is dropped into LowMem.  Since this
>>         is userland, simply put this someplace that cpu_loop can find it.  */
>>      cpu->env.__excp_addr = address;
> 
> trigger_pgm_exception() additionally sets int_pgm_ilen ... I assume
> that's OK here? A comment in the patch description would be helpful.
> 

As far as I can tell, ilen is completely ignored for linux-user (see
cpu_loop() in linux-user/main.c)

Will add a comment, thanks!

>  Thomas
>
diff mbox

Patch

diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
index 2ac36535f7..f5f5967833 100644
--- a/target/s390x/excp_helper.c
+++ b/target/s390x/excp_helper.c
@@ -59,8 +59,7 @@  int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
 {
     S390CPU *cpu = S390_CPU(cs);
 
-    cs->exception_index = EXCP_PGM;
-    cpu->env.int_pgm_code = PGM_ADDRESSING;
+    trigger_pgm_exception(&cpu->env, PGM_ADDRESSING, ILEN_AUTO);
     /* On real machines this value is dropped into LowMem.  Since this
        is userland, simply put this someplace that cpu_loop can find it.  */
     cpu->env.__excp_addr = address;