Messages in this thread | | | From | Nick Desaulniers <> | Date | Thu, 16 Dec 2021 12:07:16 -0800 | Subject | Re: [PATCH] x86: use builtins to read eflags |
| |
On Thu, Dec 16, 2021 at 12:00 PM Bill Wendling <morbo@google.com> wrote: > > ()On Wed, Dec 15, 2021 at 3:26 PM Peter Zijlstra <peterz@infradead.org> wrote: > > > > Also note the thing was extern inline, and there's actually an > > out-of-line symbol for them too. The out-of-line thing is explicitly > > using %rax due to paravirt muck.
Oh, shoot, I wrote that. d0a8d9378d16e That was before we had __attribute__(no_stack_protector). Once the minimal supported versions of both compilers support that, I'd love to revert d0a8d9378d16e.
extern inline is the thing that makes me most nervous about moving the kernel from -std=gnu89 to anything newer. I should check whether gnu99 uses c99 extern inline or gnu inline...
> > > > I'm thinking you wrecked that bit. > > If you prefer, it could be written like so: > > extern inline unsigned long native_save_fl(void); > extern __always_inline unsigned long native_save_fl(void) > { > #ifdef CONFIG_X86_64 > return __builtin_ia32_readeflags_u64(); > #else > return __builtin_ia32_readeflags_u32(); > #endif > }
Yes, that would fix the `extern inline` issue. I wonder if this is prettier as:
return IS_ENABLED(CONFIG_X86_64) ? __builtin_ia32_readeflags_u64() : __builtin_ia32_readeflags_u32(); -- Thanks, ~Nick Desaulniers
| |