1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27#include <sys/asm_linkage.h> 28#include <sys/asm_misc.h> 29#include "dboot_xboot.h" 30 31#if defined(__amd64) 32 ENTRY_NP(_start) 33 /* 34 * At entry we are passed a (start_info_t *) in %rsi. 35 */ 36 movq %rsi, xen_info(%rip) 37 38 /* 39 * make sure we have sane processor state 40 */ 41 xorw %ax, %ax 42 movw %ax, %fs 43 movw %ax, %gs 44 pushq $0 45 popfq 46 pushq $0 47 48 /* 49 * go off and unpack the kernel bits, adjust page tables, etc. 50 */ 51 call startup_kernel 52 53 /* 54 * we can only setup a stack after startup_kernel(). 55 * Its in the lower part of memroy. 56 */ 57 leaq stack_space(%rip), %rsp 58 addq $STACK_SIZE, %rsp 59 andl $0xfffffff0, %esp 60 61 pushq $0x0 /* push a dead-end frame */ 62 pushq $0x0 63 movq %rsp, %rbp 64 65 /* 66 * when we get back, load the kernel entry point and jump to it 67 * The address of the xboot_info is the kernel's only argument. 68 */ 69 movl entry_addr_low, %esi 70 movq $0xffffffff00000000,%rdx 71 orq %rdx, %rsi /* set upper bits of entry addr */ 72 73 movl bi, %edi 74 call *%rsi 75 SET_SIZE(_start) 76 77#elif defined(__i386) 78 ENTRY_NP(_start) 79 /* 80 * At entry we are passed a (start_info_t *) in %esi. 81 */ 82 movl %esi, xen_info 83 84 /* 85 * make sure we have sane processor state 86 */ 87 cld 88 xorw %ax, %ax 89 movw %ax, %fs 90 movw %ax, %gs 91 92 93 /* 94 * go off and unpack the kernel bits, adjust page tables, etc. 95 */ 96 call startup_kernel 97 98 /* 99 * we can only setup a stack after startup_kernel(). 100 */ 101 movl $stack_space, %esp /* load my stack pointer */ 102 addl $STACK_SIZE, %esp 103 104 pushl $0x0 /* push a dead-end frame */ 105 pushl $0x0 106 movl %esp, %ebp 107 108 /* 109 * when we get back, load the kernel entry point and jump to it 110 * The address of the xboot_info is the kernel's only argument. 111 */ 112 movl entry_addr_low, %esi 113 movl bi, %eax 114 pushl %eax 115 call *%esi 116 SET_SIZE(_start) 117#endif /* __i386 */ 118