linux_vdso.h revision 293523
1283407Sdchagin/*- 2283407Sdchagin * Copyright (c) 2013 Dmitry Chagin 3283407Sdchagin * All rights reserved. 4283407Sdchagin * 5283407Sdchagin * Redistribution and use in source and binary forms, with or without 6283407Sdchagin * modification, are permitted provided that the following conditions 7283407Sdchagin * are met: 8283407Sdchagin * 1. Redistributions of source code must retain the above copyright 9283407Sdchagin * notice, this list of conditions and the following disclaimer 10283407Sdchagin * in this position and unchanged. 11283407Sdchagin * 2. Redistributions in binary form must reproduce the above copyright 12283407Sdchagin * notice, this list of conditions and the following disclaimer in the 13283407Sdchagin * documentation and/or other materials provided with the distribution. 14283407Sdchagin * 15283407Sdchagin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16283407Sdchagin * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17283407Sdchagin * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18283407Sdchagin * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19283407Sdchagin * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20283407Sdchagin * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21283407Sdchagin * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22283407Sdchagin * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23283407Sdchagin * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24283407Sdchagin * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25283407Sdchagin * 26283407Sdchagin * $FreeBSD: stable/10/sys/compat/linux/linux_vdso.h 293523 2016-01-09 15:57:28Z dchagin $ 27283407Sdchagin */ 28283407Sdchagin 29283407Sdchagin#ifndef _LINUX_VDSO_H_ 30283407Sdchagin#define _LINUX_VDSO_H_ 31283407Sdchagin 32283407Sdchagin#include <sys/types.h> 33283407Sdchagin 34283407Sdchaginstruct linux_vdso_sym { 35283407Sdchagin SLIST_ENTRY(linux_vdso_sym) sym; 36283407Sdchagin uint32_t size; 37283407Sdchagin uintptr_t * ptr; 38283407Sdchagin char symname[]; 39283407Sdchagin}; 40283407Sdchagin 41283407Sdchaginvm_object_t __elfN(linux_shared_page_init)(char **); 42283407Sdchaginvoid __elfN(linux_shared_page_fini)(vm_object_t); 43283407Sdchaginvoid __elfN(linux_vdso_fixup)(struct sysentvec *); 44293523Sdchaginvoid __elfN(linux_vdso_reloc)(struct sysentvec *, long); 45283407Sdchaginvoid __elfN(linux_vdso_sym_init)(struct linux_vdso_sym *); 46283407Sdchagin 47283407Sdchagin#define LINUX_VDSO_SYM_INTPTR(name) \ 48283407Sdchaginuintptr_t name; \ 49283407SdchaginLINUX_VDSO_SYM_DEFINE(name) 50283407Sdchagin 51283407Sdchagin#define LINUX_VDSO_SYM_CHAR(name) \ 52283407Sdchaginconst char * name; \ 53283407SdchaginLINUX_VDSO_SYM_DEFINE(name) 54283407Sdchagin 55283407Sdchagin#define LINUX_VDSO_SYM_DEFINE(name) \ 56283407Sdchaginstatic struct linux_vdso_sym name ## sym = { \ 57283407Sdchagin .symname = #name, \ 58283407Sdchagin .size = sizeof(#name), \ 59283407Sdchagin .ptr = (uintptr_t *)&name \ 60283407Sdchagin}; \ 61283407SdchaginSYSINIT(__elfN(name ## _sym_init), SI_SUB_EXEC, \ 62283407Sdchagin SI_ORDER_FIRST, __elfN(linux_vdso_sym_init), &name ## sym); \ 63283407Sdchaginstruct __hack 64283407Sdchagin 65283407Sdchagin#endif /* _LINUX_VDSO_H_ */ 66