0.6.2-alt1.1
[qemu] / qemu-snapshot-2004-11-28_23 / linux-user / ppc / syscall.h
1 /*
2  *  PPC emulation for qemu: syscall definitions.
3  * 
4  *  Copyright (c) 2003 Jocelyn Mayer
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 /* XXX: ABSOLUTELY BUGGY:
22  * for now, this is quite just a cut-and-paste from i386 target...
23  */
24
25 /* default linux values for the selectors */
26 #define __USER_DS       (1)
27
28 struct target_pt_regs {
29         unsigned long gpr[32];
30         unsigned long nip;
31         unsigned long msr;
32         unsigned long orig_gpr3;        /* Used for restarting system calls */
33         unsigned long ctr;
34         unsigned long link;
35         unsigned long xer;
36         unsigned long ccr;
37         unsigned long mq;               /* 601 only (not used at present) */
38                                         /* Used on APUS to hold IPL value. */
39         unsigned long trap;             /* Reason for being here */
40         unsigned long dar;              /* Fault registers */
41         unsigned long dsisr;
42         unsigned long result;           /* Result of a system call */
43 };
44
45 /* ioctls */
46 struct target_revectored_struct {
47         target_ulong __map[8];                  /* 256 bits */
48 };
49
50 /*
51  * flags masks
52  */
53
54 /* ipcs */
55
56 #define TARGET_SEMOP           1
57 #define TARGET_SEMGET          2
58 #define TARGET_SEMCTL          3 
59 #define TARGET_MSGSND          11 
60 #define TARGET_MSGRCV          12
61 #define TARGET_MSGGET          13
62 #define TARGET_MSGCTL          14
63 #define TARGET_SHMAT           21
64 #define TARGET_SHMDT           22
65 #define TARGET_SHMGET          23
66 #define TARGET_SHMCTL          24
67
68 struct target_msgbuf {
69         int mtype;
70         char mtext[1];
71 };
72
73 struct target_ipc_kludge {
74         unsigned int    msgp;   /* Really (struct msgbuf *) */
75         int msgtyp;
76 };      
77
78 struct target_ipc_perm {
79         int     key;
80         unsigned short  uid;
81         unsigned short  gid;
82         unsigned short  cuid;
83         unsigned short  cgid;
84         unsigned short  mode;
85         unsigned short  seq;
86 };
87
88 struct target_msqid_ds {
89         struct target_ipc_perm  msg_perm;
90         unsigned int            msg_first;      /* really struct target_msg* */
91         unsigned int            msg_last;       /* really struct target_msg* */
92         unsigned int            msg_stime;      /* really target_time_t */
93         unsigned int            msg_rtime;      /* really target_time_t */
94         unsigned int            msg_ctime;      /* really target_time_t */
95         unsigned int            wwait;          /* really struct wait_queue* */
96         unsigned int            rwait;          /* really struct wait_queue* */
97         unsigned short          msg_cbytes;
98         unsigned short          msg_qnum;
99         unsigned short          msg_qbytes;
100         unsigned short          msg_lspid;
101         unsigned short          msg_lrpid;
102 };
103
104 struct target_shmid_ds {
105         struct target_ipc_perm  shm_perm;
106         int                     shm_segsz;
107         unsigned int            shm_atime;      /* really target_time_t */
108         unsigned int            shm_dtime;      /* really target_time_t */
109         unsigned int            shm_ctime;      /* really target_time_t */
110         unsigned short          shm_cpid;
111         unsigned short          shm_lpid;
112         short                   shm_nattch;
113         unsigned short          shm_npages;
114         unsigned long           *shm_pages;
115         void                    *attaches;      /* really struct shm_desc * */
116 };
117
118 #define TARGET_IPC_RMID 0
119 #define TARGET_IPC_SET  1
120 #define TARGET_IPC_STAT 2
121
122 union target_semun {
123     int val;
124     unsigned int buf;   /* really struct semid_ds * */
125     unsigned int array; /* really unsigned short * */
126     unsigned int __buf; /* really struct seminfo * */
127     unsigned int __pad; /* really void* */
128 };
129
130 #define UNAME_MACHINE "ppc"