The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef __ARCH_DESC_H |
| 20 | #define __ARCH_DESC_H |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 21 | #include <asm/ldt.h> |
| 22 | #include <asm/segment.h> |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 23 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 24 | #ifndef __ASSEMBLY__ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 25 | #include <linux/preempt.h> |
| 26 | #include <linux/smp.h> |
| 27 | #include <linux/percpu.h> |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 28 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | #include <asm/mmu.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 30 | struct Xgt_desc_struct { |
| 31 | unsigned short size; |
| 32 | unsigned long address __attribute__((packed)); |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 33 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | unsigned short pad; |
| 35 | } __attribute__ ((packed)); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 36 | struct gdt_page |
| 37 | { |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 38 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 39 | struct desc_struct gdt[GDT_ENTRIES]; |
| 40 | } __attribute__((aligned(PAGE_SIZE))); |
Elliott Hughes | c95eb57 | 2013-01-29 18:15:55 -0800 | [diff] [blame] | 41 | #define DESCTYPE_LDT 0x82 |
| 42 | #define DESCTYPE_TSS 0x89 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 43 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
Elliott Hughes | c95eb57 | 2013-01-29 18:15:55 -0800 | [diff] [blame] | 44 | #define DESCTYPE_TASK 0x85 |
| 45 | #define DESCTYPE_INT 0x8e |
| 46 | #define DESCTYPE_TRAP 0x8f |
| 47 | #define DESCTYPE_DPL3 0x60 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 48 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
Elliott Hughes | c95eb57 | 2013-01-29 18:15:55 -0800 | [diff] [blame] | 49 | #define DESCTYPE_S 0x10 |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 50 | #define load_TR_desc() native_load_tr_desc() |
| 51 | #define load_gdt(dtr) native_load_gdt(dtr) |
| 52 | #define load_idt(dtr) native_load_idt(dtr) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 53 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 54 | #define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr)) |
| 55 | #define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt)) |
| 56 | #define store_gdt(dtr) native_store_gdt(dtr) |
| 57 | #define store_idt(dtr) native_store_idt(dtr) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 58 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 59 | #define store_tr(tr) (tr = native_store_tr()) |
| 60 | #define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt)) |
| 61 | #define load_TLS(t, cpu) native_load_tls(t, cpu) |
| 62 | #define set_ldt native_set_ldt |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 63 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 64 | #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
| 65 | #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
| 66 | #define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
| 67 | #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 68 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 69 | #define LDT_entry_a(info) ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) |
| 70 | #define LDT_entry_b(info) (((info)->base_addr & 0xff000000) | (((info)->base_addr & 0x00ff0000) >> 16) | ((info)->limit & 0xf0000) | (((info)->read_exec_only ^ 1) << 9) | ((info)->contents << 10) | (((info)->seg_not_present ^ 1) << 15) | ((info)->seg_32bit << 22) | ((info)->limit_in_pages << 23) | ((info)->useable << 20) | 0x7000) |
| 71 | #define LDT_empty(info) ( (info)->base_addr == 0 && (info)->limit == 0 && (info)->contents == 0 && (info)->read_exec_only == 1 && (info)->seg_32bit == 0 && (info)->limit_in_pages == 0 && (info)->seg_not_present == 1 && (info)->useable == 0 ) |
| 72 | #else |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 73 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 74 | #define GET_DESC_BASE(idx, gdt, base, lo_w, lo_b, hi_b) movb idx*8+4(gdt), lo_b; movb idx*8+7(gdt), hi_b; shll $16, base; movw idx*8+2(gdt), lo_w; |
| 75 | #endif |
| 76 | #endif |