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 (c) 2010, Oracle and/or its affiliates. All rights reserved. 24 */ 25 26#include <sys/asm_linkage.h> 27#include <brand_misc.h> 28 29#if defined(lint) 30 31/*ARGSUSED*/ 32void 33brand_runexe(void *argv, ulong_t entry) 34{ 35} 36 37#else /* lint */ 38 .section ".text" 39 ENTRY_NP(brand_runexe) 40 /* 41 * Prepare to jump to the target program we actually want to run. 42 * If this program is dynamically linked then we'll be jumping to 43 * another copy of the linker. If it's a statically linked program 44 * we'll be jumping directy to it's main entry point. In any case, 45 * we need to reset our current state stack and register state to 46 * something similar to the initial process state setup by the kernel 47 * and documented at: 48 * usr/src/cmd/sgs/rtld/sparc/boot.s 49 * usr/src/cmd/sgs/rtld/sparcv9/boot.s 50 * 51 * Of course this is the same stack format as when this executable 52 * was first started, so here we'll just roll back the stack and 53 * frame pointers to their values when this processes first started 54 * execution. 55 * 56 * Our input parameters are stored in the %o? registers since we 57 * don't bother to allocate a new stack frame. 58 */ 59 sub %o0, CPTRSIZE + WINDOWSIZE + STACK_BIAS, %sp 60 clr %fp 61 62 /* 63 * We also have to make sure to clear %g1 since nornally ld.so.1 will 64 * set that to non-zero if there is an exit function that should be 65 * invoked when the process is terminating. This isn't actually 66 * necessary if the target program we're jumping to is a dynamically 67 * linked program since in that case we're actually jumping to another 68 * copy of ld.so.1 and it will just reset %g1, but if the target 69 * program we're jumping to is a statically linked binary that uses 70 * the standard sun compiler supplied crt1.o`_start(), it will check 71 * to see if %g1 is set. 72 */ 73 clr %g1 74 75 jmp %o1 ! jump to the target processes entry point 76 nop 77 /* 78 * target will never return. 79 */ 80 SET_SIZE(brand_runexe) 81#endif /* lint */ 82