All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
@ 2015-10-22 18:28 Sergey Fedorov
  2015-10-22 19:50 ` Richard Henderson
  2015-10-22 21:28 ` Peter Maydell
  0 siblings, 2 replies; 10+ messages in thread
From: Sergey Fedorov @ 2015-10-22 18:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paolo Bonzini, Peter Crosthwaite, Aurelien Jarno,
	Richard Henderson

Hi all,

I am trying to understand what the difference should be between
DISAS_JUMP and DISAS_UPDATE. Actually, these macros have comments in
include/exec/exec-all.h which say that DISAS_JUMP should be used when
only PC was modified dynamically whereas DISAS_UPDATE should be used
when some other CPU state was (in addition to PC?) modified dynamically.
In fact, every target except ARM AArch64 does not distinguish between
them. As I can see ARM AArch64 seems to suppose that: (1) PC was not
modified when DISAS_UPDATE is used and should be updated with dc->pc
when finishing translation; (2) DISAS_JUMP can be used to indicate that
a new PC value was set and it should be preserved when finishing
translation.

So I'm a bit confused... What the difference should be? Maybe something
should be fixed/clarified to make the comments and the code consistent.

Best regards,
Sergey

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-22 18:28 [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE Sergey Fedorov
@ 2015-10-22 19:50 ` Richard Henderson
  2015-10-22 21:28 ` Peter Maydell
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2015-10-22 19:50 UTC (permalink / raw)
  To: Sergey Fedorov, qemu-devel
  Cc: Paolo Bonzini, Peter Crosthwaite, Aurelien Jarno, Peter Maydell

On 10/22/2015 08:28 AM, Sergey Fedorov wrote:
> Hi all,
>
> I am trying to understand what the difference should be between
> DISAS_JUMP and DISAS_UPDATE. Actually, these macros have comments in
> include/exec/exec-all.h which say that DISAS_JUMP should be used when
> only PC was modified dynamically whereas DISAS_UPDATE should be used
> when some other CPU state was (in addition to PC?) modified dynamically.
> In fact, every target except ARM AArch64 does not distinguish between
> them. As I can see ARM AArch64 seems to suppose that: (1) PC was not
> modified when DISAS_UPDATE is used and should be updated with dc->pc
> when finishing translation; (2) DISAS_JUMP can be used to indicate that
> a new PC value was set and it should be preserved when finishing
> translation.
>
> So I'm a bit confused... What the difference should be? Maybe something
> should be fixed/clarified to make the comments and the code consistent.

It's a mistake that these are defined in exec/.  They ought to be totally 
private to each translator.  See e.g. ExitStatus in target-alpha/translate.c.

But yes, what you see in aarch64 is approximately what is intended.


r~

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-22 18:28 [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE Sergey Fedorov
  2015-10-22 19:50 ` Richard Henderson
@ 2015-10-22 21:28 ` Peter Maydell
  2015-10-23 10:14   ` Sergey Fedorov
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2015-10-22 21:28 UTC (permalink / raw)
  To: Sergey Fedorov
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 22 October 2015 at 19:28, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> Hi all,
>
> I am trying to understand what the difference should be between
> DISAS_JUMP and DISAS_UPDATE. Actually, these macros have comments in
> include/exec/exec-all.h which say that DISAS_JUMP should be used when
> only PC was modified dynamically whereas DISAS_UPDATE should be used
> when some other CPU state was (in addition to PC?) modified dynamically.
> In fact, every target except ARM AArch64 does not distinguish between
> them. As I can see ARM AArch64 seems to suppose that: (1) PC was not
> modified when DISAS_UPDATE is used and should be updated with dc->pc
> when finishing translation; (2) DISAS_JUMP can be used to indicate that
> a new PC value was set and it should be preserved when finishing
> translation.

As Richard says, (a) the semantics for these values are really
private to each translator (b) the general idea is how AArch64
uses them. I think the 32-bit ARM code does something a bit odd
because it has to handle conditional execution (some things we
might have otherwise done immediately in the decode function
get postponed to the end of the loop). Mostly I haven't messed
around too much with that bit of the code because it works
and it's kind of complicated to understand. But the AArch64
stuff we wrote from scratch so it does things in the straightforward
way.

-- PMM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-22 21:28 ` Peter Maydell
@ 2015-10-23 10:14   ` Sergey Fedorov
  2015-10-23 11:10     ` Peter Maydell
  0 siblings, 1 reply; 10+ messages in thread
From: Sergey Fedorov @ 2015-10-23 10:14 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 23.10.2015 00:28, Peter Maydell wrote:
> On 22 October 2015 at 19:28, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>> Hi all,
>>
>> I am trying to understand what the difference should be between
>> DISAS_JUMP and DISAS_UPDATE. Actually, these macros have comments in
>> include/exec/exec-all.h which say that DISAS_JUMP should be used when
>> only PC was modified dynamically whereas DISAS_UPDATE should be used
>> when some other CPU state was (in addition to PC?) modified dynamically.
>> In fact, every target except ARM AArch64 does not distinguish between
>> them. As I can see ARM AArch64 seems to suppose that: (1) PC was not
>> modified when DISAS_UPDATE is used and should be updated with dc->pc
>> when finishing translation; (2) DISAS_JUMP can be used to indicate that
>> a new PC value was set and it should be preserved when finishing
>> translation.
> As Richard says, (a) the semantics for these values are really
> private to each translator (b) the general idea is how AArch64
> uses them. I think the 32-bit ARM code does something a bit odd
> because it has to handle conditional execution (some things we
> might have otherwise done immediately in the decode function
> get postponed to the end of the loop). Mostly I haven't messed
> around too much with that bit of the code because it works
> and it's kind of complicated to understand. But the AArch64
> stuff we wrote from scratch so it does things in the straightforward
> way.

Thanks, Peter. What if I am going to modify DISAS_JUMP and DISAS_UPDATE
usage in 32-bit ARM code and apply AArch64 semantics to them?

Best,
Sergey

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-23 10:14   ` Sergey Fedorov
@ 2015-10-23 11:10     ` Peter Maydell
  2015-10-23 12:35       ` Sergey Fedorov
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2015-10-23 11:10 UTC (permalink / raw)
  To: Sergey Fedorov
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 23 October 2015 at 11:14, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> Thanks, Peter. What if I am going to modify DISAS_JUMP and DISAS_UPDATE
> usage in 32-bit ARM code and apply AArch64 semantics to them?

No objection as long as it all still works :-)

-- PMM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-23 11:10     ` Peter Maydell
@ 2015-10-23 12:35       ` Sergey Fedorov
  2015-10-23 12:37         ` Peter Maydell
  0 siblings, 1 reply; 10+ messages in thread
From: Sergey Fedorov @ 2015-10-23 12:35 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 23.10.2015 14:10, Peter Maydell wrote:
> On 23 October 2015 at 11:14, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>> Thanks, Peter. What if I am going to modify DISAS_JUMP and DISAS_UPDATE
>> usage in 32-bit ARM code and apply AArch64 semantics to them?
> No objection as long as it all still works :-)

Well, I made the main changes and tested them with arm-test-0.2.tar.gz
and linux-user-test-0.3.tar.gz from http://wiki.qemu.org/Testing.
Everything seems to be okay. Is this enough?

Best regards,
Sergey

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-23 12:35       ` Sergey Fedorov
@ 2015-10-23 12:37         ` Peter Maydell
  2015-10-23 12:39           ` Sergey Fedorov
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2015-10-23 12:37 UTC (permalink / raw)
  To: Sergey Fedorov
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 23 October 2015 at 13:35, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> On 23.10.2015 14:10, Peter Maydell wrote:
>> On 23 October 2015 at 11:14, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>> Thanks, Peter. What if I am going to modify DISAS_JUMP and DISAS_UPDATE
>>> usage in 32-bit ARM code and apply AArch64 semantics to them?
>> No objection as long as it all still works :-)
>
> Well, I made the main changes and tested them with arm-test-0.2.tar.gz
> and linux-user-test-0.3.tar.gz from http://wiki.qemu.org/Testing.
> Everything seems to be okay. Is this enough?

You need to test a guest that uses Thumb and Thumb2 as well.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-23 12:37         ` Peter Maydell
@ 2015-10-23 12:39           ` Sergey Fedorov
  2015-10-23 12:41             ` Peter Maydell
  0 siblings, 1 reply; 10+ messages in thread
From: Sergey Fedorov @ 2015-10-23 12:39 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 23.10.2015 15:37, Peter Maydell wrote:
> On 23 October 2015 at 13:35, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>> On 23.10.2015 14:10, Peter Maydell wrote:
>>> On 23 October 2015 at 11:14, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>>> Thanks, Peter. What if I am going to modify DISAS_JUMP and DISAS_UPDATE
>>>> usage in 32-bit ARM code and apply AArch64 semantics to them?
>>> No objection as long as it all still works :-)
>> Well, I made the main changes and tested them with arm-test-0.2.tar.gz
>> and linux-user-test-0.3.tar.gz from http://wiki.qemu.org/Testing.
>> Everything seems to be okay. Is this enough?
> You need to test a guest that uses Thumb and Thumb2 as well.

