Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/mach a bit more mach glue.



details:   https://anonhg.NetBSD.org/src/rev/4f0f90482cf9
branches:  trunk
changeset: 513364:4f0f90482cf9
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jul 29 19:30:56 2001 +0000

description:
a bit more mach glue.

diffstat:

 sys/compat/mach/mach_message.h     |  74 ++++++++++++++++++++++++++++++++++++++
 sys/compat/mach/mach_misc.c        |  43 +++++++++++++++++++++-
 sys/compat/mach/mach_syscall.h     |   6 +-
 sys/compat/mach/mach_syscallargs.h |  16 +++++++-
 sys/compat/mach/mach_syscalls.c    |   5 +-
 sys/compat/mach/mach_sysent.c      |   7 ++-
 sys/compat/mach/mach_types.h       |   3 +-
 sys/compat/mach/syscalls.master    |  13 +++++-
 8 files changed, 151 insertions(+), 16 deletions(-)

diffs (truncated from 313 to 300 lines):

diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/mach_message.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/mach/mach_message.h    Sun Jul 29 19:30:56 2001 +0000
@@ -0,0 +1,74 @@
+/*     $NetBSD: mach_message.h,v 1.1 2001/07/29 19:30:56 christos Exp $         */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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_MESSAGE_H_
+#define        _MACH_MESSAGE_H_
+
+typedef u_int32_t mach_msg_bits_t;
+typedef u_int32_t mach_msg_size_t;
+typedef u_int32_t mach_msg_id_t;
+typedef u_int32_t mach_msg_timeout_t;
+typedef u_int32_t mach_msg_option_t;
+
+/*
+ * Options
+ */
+#define MACH_MSG_OPTION_NONE   0x00000000
+#define        MACH_SEND_MSG           0x00000001
+#define        MACH_RCV_MSG            0x00000002
+#define MACH_RCV_LARGE         0x00000004
+#define MACH_SEND_TIMEOUT      0x00000010
+#define MACH_SEND_INTERRUPT    0x00000040
+#define MACH_SEND_CANCEL       0x00000080
+#define MACH_RCV_TIMEOUT       0x00000100
+#define MACH_RCV_NOTIFY                0x00000200
+#define MACH_RCV_INTERRUPT     0x00000400
+#define MACH_RCV_OVERWRITE     0x00001000
+#define MACH_SEND_ALWAYS       0x00010000
+#define MACH_SEND_TRAILER      0x00020000      
+
+typedef        struct {
+       mach_msg_bits_t msgh_bits;
+       mach_msg_size_t msgh_size;
+       mach_port_t     msgh_remote_port;
+       mach_port_t     msgh_local_port;
+       mach_msg_size_t msgh_reserved;
+       mach_msg_id_t   msgh_id;
+} mach_msg_header_t;
+
+#endif /* !_MACH_MESSAGE_H_ */
diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/mach_misc.c
--- a/sys/compat/mach/mach_misc.c       Sun Jul 29 15:50:29 2001 +0000
+++ b/sys/compat/mach/mach_misc.c       Sun Jul 29 19:30:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_misc.c,v 1.1 2001/07/14 02:11:00 christos Exp $    */
+/*     $NetBSD: mach_misc.c,v 1.2 2001/07/29 19:30:56 christos Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -78,8 +78,21 @@
 #include <miscfs/specfs/specdev.h>
 
 #include <compat/mach/mach_types.h>
+#include <compat/mach/mach_message.h>
 #include <compat/mach/mach_syscallargs.h>
 
+#ifdef DEBUG_MACH
+static void mach_print_msg_header_t(mach_msg_header_t *);
+
+static void
+mach_print_msg_header_t(mach_msg_header_t *mh) {
+       uprintf("msgh { bits=0x%x, size=%d, remote_port=%d, local_port=%d,"
+           "reserved=%d,id=%d }\n",
+           mh->msgh_bits, mh->msgh_size, mh->msgh_remote_port,
+           mh->msgh_local_port, mh->msgh_reserved, mh->msgh_id);
+}
+#endif /* DEBUG_MACH */
+
 int
 mach_sys_reply_port(struct proc *p, void *vv, register_t *r) {
        *r = 0;
@@ -113,8 +126,34 @@
 
 int
 mach_sys_msg_overwrite_trap(struct proc *p, void *v, register_t *r) {
+       struct mach_sys_msg_overwrite_trap_args *ap = v;
+       int error;
        *r = 0;
-       DPRINTF(("mach_sys_msg_overwrite_trap();\n"));
+
+       DPRINTF(("mach_sys_msg_overwrite_trap(%p, 0x%x,"
+           " %d, %d, 0x%x, %d, 0x%x, %p, %d);\n",
+           SCARG(ap, msg), SCARG(ap, option), SCARG(ap, send_size),
+           SCARG(ap, rcv_size), SCARG(ap, rcv_name), SCARG(ap, timeout),
+           SCARG(ap, notify), SCARG(ap, rcv_msg),
+           SCARG(ap, scatter_list_size)));
+
+       switch (SCARG(ap, option)) {
+       case MACH_SEND_MSG|MACH_RCV_MSG:
+               if (SCARG(ap, msg)) {
+                       mach_msg_header_t mh;
+                       if ((error = copyin(SCARG(ap, msg), &mh,
+                           sizeof(mh))) != 0)
+                               return error;
+#ifdef DEBUG_MACH
+                       mach_print_msg_header_t(&mh);
+#endif /* DEBUG_MACH */
+               }
+               break;
+       default:
+               uprintf("unhandled sys_msg_override_trap option %x\n",
+                   SCARG(ap, option));
+               break;
+       }
        return 0;
 }
 
diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/mach_syscall.h
--- a/sys/compat/mach/mach_syscall.h    Sun Jul 29 15:50:29 2001 +0000
+++ b/sys/compat/mach/mach_syscall.h    Sun Jul 29 19:30:56 2001 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: mach_syscall.h,v 1.1 2001/07/14 02:11:00 christos Exp $ */
+/* $NetBSD: mach_syscall.h,v 1.2 2001/07/29 19:30:56 christos Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.51 2001/05/30 11:37:32 mrg Exp 
+ * created from        NetBSD: syscalls.master,v 1.1 2001/07/14 02:11:02 christos Exp 
  */
 
 /* syscall: "reply_port" ret: "mach_port_name_t" args: */
@@ -19,7 +19,7 @@
 /* syscall: "host_self_trap" ret: "mach_port_name_t" args: */
 #define        MACH_SYS_host_self_trap 29
 
-/* syscall: "msg_overwrite_trap" ret: "mach_kern_return_t" args: */
+/* syscall: "msg_overwrite_trap" ret: "mach_kern_return_t" args: "mach_msg_header_t *" "mach_msg_option_t" "mach_msg_size_t" "mach_msg_size_t" "mach_port_name_t" "mach_msg_timeout_t" 
"mach_port_name_t" "mach_msg_header_t *" "mach_msg_size_t" */
 #define        MACH_SYS_msg_overwrite_trap     32
 
 /* syscall: "semaphore_signal_trap" ret: "mach_kern_return_t" args: "mach_port_name_t" */
diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/mach_syscallargs.h
--- a/sys/compat/mach/mach_syscallargs.h        Sun Jul 29 15:50:29 2001 +0000
+++ b/sys/compat/mach/mach_syscallargs.h        Sun Jul 29 19:30:56 2001 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: mach_syscallargs.h,v 1.1 2001/07/14 02:11:01 christos Exp $ */
+/* $NetBSD: mach_syscallargs.h,v 1.2 2001/07/29 19:30:56 christos Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.51 2001/05/30 11:37:32 mrg Exp 
+ * created from        NetBSD: syscalls.master,v 1.1 2001/07/14 02:11:02 christos Exp 
  */
 
 #ifndef _MACH_SYS__SYSCALLARGS_H_
@@ -26,6 +26,18 @@
                } be;                                                   \
        }
 
