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/i386/ibcs2/ibcs2_sysi86.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 /*-
    2  * Copyright (c) 1994 Søren Schmidt
    3  * Copyright (c) 1995 Steven Wallace
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer
   11  *    in this position and unchanged.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   28  */
   29 
   30 #include <sys/cdefs.h>
   31 __FBSDID("$FreeBSD$");
   32 
   33 #include <sys/param.h>
   34 #include <sys/lock.h>
   35 #include <sys/mutex.h>
   36 #include <sys/systm.h>
   37 #include <sys/sysctl.h>
   38 
   39 #include <i386/ibcs2/ibcs2_types.h>
   40 #include <i386/ibcs2/ibcs2_signal.h>
   41 #include <i386/ibcs2/ibcs2_util.h>
   42 #include <i386/ibcs2/ibcs2_proto.h>
   43 
   44 #define IBCS2_FP_NO     0       /* no fp support */
   45 #define IBCS2_FP_SW     1       /* software emulator */
   46 #define IBCS2_FP_287    2       /* 80287 FPU */
   47 #define IBCS2_FP_387    3       /* 80387 FPU */
   48 
   49 #define SI86_FPHW       40
   50 #define STIME           54
   51 #define SETNAME         56
   52 #define SI86_MEM        65
   53 
   54 extern int hw_float;
   55 
   56 int
   57 ibcs2_sysi86(struct thread *td, struct ibcs2_sysi86_args *args)
   58 {
   59         switch (args->cmd) {
   60         case SI86_FPHW: {       /* Floating Point information */
   61                 int val, error;
   62 
   63                 if (hw_float)
   64                         val = IBCS2_FP_387;
   65                 else
   66                         val = IBCS2_FP_NO;
   67                 if ((error = copyout(&val, args->arg, sizeof(val))) != 0)
   68                         return error;
   69                 return 0;
   70                 }
   71 
   72         case STIME:       /* set the system time given pointer to long */
   73           /* gettimeofday; time.tv_sec = *args->arg; settimeofday */
   74                 return EINVAL;
   75 
   76         case SETNAME:  {  /* set hostname given string w/ len <= 7 chars */
   77                 int name[2];
   78 
   79                 name[0] = CTL_KERN;
   80                 name[1] = KERN_HOSTNAME;
   81                 return (userland_sysctl(td, name, 2, 0, 0, 0, 
   82                     args->arg, 7, 0, 0));
   83         }
   84 
   85         case SI86_MEM:  /* size of physical memory */
   86                 td->td_retval[0] = ctob(physmem);
   87                 return 0;
   88 
   89         default:
   90 #ifdef DIAGNOSTIC
   91                 printf("IBCS2: 'sysi86' function %d(0x%x) "
   92                         "not implemented yet\n", args->cmd, args->cmd);
   93 #endif
   94                 return EINVAL;
   95         }
   96 }

Cache object: 32aa653f8b1096004417a632c67332fb


[ 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.