[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 26/60] AArch64: Add ADR instruction emulation
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 26/60] AArch64: Add ADR instruction emulation |
Date: |
Tue, 19 Nov 2013 18:09:06 +0000 |
On 19 November 2013 18:03, Peter Maydell <address@hidden> wrote:
> On 19 November 2013 17:52, Claudio Fontana <address@hidden> wrote:
>> static void disas_pc_rel_adr(DisasContext *s, uint32_t insn)
>> {
>> /*
>> * 31 30 29 28 27 26 25 24 23 5 4 0
>> * op immlo 1 0 0 0 0 immhi Rd
>> */
>> unsigned int page, imm, rd, len; /* op -> page, immhi:immlo -> imm */
>> uint64_t base;
>> sint64_t offset; /* SignExtend(imm) -> offset */
>>
>> page = insn & (1 << 31) ? 1 : 0;
>> imm = extract32(insn, 29, 2) + extract32(insn, 5, 19) << 2;
>> rd = extract32(insn, 0, 5);
>
> Claiming you want sign extension and not using sextract32()
> is a bit odd.
...to be a bit more specific, you can get the immediate
into a signed 64 bit variable like this:
int64_t imm = (sextract32(insn, 5, 19) << 2)
| extract32(insn, 29, 2);
if (page) {
imm <<= 12;
}
which is exactly what Alex's original patch does, except
it's not using the standard sextract/extract functions
(probably because they weren't in master at the point he
wrote it).
thanks
-- PMM