patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-ppc64 / ppc32.h
1 #ifndef _PPC64_PPC32_H
2 #define _PPC64_PPC32_H
3
4 #include <linux/compat.h>
5 #include <asm/siginfo.h>
6 #include <asm/signal.h>
7
8 /*
9  * Data types and macros for providing 32b PowerPC support.
10  * 
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version
14  * 2 of the License, or (at your option) any later version.
15  */
16
17 /* Use this to get at 32-bit user passed pointers. */
18 /* Things to consider: the low-level assembly stub does
19    srl x, 0, x for first four arguments, so if you have
20    pointer to something in the first four arguments, just
21    declare it as a pointer, not u32. On the other side, 
22    arguments from 5th onwards should be declared as u32
23    for pointers, and need AA() around each usage.
24    A() macro should be used for places where you e.g.
25    have some internal variable u32 and just want to get
26    rid of a compiler warning. AA() has to be used in
27    places where you want to convert a function argument
28    to 32bit pointer or when you e.g. access pt_regs
29    structure and want to consider 32bit registers only.
30    -
31  */
32 #define A(__x) ((unsigned long)(__x))
33 #define AA(__x)                         \
34 ({      unsigned long __ret;            \
35         __asm__ ("clrldi        %0, %0, 32"     \
36                  : "=r" (__ret)         \
37                  : "0" (__x));          \
38         __ret;                          \
39 })
40
41 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
42
43 typedef struct compat_siginfo {
44         int si_signo;
45         int si_errno;
46         int si_code;
47
48         union {
49                 int _pad[SI_PAD_SIZE32];
50
51                 /* kill() */
52                 struct {
53                         compat_pid_t _pid;              /* sender's pid */
54                         compat_uid_t _uid;              /* sender's uid */
55                 } _kill;
56
57                 /* POSIX.1b timers */
58                 struct {
59                         unsigned int _timer1;
60                         unsigned int _timer2;
61                 } _timer;
62
63                 /* POSIX.1b signals */
64                 struct {
65                         compat_pid_t _pid;              /* sender's pid */
66                         compat_uid_t _uid;              /* sender's uid */
67                         compat_sigval_t _sigval;
68                 } _rt;
69
70                 /* SIGCHLD */
71                 struct {
72                         compat_pid_t _pid;              /* which child */
73                         compat_uid_t _uid;              /* sender's uid */
74                         int _status;                    /* exit code */
75                         compat_clock_t _utime;
76                         compat_clock_t _stime;
77                 } _sigchld;
78
79                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
80                 struct {
81                         unsigned int _addr; /* faulting insn/memory ref. */
82                 } _sigfault;
83
84                 /* SIGPOLL */
85                 struct {
86                         int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
87                         int _fd;
88                 } _sigpoll;
89         } _sifields;
90 } compat_siginfo_t;
91
92 #define __old_sigaction32       old_sigaction32
93
94 struct __old_sigaction32 {
95         unsigned                sa_handler;
96         compat_old_sigset_t     sa_mask;
97         unsigned int            sa_flags;
98         unsigned                sa_restorer;     /* not used by Linux/SPARC yet */
99 };
100
101
102
103 struct sigaction32 {
104        unsigned int  sa_handler;        /* Really a pointer, but need to deal with 32 bits */
105        unsigned int sa_flags;
106        unsigned int sa_restorer;        /* Another 32 bit pointer */
107        compat_sigset_t sa_mask;         /* A 32 bit mask */
108 };
109
110 typedef struct sigaltstack_32 {
111         unsigned int ss_sp;
112         int ss_flags;
113         compat_size_t ss_size;
114 } stack_32_t;
115
116 struct sigcontext32 {
117         unsigned int    _unused[4];
118         int             signal;
119         unsigned int    handler;
120         unsigned int    oldmask;
121         u32 regs;  /* 4 byte pointer to the pt_regs32 structure. */
122 };
123
124 struct mcontext32 {
125         elf_gregset_t32         mc_gregs;
126         elf_fpregset_t          mc_fregs;
127         unsigned int            mc_pad[2];
128         elf_vrregset_t32        mc_vregs __attribute__((__aligned__(16)));
129 };
130
131 struct ucontext32 { 
132         unsigned int            uc_flags;
133         unsigned int            uc_link;
134         stack_32_t              uc_stack;
135         int                     uc_pad[7];
136         u32                     uc_regs;        /* points to uc_mcontext field */
137         compat_sigset_t         uc_sigmask;     /* mask last for extensibility */
138         /* glibc has 1024-bit signal masks, ours are 64-bit */
139         int                     uc_maskext[30];
140         int                     uc_pad2[3];
141         struct mcontext32       uc_mcontext;
142 };
143
144 #endif  /* _PPC64_PPC32_H */