linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What is the function of arch/x86/purgatory/purgatory.c?
@ 2016-12-17 17:52 Larry Finger
  2016-12-17 19:46 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Larry Finger @ 2016-12-17 17:52 UTC (permalink / raw)
  To: LKML, Vivek Goyal

While checking the rtlwifi family of drivers using Sparse, I got the following 
warnings:

   CHECK   arch/x86/purgatory/purgatory.c
arch/x86/purgatory/purgatory.c:21:15: warning: symbol 'backup_dest' was not 
declared. Should it be static?
arch/x86/purgatory/purgatory.c:22:15: warning: symbol 'backup_src' was not 
declared. Should it be static?
arch/x86/purgatory/purgatory.c:23:15: warning: symbol 'backup_sz' was not 
declared. Should it be static?
arch/x86/purgatory/purgatory.c:25:4: warning: symbol 'sha256_digest' was not 
declared. Should it be static?
arch/x86/purgatory/purgatory.c:27:19: warning: symbol 'sha_regions' was not 
declared. Should it be static?
arch/x86/purgatory/purgatory.c:42:5: warning: symbol 'verify_sha256_digest' was 
not declared. Should it be static?
arch/x86/purgatory/purgatory.c:61:6: warning: symbol 'purgatory' was not 
declared. Should it be static?

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?

If the former, then I think there should be declarations so that the clueless 
like me are not confused.

Thanks,

Larry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What is the function of arch/x86/purgatory/purgatory.c?
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2016-12-17 19:46 UTC (permalink / raw)
  To: Larry Finger; +Cc: LKML, Vivek Goyal

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().

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What is the function of arch/x86/purgatory/purgatory.c?
  2016-12-17 19:46 ` Al Viro
@ 2016-12-17 19:56   ` Larry Finger
  0 siblings, 0 replies; 3+ messages in thread
From: Larry Finger @ 2016-12-17 19:56 UTC (permalink / raw)
  To: Al Viro; +Cc: LKML, Vivek Goyal

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-17 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).