[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240928132327.GD19439@noisy.programming.kicks-ass.net>
Date: Sat, 28 Sep 2024 15:23:27 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, alyssa.milburn@...el.com,
scott.d.constable@...el.com, joao@...rdrivepizza.com,
andrew.cooper3@...rix.com, jose.marchesi@...cle.com,
hjl.tools@...il.com, ndesaulniers@...gle.com,
samitolvanen@...gle.com, nathan@...nel.org, ojeda@...nel.org,
kees@...nel.org, alexei.starovoitov@...il.com
Subject: Re: [PATCH 13/14] x86: BHI stubs
On Fri, Sep 27, 2024 at 06:37:36PM -0700, Josh Poimboeuf wrote:
> On Fri, Sep 27, 2024 at 09:49:09PM +0200, Peter Zijlstra wrote:
> > +static void *bhi_args_1(u8 args, void *addr)
> > +{
> > + u8 bytes[5];
> > +
> > + for (int i = 0; i < 6; i++) {
> > + if (args != BIT(i))
> > + continue;
> > +
> > + bytes[0] = 0x2e;
> > + memcpy(&bytes[1], &__bhi_args_6c1[i], 4);
> > +
> > + text_poke_early(addr, bytes, 5);
> > +
> > + return NULL;
>
> I assume there's some good reason this doesn't return a pointer to the
> code like the others?
The 1 bit case is different in that it does in-place CMOVcc while the
others do a CALL to an external stub.
Not saying this is the best way to do it, but it's what I ended up with
back then.
Powered by blists - more mailing lists