ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / kernel / tt / sys-i386 / sigcontext.c
1 /* 
2  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #include <stdlib.h>
7 #include <asm/sigcontext.h>
8 #include "kern_util.h"
9 #include "sysdep/frame.h"
10
11 int copy_sc_from_user_tt(void *to_ptr, void *from_ptr, void *data)
12 {
13         struct arch_frame_data *arch = data;
14         struct sigcontext *to = to_ptr, *from = from_ptr;
15         struct _fpstate *to_fp, *from_fp;
16         unsigned long sigs;
17         int err;
18
19         to_fp = to->fpstate;
20         from_fp = from->fpstate;
21         sigs = to->oldmask;
22         err = copy_from_user_proc(to, from, sizeof(*to));
23         to->oldmask = sigs;
24         if(to_fp != NULL){
25                 err |= copy_from_user_proc(&to->fpstate, &to_fp,
26                                            sizeof(to->fpstate));
27                 err |= copy_from_user_proc(to_fp, from_fp, arch->fpstate_size);
28         }
29         return(err);
30 }
31
32 int copy_sc_to_user_tt(void *to_ptr, void *fp, void *from_ptr, void *data)
33 {
34         struct arch_frame_data *arch = data;
35         struct sigcontext *to = to_ptr, *from = from_ptr;
36         struct _fpstate *to_fp, *from_fp;
37         int err;
38
39         to_fp = (struct _fpstate *) 
40                 (fp ? (unsigned long) fp : ((unsigned long) to + sizeof(*to)));
41         from_fp = from->fpstate;
42         err = copy_to_user_proc(to, from, sizeof(*to));
43         if(from_fp != NULL){
44                 err |= copy_to_user_proc(&to->fpstate, &to_fp,
45                                          sizeof(to->fpstate));
46                 err |= copy_to_user_proc(to_fp, from_fp, arch->fpstate_size);
47         }
48         return(err);
49 }
50
51 /*
52  * Overrides for Emacs so that we follow Linus's tabbing style.
53  * Emacs will notice this stuff at the end of the file and automatically
54  * adjust the settings for this buffer only.  This must remain at the end
55  * of the file.
56  * ---------------------------------------------------------------------------
57  * Local variables:
58  * c-file-style: "linux"
59  * End:
60  */