Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544035

Re: What is the function of arch/x86/purgatory/purgatory.c?

From Larry Finger <Larry.Finger@lwfinger.net>
Newsgroups linux.kernel
Subject Re: What is the function of arch/x86/purgatory/purgatory.c?
Date 2016-12-17 21:00 +0100
Message-ID <sPtjb-5uc-7@gated-at.bofh.it> (permalink)
References <sPrr4-4ij-5@gated-at.bofh.it> <sPt9v-5qQ-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 12/17/2016 01:46 PM, Al Viro wrote:
> On Sat, Dec 17, 2016 at 11:52:05AM -0600, Larry Finger wrote:
>
>> Upon examination of the routine, I can see that if purgatory() should be
>> static, then none of the code here will ever be accessed by any part of the
>> kernel. Is there some bit of magic that is above my understanding, or is
>> this a useless bit of code that has been forgotten and should be removed?
>
> I don't know what is and what is not above your understanding, but grepping
> in that area (grep -w purgatory arch/x86/purgatory/*) does catch this:
> arch/x86/purgatory/setup-x86_64.S:      call purgatory
> which is hardly magic - looks like a function call.  Looking into that
> file shows
> purgatory_start:
>         .code64
>
>         /* Load a gdt so I know what the segment registers are */
>         lgdt    gdt(%rip)
>
>         /* load the data segments */
>         movl    $0x18, %eax     /* data segment */
>         movl    %eax, %ds
>         movl    %eax, %es
>         movl    %eax, %ss
>         movl    %eax, %fs
>         movl    %eax, %gs
>
>         /* Setup a stack */
>         leaq    lstack_end(%rip), %rsp
>
>         /* Call the C code */
>         call purgatory
>         jmp     entry64
>
> which pretty much confirms that - it's called from purgatory_start().

Thanks for the explanation.

Larry

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

What is the function of arch/x86/purgatory/purgatory.c? Larry Finger <Larry.Finger@lwfinger.net> - 2016-12-17 19:00 +0100
  Re: What is the function of arch/x86/purgatory/purgatory.c? Al Viro <viro@ZenIV.linux.org.uk> - 2016-12-17 20:50 +0100
    Re: What is the function of arch/x86/purgatory/purgatory.c? Larry Finger <Larry.Finger@lwfinger.net> - 2016-12-17 21:00 +0100

csiph-web