+struct mach_sys_msg_overwrite_trap_args {
+       syscallarg(mach_msg_header_t *) msg;
+       syscallarg(mach_msg_option_t) option;
+       syscallarg(mach_msg_size_t) send_size;
+       syscallarg(mach_msg_size_t) rcv_size;
+       syscallarg(mach_port_name_t) rcv_name;
+       syscallarg(mach_msg_timeout_t) timeout;
+       syscallarg(mach_port_name_t) notify;
+       syscallarg(mach_msg_header_t *) rcv_msg;
+       syscallarg(mach_msg_size_t) scatter_list_size;
+};
+
 struct mach_sys_semaphore_signal_trap_args {
        syscallarg(mach_port_name_t) signal_name;
 };
diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/mach_syscalls.c
--- a/sys/compat/mach/mach_syscalls.c   Sun Jul 29 15:50:29 2001 +0000
+++ b/sys/compat/mach/mach_syscalls.c   Sun Jul 29 19:30:56 2001 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: mach_syscalls.c,v 1.1 2001/07/14 02:11:01 christos Exp $ */
+/* $NetBSD: mach_syscalls.c,v 1.2 2001/07/29 19:30:56 christos Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.51 2001/05/30 11:37:32 mrg Exp 
+ * created from        NetBSD: syscalls.master,v 1.1 2001/07/14 02:11:02 christos Exp 
  */
 
 #if defined(_KERNEL_OPT)
