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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 /*
  29  * exit routine from linker/loader to kernel
  30  */
  31 
  32 #include <sys/asm_linkage.h>
  33 #include <sys/reboot.h>
  34 #include <sys/trap.h>
  35 
  36 /*
  37  *  exitto is called from main() and does 1 things
  38  *      It then jumps directly to the just-loaded standalone.
  39  *      There is NO RETURN from exitto(). ????
  40  */
  41 
  42 #if defined(lint)
  43 
  44 /* ARGSUSED */
  45 void
  46 exitto(caddr_t entrypoint)
  47 {}
  48 
  49 #else   /* lint */
  50 
  51         .data
  52 save_esp2:
  53         .long   0
  54 
  55         ENTRY(exitto)
  56         push    %ebp                    / save stack
  57         mov     %esp,%ebp
  58         pushal                          / protect secondary boot
  59 
  60         movl    %esp, %eax
  61         movl    %eax, save_esp2
  62 
  63         /holds address of array of pointers to functions
  64         movl    $romp, %eax
  65         movl    (%eax), %ecx
  66 
  67         /holds address of bootops structure
  68         movl    $ops, %eax
  69         movl    (%eax), %ebx
  70 
  71         movl    8(%ebp), %eax           
  72         call   *%eax
  73 
  74         movl    save_esp2, %eax
  75         movl    %eax, %esp
  76 
  77         popal
  78         pop     %ebp                    / restore frame pointer
  79 
  80         ret
  81         SET_SIZE(exitto)
  82 #endif