Annotation of kernel/machdep/ppc/cpu_data.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: 
        !            26: #ifndef        _CPU_DATA_H_
        !            27: #define        _CPU_DATA_H_
        !            28: #if defined(KERNEL_BUILD)
        !            29: #include <cpus.h>
        !            30: #endif /* KERNEL_BUILD */
        !            31: #include <kern/kern_types.h>
        !            32: 
        !            33: typedef struct
        !            34: {
        !            35:        thread_t        active_thread;
        !            36:        int             preemption_level;
        !            37:        int             simple_lock_count;
        !            38:        int             interrupt_level;
        !            39:         unsigned        flags;
        !            40: } cpu_data_t;
        !            41: 
        !            42: extern cpu_data_t      cpu_data[NCPUS];
        !            43: 
        !            44: /*
        !            45:  * NOTE: For non-realtime configurations, the accessor functions for
        !            46:  * cpu_data fields are here, coded in C. For MACH_RT configurations,
        !            47:  * the accessor functions must be defined in the machine-specific
        !            48:  * cpu_data.h header file.
        !            49:  */
        !            50: 
        !            51: #if    MACH_RT
        !            52: 
        !            53: #include <machine/cpu_data.h>
        !            54: 
        !            55: #else  /* MACH_RT */
        !            56: 
        !            57: #include <kern/cpu_number.h>
        !            58: 
        !            59: #if    defined(__GNUC__)
        !            60: 
        !            61: #ifndef __OPTIMIZE__
        !            62: #define extern static
        !            63: #endif
        !            64: 
        !            65: extern thread_t        __inline__      current_thread(void);
        !            66: extern int __inline__          get_preemption_level(void);
        !            67: extern int __inline__          get_simple_lock_count(void);
        !            68: extern int __inline__          get_interrupt_level(void);
        !            69: extern void __inline__         disable_preemption(void);
        !            70: extern void __inline__         enable_preemption(void);
        !            71: 
        !            72: extern thread_t __inline__ current_thread(void)
        !            73: {
        !            74:        return (cpu_data[cpu_number()].active_thread);
        !            75: }
        !            76: 
        !            77: extern int __inline__  get_preemption_level(void)
        !            78: {
        !            79:        return (0);
        !            80: }
        !            81: 
        !            82: extern int __inline__  get_simple_lock_count(void)
        !            83: {
        !            84:        return (cpu_data[cpu_number()].simple_lock_count);
        !            85: }
        !            86: 
        !            87: extern int __inline__  get_interrupt_level(void)
        !            88: {
        !            89:        return (cpu_data[cpu_number()].interrupt_level);
        !            90: }
        !            91: 
        !            92: extern void __inline__ disable_preemption(void)
        !            93: {
        !            94: }
        !            95: 
        !            96: extern void __inline__ enable_preemption(void)
        !            97: {
        !            98: }
        !            99: 
        !           100: #ifndef        __OPTIMIZE__
        !           101: #undef         extern
        !           102: #endif
        !           103: 
        !           104: #else  /* !defined(__GNUC__) */
        !           105: 
        !           106: #define current_thread()       (cpu_data[cpu_number()].active_thread)
        !           107: #define get_preemption_level() (0)
        !           108: #define get_simple_lock_count()        (cpu_data[cpu_number()].simple_lock_count)
        !           109: #define get_interrupt_level()  (cpu_data[cpu_number()].interrupt_level)
        !           110: #define disable_preemption()   
        !           111: #define enable_preemption()
        !           112: 
        !           113: #endif /* defined(__GNUC__) */
        !           114: 
        !           115: #endif /* MACH_RT */
        !           116: 
        !           117: #endif /* _CPU_DATA_H_ */

unix.superglobalmegacorp.com

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