1/*- 2 * Copyright (c) 1994-1996 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/i386/linux/linux.h 161310 2006-08-15 12:54:30Z netchild $ |
29 */ 30 31#ifndef _I386_LINUX_LINUX_H_ 32#define _I386_LINUX_LINUX_H_ 33 34#include <sys/signal.h> /* for sigval union */ |
35#include <sys/param.h> 36#include <sys/lock.h> 37#include <sys/mutex.h> 38#include <sys/sx.h> |
39 40#include <i386/linux/linux_syscall.h> 41 42/* 43 * debugging support 44 */ 45extern u_char linux_debug_map[]; 46#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name) --- 658 unchanged lines hidden (view full) --- 705#define LINUX_POLLMSG 0x0400 706 707struct l_pollfd { 708 l_int fd; 709 l_short events; 710 l_short revents; 711}; 712 |
713struct l_user_desc { 714 l_uint entry_number; 715 l_uint base_addr; 716 l_uint limit; 717 l_uint seg_32bit:1; 718 l_uint contents:2; 719 l_uint read_exec_only:1; 720 l_uint limit_in_pages:1; 721 l_uint seg_not_present:1; 722 l_uint useable:1; 723}; 724 725struct l_desc_struct { 726 unsigned long a,b; 727}; 728 729 730#define LINUX_LOWERWORD 0x0000ffff 731 732/* macros which does the same thing as those in linux include/asm-um/ldt-i386.h 733 * these convert linux user-space descriptor to machine one 734 */ 735#define LDT_entry_a(info) \ 736 ((((info)->base_addr & LINUX_LOWERWORD) << 16) | ((info)->limit & LINUX_LOWERWORD)) 737 738#define ENTRY_B_READ_EXEC_ONLY 9 739#define ENTRY_B_CONTENTS 10 740#define ENTRY_B_SEG_NOT_PRESENT 15 741#define ENTRY_B_BASE_ADDR 16 742#define ENTRY_B_USEABLE 20 743#define ENTRY_B_SEG32BIT 22 744#define ENTRY_B_LIMIT 23 745 746#define LDT_entry_b(info) \ 747 (((info)->base_addr & 0xff000000) | \ 748 ((info)->limit & 0xf0000) | \ 749 ((info)->contents << ENTRY_B_CONTENTS) | \ 750 (((info)->seg_not_present == 0) << ENTRY_B_SEG_NOT_PRESENT) | \ 751 (((info)->base_addr & 0x00ff0000) >> ENTRY_B_BASE_ADDR) | \ 752 (((info)->read_exec_only == 0) << ENTRY_B_READ_EXEC_ONLY) | \ 753 ((info)->seg_32bit << ENTRY_B_SEG32BIT) | \ 754 ((info)->useable << ENTRY_B_USEABLE) | \ 755 ((info)->limit_in_pages << ENTRY_B_LIMIT) | 0x7000) 756 757#define LDT_empty(info) (\ 758 (info)->base_addr == 0 && \ 759 (info)->limit == 0 && \ 760 (info)->contents == 0 && \ 761 (info)->seg_not_present == 1 && \ 762 (info)->read_exec_only == 1 && \ 763 (info)->seg_32bit == 0 && \ 764 (info)->limit_in_pages == 0 && \ 765 (info)->useable == 0 ) 766 767/* macros for converting segments, they do the same as those in arch/i386/kernel/process.c */ 768#define GET_BASE(desc) ( \ 769 (((desc)->a >> 16) & LINUX_LOWERWORD) | \ 770 (((desc)->b << 16) & 0x00ff0000) | \ 771 ( (desc)->b & 0xff000000) ) 772 773#define GET_LIMIT(desc) ( \ 774 ((desc)->a & LINUX_LOWERWORD) | \ 775 ((desc)->b & 0xf0000) ) 776 777#define GET_32BIT(desc) (((desc)->b >> ENTRY_B_SEG32BIT) & 1) 778#define GET_CONTENTS(desc) (((desc)->b >> ENTRY_B_CONTENTS) & 3) 779#define GET_WRITABLE(desc) (((desc)->b >> ENTRY_B_READ_EXEC_ONLY) & 1) 780#define GET_LIMIT_PAGES(desc) (((desc)->b >> ENTRY_B_LIMIT) & 1) 781#define GET_PRESENT(desc) (((desc)->b >> ENTRY_B_SEG_NOT_PRESENT) & 1) 782#define GET_USEABLE(desc) (((desc)->b >> ENTRY_B_USEABLE) & 1) 783 784#define LINUX_CLOCK_REALTIME 0 785#define LINUX_CLOCK_MONOTONIC 1 786#define LINUX_CLOCK_PROCESS_CPUTIME_ID 2 787#define LINUX_CLOCK_THREAD_CPUTIME_ID 3 788#define LINUX_CLOCK_REALTIME_HR 4 789#define LINUX_CLOCK_MONOTONIC_HR 5 790 791typedef int l_timer_t; 792typedef int l_mqd_t; 793 794#define CLONE_VM 0x100 795#define CLONE_FS 0x200 796#define CLONE_FILES 0x400 797#define CLONE_SIGHAND 0x800 798#define CLONE_PID 0x1000 /* this flag does not exist in linux anymore */ 799#define CLONE_PARENT 0x00008000 800#define CLONE_THREAD 0x10000 801#define CLONE_SETTLS 0x80000 802#define CLONE_CHILD_CLEARTID 0x00200000 803#define CLONE_CHILD_SETTID 0x01000000 804#define CLONE_PARENT_SETTID 0x00100000 805 806#define THREADING_FLAGS (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND) 807 |
808#endif /* !_I386_LINUX_LINUX_H_ */ |