0.7.0-alt1
[qemu] / 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         long ebx;
7         long ecx;
8         long edx;
9         long esi;
10         long edi;
11         long ebp;
12         long eax;
13         int  xds;
14         int  xes;
15         long orig_eax;
16         long eip;
17         int  xcs;
18         long eflags;
19         long esp;
20         int  xss;
21 };
22
23 /* ioctls */
24
25 #define TARGET_LDT_ENTRIES      8192
26 #define TARGET_LDT_ENTRY_SIZE   8
27
28 #define TARGET_GDT_ENTRY_TLS_ENTRIES   3
29 #define TARGET_GDT_ENTRY_TLS_MIN       6
30 #define TARGET_GDT_ENTRY_TLS_MAX       (TARGET_GDT_ENTRY_TLS_MIN + TARGET_GDT_ENTRY_TLS_ENTRIES - 1)
31
32 struct target_modify_ldt_ldt_s {
33     unsigned int  entry_number;
34     target_ulong base_addr;
35     unsigned int limit;
36     unsigned int flags;
37 };
38
39 /* vm86 defines */
40
41 #define TARGET_BIOSSEG          0x0f000
42
43 #define TARGET_CPU_086          0
44 #define TARGET_CPU_186          1
45 #define TARGET_CPU_286          2
46 #define TARGET_CPU_386          3
47 #define TARGET_CPU_486          4
48 #define TARGET_CPU_586          5
49
50 #define TARGET_VM86_SIGNAL      0       /* return due to signal */
51 #define TARGET_VM86_UNKNOWN     1       /* unhandled GP fault - IO-instruction or similar */
52 #define TARGET_VM86_INTx        2       /* int3/int x instruction (ARG = x) */
53 #define TARGET_VM86_STI 3       /* sti/popf/iret instruction enabled virtual interrupts */
54
55 /*
56  * Additional return values when invoking new vm86()
57  */
58 #define TARGET_VM86_PICRETURN   4       /* return due to pending PIC request */
59 #define TARGET_VM86_TRAP        6       /* return due to DOS-debugger request */
60
61 /*
62  * function codes when invoking new vm86()
63  */
64 #define TARGET_VM86_PLUS_INSTALL_CHECK  0
65 #define TARGET_VM86_ENTER               1
66 #define TARGET_VM86_ENTER_NO_BYPASS     2
67 #define TARGET_VM86_REQUEST_IRQ 3
68 #define TARGET_VM86_FREE_IRQ            4
69 #define TARGET_VM86_GET_IRQ_BITS        5
70 #define TARGET_VM86_GET_AND_RESET_IRQ   6
71
72 /*
73  * This is the stack-layout seen by the user space program when we have
74  * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
75  * is 'kernel_vm86_regs' (see below).
76  */
77
78 struct target_vm86_regs {
79 /*
80  * normal regs, with special meaning for the segment descriptors..
81  */
82         target_long ebx;
83         target_long ecx;
84         target_long edx;
85         target_long esi;
86         target_long edi;
87         target_long ebp;
88         target_long eax;
89         target_long __null_ds;
90         target_long __null_es;
91         target_long __null_fs;
92         target_long __null_gs;
93         target_long orig_eax;
94         target_long eip;
95         unsigned short cs, __csh;
96         target_long eflags;
97         target_long esp;
98         unsigned short ss, __ssh;
99 /*
100  * these are specific to v86 mode:
101  */
102         unsigned short es, __esh;
103         unsigned short ds, __dsh;
104         unsigned short fs, __fsh;
105         unsigned short gs, __gsh;
106 };
107
108 struct target_revectored_struct {
109         target_ulong __map[8];                  /* 256 bits */
110 };
111
112 struct target_vm86_struct {
113         struct target_vm86_regs regs;
114         target_ulong flags;
115         target_ulong screen_bitmap;
116         target_ulong cpu_type;
117         struct target_revectored_struct int_revectored;
118         struct target_revectored_struct int21_revectored;
119 };
120
121 /*
122  * flags masks
123  */
124 #define TARGET_VM86_SCREEN_BITMAP       0x0001
125
126 struct target_vm86plus_info_struct {
127         target_ulong flags;
128 #define TARGET_force_return_for_pic (1 << 0)
129 #define TARGET_vm86dbg_active       (1 << 1)  /* for debugger */
130 #define TARGET_vm86dbg_TFpendig     (1 << 2)  /* for debugger */
131 #define TARGET_is_vm86pus           (1 << 31) /* for vm86 internal use */
132         unsigned char vm86dbg_intxxtab[32];   /* for debugger */
133 };
134
135 struct target_vm86plus_struct {
136         struct target_vm86_regs regs;
137         target_ulong flags;
138         target_ulong screen_bitmap;
139         target_ulong cpu_type;
140         struct target_revectored_struct int_revectored;
141         struct target_revectored_struct int21_revectored;
142         struct target_vm86plus_info_struct vm86plus;
143 };
144
145 /* ipcs */
146
147 #define TARGET_SEMOP           1
148 #define TARGET_SEMGET          2
149 #define TARGET_SEMCTL          3 
150 #define TARGET_MSGSND          11 
151 #define TARGET_MSGRCV          12
152 #define TARGET_MSGGET          13
153 #define TARGET_MSGCTL          14
154 #define TARGET_SHMAT           21
155 #define TARGET_SHMDT           22
156 #define TARGET_SHMGET          23
157 #define TARGET_SHMCTL          24
158
159 struct target_msgbuf {
160         int mtype;
161         char mtext[1];
162 };
163
164 struct target_ipc_kludge {
165         unsigned int    msgp;   /* Really (struct msgbuf *) */
166         int msgtyp;
167 };      
168
169 struct target_ipc_perm {
170         int     key;
171         unsigned short  uid;
172         unsigned short  gid;
173         unsigned short  cuid;
174         unsigned short  cgid;
175         unsigned short  mode;
176         unsigned short  seq;
177 };
178
179 struct target_msqid_ds {
180         struct target_ipc_perm  msg_perm;
181         unsigned int            msg_first;      /* really struct target_msg* */
182         unsigned int            msg_last;       /* really struct target_msg* */
183         unsigned int            msg_stime;      /* really target_time_t */
184         unsigned int            msg_rtime;      /* really target_time_t */
185         unsigned int            msg_ctime;      /* really target_time_t */
186         unsigned int            wwait;          /* really struct wait_queue* */
187         unsigned int            rwait;          /* really struct wait_queue* */
188         unsigned short          msg_cbytes;
189         unsigned short          msg_qnum;
190         unsigned short          msg_qbytes;
191         unsigned short          msg_lspid;
192         unsigned short          msg_lrpid;
193 };
194
195 struct target_shmid_ds {
196         struct target_ipc_perm  shm_perm;
197         int                     shm_segsz;
198         unsigned int            shm_atime;      /* really target_time_t */
199         unsigned int            shm_dtime;      /* really target_time_t */
200         unsigned int            shm_ctime;      /* really target_time_t */
201         unsigned short          shm_cpid;
202         unsigned short          shm_lpid;
203         short                   shm_nattch;
204         unsigned short          shm_npages;
205         unsigned long           *shm_pages;
206         void                    *attaches;      /* really struct shm_desc * */
207 };
208
209 #define TARGET_IPC_RMID 0
210 #define TARGET_IPC_SET  1
211 #define TARGET_IPC_STAT 2
212
213 union target_semun {
214     int val;
215     unsigned int buf;   /* really struct semid_ds * */
216     unsigned int array; /* really unsigned short * */
217     unsigned int __buf; /* really struct seminfo * */
218     unsigned int __pad; /* really void* */
219 };
220
221 #define UNAME_MACHINE "i686"