114456Ssos/*- 2230132Suqs * Copyright (c) 1995-1996 S��ren Schmidt 314456Ssos * All rights reserved. 414456Ssos * 514456Ssos * Redistribution and use in source and binary forms, with or without 614456Ssos * modification, are permitted provided that the following conditions 714456Ssos * are met: 814456Ssos * 1. Redistributions of source code must retain the above copyright 914456Ssos * notice, this list of conditions and the following disclaimer 1014456Ssos * in this position and unchanged. 1114456Ssos * 2. Redistributions in binary form must reproduce the above copyright 1214456Ssos * notice, this list of conditions and the following disclaimer in the 1314456Ssos * documentation and/or other materials provided with the distribution. 1414456Ssos * 3. The name of the author may not be used to endorse or promote products 1597748Sschweikh * derived from this software without specific prior written permission 1614456Ssos * 1714456Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1814456Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1914456Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2014456Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2114456Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2214456Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2314456Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2414456Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2514456Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2614456Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2714456Ssos * 2850477Speter * $FreeBSD: stable/10/sys/sys/imgact_elf.h 316277 2017-03-30 15:05:58Z ed $ 2914456Ssos */ 3014456Ssos 3125984Sjdp#ifndef _SYS_IMGACT_ELF_H_ 32186668Sobrien#define _SYS_IMGACT_ELF_H_ 3314456Ssos 3425984Sjdp#include <machine/elf.h> 3514456Ssos 3655205Speter#ifdef _KERNEL 3714456Ssos 38186668Sobrien#define AUXARGS_ENTRY(pos, id, val) {suword(pos++, id); suword(pos++, val);} 3914456Ssos 40100384Speterstruct thread; 41316277Sedstruct vnode; 42100384Speter 4314456Ssos/* 44300060Spfg * Structure used to pass information from the loader to the 4514456Ssos * stack fixup routine. 4614456Ssos */ 4714456Ssostypedef struct { 48153504Smarcel Elf_Ssize execfd; 49153504Smarcel Elf_Size phdr; 50153504Smarcel Elf_Size phent; 51153504Smarcel Elf_Size phnum; 52153504Smarcel Elf_Size pagesz; 53153504Smarcel Elf_Size base; 54153504Smarcel Elf_Size flags; 55153504Smarcel Elf_Size entry; 56108696Sjake} __ElfN(Auxargs); 5714456Ssos 5814456Ssostypedef struct { 59189771Sdchagin Elf_Note hdr; 60189771Sdchagin const char * vendor; 61189771Sdchagin int flags; 62196512Sbz boolean_t (*trans_osrel)(const Elf_Note *, int32_t *); 63196512Sbz#define BN_CAN_FETCH_OSREL 0x0001 /* Deprecated. */ 64210446Skib#define BN_TRANSLATE_OSREL 0x0002 /* Use trans_osrel to fetch osrel */ 65210446Skib /* after checking the image ABI specification, if needed. */ 66189771Sdchagin} Elf_Brandnote; 67189771Sdchagin 68189771Sdchagintypedef struct { 6959342Sobrien int brand; 70100384Speter int machine; 7172999Sobrien const char *compat_3_brand; /* pre Binutils 2.10 method (FBSD 3) */ 7259342Sobrien const char *emul_path; 7359342Sobrien const char *interp_path; 74123742Speter struct sysentvec *sysvec; 75123742Speter const char *interp_newpath; 76190708Sdchagin int flags; 77189771Sdchagin Elf_Brandnote *brand_note; 78196653Sbz#define BI_CAN_EXEC_DYN 0x0001 79196653Sbz#define BI_BRAND_NOTE 0x0002 /* May have note.ABI-tag section. */ 80196653Sbz#define BI_BRAND_NOTE_MANDATORY 0x0004 /* Must have note.ABI-tag section. */ 81108696Sjake} __ElfN(Brandinfo); 8214456Ssos 83108696Sjake__ElfType(Auxargs); 84108696Sjake__ElfType(Brandinfo); 8514456Ssos 86186668Sobrien#define MAX_BRANDS 8 8736735Sdfr 88108696Sjakeint __elfN(brand_inuse)(Elf_Brandinfo *entry); 89108696Sjakeint __elfN(insert_brand_entry)(Elf_Brandinfo *entry); 90108696Sjakeint __elfN(remove_brand_entry)(Elf_Brandinfo *entry); 91108696Sjakeint __elfN(freebsd_fixup)(register_t **, struct image_params *); 92204552Salfredint __elfN(coredump)(struct thread *, struct vnode *, off_t, int); 93279211Sjhbsize_t __elfN(populate_note)(int, void *, void *, size_t, void **); 9436735Sdfr 95133464Smarcel/* Machine specific function to dump per-thread information. */ 96133464Smarcelvoid __elfN(dump_thread)(struct thread *, void *, size_t *); 97133464Smarcel 98186680Sbzextern int __elfN(fallback_brand); 99189771Sdchaginextern Elf_Brandnote __elfN(freebsd_brandnote); 100196512Sbzextern Elf_Brandnote __elfN(kfreebsd_brandnote); 10155205Speter#endif /* _KERNEL */ 10225984Sjdp 10325984Sjdp#endif /* !_SYS_IMGACT_ELF_H_ */ 104