]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/xpr.c
xnu-1699.24.23.tar.gz
[apple/xnu.git] / osfmk / kern / xpr.c
index d6088c4c1fc5a44beecfe4d68cb905d5966ed30c..1b4d1670711ecaf8e0217acc40e9c19986623e1c 100644 (file)
@@ -1,23 +1,29 @@
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
@@ -133,7 +139,7 @@ xprbootstrap(void)
        /* leave room at the end for a saved copy of xprptr */
        size = nxprbufs * sizeof(struct xprbuf) + sizeof xprptr;
 
-       kr = kmem_alloc_wired(kernel_map, &addr, size);
+       kr = kmem_alloc_kobject(kernel_map, &addr, size);
        if (kr != KERN_SUCCESS)
                panic("xprbootstrap");
 
@@ -189,17 +195,22 @@ extern jmp_buf_t *db_recover;
  *     Called with arguments, it can dump xpr buffers in user tasks,
  *     assuming they use the same format as the kernel.
  */
+static spl_t xpr_dump_spl;
+static struct xprbuf *base;
+static int nbufs;
 void
 xpr_dump(
-       struct xprbuf   *base,
-       int             nbufs)
+       struct xprbuf   *_base,
+       int             _nbufs)
 {
        jmp_buf_t db_jmpbuf;
        jmp_buf_t *prev;
        struct xprbuf *last, *ptr;
        register struct xprbuf *x;
        int i;
-       spl_t s;
+
+       base = _base;
+       nbufs = _nbufs;
 
        if (base == 0) {
                base = xprbase;
@@ -210,7 +221,7 @@ xpr_dump(
                return;
 
        if (base == xprbase) {
-               s = splhigh();
+               xpr_dump_spl = splhigh();
                simple_lock(&xprlock);
        }
 
@@ -233,7 +244,7 @@ xpr_dump(
 
        if (base == xprbase) {
                simple_unlock(&xprlock);
-               splx(s);
+               splx(xpr_dump_spl);
        }
 }
 
@@ -256,13 +267,13 @@ xpr_search(
        if (!nxprbufs)
                return;
 
-       n = nxprbufs;
-
        s = splhigh();
        simple_lock(&xprlock);
 
        prev = db_recover;
-       if (_setjmp(db_recover = &db_jmpbuf) == 0)
+       if (_setjmp(db_recover = &db_jmpbuf) == 0) {
+           n = nxprbufs;
+
            for (x = *(struct xprbuf **)xprlast ; n--; ) {
                if (--x < xprbase)
                        x = xprlast - 1;
@@ -278,6 +289,7 @@ xpr_search(
                          x->cpuinfo, x->timestamp);
                db_printf(x->msg, x->arg1,x->arg2,x->arg3,x->arg4,x->arg5);
            }
+       }
        db_recover = prev;
 
        simple_unlock(&xprlock);