Merge commit 'origin/upstream' into juha-devel
[qemu] / linux-user / i386 / syscall.h
1 /* default linux values for the selectors */
2 #define __USER_CS       (0x23)
3 #define __USER_DS       (0x2B)
4
5 struct target_pt_regs {
6     abi_ulong ebx;
7     abi_ulong ecx;
8     abi_ulong edx;
9     abi_ulong esi;
10     abi_ulong edi;
11     abi_ulong ebp;
12     abi_ulong eax;
13     abi_ulong xds;
14     abi_ulong xes;
15     abi_ulong xfs;
16     abi_ulong xgs;
17     abi_ulong orig_eax;
18     abi_ulong eip;
19     abi_ulong xcs;
20     abi_ulong eflags;
21     abi_ulong esp;
22     abi_ulong xss;
23 };
24
25 /* ioctls */
26
27 #define TARGET_LDT_ENTRIES      8192
28 #define TARGET_LDT_ENTRY_SIZE   8
29
30 #define TARGET_GDT_ENTRIES             9
31 #define TARGET_GDT_ENTRY_TLS_ENTRIES   3
32 #define TARGET_GDT_ENTRY_TLS_MIN       6
33 #define TARGET_GDT_ENTRY_TLS_MAX       (TARGET_GDT_ENTRY_TLS_MIN + TARGET_GDT_ENTRY_TLS_ENTRIES - 1)
34
35 struct target_modify_ldt_ldt_s {
36     unsigned int  entry_number;
37     abi_ulong base_addr;
38     unsigned int limit;
39     unsigned int flags;
40 };
41
42 /* vm86 defines */
43
44 #define TARGET_BIOSSEG          0x0f000
45
46 #define TARGET_CPU_086          0
47 #define TARGET_CPU_186          1
48 #define TARGET_CPU_286          2
49 #define TARGET_CPU_386          3
50 #define TARGET_CPU_486          4
51 #define TARGET_CPU_586          5
52
53 #define TARGET_VM86_SIGNAL      0       /* return due to signal */
54 #define TARGET_VM86_UNKNOWN     1       /* unhandled GP fault - IO-instruction or similar */
55 #define TARGET_VM86_INTx        2       /* int3/int x instruction (ARG = x) */
56 #define TARGET_VM86_STI 3       /* sti/popf/iret instruction enabled virtual interrupts */
57
58 /*
59  * Additional return values when invoking new vm86()
60  */
61 #define TARGET_VM86_PICRETURN   4       /* return due to pending PIC request */
62 #define TARGET_VM86_TRAP        6       /* return due to DOS-debugger request */
63
64 /*
65  * function codes when invoking new vm86()
66  */
67 #define TARGET_VM86_PLUS_INSTALL_CHECK  0
68 #define TARGET_VM86_ENTER               1
69 #define TARGET_VM86_ENTER_NO_BYPASS     2
70 #define TARGET_VM86_REQUEST_IRQ 3
71 #define TARGET_VM86_FREE_IRQ            4
72 #define TARGET_VM86_GET_IRQ_BITS        5
73 #define TARGET_VM86_GET_AND_RESET_IRQ   6
74
75 /*
76  * This is the stack-layout seen by the user space program when we have
77  * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
78  * is 'kernel_vm86_regs' (see below).
79  */
80
81 struct target_vm86_regs {
82 /*
83  * normal regs, with special meaning for the segment descriptors..
84  */
85         abi_long ebx;
86         abi_long ecx;
87         abi_long edx;
88         abi_long esi;
89         abi_long edi;
90         abi_long ebp;
91         abi_long eax;
92         abi_long __null_ds;
93         abi_long __null_es;
94         abi_long __null_fs;
95         abi_long __null_gs;
96         abi_long orig_eax;
97         abi_long eip;
98         unsigned short cs, __csh;
99         abi_long eflags;
100         abi_long esp;
101         unsigned short ss, __ssh;
102 /*
103  * these are specific to v86 mode:
104  */
105         unsigned short es, __esh;
106         unsigned short ds, __dsh;
107         unsigned short fs, __fsh;
108         unsigned short gs, __gsh;
109 };
110
111 struct target_revectored_struct {
112         abi_ulong __map[8];                     /* 256 bits */
113 };
114
115 struct target_vm86_struct {
116         struct target_vm86_regs regs;
117         abi_ulong flags;
118         abi_ulong screen_bitmap;
119         abi_ulong cpu_type;
120         struct target_revectored_struct int_revectored;
121         struct target_revectored_struct int21_revectored;
122 };
123
124 /*
125  * flags masks
126  */
127 #define TARGET_VM86_SCREEN_BITMAP       0x0001
128
129 struct target_vm86plus_info_struct {
130         abi_ulong flags;
131 #define TARGET_force_return_for_pic (1 << 0)
132 #define TARGET_vm86dbg_active       (1 << 1)  /* for debugger */
133 #define TARGET_vm86dbg_TFpendig     (1 << 2)  /* for debugger */
134 #define TARGET_is_vm86pus           (1 << 31) /* for vm86 internal use */
135         unsigned char vm86dbg_intxxtab[32];   /* for debugger */
136 };
137
138 struct target_vm86plus_struct {
139         struct target_vm86_regs regs;
140         abi_ulong flags;
141         abi_ulong screen_bitmap;
142         abi_ulong cpu_type;
143         struct target_revectored_struct int_revectored;
144         struct target_revectored_struct int21_revectored;
145         struct target_vm86plus_info_struct vm86plus;
146 };
147
148 #define UNAME_MACHINE "i686"