Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/mach Some bits of the first iokit call



details:   https://anonhg.NetBSD.org/src/rev/77aa0274ef4d
branches:  trunk
changeset: 542716:77aa0274ef4d
user:      manu <manu%NetBSD.org@localhost>
date:      Tue Feb 04 22:47:41 2003 +0000

description:
Some bits of the first iokit call

diffstat:

 sys/compat/mach/files.mach     |   3 +-
 sys/compat/mach/mach_iokit.c   |  75 ++++++++++++++++++++++++++++++++++++++++++
 sys/compat/mach/mach_iokit.h   |  64 +++++++++++++++++++++++++++++++++++
 sys/compat/mach/mach_message.c |  11 +++--
 sys/compat/mach/mach_namemap.c |   7 ++-
 5 files changed, 152 insertions(+), 8 deletions(-)

diffs (235 lines):

diff -r 30284d4151aa -r 77aa0274ef4d sys/compat/mach/files.mach
--- a/sys/compat/mach/files.mach        Tue Feb 04 22:38:15 2003 +0000
+++ b/sys/compat/mach/files.mach        Tue Feb 04 22:47:41 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.mach,v 1.10 2002/12/12 23:18:20 manu Exp $
+#      $NetBSD: files.mach,v 1.11 2003/02/04 22:47:41 manu Exp $
 #
 # Config file description for machine-independent Mach compat code.
 # Included by ports that need it.
@@ -11,6 +11,7 @@
 file   compat/mach/mach_errno.c        compat_mach | compat_darwin
 file   compat/mach/mach_exec.c         compat_mach | compat_darwin
 file   compat/mach/mach_host.c         compat_mach | compat_darwin
+file   compat/mach/mach_iokit.c        compat_mach | compat_darwin
 file   compat/mach/mach_misc.c         compat_mach | compat_darwin
 file   compat/mach/mach_message.c      compat_mach | compat_darwin
 file   compat/mach/mach_namemap.c      compat_mach | compat_darwin
diff -r 30284d4151aa -r 77aa0274ef4d sys/compat/mach/mach_iokit.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/mach/mach_iokit.c      Tue Feb 04 22:47:41 2003 +0000
@@ -0,0 +1,75 @@
+/*     $NetBSD: mach_iokit.c,v 1.1 2003/02/04 22:47:41 manu Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.1 2003/02/04 22:47:41 manu Exp $");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/mount.h>
+#include <sys/proc.h>
+
+#include <compat/mach/mach_types.h>
+#include <compat/mach/mach_message.h>
+#include <compat/mach/mach_port.h>
+
+#include <compat/mach/mach_iokit.h>
+
+
+int
+mach_io_service_get_matching_services(args)
+       struct mach_trap_args *args;
+{
+       mach_io_service_get_matching_services_request_t *req = args->smsg;
+       mach_io_service_get_matching_services_reply_t *rep = args->rmsg;
+       size_t *msglen = args->rsize; 
+
+       rep->rep_msgh.msgh_bits = 
+           MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
+       rep->rep_msgh.msgh_size = sizeof(*rep) - sizeof(rep->rep_trailer);
+       rep->rep_msgh.msgh_local_port = req->req_msgh.msgh_local_port;
+       rep->rep_msgh.msgh_id = req->req_msgh.msgh_id + 100;
+       rep->rep_io_object = (mach_io_object_t)0xfffffed0; /* XXX Why? */
+       rep->rep_trailer.msgh_trailer_size = 8;
+
+       *msglen = sizeof(*rep);
+       return 0;
+}
diff -r 30284d4151aa -r 77aa0274ef4d sys/compat/mach/mach_iokit.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/mach/mach_iokit.h      Tue Feb 04 22:47:41 2003 +0000
@@ -0,0 +1,64 @@
+/*     $NetBSD: mach_iokit.h,v 1.1 2003/02/04 22:47:41 manu Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef        _MACH_IOKIT_H_
+#define        _MACH_IOKIT_H_
+
+typedef struct mach_io_object *mach_io_object_t;
+
+/* mach_io_service_get_matching_services */
+
+typedef struct {
+       mach_msg_header_t req_msgh;
+       mach_ndr_record_t req_ndr;
+       mach_io_object_t req_io_master;
+       mach_msg_size_t req_size;
+       char req_string[0];
+} mach_io_service_get_matching_services_request_t;
+
+typedef struct {
+       mach_msg_header_t rep_msgh; 
+       mach_ndr_record_t rep_ndr;
+       mach_io_object_t rep_io_object;
+       mach_msg_trailer_t rep_trailer;
+} mach_io_service_get_matching_services_reply_t;
+
+int mach_io_service_get_matching_services(struct mach_trap_args *);
+
+#endif /* _MACH_IOKIT_H_ */
+
diff -r 30284d4151aa -r 77aa0274ef4d sys/compat/mach/mach_message.c
--- a/sys/compat/mach/mach_message.c    Tue Feb 04 22:38:15 2003 +0000
+++ b/sys/compat/mach/mach_message.c    Tue Feb 04 22:47:41 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_message.c,v 1.22 2003/01/24 21:37:03 manu Exp $ */
+/*     $NetBSD: mach_message.c,v 1.23 2003/02/04 22:47:41 manu Exp $ */
 
 /*-
  * Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.22 2003/01/24 21:37:03 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.23 2003/02/04 22:47:41 manu Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_mach.h" /* For COMPAT_MACH in <sys/ktrace.h> */
