The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/irix/irix_kmem.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: irix_kmem.c,v 1.8 2008/04/28 20:23:41 martin Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Emmanuel Dreyfus.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   29  * POSSIBILITY OF SUCH DAMAGE.
   30  */
   31 
   32 #include <sys/cdefs.h>
   33 __KERNEL_RCSID(0, "$NetBSD: irix_kmem.c,v 1.8 2008/04/28 20:23:41 martin Exp $");
   34 
   35 #include <sys/param.h>
   36 #include <sys/systm.h>
   37 #include <sys/proc.h>
   38 #include <sys/errno.h>
   39 #include <sys/ioctl.h>
   40 #include <sys/device.h>
   41 #include <sys/vnode.h>
   42 #include <sys/conf.h>
   43 
   44 #include <compat/irix/irix_kmem.h>
   45 #include <compat/irix/irix_sysmp.h>
   46 
   47 /*
   48  * We have no idea of theses value's meaning yet, but time will come
   49  */
   50 long irix_kernel_var[32] = { 0x7fff2fc8, 0x0fb72194, 0x00000000, 0x0fb68890,
   51                              0x7fff2f74, 0x7fff2fc8, 0x7fff2fc8, 0x7fff2f74,
   52                              0x7fff2f7c, 0x0fb7246c, 0x0fbd9178, 0x0fb910d4,
   53                              0x0fb65440, 0x00000800, 0x00400034, 0x0000000a,
   54                              0x00000008, 0x0fb73fb0, 0x00000000, 0x00000000,
   55                              0x00000000, 0x7fff3000, 0x00000001, 0x7fff2f74,
   56                              0x7fff2d24, 0x0fa85880, 0x00000001, 0x0fb60188,
   57                              0x00000004, 0x00000000, 0x00000000, 0x00000001,
   58                            };
   59 struct irix_kmem_softc {
   60         struct device irix_kmem_dev;
   61 };
   62 
   63 dev_type_open(irix_kmemopen);
   64 dev_type_close(irix_kmemclose);
   65 dev_type_read(irix_kmemread);
   66 dev_type_write(irix_kmemwrite);
   67 
   68 const struct cdevsw irix_kmem_cdevsw = {
   69         irix_kmemopen, irix_kmemclose, irix_kmemread, irix_kmemwrite,
   70         noioctl, nostop, notty, nopoll, nommap, nokqfilter,
   71 };
   72 
   73 void
   74 irix_kmemattach(struct device *parent, struct device *self, void *aux)
   75 {
   76         return;
   77 }
   78 
   79 int
   80 irix_kmemopen(dev, flags, fmt, l)
   81         dev_t dev;
   82         int flags, fmt;
   83         struct lwp *l;
   84 {
   85         return 0;
   86 }
   87 
   88 int
   89 irix_kmemread(dev_t dev, struct uio *uio, int flag)
   90 {
   91         void *buf = NULL;
   92         off_t buflen = 0;
   93         void *offset;
   94         int error = 0;
   95 
   96 #ifdef DEBUG_IRIX
   97         printf("irix_kmemread(): offset = 0x%08lx\n", (long)uio->uio_offset);
   98         printf("irix_kmemread(): addr = %p\n", uio->uio_iov->iov_base);
   99         printf("irix_kmemread(): len = 0x%08lx\n", (long)uio->uio_iov->iov_len);
  100 #endif
  101         offset = (void *)(uint32_t)uio->uio_offset; /* XXX */
  102         if (offset == &averunnable) { /* load average */
  103                 struct irix_loadavg iav;
  104                 int scale = averunnable.fscale / IRIX_LOADAVG_SCALE;
  105 
  106                 (void)memset(&iav, 0, sizeof(iav));
  107                 iav.ldavg[0] = averunnable.ldavg[0] / scale;
  108                 iav.ldavg[1] = averunnable.ldavg[1] / scale;
  109                 iav.ldavg[2] = averunnable.ldavg[2] / scale;
  110                 buf = (void *)&iav;
  111                 buflen = sizeof(iav);
  112         }
  113 
  114         if (offset == &irix_kernel_var) { /* kernel variables */
  115                 buf = &irix_kernel_var;
  116                 buflen = sizeof(irix_kernel_var);
  117         }
  118 
  119         if (buflen != 0)
  120                 error = uiomove(buf, buflen, uio);
  121         return error;
  122 }
  123 
  124 int
  125 irix_kmemwrite(dev_t dev, struct uio *uio, int flag)
  126 {
  127         return 0;
  128 }
  129 
  130 int
  131 irix_kmemclose(dev, flags, fmt, l)
  132         dev_t dev;
  133         int flags, fmt;
  134         struct lwp *l;
  135 {
  136         return 0;
  137 }
  138 

Cache object: 718c08884095e0e82e5009cde3eba86a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.