On 03.03.2026 16:09, Edwin Torok wrote:
>> On 3 Mar 2026, at 13:59, Jan Beulich <[email protected]> wrote:
>> On 27.02.2026 11:58, Edwin Török wrote:
>>> --- a/tools/tests/x86_emulator/test_x86_emulator.c
>>> +++ b/tools/tests/x86_emulator/test_x86_emulator.c
>>> @@ -1882,8 +1882,13 @@ int main(int argc, char **argv)
>>> #define decl_insn(which) extern const unsigned char which[], \
>>>                          which##_end[] asm ( ".L" #which "_end" )
>>> #define put_insn(which, insn) ".pushsection .test\n" \
>>> -                              #which ": " insn "\n"  \
>>> +                              ".ifndef "#which"\n" \
>>> +                              #which ": \n" \
>>> +                              ".endif\n" \
>>> +                              insn "\n"  \
>>> +                              ".ifndef .L"#which"_end\n" \
>>>                               ".L" #which "_end:\n"  \
>>> +                              ".endif\n" \
>>>                               ".popsection"
>>
>> Nice idea, but why multiple .ifndef, and why emitting the insn even if the
>> labels are already there (and hence won't be emitted a 2nd time)?
> 
> I think we still need to execute the instructions, so they can be compared 
> against the emulator.

Of course, but they cannot be executed without having a label. We use the
label to point the emulated IP there, and then we use the end label to
check that after emulation the emulated IP has advanced as expected.

Jan

Reply via email to