@@ -171,13 +171,14 @@
                }
 
                /*
-                * If the remote port is a special port (host, kernel or
-                * clock), the message will be handled by the kernel.
+                * If the remote port is a special port (host, kernel,
+                * clock, or io_master), the message will be handled 
+                * by the kernel.
                 */
                med = (struct mach_emuldata *)p->p_emuldata;
                mp = rr->mr_port;
                if ((mp == med->med_host) || (mp == med->med_kernel) ||
-                   (mp == mach_clock_port) || 
+                   (mp == mach_clock_port) || (mp == mach_io_master_port) ||
                    (mp == mach_saved_bootstrap_port)) {
                        struct mach_trap_args args;
                        mach_msg_header_t *rm;
diff -r 30284d4151aa -r 77aa0274ef4d sys/compat/mach/mach_namemap.c
--- a/sys/compat/mach/mach_namemap.c    Tue Feb 04 22:38:15 2003 +0000
+++ b/sys/compat/mach/mach_namemap.c    Tue Feb 04 22:47:41 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_namemap.c,v 1.13 2003/02/02 19:07:18 manu Exp $ */
+/*     $NetBSD: mach_namemap.c,v 1.14 2003/02/04 22:47:42 manu Exp $ */
 
 /*-
  * Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.13 2003/02/02 19:07:18 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.14 2003/02/04 22:47:42 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -45,6 +45,7 @@
 #include <compat/mach/mach_types.h>
 #include <compat/mach/mach_message.h>
 #include <compat/mach/mach_bootstrap.h>
+#include <compat/mach/mach_iokit.h>
 #include <compat/mach/mach_clock.h>
 #include <compat/mach/mach_host.h>
 #include <compat/mach/mach_port.h>
@@ -61,6 +62,8 @@
 /*     { 403, mach_boostrap_register, "boostrap_register" }, */
        { 404, mach_bootstrap_look_up, "bootstrap_look_up" }, 
        { 1000, mach_clock_get_time, "clock_get_time" },
+       { 2804, mach_io_service_get_matching_services, 
+           "io_service_get_matching_services" },
        { 3201, mach_port_type, "port_type" },
        { 3204, mach_port_allocate, "port_allocate" },
        { 3205, mach_port_destroy, "port_destroy" },



Home | Main Index | Thread Index | Old Index