blob: e6b7f2234e439ccdac3400be1e49d2cd624f1d61 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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 */
17struct 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
25struct 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
33typedef struct sigaltstack_ia32 {
34 unsigned int ss_sp;
35 int ss_flags;
36 unsigned int ss_size;
37} stack_ia32_t;
38
39struct 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 */
50struct 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
81typedef struct compat_siginfo{
82 int si_signo;
83 int si_errno;
84 int si_code;
85
86 union {
87 int _pad[((128/sizeof(int)) - 3)];
88
89 /* kill() */
90 struct {
91 unsigned int _pid; /* sender's pid */
92 unsigned int _uid; /* sender's uid */
93 } _kill;
94
95 /* POSIX.1b timers */
96 struct {
Stephen Rothwell0d77e5a2005-06-23 00:10:14 -070097 compat_timer_t _tid; /* timer id */
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 int _overrun; /* overrun count */
99 compat_sigval_t _sigval; /* same as below */
100 int _sys_private; /* not to be passed to user */
101 int _overrun_incr; /* amount to add to overrun */
102 } _timer;
103
104 /* POSIX.1b signals */
105 struct {
106 unsigned int _pid; /* sender's pid */
107 unsigned int _uid; /* sender's uid */
108 compat_sigval_t _sigval;
109 } _rt;
110
111 /* SIGCHLD */
112 struct {
113 unsigned int _pid; /* which child */
114 unsigned int _uid; /* sender's uid */
115 int _status; /* exit code */
116 compat_clock_t _utime;
117 compat_clock_t _stime;
118 } _sigchld;
119
120 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
121 struct {
122 unsigned int _addr; /* faulting insn/memory ref. */
123 } _sigfault;
124
125 /* SIGPOLL */
126 struct {
127 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
128 int _fd;
129 } _sigpoll;
130 } _sifields;
131} compat_siginfo_t;
132
133struct sigframe32
134{
135 u32 pretcode;
136 int sig;
137 struct sigcontext_ia32 sc;
138 struct _fpstate_ia32 fpstate;
139 unsigned int extramask[_COMPAT_NSIG_WORDS-1];
140};
141
142struct rt_sigframe32
143{
144 u32 pretcode;
145 int sig;
146 u32 pinfo;
147 u32 puc;
148 compat_siginfo_t info;
149 struct ucontext_ia32 uc;
150 struct _fpstate_ia32 fpstate;
151};
152
153struct ustat32 {
154 __u32 f_tfree;
155 compat_ino_t f_tinode;
156 char f_fname[6];
157 char f_fpack[6];
158};
159
160#define IA32_STACK_TOP IA32_PAGE_OFFSET
161
162#ifdef __KERNEL__
163struct user_desc;
164struct siginfo_t;
165int do_get_thread_area(struct thread_struct *t, struct user_desc __user *info);
166int do_set_thread_area(struct thread_struct *t, struct user_desc __user *info);
167int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs);
Andi Kleenea0be472005-11-05 17:25:54 +0100168
169struct linux_binprm;
170extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
171 unsigned long stack_top, int exec_stack);
Andi Kleen88172102006-01-17 07:03:38 +0100172struct mm_struct;
173extern void ia32_pick_mmap_layout(struct mm_struct *mm);
Andi Kleenea0be472005-11-05 17:25:54 +0100174
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175#endif
176
177#endif /* !CONFIG_IA32_SUPPORT */
178
179#endif