~smartboyhw/wubi/bug-1080090-new

« back to all changes in this revision

Viewing changes to src/grub4dos/stage2/asm/.svn/text-base/segment.h.svn-base

  • Committer: Howard Chan
  • Date: 2012-11-20 10:16:05 UTC
  • Revision ID: smartboyhw@gmail.com-20121120101605-qfmjfsdynpzg9an9
Added images

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _ASM_SEGMENT_H
2
 
#define _ASM_SEGMENT_H
3
 
 
4
 
/*
5
 
 * The layout of the per-CPU GDT under Linux:
6
 
 *
7
 
 *   0 - null
8
 
 *   1 - reserved
9
 
 *   2 - reserved
10
 
 *   3 - reserved
11
 
 *
12
 
 *   4 - unused                 <==== new cacheline
13
 
 *   5 - unused
14
 
 *
15
 
 *  ------- start of TLS (Thread-Local Storage) segments:
16
 
 *
17
 
 *   6 - TLS segment #1                 [ glibc's TLS segment ]
18
 
 *   7 - TLS segment #2                 [ Wine's %fs Win32 segment ]
19
 
 *   8 - TLS segment #3
20
 
 *   9 - reserved
21
 
 *  10 - reserved
22
 
 *  11 - reserved
23
 
 *
24
 
 *  ------- start of kernel segments:
25
 
 *
26
 
 *  12 - kernel code segment            <==== new cacheline
27
 
 *  13 - kernel data segment
28
 
 *  14 - default user CS
29
 
 *  15 - default user DS
30
 
 *  16 - TSS
31
 
 *  17 - LDT
32
 
 *  18 - PNPBIOS support (16->32 gate)
33
 
 *  19 - PNPBIOS support
34
 
 *  20 - PNPBIOS support
35
 
 *  21 - PNPBIOS support
36
 
 *  22 - PNPBIOS support
37
 
 *  23 - APM BIOS support
38
 
 *  24 - APM BIOS support
39
 
 *  25 - APM BIOS support 
40
 
 *
41
 
 *  26 - ESPFIX small SS
42
 
 *  27 - unused
43
 
 *  28 - unused
44
 
 *  29 - unused
45
 
 *  30 - unused
46
 
 *  31 - TSS for double fault handler
47
 
 */
48
 
#define GDT_ENTRY_TLS_ENTRIES   3
49
 
#define GDT_ENTRY_TLS_MIN       6
50
 
#define GDT_ENTRY_TLS_MAX       (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
51
 
 
52
 
#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)
53
 
 
54
 
#define GDT_ENTRY_DEFAULT_USER_CS       14
55
 
#define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS * 8 + 3)
56
 
 
57
 
#define GDT_ENTRY_DEFAULT_USER_DS       15
58
 
#define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS * 8 + 3)
59
 
 
60
 
#define GDT_ENTRY_KERNEL_BASE   12
61
 
 
62
 
#define GDT_ENTRY_KERNEL_CS             (GDT_ENTRY_KERNEL_BASE + 0)
63
 
#define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8)
64
 
 
65
 
#define GDT_ENTRY_KERNEL_DS             (GDT_ENTRY_KERNEL_BASE + 1)
66
 
#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8)
67
 
 
68
 
#define GDT_ENTRY_TSS                   (GDT_ENTRY_KERNEL_BASE + 4)
69
 
#define GDT_ENTRY_LDT                   (GDT_ENTRY_KERNEL_BASE + 5)
70
 
 
71
 
#define GDT_ENTRY_PNPBIOS_BASE          (GDT_ENTRY_KERNEL_BASE + 6)
72
 
#define GDT_ENTRY_APMBIOS_BASE          (GDT_ENTRY_KERNEL_BASE + 11)
73
 
 
74
 
#define GDT_ENTRY_ESPFIX_SS             (GDT_ENTRY_KERNEL_BASE + 14)
75
 
#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8)
76
 
 
77
 
#define GDT_ENTRY_DOUBLEFAULT_TSS       31
78
 
 
79
 
/*
80
 
 * The GDT has 32 entries
81
 
 */
82
 
#define GDT_ENTRIES 32
83
 
 
84
 
#define GDT_SIZE (GDT_ENTRIES * 8)
85
 
 
86
 
/* Simple and small GDT entries for booting only */
87
 
 
88
 
#define GDT_ENTRY_BOOT_CS               2
89
 
#define __BOOT_CS       (GDT_ENTRY_BOOT_CS * 8)
90
 
 
91
 
#define GDT_ENTRY_BOOT_DS               (GDT_ENTRY_BOOT_CS + 1)
92
 
#define __BOOT_DS       (GDT_ENTRY_BOOT_DS * 8)
93
 
 
94
 
/*
95
 
 * The interrupt descriptor table has room for 256 idt's,
96
 
 * the global descriptor table is dependent on the number
97
 
 * of tasks we can have..
98
 
 */
99
 
#define IDT_ENTRIES 256
100
 
 
101
 
#endif