What would you recommend to use for doing this?

Best,
Sergey

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-23 12:39           ` Sergey Fedorov
@ 2015-10-23 12:41             ` Peter Maydell
  2015-10-27 17:47               ` Sergey Fedorov
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2015-10-23 12:41 UTC (permalink / raw)
  To: Sergey Fedorov
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 23 October 2015 at 13:39, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> On 23.10.2015 15:37, Peter Maydell wrote:
>> On 23 October 2015 at 13:35, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>> On 23.10.2015 14:10, Peter Maydell wrote:
>>>> On 23 October 2015 at 11:14, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>>>> Thanks, Peter. What if I am going to modify DISAS_JUMP and DISAS_UPDATE
>>>>> usage in 32-bit ARM code and apply AArch64 semantics to them?
>>>> No objection as long as it all still works :-)
>>> Well, I made the main changes and tested them with arm-test-0.2.tar.gz
>>> and linux-user-test-0.3.tar.gz from http://wiki.qemu.org/Testing.
>>> Everything seems to be okay. Is this enough?
>> You need to test a guest that uses Thumb and Thumb2 as well.
>
> What would you recommend to use for doing this?

Ubuntu guest filesystem images for ARMv7 or better are generally
built to use Thumb.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE
  2015-10-23 12:41             ` Peter Maydell
