root/zBoot/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.
  13  *
  14  * Page 0 is deliberately kept safe, since System Management Mode code in 
  15  * laptops may need to access the BIOS data stored there.  This is also
  16  * useful for future device drivers that either access the BIOS via VM86 
  17  * mode.
  18  */
  19 .text
  20 
  21 #include <linux/segment.h>
  22 
  23 startup_32:
  24         cld
  25         cli
  26         movl $(KERNEL_DS),%eax
  27         mov %ax,%ds
  28         mov %ax,%es
  29         mov %ax,%fs
  30         mov %ax,%gs
  31         lss _stack_start,%esp
  32         xorl %eax,%eax
  33 1:      incl %eax               # check that A20 really IS enabled
  34         movl %eax,0x000000      # loop forever if it isn't
  35         cmpl %eax,0x100000
  36         je 1b
  37 /*
  38  * Initialize eflags.  Some BIOS's leave bits like NT set.  This would
  39  * confuse the debugger if this code is traced.
  40  * XXX - best to initialize before switching to protected mode.
  41  */
  42         pushl $0
  43         popfl
  44 /*
  45  * Clear BSS
  46  */
  47         xorl %eax,%eax
  48         movl $__edata,%edi
  49         movl $__end,%ecx
  50         subl %edi,%ecx
  51         cld
  52         rep
  53         stosb
  54 /*
  55  * Do the decompression, and jump to the new kernel..
  56  */
  57         call _decompress_kernel
  58         ljmp $(KERNEL_CS), $0x100000

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