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