MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / um / sys-i386 / sigcontext.c
blob28b16cd1b222536a8ba2622bd943152f9bf6c671
1 /*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #include <stddef.h>
7 #include <string.h>
8 #include <asm/ptrace.h>
9 #include <asm/sigcontext.h>
10 #include "sysdep/ptrace.h"
11 #include "kern_util.h"
12 #include "frame_user.h"
14 int sc_size(void *data)
16 struct arch_frame_data *arch = data;
18 return(sizeof(struct sigcontext) + arch->fpstate_size);
21 void sc_to_sc(void *to_ptr, void *from_ptr)
23 struct sigcontext *to = to_ptr, *from = from_ptr;
24 int size = sizeof(*to) + signal_frame_sc.common.arch.fpstate_size;
26 memcpy(to, from, size);
27 if(from->fpstate != NULL) to->fpstate = (struct _fpstate *) (to + 1);
30 unsigned long *sc_sigmask(void *sc_ptr)
32 struct sigcontext *sc = sc_ptr;
34 return(&sc->oldmask);
37 int sc_get_fpregs(unsigned long buf, void *sc_ptr)
39 struct sigcontext *sc = sc_ptr;
40 struct _fpstate *from = sc->fpstate, *to = (struct _fpstate *) buf;
41 int err = 0;
43 if(from == NULL){
44 err |= clear_user_proc(&to->cw, sizeof(to->cw));
45 err |= clear_user_proc(&to->sw, sizeof(to->sw));
46 err |= clear_user_proc(&to->tag, sizeof(to->tag));
47 err |= clear_user_proc(&to->ipoff, sizeof(to->ipoff));
48 err |= clear_user_proc(&to->cssel, sizeof(to->cssel));
49 err |= clear_user_proc(&to->dataoff, sizeof(to->dataoff));
50 err |= clear_user_proc(&to->datasel, sizeof(to->datasel));
51 err |= clear_user_proc(&to->_st, sizeof(to->_st));
53 else {
54 err |= copy_to_user_proc(&to->cw, &from->cw, sizeof(to->cw));
55 err |= copy_to_user_proc(&to->sw, &from->sw, sizeof(to->sw));
56 err |= copy_to_user_proc(&to->tag, &from->tag,
57 sizeof(to->tag));
58 err |= copy_to_user_proc(&to->ipoff, &from->ipoff,
59 sizeof(to->ipoff));
60 err |= copy_to_user_proc(&to->cssel,& from->cssel,
61 sizeof(to->cssel));
62 err |= copy_to_user_proc(&to->dataoff, &from->dataoff,
63 sizeof(to->dataoff));
64 err |= copy_to_user_proc(&to->datasel, &from->datasel,
65 sizeof(to->datasel));
66 err |= copy_to_user_proc(to->_st, from->_st, sizeof(to->_st));
68 return(err);
72 * Overrides for Emacs so that we follow Linus's tabbing style.
73 * Emacs will notice this stuff at the end of the file and automatically
74 * adjust the settings for this buffer only. This must remain at the end
75 * of the file.
76 * ---------------------------------------------------------------------------
77 * Local variables:
78 * c-file-style: "linux"
79 * End: