* questions about header.S
@ 2018-03-17 10:01 Cao jin
2018-03-21 9:23 ` Cao jin
0 siblings, 1 reply; 4+ messages in thread
From: Cao jin @ 2018-03-17 10:01 UTC (permalink / raw)
To: x86, linux-kernel; +Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Hi,
I find two small questions which confuse me a little.
1.
# Check signature at end of setup
cmpl $0x5a5aaa55, setup_sig
jne setup_bad
setup_sig is defined in setup.ld, which points to the constant also
defined in setup.ld, so I don't figure out in which case they don't
equal and jump to setup_bad?
In my test, drop these 2 lines seems fine, system can boot without any
obvious error.
2.
# Zero the bss
movw $__bss_start, %di
movw $_end+3, %cx
xorl %eax, %eax
subw %di, %cx
shrw $2, %cx
rep; stosl
It is not a big deal, but I think replace "_end" with "__bss_end" make
more sense, and "_end" is already aligned to word length. And, there is
no other code use symbol "__bss_end". So I don't know is there any
reason to use "_end" here?
In my test, replace the 2nd line with:
movw $_end, %cx
or:
movw $__bss_end+3, %cx
are both fine.
--
Sincerely,
Cao jin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: questions about header.S
2018-03-17 10:01 questions about header.S Cao jin
@ 2018-03-21 9:23 ` Cao jin
2018-03-21 9:57 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Cao jin @ 2018-03-21 9:23 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: x86, linux-kernel
Dear Maintainers,
Could you help to give a hint?
Thanks in advance.
--
Sincerely,
Cao jin
On 03/17/2018 06:01 PM, Cao jin wrote:
> Hi,
>
> I find two small questions which confuse me a little.
>
> 1.
> # Check signature at end of setup
> cmpl $0x5a5aaa55, setup_sig
> jne setup_bad
>
> setup_sig is defined in setup.ld, which points to the constant also
> defined in setup.ld, so I don't figure out in which case they don't
> equal and jump to setup_bad?
>
> In my test, drop these 2 lines seems fine, system can boot without any
> obvious error.
>
> 2.
> # Zero the bss
> movw $__bss_start, %di
> movw $_end+3, %cx
> xorl %eax, %eax
> subw %di, %cx
> shrw $2, %cx
> rep; stosl
>
> It is not a big deal, but I think replace "_end" with "__bss_end" make
> more sense, and "_end" is already aligned to word length. And, there is
> no other code use symbol "__bss_end". So I don't know is there any
> reason to use "_end" here?
>
> In my test, replace the 2nd line with:
>
> movw $_end, %cx
>
> or:
>
> movw $__bss_end+3, %cx
>
> are both fine.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: questions about header.S
2018-03-21 9:23 ` Cao jin
@ 2018-03-21 9:57 ` Thomas Gleixner
2018-03-22 2:31 ` Cao jin
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2018-03-21 9:57 UTC (permalink / raw)
To: Cao jin; +Cc: Ingo Molnar, H. Peter Anvin, x86, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]
On Wed, 21 Mar 2018, Cao jin wrote:
> On 03/17/2018 06:01 PM, Cao jin wrote:
> > I find two small questions which confuse me a little.
> >
> > 1.
> > # Check signature at end of setup
> > cmpl $0x5a5aaa55, setup_sig
> > jne setup_bad
> >
> > setup_sig is defined in setup.ld, which points to the constant also
> > defined in setup.ld, so I don't figure out in which case they don't
> > equal and jump to setup_bad?
That's a lame sanity check to make sure that nothing overwrote the loader.
> > In my test, drop these 2 lines seems fine, system can boot without any
> > obvious error.
Sure it does as long as you have no corruption.
> > 2.
> > # Zero the bss
> > movw $__bss_start, %di
> > movw $_end+3, %cx
> > xorl %eax, %eax
> > subw %di, %cx
> > shrw $2, %cx
> > rep; stosl
> >
> > It is not a big deal, but I think replace "_end" with "__bss_end" make
> > more sense, and "_end" is already aligned to word length. And, there is
> > no other code use symbol "__bss_end". So I don't know is there any
> > reason to use "_end" here?
It doesn't matter at all. But its also pointless to change it.
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: questions about header.S
2018-03-21 9:57 ` Thomas Gleixner
@ 2018-03-22 2:31 ` Cao jin
0 siblings, 0 replies; 4+ messages in thread
From: Cao jin @ 2018-03-22 2:31 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Ingo Molnar, H. Peter Anvin, x86, linux-kernel
Thanks very much for you hint!
On 03/21/2018 05:57 PM, Thomas Gleixner wrote:
> On Wed, 21 Mar 2018, Cao jin wrote:
>> On 03/17/2018 06:01 PM, Cao jin wrote:
>>> I find two small questions which confuse me a little.
>>>
>>> 1.
>>> # Check signature at end of setup
>>> cmpl $0x5a5aaa55, setup_sig
>>> jne setup_bad
>>>
>>> setup_sig is defined in setup.ld, which points to the constant also
>>> defined in setup.ld, so I don't figure out in which case they don't
>>> equal and jump to setup_bad?
>
> That's a lame sanity check to make sure that nothing overwrote the loader.
>
I see.
>>> In my test, drop these 2 lines seems fine, system can boot without any
>>> obvious error.
>
> Sure it does as long as you have no corruption.
>
>>> 2.
>>> # Zero the bss
>>> movw $__bss_start, %di
>>> movw $_end+3, %cx
>>> xorl %eax, %eax
>>> subw %di, %cx
>>> shrw $2, %cx
>>> rep; stosl
>>>
>>> It is not a big deal, but I think replace "_end" with "__bss_end" make
>>> more sense, and "_end" is already aligned to word length. And, there is
>>> no other code use symbol "__bss_end". So I don't know is there any
>>> reason to use "_end" here?
>
> It doesn't matter at all. But its also pointless to change it.
>
It does not matter and is pointless to change for kernel itself. It just
may confuse a little for newbies who has interests.
--
Sincerely,
Cao jin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-22 2:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-17 10:01 questions about header.S Cao jin
2018-03-21 9:23 ` Cao jin
2018-03-21 9:57 ` Thomas Gleixner
2018-03-22 2:31 ` Cao jin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®