linux_machdep.h revision 1.12 1 1.12 njoly /* $NetBSD: linux_machdep.h,v 1.12 2011/11/21 22:00:42 njoly Exp $ */
2 1.1 erh
3 1.1 erh /*-
4 1.4 mycroft * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
5 1.1 erh * All rights reserved.
6 1.1 erh *
7 1.1 erh * This code is derived from software contributed to The NetBSD Foundation
8 1.1 erh * by Eric Haszlakiewicz.
9 1.1 erh *
10 1.1 erh * Redistribution and use in source and binary forms, with or without
11 1.1 erh * modification, are permitted provided that the following conditions
12 1.1 erh * are met:
13 1.1 erh * 1. Redistributions of source code must retain the above copyright
14 1.1 erh * notice, this list of conditions and the following disclaimer.
15 1.1 erh * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 erh * notice, this list of conditions and the following disclaimer in the
17 1.1 erh * documentation and/or other materials provided with the distribution.
18 1.1 erh *
19 1.1 erh * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 erh * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 erh * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 erh * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 erh * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 erh * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 erh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 erh * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 erh * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 erh * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 erh * POSSIBILITY OF SUCH DAMAGE.
30 1.1 erh */
31 1.1 erh
32 1.1 erh #ifndef _ALPHA_LINUX_MACHDEP_H
33 1.1 erh #define _ALPHA_LINUX_MACHDEP_H
34 1.1 erh
35 1.10 chs #include <compat/linux/common/linux_types.h>
36 1.6 christos #include <compat/linux/common/linux_signal.h>
37 1.10 chs #include <compat/linux/common/linux_siginfo.h>
38 1.6 christos
39 1.1 erh /*
40 1.1 erh * The Linux sigcontext, pretty much a standard alpha trapframe.
41 1.1 erh */
42 1.1 erh struct linux_sigcontext {
43 1.1 erh long sc_onstack;
44 1.1 erh long sc_mask;
45 1.1 erh long sc_pc;
46 1.1 erh long sc_ps;
47 1.1 erh long sc_regs[32];
48 1.1 erh long sc_ownedfp;
49 1.1 erh long sc_fpregs[32];
50 1.1 erh unsigned long sc_fpcr;
51 1.1 erh unsigned long sc_fp_control;
52 1.1 erh unsigned long sc_reserved1, sc_reserved2;
53 1.1 erh unsigned long sc_ssize;
54 1.1 erh char * sc_sbase;
55 1.1 erh unsigned long sc_traparg_a0;
56 1.1 erh unsigned long sc_traparg_a1;
57 1.1 erh unsigned long sc_traparg_a2;
58 1.1 erh unsigned long sc_fp_trap_pc;
59 1.1 erh unsigned long sc_fp_trigger_sum;
60 1.1 erh unsigned long sc_fp_trigger_inst;
61 1.1 erh };
62 1.1 erh
63 1.1 erh struct linux_ucontext {
64 1.1 erh u_long uc_flags;
65 1.1 erh struct linux_ucontext *uc_link;
66 1.1 erh linux_old_sigset_t uc_osf_sigmask;
67 1.1 erh linux_stack_t uc_stack;
68 1.1 erh struct linux_sigcontext uc_mcontext;
69 1.1 erh linux_sigset_t uc_sigmask;
70 1.1 erh };
71 1.1 erh
72 1.1 erh /*
73 1.1 erh * We make the stack look like Linux expects it when calling a signal
74 1.1 erh * handler, but use the BSD way of calling the handler and sigreturn().
75 1.1 erh */
76 1.1 erh
77 1.1 erh #define LINUX_INSN_MOV_R30_R16 0x47fe0410
78 1.1 erh #define LINUX_INSN_LDI_R0 0x201f0000
79 1.1 erh #define LINUX_INSN_CALLSYS 0x00000083
80 1.1 erh
81 1.1 erh struct linux_sigframe {
82 1.1 erh struct linux_sigcontext sf_sc;
83 1.1 erh unsigned long extramask[LINUX__NSIG_WORDS-1];
84 1.1 erh unsigned int retcode[3];
85 1.1 erh };
86 1.1 erh
87 1.1 erh struct linux_rt_sigframe {
88 1.1 erh struct linux_siginfo info;
89 1.1 erh struct linux_ucontext uc;
90 1.1 erh unsigned int retcode[3];
91 1.1 erh };
92 1.1 erh
93 1.1 erh #ifdef _KERNEL
94 1.1 erh __BEGIN_DECLS
95 1.12 njoly void setup_linux_rt_sigframe(struct trapframe *, const ksiginfo_t *,
96 1.12 njoly const sigset_t *);
97 1.12 njoly void setup_linux_sigframe(struct trapframe *, const ksiginfo_t *,
98 1.12 njoly const sigset_t *);
99 1.9 matt int linux_restore_sigcontext(struct lwp *, struct linux_sigcontext,
100 1.12 njoly sigset_t *);
101 1.9 matt void linux_syscall_intern(struct proc *);
102 1.1 erh __END_DECLS
103 1.1 erh #endif /* !_KERNEL */
104 1.1 erh
105 1.1 erh #endif /* _ALPHA_LINUX_MACHDEP_H */
106