|
From: | Sergey Fedorov |
Subject: | Re: [Qemu-arm] [Qemu-devel] [PATCH] target-*: Get rid of "PC advancement" trick |
Date: | Sat, 12 Dec 2015 23:02:00 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
On 12/12/15 02:39, Richard Henderson wrote:
On 12/10/2015 10:47 AM, Sergey Fedorov wrote:The "PC advancement" trick was used just after recognizing that a breakpoint exception was going to be generated. This trick has had two points:1. Guarantee that tb->size isn't zero: there are many places where it's expected to be non-zero. In fact, that is even stated in the commentfor this field. 2. Try to satisfy disassembler's check for instruction length. To this end, PC advancement was done for estimated instruction length, butactually, didn't work properly in variable-instruction-length cases.Substitute this trick with checking for TB size at the end of translation. If we get an empty TB then just set tb->size to 1 and skip disassembling. Setting tb->size to 1 is enough to get correct behaviour, whereas an empty TB doesn't obviously need to be disassembled.This doesn't help when the TB already has instructions, the TB would ordinarily cross a page boundary, and the breakpoint is at the page boundary.
I see your point. But I am wondering why most architectures stop translating on a page boundary whereas i386 and m86k don't. There are some comments which say that's to ensure instruction fetch aborts occur at the right place. Isn't it necessary for all architectures?
At least for those architectures which do stop translating on a page boundary, I think this patch is applicable. Certainly, it would be better to have a single solution for all architectures.
Thanks, Sergey
[Prev in Thread] | Current Thread | [Next in Thread] |