Re: kernel loading question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 3 Dec 2005, Daniel Bonekeeper wrote:

> Well, this probably should not be posted here, but who knows ? =)
>
> Well, on arch/i386/boot/compressed/head.S line 65 we call
> decompress_kernel that decompresses the kernel starting at $0x100000.
> If we were loaded high, we first move the code back to $0x1000 before
> ljmp'ing it.
>
> My question is: why, when loaded high, we care to disable interrupts
> (cli  # make sure we don't get interrupted) while otherwise, we don't
> do that ? in both cases, aren't we supposed to disable cli (as they
> can happen in both situations) ?
>
> Since currently, the kernel boots fine for everybody in the world, I
> know that this is not a bug... but why don't disable interruptions on
> both cases ?
>
> Thanks !

The first thing to do when looking at assembly language files
is to find what symbols are global (.globl or .global). Unlike
'C' the stuff doesn't default to being visible from other
files. Given that, you will see that code executes from
startup_32, the only way "in" since it's the only global
symbol. The second instruction is 'cli', which will disable
interrupts on the current processor.

Now, later on in the code is the sequence:
 		pushl	$0
 		popfl

... which will further clear any flags so the interrupt-enable
flag is truly disabled there, also. Later on, there are redundant
'cld' instructions as well as an additional 'cli' instruction.

These probably occurred because the code was assembled from
various pieces and nobody bothered to review it for such
redundancy.

Getting rid of the extra instructions will save 3 or 4 bytes
of code. Since this code executes only once, it's certainly
not in the "fast-path" so nobody has bothered to clean it.
If you would like to clean up the code and submit a patch
it probably would be accepted.

I will test any patch you may want to produce.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.44 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux