1 /* $NetBSD: linux_machdep.h,v 1.6 2007/12/04 18:40:14 dsl Exp $ */
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _M68K_LINUX_MACHDEP_H
33 #define _M68K_LINUX_MACHDEP_H
35 #include <m68k/frame.h>
36 #include <compat/linux/common/linux_types.h>
37 #include <compat/linux/common/linux_signal.h>
38 #include <compat/linux/common/linux_siginfo.h>
41 * Signal stack definitions for old signal interface.
44 struct linux_sigcontext
{
45 linux_old_sigset_t sc_mask
; /* signal mask to restore */
46 u_int sc_sp
; /* usp to restore */
51 u_short sc_ps
; /* processor status (sr reg) */
55 * The Linux sigstate (state of hardware).
57 struct linux_sigstate
{
58 u_short ss_format
:4, /* frame # */
59 ss_vector
:12; /* vector offset */
60 struct linux_fpframe
{
61 u_int fpf_regs
[2][3]; /* only fp0 and fp1 */
67 } ss_fpstate
; /* 68881/68882 state info */
68 union F_u ss_frame
; /* original exception frame */
73 * The Linux compatible signal frame
74 * On Linux, the sigtramp code is on the frame structure.
76 struct linux_sigframe
{
78 int sf_signum
; /* signo for handler */
79 int sf_code
; /* Linux stores vector offset here */
80 struct linux_sigcontext
*sf_scp
; /* context ptr for handler */
83 #if LINUX__NSIG_WORDS > 1
84 /* This breaks backward compatibility, but Linux 2.1 has.... */
85 u_long c_extrasigmask
[LINUX__NSIG_WORDS
- 1];
87 struct linux_sigcontext c_sc
; /* actual context */
91 #define LINUX_SF_SIGTRAMP0 0xDEFC0014 /* addaw #20,sp */
92 #define LINUX_SF_SIGTRAMP1 (0x70004E40 | (LINUX_SYS_sigreturn << 16))
93 /* moveq #LINUX_SYS_sigreturn,d0; trap #0 */
96 * Signal stack definitions for new RT signal interface.
99 typedef struct linux_gregset
{
100 u_int gr_regs
[16]; /* d0-d7/a0-a6/usp */
105 typedef struct linux_fpregset
{
109 u_int fpr_regs
[8][3]; /* fp0-fp7 */
112 struct linux_mcontext
{
114 linux_gregset_t mc_gregs
;
115 linux_fpregset_t mc_fpregs
;
118 #define LINUX_MCONTEXT_VERSION 2
120 struct linux_ucontext
{
121 u_long uc_flags
; /* 0 */
122 struct linux_ucontext
*uc_link
; /* 0 */
123 linux_stack_t uc_stack
;
124 struct linux_mcontext uc_mc
;
125 struct linux_rt_sigstate
{
126 struct linux_rt_fpframe
{
130 unsigned int ss_unused1
:16,
133 union F_u ss_frame
; /* original exception frame */
136 linux_sigset_t uc_sigmask
;
140 * The Linux compatible RT signal frame
141 * On Linux, the sigtramp code is on the frame structure.
143 struct linux_rt_sigframe
{
146 struct linux_siginfo
*sf_pinfo
;
148 struct linux_siginfo sf_info
;
149 struct linux_ucontext sf_uc
;
153 #define LINUX_RT_SF_SIGTRAMP0 (0x203C0000 | (LINUX_SYS_rt_sigreturn >> 16))
154 #define LINUX_RT_SF_SIGTRAMP1 (0x00004E40 | (LINUX_SYS_rt_sigreturn << 16))
155 /* movel #LINUX_SYS_rt_sigreturn,#d0; trap #0 */
159 void linux_syscall_intern(struct proc
*);
161 #endif /* !_KERNEL */
163 #endif /* _M68K_LINUX_MACHDEP_H */