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 #define __ASSEMBLY__ 22 #include <asm/segment.h> 23 24 startup_32: 25 cld 26 cli 27 movl $(KERNEL_DS),%eax 28 mov %ax,%ds 29 mov %ax,%es 30 mov %ax,%fs 31 mov %ax,%gs 32 lss _stack_start,%esp 33 xorl %eax,%eax 34 1: incl %eax # check that A20 really IS enabled 35 movl %eax,0x000000 # loop forever if it isn't 36 cmpl %eax,0x100000 37 je 1b 38 /* 39 * Initialize eflags. Some BIOS's leave bits like NT set. This would 40 * confuse the debugger if this code is traced. 41 * XXX - best to initialize before switching to protected mode. 42 */ 43 pushl $0 44 popfl 45 /* 46 * Clear BSS 47 */ 48 xorl %eax,%eax 49 movl $__edata,%edi 50 movl $__end,%ecx 51 subl %edi,%ecx 52 cld 53 rep 54 stosb 55 /* 56 * Do the decompression, and jump to the new kernel.. 57 */ 58 call _decompress_kernel 59 ljmp $(KERNEL_CS), $0x100000