[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 4/8] disas: Support the Capstone disassembler
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v2 4/8] disas: Support the Capstone disassembler library |
Date: |
Tue, 26 Sep 2017 11:20:07 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/19/2017 08:03 AM, Richard Henderson wrote:
> + while (1) {
> + /* We want to read memory for one insn, but generically we do not
> + know how much memory that is. We have a small buffer which is
> + known to be sufficient for all supported targets. Try to not
> + read beyond the page, Just In Case. For even more simplicity,
> + ignore the actual target page size and use a 1k boundary. If
> + that turns out to be insufficient, we'll come back around the
> + loop and read more. */
> + uint64_t epc = QEMU_ALIGN_UP(pc + csize, 1024);
> + size_t tsize = MIN(sizeof(cap_buf) - csize, epc - pc);
...
> + assert(tsize != 0);
By inspection, epc must be computed from pc + csize + 1.
If csize = 0 and pc % 1024 == 0, epc == pc and tsize == 0,
which will assert.
r~
- [Qemu-devel] [PATCH v2 7/8] ppc: Support Capstone in disas_set_info, (continued)
- [Qemu-devel] [PATCH v2 7/8] ppc: Support Capstone in disas_set_info, Richard Henderson, 2017/09/19
- [Qemu-devel] [PATCH v2 6/8] arm: Support Capstone in disas_set_info, Richard Henderson, 2017/09/19
- [Qemu-devel] [PATCH v2 3/8] disas: Remove unused flags arguments, Richard Henderson, 2017/09/19
- [Qemu-devel] [PATCH v2 8/8] disas: Remove monitor_disas_is_physical, Richard Henderson, 2017/09/19
- [Qemu-devel] [PATCH v2 4/8] disas: Support the Capstone disassembler library, Richard Henderson, 2017/09/19
- Re: [Qemu-devel] [PATCH v2 0/8] Support the Capstone disassembler, no-reply, 2017/09/19