Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
0003  * Licensed under the GPL
0004  *
0005  * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
0006  */
0007 
0008 #ifndef __ASM_LDT_H
0009 #define __ASM_LDT_H
0010 
0011 #include <linux/mutex.h>
0012 #include <asm/ldt.h>
0013 
0014 extern void ldt_host_info(void);
0015 
0016 #define LDT_PAGES_MAX \
0017     ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
0018 #define LDT_ENTRIES_PER_PAGE \
0019     (PAGE_SIZE/LDT_ENTRY_SIZE)
0020 #define LDT_DIRECT_ENTRIES \
0021     ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
0022 
0023 struct ldt_entry {
0024     __u32 a;
0025     __u32 b;
0026 };
0027 
0028 typedef struct uml_ldt {
0029     int entry_count;
0030     struct mutex lock;
0031     union {
0032         struct ldt_entry * pages[LDT_PAGES_MAX];
0033         struct ldt_entry entries[LDT_DIRECT_ENTRIES];
0034     } u;
0035 } uml_ldt_t;
0036 
0037 #define LDT_entry_a(info) \
0038     ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
0039 
0040 #define LDT_entry_b(info) \
0041     (((info)->base_addr & 0xff000000) | \
0042     (((info)->base_addr & 0x00ff0000) >> 16) | \
0043     ((info)->limit & 0xf0000) | \
0044     (((info)->read_exec_only ^ 1) << 9) | \
0045     ((info)->contents << 10) | \
0046     (((info)->seg_not_present ^ 1) << 15) | \
0047     ((info)->seg_32bit << 22) | \
0048     ((info)->limit_in_pages << 23) | \
0049     ((info)->useable << 20) | \
0050     0x7000)
0051 
0052 #define _LDT_empty(info) (\
0053     (info)->base_addr   == 0    && \
0054     (info)->limit       == 0    && \
0055     (info)->contents    == 0    && \
0056     (info)->read_exec_only  == 1    && \
0057     (info)->seg_32bit   == 0    && \
0058     (info)->limit_in_pages  == 0    && \
0059     (info)->seg_not_present == 1    && \
0060     (info)->useable     == 0    )
0061 
0062 #ifdef CONFIG_X86_64
0063 #define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0))
0064 #else
0065 #define LDT_empty(info) (_LDT_empty(info))
0066 #endif
0067 
0068 struct uml_arch_mm_context {
0069     uml_ldt_t ldt;
0070 };
0071 
0072 #endif