[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/11] tcg/i386: Make direct jump patching threa
From: |
Sergey Fedorov |
Subject: |
Re: [Qemu-devel] [PATCH 05/11] tcg/i386: Make direct jump patching thread-safe |
Date: |
Wed, 20 Apr 2016 19:15:55 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 20/04/16 18:04, Richard Henderson wrote:
> On 04/20/2016 02:55 AM, Alex Bennée wrote:
>>> +static void tcg_out_nopn(TCGContext *s, int n)
>>> +{
>>> + static const uint8_t nop1[] = { 0x90 };
>>> + static const uint8_t nop2[] = { 0x66, 0x90 };
>>> + static const uint8_t nop3[] = { 0x8d, 0x76, 0x00 };
>>> + static const uint8_t *const nopn[] = { nop1, nop2, nop3 };
>>> + int i;
>>> + assert(n <= ARRAY_SIZE(nopn));
>>> + for (i = 0; i < n; ++i) {
>>> + tcg_out8(s, nopn[n - 1][i]);
>>> + }
>>> +}
>>
>> *shudder* I recall x86 instruction encoding is weird. Maybe a comment
>> for the function to describe the 3 forms of NOP we have here?
>
> I think I'd prefer to drop the tables and do
>
> /* Emit 1 or 2 operand size prefixes for the standard one byte nop,
> xchg %eax,%eax, forming xchg %ax,%ax. All cores accept the
> duplicate prefix, and all of the interesting recent cores can
> decode and discard the duplicates in a single cycle. */
> for (i = 1; i < n; ++i) {
> tcg_out8(s, 0x66);
> }
> tcg_out8(s, 0x90);
It's fine if you are sure about that :)
Kind regards,
Sergey
- Re: [Qemu-devel] [PATCH 06/11] tcg/s390: Make direct jump patching thread-safe, (continued)
[Qemu-devel] [PATCH 05/11] tcg/i386: Make direct jump patching thread-safe, Sergey Fedorov, 2016/04/07
[Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Sergey Fedorov, 2016/04/07
- Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Cornelia Huck, 2016/04/07
- Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Cornelia Huck, 2016/04/18
- Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Cornelia Huck, 2016/04/18
- Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Sergey Fedorov, 2016/04/18
- Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Sergey Fedorov, 2016/04/21
- Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Alex Bennée, 2016/04/21
- Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling, Sergey Fedorov, 2016/04/21