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-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

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

Cache object: 5585787d0a4008c6e30143ec1c6e63ef


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