Annotation of XNU/pexpert/i386/pe_spl.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: #include <pexpert/protos.h>
        !            23: 
        !            24: 
        !            25: typedef unsigned long  spl_t;
        !            26: 
        !            27: spl_t  PE_set_spl(spl_t x);
        !            28: 
        !            29: spl_t splhi() { return PE_set_spl(8); }
        !            30: spl_t splhigh() { return PE_set_spl(8); }
        !            31: spl_t splclock() { return PE_set_spl(8); }
        !            32: spl_t splvm() { return PE_set_spl(8); }
        !            33: spl_t splsched() { return      PE_set_spl(8); }
        !            34: spl_t splimp() { return PE_set_spl(6); }
        !            35: void   splx(spl_t x) { (void) PE_set_spl(x); }
        !            36: spl_t splnet() { return PE_set_spl(6); }
        !            37: void  spllo() { (void) PE_set_spl(0); }
        !            38: spl_t spl1() { return PE_set_spl(1); }
        !            39: spl_t spl2() { return PE_set_spl(2); }
        !            40: spl_t spl3() { return PE_set_spl(3); }
        !            41: spl_t spl4() { return PE_set_spl(4); }
        !            42: spl_t spl5() { return PE_set_spl(5); }
        !            43: spl_t spl6() { return PE_set_spl(6); }
        !            44: spl_t splbio() { return        PE_set_spl(5); }
        !            45: spl_t spltty() { return        PE_set_spl(6); }
        !            46: 
        !            47: spl_t sploff() { return PE_set_spl(8); }
        !            48: void splon(spl_t x) { (void) PE_set_spl(x); }
        !            49: 
        !            50: spl_t PE_set_spl(spl_t lvl)
        !            51: {
        !            52:   spl_t old_level;
        !            53:   int   mycpu;
        !            54: 
        !            55:   
        !            56:   __asm__ volatile("cli");
        !            57: 
        !            58:   mycpu = cpu_number();
        !            59:   old_level = cpu_data[mycpu].spl_level;
        !            60:   cpu_data[mycpu].spl_level = lvl ;
        !            61:   
        !            62:   if (!lvl) __asm__ volatile("sti");
        !            63:   
        !            64:   return old_level;
        !            65: }
        !            66: 
        !            67: void PE_set_spl_no_interrupt(spl_t lvl)
        !            68: {
        !            69:   int mycpu;
        !            70: 
        !            71:   __asm__ volatile("cli");
        !            72: 
        !            73:   mycpu = cpu_number();
        !            74:   cpu_data[mycpu].spl_level = lvl ;
        !            75: 
        !            76:   return;
        !            77: }
        !            78:   

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.