linux_machdep.c revision 1.1 1 1.1 bjh21 /* $NetBSD: linux_machdep.c,v 1.1 2002/01/14 23:14:38 bjh21 Exp $ */
2 1.1 bjh21
3 1.1 bjh21 /*-
4 1.1 bjh21 * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
5 1.1 bjh21 * All rights reserved.
6 1.1 bjh21 *
7 1.1 bjh21 * This code is derived from software contributed to The NetBSD Foundation
8 1.1 bjh21 * by Frank van der Linden.
9 1.1 bjh21 *
10 1.1 bjh21 * Redistribution and use in source and binary forms, with or without
11 1.1 bjh21 * modification, are permitted provided that the following conditions
12 1.1 bjh21 * are met:
13 1.1 bjh21 * 1. Redistributions of source code must retain the above copyright
14 1.1 bjh21 * notice, this list of conditions and the following disclaimer.
15 1.1 bjh21 * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 bjh21 * notice, this list of conditions and the following disclaimer in the
17 1.1 bjh21 * documentation and/or other materials provided with the distribution.
18 1.1 bjh21 * 3. All advertising materials mentioning features or use of this software
19 1.1 bjh21 * must display the following acknowledgement:
20 1.1 bjh21 * This product includes software developed by the NetBSD
21 1.1 bjh21 * Foundation, Inc. and its contributors.
22 1.1 bjh21 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 bjh21 * contributors may be used to endorse or promote products derived
24 1.1 bjh21 * from this software without specific prior written permission.
25 1.1 bjh21 *
26 1.1 bjh21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 bjh21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 bjh21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 bjh21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 bjh21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 bjh21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 bjh21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 bjh21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 bjh21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 bjh21 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 bjh21 * POSSIBILITY OF SUCH DAMAGE.
37 1.1 bjh21 */
38 1.1 bjh21
39 1.1 bjh21 #include <sys/param.h>
40 1.1 bjh21
41 1.1 bjh21 __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.1 2002/01/14 23:14:38 bjh21 Exp $");
42 1.1 bjh21
43 1.1 bjh21 #include <sys/param.h>
44 1.1 bjh21 #include <sys/systm.h>
45 1.1 bjh21 #include <sys/signalvar.h>
46 1.1 bjh21 #include <sys/kernel.h>
47 1.1 bjh21 #include <sys/map.h>
48 1.1 bjh21 #include <sys/proc.h>
49 1.1 bjh21 #include <sys/user.h>
50 1.1 bjh21 #include <sys/buf.h>
51 1.1 bjh21 #include <sys/reboot.h>
52 1.1 bjh21 #include <sys/conf.h>
53 1.1 bjh21 #include <sys/exec.h>
54 1.1 bjh21 #include <sys/file.h>
55 1.1 bjh21 #include <sys/callout.h>
56 1.1 bjh21 #include <sys/malloc.h>
57 1.1 bjh21 #include <sys/mbuf.h>
58 1.1 bjh21 #include <sys/msgbuf.h>
59 1.1 bjh21 #include <sys/mount.h>
60 1.1 bjh21 #include <sys/vnode.h>
61 1.1 bjh21 #include <sys/device.h>
62 1.1 bjh21 #include <sys/syscallargs.h>
63 1.1 bjh21 #include <sys/filedesc.h>
64 1.1 bjh21 #include <sys/exec_elf.h>
65 1.1 bjh21 #include <sys/disklabel.h>
66 1.1 bjh21 #include <sys/ioctl.h>
67 1.1 bjh21 #include <miscfs/specfs/specdev.h>
68 1.1 bjh21
69 1.1 bjh21 #include <compat/linux/common/linux_types.h>
70 1.1 bjh21 #include <compat/linux/common/linux_signal.h>
71 1.1 bjh21 #include <compat/linux/common/linux_util.h>
72 1.1 bjh21 #include <compat/linux/common/linux_ioctl.h>
73 1.1 bjh21 #include <compat/linux/common/linux_hdio.h>
74 1.1 bjh21 #include <compat/linux/common/linux_exec.h>
75 1.1 bjh21 #include <compat/linux/common/linux_machdep.h>
76 1.1 bjh21
77 1.1 bjh21 #include <compat/linux/linux_syscallargs.h>
78 1.1 bjh21
79 1.1 bjh21 void
80 1.1 bjh21 linux_setregs(p, epp, stack)
81 1.1 bjh21 struct proc *p;
82 1.1 bjh21 struct exec_package *epp;
83 1.1 bjh21 u_long stack;
84 1.1 bjh21 {
85 1.1 bjh21 /* struct pcb *pcb = &p->p_addr->u_pcb; */
86 1.1 bjh21
87 1.1 bjh21 setregs(p, epp, stack);
88 1.1 bjh21 }
89 1.1 bjh21
90 1.1 bjh21 void
91 1.1 bjh21 linux_sendsig(catcher, sig, mask, code)
92 1.1 bjh21 sig_t catcher;
93 1.1 bjh21 int sig;
94 1.1 bjh21 sigset_t *mask;
95 1.1 bjh21 u_long code;
96 1.1 bjh21 {
97 1.1 bjh21
98 1.1 bjh21 panic("linux_sendsig not implemented");
99 1.1 bjh21 }
100 1.1 bjh21 /*
101 1.1 bjh21 * System call to cleanup state after a signal
102 1.1 bjh21 * has been taken. Reset signal mask and
103 1.1 bjh21 * stack state from context left by sendsig (above).
104 1.1 bjh21 * Return to previous pc and psl as specified by
105 1.1 bjh21 * context left by sendsig. Check carefully to
106 1.1 bjh21 * make sure that the user has not modified the
107 1.1 bjh21 * psl to gain improper privileges or to cause
108 1.1 bjh21 * a machine fault.
109 1.1 bjh21 */
110 1.1 bjh21 int
111 1.1 bjh21 linux_sys_rt_sigreturn(p, v, retval)
112 1.1 bjh21 struct proc *p;
113 1.1 bjh21 void *v;
114 1.1 bjh21 register_t *retval;
115 1.1 bjh21 {
116 1.1 bjh21 /* XXX XAX write me */
117 1.1 bjh21 return(ENOSYS);
118 1.1 bjh21 }
119 1.1 bjh21
120 1.1 bjh21 int
121 1.1 bjh21 linux_sys_sigreturn(p, v, retval)
122 1.1 bjh21 struct proc *p;
123 1.1 bjh21 void *v;
124 1.1 bjh21 register_t *retval;
125 1.1 bjh21 {
126 1.1 bjh21
127 1.1 bjh21 return ENOSYS;
128 1.1 bjh21 }
129 1.1 bjh21
130 1.1 bjh21 /*
131 1.1 bjh21 * major device numbers remapping
132 1.1 bjh21 */
133 1.1 bjh21 dev_t
134 1.1 bjh21 linux_fakedev(dev)
135 1.1 bjh21 dev_t dev;
136 1.1 bjh21 {
137 1.1 bjh21 /* XXX write me */
138 1.1 bjh21 return dev;
139 1.1 bjh21 }
140 1.1 bjh21
141 1.1 bjh21 /*
142 1.1 bjh21 * We come here in a last attempt to satisfy a Linux ioctl() call
143 1.1 bjh21 */
144 1.1 bjh21 int
145 1.1 bjh21 linux_machdepioctl(p, v, retval)
146 1.1 bjh21 struct proc *p;
147 1.1 bjh21 void *v;
148 1.1 bjh21 register_t *retval;
149 1.1 bjh21 {
150 1.1 bjh21 struct linux_sys_ioctl_args /* {
151 1.1 bjh21 syscallarg(int) fd;
152 1.1 bjh21 syscallarg(u_long) com;
153 1.1 bjh21 syscallarg(caddr_t) data;
154 1.1 bjh21 } */ *uap = v;
155 1.1 bjh21 struct sys_ioctl_args bia;
156 1.1 bjh21 u_long com;
157 1.1 bjh21
158 1.1 bjh21 SCARG(&bia, fd) = SCARG(uap, fd);
159 1.1 bjh21 SCARG(&bia, data) = SCARG(uap, data);
160 1.1 bjh21 com = SCARG(uap, com);
161 1.1 bjh21
162 1.1 bjh21 switch (com) {
163 1.1 bjh21 default:
164 1.1 bjh21 printf("linux_machdepioctl: invalid ioctl %08lx\n", com);
165 1.1 bjh21 return EINVAL;
166 1.1 bjh21 }
167 1.1 bjh21 SCARG(&bia, com) = com;
168 1.1 bjh21 return sys_ioctl(p, &bia, retval);
169 1.1 bjh21 }
170