lkml.org 
[lkml]   [2022]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 06/16] x86/boot: Setup memory protection for bzImage code
    On 2022-10-19 10:57, Andrew Cooper wrote:
    > On 06/09/2022 11:41, Evgeniy Baskov wrote:
    >> diff --git a/arch/x86/boot/compressed/head_64.S
    >> b/arch/x86/boot/compressed/head_64.S
    >> index 5273367283b7..889ca7176aa7 100644
    >> --- a/arch/x86/boot/compressed/head_64.S
    >> +++ b/arch/x86/boot/compressed/head_64.S
    >> @@ -602,6 +603,28 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated)
    >> jmp *%rax
    >> SYM_FUNC_END(.Lrelocated)
    >>
    >> +SYM_FUNC_START_LOCAL_NOALIGN(startup32_enable_nx_if_supported)
    >> + pushq %rbx
    >> +
    >> + leaq has_nx(%rip), %rcx
    >> +
    >> + mov $0x80000001, %eax
    >> + cpuid
    >> + btl $20, %edx
    >
    > btl $(X86_FEATURE_NX & 31), %edx
    >
    > But also need to check for the availability of the extended leaf in the
    > first place.

    Yes, thank you for suggestion, that looks more readable. I will
    also add the leaf node check. Is there any processor though that
    supports long mode and does not support 0x80000001 leaf node?

    >
    >> + jnc .Lnonx
    >> +
    >> + movl $1, (%rcx)
    >
    > Your pointer has been clobbered with some feature flags.

    Thanks, I apparently forgot to include fix for this into a patch set...

    >
    > movl $1, has_nx(%rip)
    >
    > will work fine without needing the intermediary lea.
    >
    > ~Andrew

    \
     
     \ /
      Last update: 2022-10-20 15:31    [W:4.780 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site