linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>, Vivek Goyal <vgoyal@redhat.com>
Subject: Re: What is the function of arch/x86/purgatory/purgatory.c?
Date: Sat, 17 Dec 2016 13:56:37 -0600	[thread overview]
Message-ID: <c96f5ab8-7de4-5e37-2222-7f946ebd1acb@lwfinger.net> (raw)
In-Reply-To: <20161217194645.GV1555@ZenIV.linux.org.uk>

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

      reply	other threads:[~2016-12-17 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-17 17:52 What is the function of arch/x86/purgatory/purgatory.c? Larry Finger
2016-12-17 19:46 ` Al Viro
2016-12-17 19:56   ` Larry Finger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c96f5ab8-7de4-5e37-2222-7f946ebd1acb@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@redhat.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).