xref: /titanic_52/usr/src/uts/intel/ia32/krtld/kobj_crt.s (revision 8918dff3e162b85faa068f02fc6f2ca350150e71)
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29/*
30 * exit routine from linker/loader to kernel
31 */
32
33#include <sys/asm_linkage.h>
34#include <sys/reboot.h>
35#include <sys/trap.h>
36
37/*
38 *  exitto is called from main() and does 1 things
39 *	It then jumps directly to the just-loaded standalone.
40 *	There is NO RETURN from exitto(). ????
41 */
42
43#if defined(lint)
44
45/* ARGSUSED */
46void
47exitto(caddr_t entrypoint)
48{}
49
50#else	/* lint */
51
52	.data
53save_esp2:
54        .long   0
55
56	ENTRY(exitto)
57	push	%ebp			/ save stack
58	mov	%esp,%ebp
59	pushal				/ protect secondary boot
60
61	movl	%esp, %eax
62	movl	%eax, save_esp2
63
64	movl	boothowto, %eax
65	andl	$RB_DEBUGENTER, %eax
66	jz	1f
67
68	/* enter the debugger */
69	int	$T_DBGENTR
70
711:
72	/holds address of array of pointers to functions
73	movl	$romp, %eax
74	movl    (%eax), %ecx
75
76	/holds address of bootops structure
77	movl	$ops, %eax
78	movl    (%eax), %ebx
79
80	movl	8(%ebp), %eax
81	call   *%eax
82
83	movl	save_esp2, %eax
84	movl	%eax, %esp
85
86	popal
87	pop	%ebp			/ restore frame pointer
88
89	ret
90	SET_SIZE(exitto)
91#endif
92