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 33 ENTRY_NP(_start) 34 /* 35 * At entry we are passed a (start_info_t *) in %rsi. 36 */ 37 movq %rsi, xen_info(%rip) 38 39 /* 40 * make sure we have sane processor state 41 */ 42 xorw %ax, %ax 43 movw %ax, %fs 44 movw %ax, %gs 45 pushq $0 46 popfq 47 pushq $0 48 49 /* 50 * go off and unpack the kernel bits, adjust page tables, etc. 51 */ 52 call startup_kernel 53 54 /* 55 * we can only setup a stack after startup_kernel(). 56 * Its in the lower part of memroy. 57 */ 58 leaq stack_space(%rip), %rsp 59 addq $STACK_SIZE, %rsp 60 andl $0xfffffff0, %esp 61 62 pushq $0x0 /* push a dead-end frame */ 63 pushq $0x0 64 movq %rsp, %rbp 65 66 /* 67 * when we get back, load the kernel entry point and jump to it 68 * The address of the xboot_info is the kernel's only argument. 69 */ 70 movl entry_addr_low, %esi 71 movq $0xffffffff00000000,%rdx 72 orq %rdx, %rsi /* set upper bits of entry addr */ 73 74 movl bi, %edi 75 call *%rsi 76 SET_SIZE(_start) 77 78 #elif defined(__i386) 79 80 ENTRY_NP(_start) 81 /* 82 * At entry we are passed a (start_info_t *) in %esi. 83 */ 84 movl %esi, xen_info 85 86 /* 87 * make sure we have sane processor state 88 */ 89 cld 90 xorw %ax, %ax 91 movw %ax, %fs 92 movw %ax, %gs 93 94 95 /* 96 * go off and unpack the kernel bits, adjust page tables, etc. 97 */ 98 call startup_kernel 99 100 /* 101 * we can only setup a stack after startup_kernel(). 102 */ 103 movl $stack_space, %esp /* load my stack pointer */ 104 addl $STACK_SIZE, %esp 105 106 pushl $0x0 /* push a dead-end frame */ 107 pushl $0x0 108 movl %esp, %ebp 109 110 /* 111 * when we get back, load the kernel entry point and jump to it 112 * The address of the xboot_info is the kernel's only argument. 113 */ 114 movl entry_addr_low, %esi 115 movl bi, %eax 116 pushl %eax 117 call *%esi 118 SET_SIZE(_start) 119 120 #endif /* __i386 */ 121