Re: [patch V4 part 3 09/29] x86/entry/32: Provide macro to emit IDT entry stubs

Mathieu Desnoyers
2020-05-14T13:39:03Z

----- On May 14, 2020, at 12:31 AM, Andy Lutomirski luto@kernel.org wrote:

> On Wed, May 13, 2020 at 6:44 PM Mathieu Desnoyers
> <mathieu.desnoyers@efficios.com> wrote:
>>
>> ----- On May 5, 2020, at 9:44 AM, Thomas Gleixner tglx@linutronix.de wrote:
>>
>> [...]
>>
>> > +.macro idtentry vector asmsym cfunc has_error_code:req sane=0
>> > +SYM_CODE_START(\asmsym)
>> > + ASM_CLAC
>> > + cld
>>
>> Looking at the various interrupt and trap entry points for 32 and 64-bit
>> x86, I notice a lack of consistency in use of the following instruction
>> sequence at the asm entry point:
>>
>> - ASM_CLAC,
>> - cld (clear direction flag).
>>
>> Are they always needed, or only for interrupt handlers ?
>
> They're needed for all entries except SYSCALL, but they're hidden
> inside helpers in many cases.

Indeed, on x86-32 the macro SAVE_ALL contains cld. That architecture
appears to be OK.

What I am concerned about is the idtentry, idtentry_mce_db,
and idtentry_df macros introduced in entry_64.S by this series.
Those are supposed to be technically equivalent to the prior
code, which indeed has the ASM_CLAC but no "cld".

So maybe the cld happens to be hidden elsewhere, but I'm clearly
missing it ? Or is it not needed for some reason ?

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.