root/arch/i386/boot/compressed/head.S

/* [previous][next][first][last][top][bottom][index][help] */
   1 /*
   2  *  linux/boot/head.S
   3  *
   4  *  Copyright (C) 1991, 1992, 1993  Linus Torvalds
   5  */
   6 
   7 /*
   8  *  head.S contains the 32-bit startup code.
   9  *
  10  * NOTE!!! Startup happens at absolute address 0x00001000, which is also where
  11  * the page directory will exist. The startup code will be overwritten by
  12  * the page directory. [According to comments etc elsewhere on a compressed
  13  * kernel it will end up at 0x1000 + 1Mb I hope so as I assume this. - AC]
  14  *
  15  * In SMP mode we keep this page safe. Really we ought to shuffle things and
  16  * put the trampoline here. - AC. An SMP trampoline enters with %cx holding
  17  * the stack base.
  18  *
  19  * Page 0 is deliberately kept safe, since System Management Mode code in 
  20  * laptops may need to access the BIOS data stored there.  This is also
  21  * useful for future device drivers that either access the BIOS via VM86 
  22  * mode.
  23  */
  24 .text
  25 
  26 #define __ASSEMBLY__
  27 #include <linux/config.h>
  28 #include <linux/linkage.h>
  29 #include <asm/segment.h>
  30 
  31         .globl startup_32
  32         
  33 startup_32:
  34         cld
  35         cli
  36         movl $(KERNEL_DS),%eax
  37         mov %ax,%ds
  38         mov %ax,%es
  39         mov %ax,%fs
  40         mov %ax,%gs
  41 #ifdef __SMP__
  42         orw %bx,%bx                     # What state are we in BX=1 for SMP
  43                                         # 0 for boot
  44         jz  2f                          # Initial boot
  45 
  46 /*
  47  *      We are trampolining an SMP processor
  48  */
  49         mov %ax,%ss
  50         xorl %eax,%eax                  # Back to 0
  51         mov  %cx,%ax                    # SP low 16 bits
  52         movl %eax,%esp
  53         pushl 0                         # Clear NT
  54         popfl
  55         ljmp $(KERNEL_CS), $0x100000    # Into C and sanity
  56 
  57 2:
  58 #endif
  59         lss SYMBOL_NAME(stack_start),%esp
  60         xorl %eax,%eax
  61 1:      incl %eax               # check that A20 really IS enabled
  62         movl %eax,0x000000      # loop forever if it isn't
  63         cmpl %eax,0x100000
  64         je 1b
  65 /*
  66  * Initialize eflags.  Some BIOS's leave bits like NT set.  This would
  67  * confuse the debugger if this code is traced.
  68  * XXX - best to initialize before switching to protected mode.
  69  */
  70         pushl $0
  71         popfl
  72 /*
  73  * Clear BSS
  74  */
  75         xorl %eax,%eax
  76         movl $ SYMBOL_NAME(_edata),%edi
  77         movl $ SYMBOL_NAME(_end),%ecx
  78         subl %edi,%ecx
  79         cld
  80         rep
  81         stosb
  82 /*
  83  * Do the decompression, and jump to the new kernel..
  84  */
  85         call SYMBOL_NAME(decompress_kernel)
  86         xorl %ebx,%ebx
  87         ljmp $(KERNEL_CS), $0x100000
  88 

/* [previous][next][first][last][top][bottom][index][help] */