exec: About DISAS_JUMP and DISAS_UPDATE
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
Quoted 14 lines · Sergey Fedorov
Hi all,
I am trying to understand what the difference should be between
DISAS_JUMPandDISAS_UPDATE. Actually, these macros have comments ininclude/exec/exec-all.hwhich say thatDISAS_JUMPshould be used when only PC was modified dynamically whereasDISAS_UPDATEshould 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 whenDISAS_UPDATEis used and should be updated withdc->pcwhen finishing translation; (2)DISAS_JUMPcan be used to indicate that a new PC value was set and it should be preserved when finishing translation.
Quoted 2 lines
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~
Quoted 13 lines · Sergey Fedorov
Hi all,
I am trying to understand what the difference should be between
DISAS_JUMPandDISAS_UPDATE. Actually, these macros have comments ininclude/exec/exec-all.hwhich say thatDISAS_JUMPshould be used when only PC was modified dynamically whereasDISAS_UPDATEshould 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 whenDISAS_UPDATEis used and should be updated withdc->pcwhen finishing translation; (2)DISAS_JUMPcan 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
Quoted 14 lines · Peter Maydell
Quoted 13 lines · Sergey Fedorov
Hi all,
I am trying to understand what the difference should be between
DISAS_JUMPandDISAS_UPDATE. Actually, these macros have comments ininclude/exec/exec-all.hwhich say thatDISAS_JUMPshould be used when only PC was modified dynamically whereasDISAS_UPDATEshould 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 whenDISAS_UPDATEis used and should be updated withdc->pcwhen finishing translation; (2)DISAS_JUMPcan be used to indicate that a new PC value was set and it should be preserved when finishing translation.
Quoted 10 lines
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
Quoted 2 lines · Sergey Fedorov
Thanks, Peter. What if I am going to modify
DISAS_JUMPandDISAS_UPDATEusage in 32-bit ARM code and apply AArch64 semantics to them?
No objection as long as it all still works :-)
-- PMM
Quoted 4 lines · Peter Maydell
Quoted 2 lines · Sergey Fedorov
Thanks, Peter. What if I am going to modify
DISAS_JUMPandDISAS_UPDATEusage 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
Quoted 9 lines · Sergey Fedorov
Quoted 4 lines · Peter Maydell
Quoted 2 lines · Sergey Fedorov
Thanks, Peter. What if I am going to modify
DISAS_JUMPandDISAS_UPDATEusage 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
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Sergey Fedorov
Quoted 4 lines · Peter Maydell
Quoted 2 lines · Sergey Fedorov
Thanks, Peter. What if I am going to modify
DISAS_JUMPandDISAS_UPDATEusage 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
Quoted 6 lines · Sergey Fedorov
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Sergey Fedorov
Quoted 3 lines · Peter Maydell
Quoted 2 lines · Sergey Fedorov
Thanks, Peter. What if I am going to modify
DISAS_JUMPandDISAS_UPDATEusage in 32-bit ARM code and apply AArch64 semantics to them?
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
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
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Sergey Fedorov
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Sergey Fedorov
Quoted 3 lines · Peter Maydell
Quoted 2 lines · Sergey Fedorov
Thanks, Peter. What if I am going to modify
DISAS_JUMPandDISAS_UPDATEusage in 32-bit ARM code and apply AArch64 semantics to them?
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
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