ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / include / sysdep-i386 / frame_kern.h
1 /* 
2  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #ifndef __FRAME_KERN_I386_H
7 #define __FRAME_KERN_I386_H
8
9 /* This is called from sys_sigreturn.  It takes the sp at the point of the
10  * sigreturn system call and returns the address of the sigcontext struct
11  * on the stack.
12  */
13
14 static inline void *sp_to_sc(unsigned long sp)
15 {
16         return((void *) sp);
17 }
18
19 static inline void *sp_to_uc(unsigned long sp)
20 {
21         unsigned long uc;
22
23         uc = sp + signal_frame_si.uc_index - 
24                 signal_frame_si.common.sp_index - 4;
25         return((void *) uc);
26 }
27
28 static inline void *sp_to_rt_sc(unsigned long sp)
29 {
30         unsigned long sc;
31
32         sc = sp - signal_frame_si.common.sp_index + 
33                 signal_frame_si.common.len - 4;
34         return((void *) sc);
35 }
36
37 static inline void *sp_to_mask(unsigned long sp)
38 {
39         unsigned long mask;
40
41         mask = sp - signal_frame_sc.common.sp_index + 
42                 signal_frame_sc.common.len - 8;
43         return((void *) mask);
44 }
45
46 extern int sc_size(void *data);
47
48 static inline void *sp_to_rt_mask(unsigned long sp)
49 {
50         unsigned long mask;
51
52         mask = sp - signal_frame_si.common.sp_index + 
53                 signal_frame_si.common.len + 
54                 sc_size(&signal_frame_si.common.arch) - 4;
55         return((void *) mask);
56 }
57
58 #endif
59
60 /*
61  * Overrides for Emacs so that we follow Linus's tabbing style.
62  * Emacs will notice this stuff at the end of the file and automatically
63  * adjust the settings for this buffer only.  This must remain at the end
64  * of the file.
65  * ---------------------------------------------------------------------------
66  * Local variables:
67  * c-file-style: "linux"
68  * End:
69  */