1*29add945Sskrll /* $NetBSD: kobj.h,v 1.21 2023/04/28 07:33:57 skrll Exp $ */ 21dd75d28Sad 31dd75d28Sad /*- 41dd75d28Sad * Copyright (c) 2008 The NetBSD Foundation, Inc. 51dd75d28Sad * All rights reserved. 61dd75d28Sad * 71dd75d28Sad * Redistribution and use in source and binary forms, with or without 81dd75d28Sad * modification, are permitted provided that the following conditions 91dd75d28Sad * are met: 101dd75d28Sad * 1. Redistributions of source code must retain the above copyright 111dd75d28Sad * notice, this list of conditions and the following disclaimer. 121dd75d28Sad * 2. Redistributions in binary form must reproduce the above copyright 131dd75d28Sad * notice, this list of conditions and the following disclaimer in the 141dd75d28Sad * documentation and/or other materials provided with the distribution. 151dd75d28Sad * 161dd75d28Sad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171dd75d28Sad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181dd75d28Sad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191dd75d28Sad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201dd75d28Sad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211dd75d28Sad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221dd75d28Sad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231dd75d28Sad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241dd75d28Sad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251dd75d28Sad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261dd75d28Sad * POSSIBILITY OF SUCH DAMAGE. 271dd75d28Sad */ 281dd75d28Sad 291dd75d28Sad #ifndef _SYS_KOBJ_H_ 301dd75d28Sad #define _SYS_KOBJ_H_ 311dd75d28Sad 32e7fd2252Schristos #if !defined(ELFSIZE) && !defined(_RUMPKERNEL) 33004c1f6dSchristos #define ELFSIZE KERN_ELFSIZE 34004c1f6dSchristos #endif 35004c1f6dSchristos 36964d1b01Spooka #include <sys/exec.h> 37da792af7Spooka #include <sys/exec_elf.h> 38da792af7Spooka 391dd75d28Sad typedef struct kobj *kobj_t; 401dd75d28Sad 411dd75d28Sad /* External interface. */ 42f32c83c1Spooka int kobj_load_vfs(kobj_t *, const char *, const bool); 43094fd6b6Schristos int kobj_load_mem(kobj_t *, const char *, void *, ssize_t); 44d0bd9aa4Sad int kobj_affix(kobj_t, const char *); 451dd75d28Sad void kobj_unload(kobj_t); 4661fa5bb9Sdyoung int kobj_stat(kobj_t, vaddr_t *, size_t *); 479dfa2c02Sad int kobj_find_section(kobj_t, const char *, void **, size_t *); 481dd75d28Sad 491dd75d28Sad /* MI-MD interface. */ 50*29add945Sskrll const Elf_Sym * kobj_symbol(kobj_t, uintptr_t); 5143f0ff6bSmartin int kobj_sym_lookup(kobj_t, uintptr_t, Elf_Addr *); 521dd75d28Sad int kobj_reloc(kobj_t, uintptr_t, const void *, bool, bool); 531dd75d28Sad int kobj_machdep(kobj_t, void *, size_t, bool); 541dd75d28Sad 55da792af7Spooka /* implementation interface. */ 56da792af7Spooka int kobj_renamespace(Elf_Sym *, size_t, char **, size_t *); 57da792af7Spooka 581dd75d28Sad #endif /* !_SYS_KOBJ_H_ */ 59