linux_machdep.h revision 1.7 1 1.7 martin /* $NetBSD: linux_machdep.h,v 1.7 2008/04/28 20:23:42 martin Exp $ */
2 1.1 itohy
3 1.1 itohy /*-
4 1.1 itohy * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.1 itohy * All rights reserved.
6 1.1 itohy *
7 1.1 itohy * This code is derived from software contributed to The NetBSD Foundation
8 1.1 itohy * by ITOH Yasufumi.
9 1.1 itohy *
10 1.1 itohy * Redistribution and use in source and binary forms, with or without
11 1.1 itohy * modification, are permitted provided that the following conditions
12 1.1 itohy * are met:
13 1.1 itohy * 1. Redistributions of source code must retain the above copyright
14 1.1 itohy * notice, this list of conditions and the following disclaimer.
15 1.1 itohy * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 itohy * notice, this list of conditions and the following disclaimer in the
17 1.1 itohy * documentation and/or other materials provided with the distribution.
18 1.1 itohy *
19 1.1 itohy * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 itohy * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 itohy * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 itohy * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 itohy * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 itohy * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 itohy * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 itohy * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 itohy * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 itohy * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 itohy * POSSIBILITY OF SUCH DAMAGE.
30 1.1 itohy */
31 1.1 itohy
32 1.1 itohy #ifndef _M68K_LINUX_MACHDEP_H
33 1.1 itohy #define _M68K_LINUX_MACHDEP_H
34 1.1 itohy
35 1.1 itohy #include <m68k/frame.h>
36 1.5 chs #include <compat/linux/common/linux_types.h>
37 1.1 itohy #include <compat/linux/common/linux_signal.h>
38 1.5 chs #include <compat/linux/common/linux_siginfo.h>
39 1.1 itohy
40 1.1 itohy /*
41 1.1 itohy * Signal stack definitions for old signal interface.
42 1.1 itohy */
43 1.1 itohy
44 1.1 itohy struct linux_sigcontext {
45 1.1 itohy linux_old_sigset_t sc_mask; /* signal mask to restore */
46 1.1 itohy u_int sc_sp; /* usp to restore */
47 1.1 itohy u_int sc_d0;
48 1.1 itohy u_int sc_d1;
49 1.1 itohy u_int sc_a0;
50 1.1 itohy u_int sc_a1;
51 1.1 itohy u_short sc_ps; /* processor status (sr reg) */
52 1.1 itohy u_int sc_pc;
53 1.1 itohy
54 1.1 itohy /*
55 1.1 itohy * The Linux sigstate (state of hardware).
56 1.1 itohy */
57 1.1 itohy struct linux_sigstate {
58 1.1 itohy u_short ss_format:4, /* frame # */
59 1.1 itohy ss_vector:12; /* vector offset */
60 1.1 itohy struct linux_fpframe {
61 1.1 itohy u_int fpf_regs[2][3]; /* only fp0 and fp1 */
62 1.1 itohy u_int fpf_fpcr;
63 1.1 itohy u_int fpf_fpsr;
64 1.1 itohy u_int fpf_fpiar;
65 1.1 itohy union FPF_u1 FPF_u1;
66 1.1 itohy union FPF_u2 FPF_u2;
67 1.1 itohy } ss_fpstate; /* 68881/68882 state info */
68 1.1 itohy union F_u ss_frame; /* original exception frame */
69 1.1 itohy } sc_ss;
70 1.1 itohy };
71 1.1 itohy
72 1.1 itohy /*
73 1.1 itohy * The Linux compatible signal frame
74 1.1 itohy * On Linux, the sigtramp code is on the frame structure.
75 1.1 itohy */
76 1.1 itohy struct linux_sigframe {
77 1.1 itohy void *sf_psigtramp;
78 1.1 itohy int sf_signum; /* signo for handler */
79 1.1 itohy int sf_code; /* Linux stores vector offset here */
80 1.1 itohy struct linux_sigcontext *sf_scp; /* context ptr for handler */
81 1.1 itohy int sf_sigtramp[2];
82 1.1 itohy struct linux_sigc2 {
83 1.1 itohy #if LINUX__NSIG_WORDS > 1
84 1.1 itohy /* This breaks backward compatibility, but Linux 2.1 has.... */
85 1.1 itohy u_long c_extrasigmask[LINUX__NSIG_WORDS - 1];
86 1.1 itohy #endif
87 1.1 itohy struct linux_sigcontext c_sc; /* actual context */
88 1.1 itohy } sf_c;
89 1.1 itohy };
90 1.1 itohy
91 1.1 itohy #define LINUX_SF_SIGTRAMP0 0xDEFC0014 /* addaw #20,sp */
92 1.1 itohy #define LINUX_SF_SIGTRAMP1 (0x70004E40 | (LINUX_SYS_sigreturn << 16))
93 1.1 itohy /* moveq #LINUX_SYS_sigreturn,d0; trap #0 */
94 1.1 itohy
95 1.1 itohy /*
96 1.1 itohy * Signal stack definitions for new RT signal interface.
97 1.1 itohy */
98 1.1 itohy
99 1.1 itohy typedef struct linux_gregset {
100 1.1 itohy u_int gr_regs[16]; /* d0-d7/a0-a6/usp */
101 1.1 itohy u_int gr_pc;
102 1.1 itohy u_int gr_sr;
103 1.1 itohy } linux_gregset_t;
104 1.1 itohy
105 1.1 itohy typedef struct linux_fpregset {
106 1.1 itohy u_int fpr_fpcr;
107 1.1 itohy u_int fpr_fpsr;
108 1.1 itohy u_int fpr_fpiar;
109 1.1 itohy u_int fpr_regs[8][3]; /* fp0-fp7 */
110 1.1 itohy } linux_fpregset_t;
111 1.1 itohy
112 1.1 itohy struct linux_mcontext {
113 1.1 itohy int mc_version;
114 1.1 itohy linux_gregset_t mc_gregs;
115 1.1 itohy linux_fpregset_t mc_fpregs;
116 1.1 itohy };
117 1.1 itohy
118 1.1 itohy #define LINUX_MCONTEXT_VERSION 2
119 1.1 itohy
120 1.1 itohy struct linux_ucontext {
121 1.1 itohy u_long uc_flags; /* 0 */
122 1.1 itohy struct linux_ucontext *uc_link; /* 0 */
123 1.1 itohy linux_stack_t uc_stack;
124 1.1 itohy struct linux_mcontext uc_mc;
125 1.1 itohy struct linux_rt_sigstate {
126 1.1 itohy struct linux_rt_fpframe {
127 1.1 itohy union FPF_u1 FPF_u1;
128 1.1 itohy union FPF_u2 FPF_u2;
129 1.1 itohy } ss_fpstate;
130 1.1 itohy unsigned int ss_unused1:16,
131 1.1 itohy ss_format:4,
132 1.1 itohy ss_vector:12;
133 1.1 itohy union F_u ss_frame; /* original exception frame */
134 1.1 itohy int ss_unused2[4];
135 1.1 itohy } uc_ss;
136 1.1 itohy linux_sigset_t uc_sigmask;
137 1.1 itohy };
138 1.1 itohy
139 1.1 itohy /*
140 1.1 itohy * The Linux compatible RT signal frame
141 1.1 itohy * On Linux, the sigtramp code is on the frame structure.
142 1.1 itohy */
143 1.1 itohy struct linux_rt_sigframe {
144 1.1 itohy void *sf_psigtramp;
145 1.1 itohy int sf_signum;
146 1.1 itohy struct linux_siginfo *sf_pinfo;
147 1.1 itohy void *sf_puc;
148 1.1 itohy struct linux_siginfo sf_info;
149 1.1 itohy struct linux_ucontext sf_uc;
150 1.1 itohy int sf_sigtramp[2];
151 1.1 itohy };
152 1.1 itohy
153 1.1 itohy #define LINUX_RT_SF_SIGTRAMP0 (0x203C0000 | (LINUX_SYS_rt_sigreturn >> 16))
154 1.1 itohy #define LINUX_RT_SF_SIGTRAMP1 (0x00004E40 | (LINUX_SYS_rt_sigreturn << 16))
155 1.1 itohy /* movel #LINUX_SYS_rt_sigreturn,#d0; trap #0 */
156 1.4 scw
157 1.4 scw #ifdef _KERNEL
158 1.4 scw __BEGIN_DECLS
159 1.6 dsl void linux_syscall_intern(struct proc *);
160 1.4 scw __END_DECLS
161 1.4 scw #endif /* !_KERNEL */
162 1.1 itohy
163 1.1 itohy #endif /* _M68K_LINUX_MACHDEP_H */
164