@@ -19,6 +19,7 @@
 #include <sys/poll.h>
 #include <sys/syscallargs.h>
 #include <compat/mach/mach_types.h>
+#include <compat/mach/mach_message.h>
 #include <compat/mach/mach_syscallargs.h>
 #endif /* _KERNEL_OPT */
 
diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/mach_sysent.c
--- a/sys/compat/mach/mach_sysent.c     Sun Jul 29 15:50:29 2001 +0000
+++ b/sys/compat/mach/mach_sysent.c     Sun Jul 29 19:30:56 2001 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: mach_sysent.c,v 1.1 2001/07/14 02:11:02 christos Exp $ */
+/* $NetBSD: mach_sysent.c,v 1.2 2001/07/29 19:30:57 christos Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.51 2001/05/30 11:37:32 mrg Exp 
+ * created from        NetBSD: syscalls.master,v 1.1 2001/07/14 02:11:02 christos Exp 
  */
 
 #if defined(_KERNEL_OPT)
@@ -18,6 +18,7 @@
 #include <sys/poll.h>
 #include <sys/syscallargs.h>
 #include <compat/mach/mach_types.h>
+#include <compat/mach/mach_message.h>
 #include <compat/mach/mach_syscallargs.h>
 
 #define        s(type) sizeof(type)
@@ -87,7 +88,7 @@
            sys_nosys },                        /* 30 = unimplemented */
        { 0, 0, 0,
            sys_nosys },                        /* 31 = unimplemented */
-       { 0, 0, 0,
+       { 9, s(struct mach_sys_msg_overwrite_trap_args), 0,
            mach_sys_msg_overwrite_trap },      /* 32 = msg_overwrite_trap */
        { 1, s(struct mach_sys_semaphore_signal_trap_args), 0,
            mach_sys_semaphore_signal_trap },   /* 33 = semaphore_signal_trap */
diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/mach_types.h
--- a/sys/compat/mach/mach_types.h      Sun Jul 29 15:50:29 2001 +0000
+++ b/sys/compat/mach/mach_types.h      Sun Jul 29 19:30:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_types.h,v 1.1 2001/07/14 02:11:02 christos Exp $   */
+/*     $NetBSD: mach_types.h,v 1.2 2001/07/29 19:30:57 christos Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -44,7 +44,6 @@
 typedef int mach_kern_return_t;
 typedef int mach_clock_res_t;
 typedef int mach_boolean_t;
-typedef int mach_msg_timeout_t;
 typedef int mach_sleep_type_t;
 typedef int mach_timespec_t;
 typedef int mach_absolute_time_t;
diff -r 09f45378d816 -r 4f0f90482cf9 sys/compat/mach/syscalls.master
--- a/sys/compat/mach/syscalls.master   Sun Jul 29 15:50:29 2001 +0000
+++ b/sys/compat/mach/syscalls.master   Sun Jul 29 19:30:56 2001 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.1 2001/07/14 02:11:02 christos Exp $
+       $NetBSD: syscalls.master,v 1.2 2001/07/29 19:30:57 christos Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -45,6 +45,7 @@
 #include <sys/syscallargs.h>
 
 #include <compat/mach/mach_types.h>
+#include <compat/mach/mach_message.h>
 #include <compat/mach/mach_syscallargs.h>
 %%
 
@@ -82,7 +83,15 @@
 30     UNIMPL  
 31     UNIMPL  
 32     STD             { mach_kern_return_t    mach_sys_msg_overwrite_trap( \



Home | Main Index | Thread Index | Old Index