@ 2015-10-27 17:47               ` Sergey Fedorov
  0 siblings, 0 replies; 10+ messages in thread
From: Sergey Fedorov @ 2015-10-27 17:47 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Peter Crosthwaite, QEMU Developers,
	Aurelien Jarno, Richard Henderson

On 23.10.2015 15:41, Peter Maydell wrote:
> On 23 October 2015 at 13:39, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>> On 23.10.2015 15:37, Peter Maydell wrote:
>>> On 23 October 2015 at 13:35, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>>> On 23.10.2015 14:10, Peter Maydell wrote:
>>>>> On 23 October 2015 at 11:14, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>>>>> Thanks, Peter. What if I am going to modify DISAS_JUMP and DISAS_UPDATE
>>>>>> usage in 32-bit ARM code and apply AArch64 semantics to them?
>>>>> No objection as long as it all still works :-)
>>>> Well, I made the main changes and tested them with arm-test-0.2.tar.gz
>>>> and linux-user-test-0.3.tar.gz from http://wiki.qemu.org/Testing.
>>>> Everything seems to be okay. Is this enough?
>>> You need to test a guest that uses Thumb and Thumb2 as well.
>> What would you recommend to use for doing this?
> Ubuntu guest filesystem images for ARMv7 or better are generally
> built to use Thumb.

I used this manual to test my changes:
https://wiki.ubuntu.com/Kernel/Dev/QemuARMVexpress. Hope to come up with
a patch soon :)

Best,
Sergey

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-27 17:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 18:28 [Qemu-devel] exec: About DISAS_JUMP and DISAS_UPDATE Sergey Fedorov
2015-10-22 19:50 ` Richard Henderson
2015-10-22 21:28 ` Peter Maydell
2015-10-23 10:14   ` Sergey Fedorov
2015-10-23 11:10     ` Peter Maydell
2015-10-23 12:35       ` Sergey Fedorov
2015-10-23 12:37         ` Peter Maydell
2015-10-23 12:39           ` Sergey Fedorov
2015-10-23 12:41             ` Peter Maydell
2015-10-27 17:47               ` Sergey Fedorov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.