patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-x86_64 / ia32.h
1 #ifndef _ASM_X86_64_IA32_H
2 #define _ASM_X86_64_IA32_H
3
4 #include <linux/config.h>
5
6 #ifdef CONFIG_IA32_EMULATION
7
8 #include <linux/compat.h>
9
10 /*
11  * 32 bit structures for IA32 support.
12  */
13
14 #include <asm/sigcontext32.h>
15
16 /* signal.h */
17 struct sigaction32 {
18        unsigned int  sa_handler;        /* Really a pointer, but need to deal 
19                                              with 32 bits */
20        unsigned int sa_flags;
21        unsigned int sa_restorer;        /* Another 32 bit pointer */
22        compat_sigset_t sa_mask;         /* A 32 bit mask */
23 };
24
25 struct old_sigaction32 {
26        unsigned int  sa_handler;        /* Really a pointer, but need to deal 
27                                              with 32 bits */
28        compat_old_sigset_t sa_mask;             /* A 32 bit mask */
29        unsigned int sa_flags;
30        unsigned int sa_restorer;        /* Another 32 bit pointer */
31 };
32
33 typedef struct sigaltstack_ia32 {
34         unsigned int    ss_sp;
35         int             ss_flags;
36         unsigned int    ss_size;
37 } stack_ia32_t;
38
39 struct ucontext_ia32 {
40         unsigned int      uc_flags;
41         unsigned int      uc_link;
42         stack_ia32_t      uc_stack;
43         struct sigcontext_ia32 uc_mcontext;
44         compat_sigset_t   uc_sigmask;   /* mask last for extensibility */
45 };
46
47 /* This matches struct stat64 in glibc2.2, hence the absolutely
48  * insane amounts of padding around dev_t's.
49  */
50 struct stat64 {
51         unsigned long long      st_dev;
52         unsigned char           __pad0[4];
53
54 #define STAT64_HAS_BROKEN_ST_INO        1
55         unsigned int            __st_ino;
56
57         unsigned int            st_mode;
58         unsigned int            st_nlink;
59
60         unsigned int            st_uid;
61         unsigned int            st_gid;
62
63         unsigned long long      st_rdev;
64         unsigned char           __pad3[4];
65
66         long long               st_size;
67         unsigned int            st_blksize;
68
69         long long               st_blocks;/* Number 512-byte blocks allocated. */
70
71         unsigned                st_atime;
72         unsigned                st_atime_nsec;
73         unsigned                st_mtime;
74         unsigned                st_mtime_nsec;
75         unsigned                st_ctime;
76         unsigned                st_ctime_nsec;
77
78         unsigned long long      st_ino;
79 } __attribute__((packed));
80
81
82 typedef union sigval32 {
83         int sival_int;
84         unsigned int sival_ptr;
85 } sigval_t32;
86
87 typedef struct siginfo32 {
88         int si_signo;
89         int si_errno;
90         int si_code;
91
92         union {
93                 int _pad[((128/sizeof(int)) - 3)];
94
95                 /* kill() */
96                 struct {
97                         unsigned int _pid;      /* sender's pid */
98                         unsigned int _uid;      /* sender's uid */
99                 } _kill;
100
101                 /* POSIX.1b timers */
102                 struct {
103                         int _tid;               /* timer id */
104                         int _overrun;           /* overrun count */
105                         sigval_t32 _sigval;     /* same as below */
106                         int _sys_private;       /* not to be passed to user */
107                         int _overrun_incr;      /* amount to add to overrun */
108                 } _timer;
109
110                 /* POSIX.1b signals */
111                 struct {
112                         unsigned int _pid;      /* sender's pid */
113                         unsigned int _uid;      /* sender's uid */
114                         sigval_t32 _sigval;
115                 } _rt;
116
117                 /* SIGCHLD */
118                 struct {
119                         unsigned int _pid;      /* which child */
120                         unsigned int _uid;      /* sender's uid */
121                         int _status;            /* exit code */
122                         compat_clock_t _utime;
123                         compat_clock_t _stime;
124                 } _sigchld;
125
126                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
127                 struct {
128                         unsigned int _addr;     /* faulting insn/memory ref. */
129                 } _sigfault;
130
131                 /* SIGPOLL */
132                 struct {
133                         int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
134                         int _fd;
135                 } _sigpoll;
136         } _sifields;
137 } siginfo_t32;
138
139 struct sigframe32
140 {
141         u32 pretcode;
142         int sig;
143         struct sigcontext_ia32 sc;
144         struct _fpstate_ia32 fpstate;
145         unsigned int extramask[_COMPAT_NSIG_WORDS-1];
146 };
147
148 struct rt_sigframe32
149 {
150         u32 pretcode;
151         int sig;
152         u32 pinfo;
153         u32 puc;
154         struct siginfo32 info;
155         struct ucontext_ia32 uc;
156         struct _fpstate_ia32 fpstate;
157 };
158
159 struct ustat32 {
160         __u32   f_tfree;
161         compat_ino_t            f_tinode;
162         char                    f_fname[6];
163         char                    f_fpack[6];
164 };
165
166 #define IA32_STACK_TOP IA32_PAGE_OFFSET
167
168 #ifdef __KERNEL__
169 struct user_desc;
170 struct siginfo_t;
171 int do_get_thread_area(struct thread_struct *t, struct user_desc __user *info);
172 int do_set_thread_area(struct thread_struct *t, struct user_desc __user *info);
173 int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs);
174 int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from);
175 int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from);
176 #endif
177
178 #endif /* !CONFIG_IA32_SUPPORT */
179  
180 #endif