diff options
author | Kyle McMartin <kyle@parisc-linux.org> | 2006-01-15 14:10:29 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@duet.int.mcmartin.ca> | 2006-01-22 20:57:42 -0500 |
commit | f671c45df23005692daa200aba768c642fb14ef2 (patch) | |
tree | fbc882669f06171cd1a8be2ad7b99f062a6e1e57 /arch/parisc/kernel/signal32.h | |
parent | 16541c8745e28f62b3dcb6cb354b73c9c01ea178 (diff) |
[PARISC] Arch-specific compat signals
Add enough arch-specific compat signals code to enable parisc64
to compile and boot out of the mainline tree. There are likely still
many dragons here, but this is a start to squashing the last
big difference between the mainline tree and the parisc-linux tree.
The remaining bugs can be squashed as they come up.
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc/kernel/signal32.h')
-rw-r--r-- | arch/parisc/kernel/signal32.h | 127 |
1 files changed, 125 insertions, 2 deletions
diff --git a/arch/parisc/kernel/signal32.h b/arch/parisc/kernel/signal32.h index 4d1569e717cc..e39b38a67a87 100644 --- a/arch/parisc/kernel/signal32.h +++ b/arch/parisc/kernel/signal32.h | |||
@@ -20,8 +20,34 @@ | |||
20 | #define _PARISC64_KERNEL_SIGNAL32_H | 20 | #define _PARISC64_KERNEL_SIGNAL32_H |
21 | 21 | ||
22 | #include <linux/compat.h> | 22 | #include <linux/compat.h> |
23 | #include <asm/compat_signal.h> | 23 | |
24 | #include <asm/compat_rt_sigframe.h> | 24 | typedef compat_uptr_t compat_sighandler_t; |
25 | |||
26 | typedef struct compat_sigaltstack { | ||
27 | compat_uptr_t ss_sp; | ||
28 | compat_int_t ss_flags; | ||
29 | compat_size_t ss_size; | ||
30 | } compat_stack_t; | ||
31 | |||
32 | /* Most things should be clean enough to redefine this at will, if care | ||
33 | is taken to make libc match. */ | ||
34 | |||
35 | struct compat_sigaction { | ||
36 | compat_sighandler_t sa_handler; | ||
37 | compat_uint_t sa_flags; | ||
38 | compat_sigset_t sa_mask; /* mask last for extensibility */ | ||
39 | }; | ||
40 | |||
41 | /* 32-bit ucontext as seen from an 64-bit kernel */ | ||
42 | struct compat_ucontext { | ||
43 | compat_uint_t uc_flags; | ||
44 | compat_uptr_t uc_link; | ||
45 | compat_stack_t uc_stack; /* struct compat_sigaltstack (12 bytes)*/ | ||
46 | /* FIXME: Pad out to get uc_mcontext to start at an 8-byte aligned boundary */ | ||
47 | compat_uint_t pad[1]; | ||
48 | struct compat_sigcontext uc_mcontext; | ||
49 | compat_sigset_t uc_sigmask; /* mask last for extensibility */ | ||
50 | }; | ||
25 | 51 | ||
26 | /* ELF32 signal handling */ | 52 | /* ELF32 signal handling */ |
27 | 53 | ||
@@ -29,6 +55,103 @@ struct k_sigaction32 { | |||
29 | struct compat_sigaction sa; | 55 | struct compat_sigaction sa; |
30 | }; | 56 | }; |
31 | 57 | ||
58 | typedef struct compat_siginfo { | ||
59 | int si_signo; | ||
60 | int si_errno; | ||
61 | int si_code; | ||
62 | |||
63 | union { | ||
64 | int _pad[((128/sizeof(int)) - 3)]; | ||
65 | |||
66 | /* kill() */ | ||
67 | struct { | ||
68 | unsigned int _pid; /* sender's pid */ | ||
69 | unsigned int _uid; /* sender's uid */ | ||
70 | } _kill; | ||
71 | |||
72 | /* POSIX.1b timers */ | ||
73 | struct { | ||
74 | compat_timer_t _tid; /* timer id */ | ||
75 | int _overrun; /* overrun count */ | ||
76 | char _pad[sizeof(unsigned int) - sizeof(int)]; | ||
77 | compat_sigval_t _sigval; /* same as below */ | ||
78 | int _sys_private; /* not to be passed to user */ | ||
79 | } _timer; | ||
80 | |||
81 | /* POSIX.1b signals */ | ||
82 | struct { | ||
83 | unsigned int _pid; /* sender's pid */ | ||
84 | unsigned int _uid; /* sender's uid */ | ||
85 | compat_sigval_t _sigval; | ||
86 | } _rt; | ||
87 | |||
88 | /* SIGCHLD */ | ||
89 | struct { | ||
90 | unsigned int _pid; /* which child */ | ||
91 | unsigned int _uid; /* sender's uid */ | ||
92 | int _status; /* exit code */ | ||
93 | compat_clock_t _utime; | ||
94 | compat_clock_t _stime; | ||
95 | } _sigchld; | ||
96 | |||
97 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ | ||
98 | struct { | ||
99 | unsigned int _addr; /* faulting insn/memory ref. */ | ||
100 | } _sigfault; | ||
101 | |||
102 | /* SIGPOLL */ | ||
103 | struct { | ||
104 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ | ||
105 | int _fd; | ||
106 | } _sigpoll; | ||
107 | } _sifields; | ||
108 | } compat_siginfo_t; | ||
109 | |||
110 | int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from); | ||
111 | int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from); | ||
112 | |||
113 | /* In a deft move of uber-hackery, we decide to carry the top half of all | ||
114 | * 64-bit registers in a non-portable, non-ABI, hidden structure. | ||
115 | * Userspace can read the hidden structure if it *wants* but is never | ||
116 | * guaranteed to be in the same place. Infact the uc_sigmask from the | ||
117 | * ucontext_t structure may push the hidden register file downards | ||
118 | */ | ||
119 | struct compat_regfile { | ||
120 | /* Upper half of all the 64-bit registers that were truncated | ||
121 | on a copy to a 32-bit userspace */ | ||
122 | compat_int_t rf_gr[32]; | ||
123 | compat_int_t rf_iasq[2]; | ||
124 | compat_int_t rf_iaoq[2]; | ||
125 | compat_int_t rf_sar; | ||
126 | }; | ||
127 | |||
128 | #define COMPAT_SIGRETURN_TRAMP 4 | ||
129 | #define COMPAT_SIGRESTARTBLOCK_TRAMP 5 | ||
130 | #define COMPAT_TRAMP_SIZE (COMPAT_SIGRETURN_TRAMP + \ | ||
131 | COMPAT_SIGRESTARTBLOCK_TRAMP) | ||
132 | |||
133 | struct compat_rt_sigframe { | ||
134 | /* XXX: Must match trampoline size in arch/parisc/kernel/signal.c | ||
135 | Secondary to that it must protect the ERESTART_RESTARTBLOCK | ||
136 | trampoline we left on the stack (we were bad and didn't | ||
137 | change sp so we could run really fast.) */ | ||
138 | compat_uint_t tramp[COMPAT_TRAMP_SIZE]; | ||
139 | compat_siginfo_t info; | ||
140 | struct compat_ucontext uc; | ||
141 | /* Hidden location of truncated registers, *must* be last. */ | ||
142 | struct compat_regfile regs; | ||
143 | }; | ||
144 | |||
145 | /* | ||
146 | * The 32-bit ABI wants at least 48 bytes for a function call frame: | ||
147 | * 16 bytes for arg0-arg3, and 32 bytes for magic (the only part of | ||
148 | * which Linux/parisc uses is sp-20 for the saved return pointer...) | ||
149 | * Then, the stack pointer must be rounded to a cache line (64 bytes). | ||
150 | */ | ||
151 | #define SIGFRAME32 64 | ||
152 | #define FUNCTIONCALLFRAME32 48 | ||
153 | #define PARISC_RT_SIGFRAME_SIZE32 (((sizeof(struct compat_rt_sigframe) + FUNCTIONCALLFRAME32) + SIGFRAME32) & -SIGFRAME32) | ||
154 | |||
32 | void sigset_32to64(sigset_t *s64, compat_sigset_t *s32); | 155 | void sigset_32to64(sigset_t *s64, compat_sigset_t *s32); |
33 | void sigset_64to32(compat_sigset_t *s32, sigset_t *s64); | 156 | void sigset_64to32(compat_sigset_t *s32, sigset_t *s64); |
34 | int do_sigaltstack32 (const compat_stack_t __user *uss32, | 157 | int do_sigaltstack32 (const compat_stack_t __user *uss32, |