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/sqt/misc.s

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  * Mach Operating System
    3  * Copyright (c) 1991 Carnegie Mellon University
    4  * Copyright (c) 1991 Sequent Computer Systems
    5  * All Rights Reserved.
    6  * 
    7  * Permission to use, copy, modify and distribute this software and its
    8  * documentation is hereby granted, provided that both the copyright
    9  * notice and this permission notice appear in all copies of the
   10  * software, derivative works or modified versions, and any portions
   11  * thereof, and that both notices appear in supporting documentation.
   12  * 
   13  * CARNEGIE MELLON AND SEQUENT COMPUTER SYSTEMS ALLOW FREE USE OF
   14  * THIS SOFTWARE IN ITS "AS IS" CONDITION.  CARNEGIE MELLON AND
   15  * SEQUENT COMPUTER SYSTEMS DISCLAIM ANY LIABILITY OF ANY KIND FOR
   16  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   17  * 
   18  * Carnegie Mellon requests users of this software to return to
   19  * 
   20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   21  *  School of Computer Science
   22  *  Carnegie Mellon University
   23  *  Pittsburgh PA 15213-3890
   24  * 
   25  * any improvements or extensions that they make and grant Carnegie Mellon 
   26  * the rights to redistribute these changes.
   27  */
   28 
   29 /*
   30  * HISTORY
   31  * $Log:        misc.s,v $
   32  * Revision 2.3  91/07/31  18:02:35  dbg
   33  *      Changed copyright.
   34  *      [91/07/31            dbg]
   35  * 
   36  * Revision 2.2  91/05/08  12:57:48  dbg
   37  *      Converted for pure kernel.
   38  *      [90/05/02            dbg]
   39  * 
   40  */
   41 
   42 /* $Copyright:  $
   43  * Copyright (c) 1984, 1985, 1986, 1987 Sequent Computer Systems, Inc.
   44  * All rights reserved
   45  *  
   46  * This software is furnished under a license and may be used
   47  * only in accordance with the terms of that license and with the
   48  * inclusion of the above copyright notice.   This software may not
   49  * be provided or otherwise made available to, or used by, any
   50  * other person.  No title to or ownership of the software is
   51  * hereby transferred.
   52  */
   53 
   54 /*
   55  * misc.s
   56  *      Miscellaneous Assembly routines.
   57  */
   58 
   59 #include <assym.s>
   60 #include <machine/asm.h>
   61 #include <sqt/asm_macros.h>
   62 
   63 /*
   64  * bit = ffs(mask)
   65  *      unsigned int mask;
   66  *
   67  * Return first found set bit position (1-32) or zero if none set.
   68  */
   69 
   70 ENTRY(ffs)
   71         movl    $-1, %eax       # in case no bits set
   72         bsfl    S_ARG0, %eax    # check all 32 bits of arg
   73         incl    %eax            # incr by one for 0-32 (0 if S_ARG==0)
   74         ret
   75 
   76 /*
   77  * enable_nmi: NMI's are enabled at the processor by
   78  * an iret. This routine enables interrupts and does
   79  * an iret back to the caller, thus enabling interrupts
   80  * and NMI's. Only called by trap().
   81  *      On entry, stack looks like
   82  *              <return_eip>
   83  *      Change to (stack grows down)
   84  *              <flags>
   85  *              <kernel_cs>
   86  *              <return_eip>
   87  *      so the iret works
   88  */
   89 
   90 ENTRY(enable_nmi)
   91         popl    %eax            # return addr
   92         sti
   93         pushfl
   94         pushl   $(KERNEL_CS)
   95         pushl   %eax
   96         iret
   97 
   98 /*
   99  * Return logical processor ID
  100  */
  101 
  102 ENTRY(cpu_number)
  103         CPU_NUMBER(%eax)
  104         ret

Cache object: af97cac201e7ffea75e9b1460d18d8bd


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