linux_exec.h revision 1.3
11.3Swiz/*	$NetBSD: linux_exec.h,v 1.3 2001/07/26 22:53:14 wiz Exp $  */
21.1Smanu
31.1Smanu/*-
41.1Smanu * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
51.1Smanu * All rights reserved.
61.1Smanu *
71.1Smanu * This code is derived from software contributed to The NetBSD Foundation
81.1Smanu * by Emmanuel Dreyfus.
91.1Smanu *
101.1Smanu * Redistribution and use in source and binary forms, with or without
111.1Smanu * modification, are permitted provided that the following conditions
121.1Smanu * are met:
131.1Smanu * 1. Redistributions of source code must retain the above copyright
141.1Smanu *    notice, this list of conditions and the following disclaimer.
151.1Smanu * 2. Redistributions in binary form must reproduce the above copyright
161.1Smanu *    notice, this list of conditions and the following disclaimer in the
171.1Smanu *    documentation and/or other materials provided with the distribution.
181.1Smanu * 3. All advertising materials mentioning features or use of this software
191.1Smanu *    must display the following acknowledgement:
201.1Smanu *	     This product includes software developed by the NetBSD
211.1Smanu *	     Foundation, Inc. and its contributors.
221.1Smanu * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Smanu *	   contributors may be used to endorse or promote products derived
241.1Smanu *	   from this software without specific prior written permission.
251.1Smanu *
261.1Smanu * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Smanu * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Smanu * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Smanu * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.1Smanu * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Smanu * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Smanu * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Smanu * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Smanu * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Smanu * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Smanu * POSSIBILITY OF SUCH DAMAGE.
371.1Smanu */
381.1Smanu
391.1Smanu#ifndef _POWERPC_LINUX_EXEC_H
401.1Smanu#define _POWERPC_LINUX_EXEC_H
411.1Smanu
421.1Smanu#include <sys/exec_aout.h>
431.1Smanu#include <sys/exec_elf.h>
441.1Smanu#include <sys/types.h>
451.1Smanu#include <sys/systm.h>
461.1Smanu
471.1Smanu/*
481.1Smanu * From Linux's include/asm-ppc/elf.h
491.1Smanu */
501.1Smanu#define LINUX_ELF_HWCAP (0)
511.1Smanu
521.1Smanu/*
531.1Smanu * From Linux's include/asm-ppc/param.h
541.1Smanu */
551.1Smanu# define LINUX_CLOCKS_PER_SEC 100	/* frequency at which times() counts */
561.1Smanu
571.1Smanu/*
581.1Smanu * Linux a.out format parameters
591.1Smanu */
601.1Smanu#define LINUX_M_POWERPC		MID_POWERPC
611.1Smanu#define LINUX_MID_MACHINE	LINUX_M_POWERPC
621.1Smanu
631.1Smanu/*
641.1Smanu * Linux Elf32 format parameters
651.1Smanu */
661.1Smanu
671.1Smanu/*
681.1Smanu * LINUX_ATEXIT_SIGNATURE enable the atexit_signature test. See
691.1Smanu * sys/compat/linux/common/linux_exec_elf32.c:linux_atexit_signature()
701.1Smanu */
711.1Smanu#define LINUX_ATEXIT_SIGNATURE	1
721.1Smanu
731.1Smanu/*
741.3Swiz * LINUX_SHIFT enable the 16 bytes shift for arguments and ELF auxiliary
751.1Smanu * table. This is needed on the PowerPC
761.1Smanu */
771.1Smanu#define LINUX_SHIFT 0x0000000FUL
781.1Smanu
791.1Smanu/*
801.1Smanu * LINUX_SP_WRAP enable the stack pointer wrap before Linux's ld.so
811.1Smanu * transfers control to the Linux executable. It is set to the size
821.1Smanu * of the stack pointer wrap code, which is defined in
831.1Smanu * sys/compat/linux/arch/powerpc/linux_sp_wrap.S
841.1Smanu */
851.1Smanu#define LINUX_SP_WRAP 0x30		/* Size of the stack pointer wrap code */
861.1Smanu
871.1Smanu/*
881.3Swiz * Entries in the ELF auxiliary table. This is counted from
891.1Smanu * sys/compat/linux/arc/powerpc/linux_exec_powerpc.c
901.1Smanu */
911.1Smanu#define LINUX_ELF_AUX_ENTRIES 14
921.1Smanu
931.1Smanu/*
941.1Smanu * Size of the auxiliary ELF table. On the PowerPC we need 16 extra bytes
951.1Smanu * in order to force an alignement on a 16 bytes boundary (this is expected
961.1Smanu * by PowerPC GNU ld.so). If we use LINUX_SP_WRAP, we also need some extra
971.1Smanu * room for the sp_wrap_code.
981.1Smanu */
991.1Smanu#ifdef LINUX_SP_WRAP
1001.1Smanu#define LINUX_ELF_AUX_ARGSIZ \
1011.2Schristos    ((howmany(ELF_AUX_ENTRIES * sizeof(LinuxAuxInfo), sizeof(Elf32_Addr))) \
1021.2Schristos    + 16 + LINUX_SP_WRAP)
1031.1Smanu#else
1041.1Smanu#define LINUX_ELF_AUX_ARGSIZ \
1051.2Schristos    ((howmany(ELF_AUX_ENTRIES * sizeof(LinuxAuxInfo), sizeof(Elf32_Addr))) + 16)
1061.1Smanu#endif
1071.1Smanu
1081.1Smanu/* XXX should use ELFNAME2 */
1091.1Smanu#define LINUX_COPYARGS_FUNCTION linux_elf32_copyargs
1101.1Smanu
1111.1Smanutypedef struct {
1121.1Smanu	Elf32_Sword a_type;
1131.1Smanu	Elf32_Word  a_v;
1141.1Smanu} LinuxAux32Info;
1151.1Smanu#define LinuxAuxInfo LinuxAux32Info
1161.1Smanu
1171.1Smanu#ifdef _KERNEL
1181.1Smanu__BEGIN_DECLS
1191.2Schristosvoid * linux_elf32_copyargs __P((struct exec_package *,
1201.2Schristos    struct ps_strings *, void *, void *));
1211.1Smanu__END_DECLS
1221.1Smanu#endif /* _KERNEL */
1231.1Smanu
1241.1Smanu#endif /* !_POWERPC_LINUX_EXEC_H */
125