Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/mach Handle the kernel clock service by the kernel.



details:   https://anonhg.NetBSD.org/src/rev/6606e66ce8cc
branches:  trunk
changeset: 540850:6606e66ce8cc
user:      manu <manu%NetBSD.org@localhost>
date:      Thu Dec 26 13:45:17 2002 +0000

description:
Handle the kernel clock service by the kernel.

diffstat:

 sys/compat/mach/mach_clock.c   |  12 ++++++++++--
 sys/compat/mach/mach_clock.h   |   5 ++++-
 sys/compat/mach/mach_exec.c    |   6 ++++--
 sys/compat/mach/mach_host.c    |  12 +++++++++---
 sys/compat/mach/mach_message.c |  10 ++++++----
 5 files changed, 33 insertions(+), 12 deletions(-)

diffs (174 lines):

diff -r 933593a61530 -r 6606e66ce8cc sys/compat/mach/mach_clock.c
--- a/sys/compat/mach/mach_clock.c      Thu Dec 26 13:37:18 2002 +0000
+++ b/sys/compat/mach/mach_clock.c      Thu Dec 26 13:45:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_clock.c,v 1.5 2002/12/17 18:42:56 manu Exp $ */
+/*     $NetBSD: mach_clock.c,v 1.6 2002/12/26 13:45:17 manu Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_clock.c,v 1.5 2002/12/17 18:42:56 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_clock.c,v 1.6 2002/12/26 13:45:17 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -49,9 +49,11 @@
 
 #include <compat/mach/mach_types.h>
 #include <compat/mach/mach_message.h>
+#include <compat/mach/mach_port.h>
 #include <compat/mach/mach_clock.h>
 #include <compat/mach/mach_syscallargs.h>
 
+struct mach_port *mach_clock_port;
 
 int
 mach_sys_clock_sleep_trap(p, v, retval)
@@ -153,3 +155,9 @@
        return 0;
 }
 
+void
+mach_clock_init(void)
+{
+       mach_clock_port = mach_port_get();
+       return;
+}
diff -r 933593a61530 -r 6606e66ce8cc sys/compat/mach/mach_clock.h
--- a/sys/compat/mach/mach_clock.h      Thu Dec 26 13:37:18 2002 +0000
+++ b/sys/compat/mach/mach_clock.h      Thu Dec 26 13:45:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_clock.h,v 1.3 2002/12/17 18:42:56 manu Exp $ */
+/*     $NetBSD: mach_clock.h,v 1.4 2002/12/26 13:45:18 manu Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -68,6 +68,9 @@
        mach_msg_trailer_t rep_trailer;
 } mach_clock_get_time_reply_t;
 
+extern struct mach_port *mach_clock_port;
+
 int mach_clock_get_time(struct mach_trap_args *);
+void mach_clock_init(void);
 
 #endif /* _MACH_CLOCK_H_ */
diff -r 933593a61530 -r 6606e66ce8cc sys/compat/mach/mach_exec.c
--- a/sys/compat/mach/mach_exec.c       Thu Dec 26 13:37:18 2002 +0000
+++ b/sys/compat/mach/mach_exec.c       Thu Dec 26 13:45:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_exec.c,v 1.17 2002/12/19 22:23:06 manu Exp $       */
+/*     $NetBSD: mach_exec.c,v 1.18 2002/12/26 13:45:18 manu Exp $       */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.17 2002/12/19 22:23:06 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.18 2002/12/26 13:45:18 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,6 +55,7 @@
 #include <compat/mach/mach_types.h>
 #include <compat/mach/mach_message.h>
 #include <compat/mach/mach_port.h>
+#include <compat/mach/mach_clock.h>
 #include <compat/mach/mach_semaphore.h>
 #include <compat/mach/mach_exec.h>
 
@@ -292,6 +293,7 @@
        mach_semaphore_init();
        mach_message_init();
        mach_port_init();
+       mach_clock_init();
 
        mach_cold = 0;
 
diff -r 933593a61530 -r 6606e66ce8cc sys/compat/mach/mach_host.c
--- a/sys/compat/mach/mach_host.c       Thu Dec 26 13:37:18 2002 +0000
+++ b/sys/compat/mach/mach_host.c       Thu Dec 26 13:45:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_host.c,v 1.16 2002/12/17 18:42:56 manu Exp $ */
+/*     $NetBSD: mach_host.c,v 1.17 2002/12/26 13:45:18 manu Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_host.c,v 1.16 2002/12/17 18:42:56 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_host.c,v 1.17 2002/12/26 13:45:18 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -51,6 +51,8 @@
 
 #include <compat/mach/mach_types.h>
 #include <compat/mach/mach_host.h>
+#include <compat/mach/mach_port.h>
+#include <compat/mach/mach_clock.h>
 #include <compat/mach/mach_errno.h>
 
 int 
@@ -154,6 +156,10 @@
        mach_host_get_clock_service_request_t *req = args->smsg;
        mach_host_get_clock_service_reply_t *rep = args->rmsg;
        size_t *msglen = args->rsize;
+       struct proc *p = args->p;
+       struct mach_right *mr;
+
+       mr = mach_right_get(mach_clock_port, p, MACH_PORT_RIGHT_SEND);
 
        rep->rep_msgh.msgh_bits = 
            MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) |
@@ -162,7 +168,7 @@
        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_body.msgh_descriptor_count = 1; /* XXX why? */
-       rep->rep_clock_serv.name = 0x60b; /* XXX */
+       rep->rep_clock_serv.name = (mach_port_t)mr;
        rep->rep_clock_serv.disposition = 0x11; /* XXX */
        rep->rep_trailer.msgh_trailer_size = 8;
 
diff -r 933593a61530 -r 6606e66ce8cc sys/compat/mach/mach_message.c
--- a/sys/compat/mach/mach_message.c    Thu Dec 26 13:37:18 2002 +0000
+++ b/sys/compat/mach/mach_message.c    Thu Dec 26 13:45:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_message.c,v 1.10 2002/12/26 11:41:46 manu Exp $ */
+/*     $NetBSD: mach_message.c,v 1.11 2002/12/26 13:45:18 manu Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.10 2002/12/26 11:41:46 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.11 2002/12/26 13:45:18 manu Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_mach.h" /* For COMPAT_MACH in <sys/ktrace.h> */
@@ -160,11 +160,13 @@
 
                /*
                 * If the remote port is a special port (host, kernel or
-                * bootstrap), the message will be handled by the kernel.
+                * clock), the message will be handled by the kernel.
                 */
                med = (struct mach_emuldata *)p->p_emuldata;
                mp = ((struct mach_right *)sm->msgh_remote_port)->mr_port;
-               if ((mp == med->med_host) || (mp == med->med_kernel)) {
+               if ((mp == med->med_host) || 
+                   (mp == med->med_kernel) ||
+                   (mp == mach_clock_port)) {
                        /* 
                         * Look for the function that will handle it,
                         * using the message id.



Home | Main Index | Thread Index | Old Index