1bdc37934SDmitry Chagin /*- 2*1ca6b15bSDmitry Chagin * Copyright (c) 2013-2021 Dmitry Chagin <dchagin@FreeBSD.org> 3bdc37934SDmitry Chagin * 4bdc37934SDmitry Chagin * Redistribution and use in source and binary forms, with or without 5bdc37934SDmitry Chagin * modification, are permitted provided that the following conditions 6bdc37934SDmitry Chagin * are met: 7bdc37934SDmitry Chagin * 1. Redistributions of source code must retain the above copyright 8bdc37934SDmitry Chagin * notice, this list of conditions and the following disclaimer 9bdc37934SDmitry Chagin * in this position and unchanged. 10bdc37934SDmitry Chagin * 2. Redistributions in binary form must reproduce the above copyright 11bdc37934SDmitry Chagin * notice, this list of conditions and the following disclaimer in the 12bdc37934SDmitry Chagin * documentation and/or other materials provided with the distribution. 13bdc37934SDmitry Chagin * 14bdc37934SDmitry Chagin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15bdc37934SDmitry Chagin * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16bdc37934SDmitry Chagin * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17bdc37934SDmitry Chagin * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18bdc37934SDmitry Chagin * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19bdc37934SDmitry Chagin * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20bdc37934SDmitry Chagin * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21bdc37934SDmitry Chagin * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22bdc37934SDmitry Chagin * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23bdc37934SDmitry Chagin * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24bdc37934SDmitry Chagin * 25bdc37934SDmitry Chagin * $FreeBSD$ 26bdc37934SDmitry Chagin */ 27bdc37934SDmitry Chagin 28bdc37934SDmitry Chagin #ifndef _LINUX_VDSO_H_ 29bdc37934SDmitry Chagin #define _LINUX_VDSO_H_ 30bdc37934SDmitry Chagin 31bdc37934SDmitry Chagin #include <sys/types.h> 32bdc37934SDmitry Chagin 33bdc37934SDmitry Chagin struct linux_vdso_sym { 34bdc37934SDmitry Chagin SLIST_ENTRY(linux_vdso_sym) sym; 35bdc37934SDmitry Chagin uint32_t size; 36bdc37934SDmitry Chagin uintptr_t * ptr; 37bdc37934SDmitry Chagin char symname[]; 38bdc37934SDmitry Chagin }; 39bdc37934SDmitry Chagin 409931033bSDmitry Chagin vm_object_t __elfN(linux_shared_page_init)(char **, vm_size_t); 419931033bSDmitry Chagin void __elfN(linux_shared_page_fini)(vm_object_t, void *, vm_size_t); 429931033bSDmitry Chagin void __elfN(linux_vdso_fixup)(char *, vm_offset_t); 43bdc37934SDmitry Chagin void __elfN(linux_vdso_sym_init)(struct linux_vdso_sym *); 44bdc37934SDmitry Chagin 459931033bSDmitry Chagin int linux_map_vdso(struct proc *, vm_object_t, vm_offset_t, 469931033bSDmitry Chagin vm_offset_t, struct image_params *); 479931033bSDmitry Chagin 48bdc37934SDmitry Chagin #define LINUX_VDSO_SYM_INTPTR(name) \ 49bdc37934SDmitry Chagin uintptr_t name; \ 50bdc37934SDmitry Chagin LINUX_VDSO_SYM_DEFINE(name) 51bdc37934SDmitry Chagin 52bdc37934SDmitry Chagin #define LINUX_VDSO_SYM_CHAR(name) \ 53bdc37934SDmitry Chagin const char * name; \ 54bdc37934SDmitry Chagin LINUX_VDSO_SYM_DEFINE(name) 55bdc37934SDmitry Chagin 56bdc37934SDmitry Chagin #define LINUX_VDSO_SYM_DEFINE(name) \ 57bdc37934SDmitry Chagin static struct linux_vdso_sym name ## sym = { \ 58bdc37934SDmitry Chagin .symname = #name, \ 59bdc37934SDmitry Chagin .size = sizeof(#name), \ 60bdc37934SDmitry Chagin .ptr = (uintptr_t *)&name \ 61bdc37934SDmitry Chagin }; \ 62bdc37934SDmitry Chagin SYSINIT(__elfN(name ## _sym_init), SI_SUB_EXEC, \ 63bdc37934SDmitry Chagin SI_ORDER_FIRST, __elfN(linux_vdso_sym_init), &name ## sym); \ 64bdc37934SDmitry Chagin struct __hack 65bdc37934SDmitry Chagin 66bdc37934SDmitry Chagin #endif /* _LINUX_VDSO_H_ */ 67