Re: [PATCH V2 16/41] x86/entry: Implement the whole error_entry() as C code

From: Peter Zijlstra
Date: Wed Sep 29 2021 - 04:45:39 EST


On Tue, Sep 28, 2021 at 05:34:02PM -0400, Brian Gerst wrote:
> On Sun, Sep 26, 2021 at 11:13 AM Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:
> > +asmlinkage __visible __entry_text
> > +struct pt_regs *error_entry(struct pt_regs *eregs)
> > +{
> > + unsigned long iret_ip = (unsigned long)native_irq_return_iret;
> > +
> > + asm volatile ("cld");
>
> The C ABI states that the direction flag must be clear on function
> entry and exit, so the CLD instruction needs to remain in the asm
> code.

Right, also, one of my pet peeves with out entry code is that CLD and
CLAC are not next to one another.