1 /* 2 * head.S for bootstub to load protected mode kernel 3 * 4 * Copyright (C) 2008-2010 Intel Corporation. 5 * Author: Alek Du <alek.du (at) intel.com> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms and conditions of the GNU General Public License, 9 * version 2, as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 * 16 * You should have received a copy of the GNU General Public License along with 17 * this program; if not, write to the Free Software Foundation, Inc., 18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 */ 21 22 /* 23 * 24 * Note. When FW hand-off control to bootstub, the CPU is already in protected 25 * Mode with 1. GDT(8)=4G GDT(10)=4G 26 * 2. CS=8, DS=ES=FS=GS=10 27 * 3. Paging mode disabled 28 * 4. Interrupt ENABLED 29 * 30 * When bootstub get control, the memory map in DRAM is like: 31 * ~ ~ 32 * 0x1102000 | initrd | initrd will move to highest memory otherwise 33 *+bzImage size +-----------------------+ bzImage uncompressing will destory it 34 * | bzImage | 35 * 0x1102000 +-----------------------+ 36 * | boot stub | 37 * 0x1101000 +-----------------------+ 38 * | free space | 39 * | used as stack | 40 * 0x1100110 +-----------------------+ 41 * | SPI0 or SPI1 | MIC need to fill it: 42 * | | 0x0: SPI0, 0x1: SPI1 43 * 0x110010c +-----------------------+ 44 * | boot stub spi uart | MIC need to fill it: 45 * | suppression flag | 0x1 suppression, 0x0 default 46 * 0x1100108 +-----------------------+ 47 * | initrd size | MIC need to fill it: initrd file size 48 * 0x1100104 +-----------------------+ 49 * | bzImage size | MIC need to fill it: bzImage file size 50 * 0x1100100 +-----------------------+ 51 * | kernel cmdline | MIC need to fill it 52 * 0x1100000 +-----------------------+ 53 */ 54 55 #include "bootstub.h" 56 57 .text 58 59 .section ".text.head","ax",@progbits 60 .globl _start 61 62 _start: 63 cld 64 cli 65 /* setup stack, because we are heading off to "C" */ 66 movl $STACK_OFFSET, %esp 67 calll bootstub 68 /* after call bootstub, GDT is set, IDT is clear 69 * eax contains 32-bit entry of bzImage 70 */ 71 movl $__BOOT_DS, %ebx 72 movl %ebx, %ds 73 movl %ebx, %es 74 movl %ebx, %fs 75 movl %ebx, %gs 76 movl %ebx, %ss 77 ljmp $__BOOT_CS,$1f 78 1: 79 /* tell kernel where is boot_param */ 80 movl $(BOOT_PARAMS_OFFSET), %esi 81 xor %ebp, %ebp 82 xor %edi, %edi 83 mov %eax, %ecx 84 mov mb_magic, %eax 85 mov mb_info, %ebx 86 87 jmpl *%ecx # Jump to the 32-bit entrypoint 88