Annotation of kernel/machdep/ppc/ast_ppc.c, 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:  * Copyright (c) 1997 Apple Computer, Inc.
        !            27:  *
        !            28:  * HISTORY
        !            29:  *
        !            30:  *     [email protected]
        !            31:  *     Fixed sleep integration problem. sleep was not properly
        !            32:  *     handling thread states of THREAD_INTERRUPTED and 
        !            33:  *     THREAD_MUST_TERMINATE, so callers of sleep were getting
        !            34:  *     confused and many times looping.  This fixes the (in)famous
        !            35:  *     unkillable gdb problem, the PB (and other processes) don't
        !            36:  *     terminate, and more. Cleaned up ast code to be just like
        !            37:  *  i386 version.
        !            38:  *
        !            39:  */
        !            40: 
        !            41: #import <mach/mach_types.h>
        !            42: #import <mach/exception.h>
        !            43: 
        !            44: #import <sys/param.h>
        !            45: #import <sys/proc.h>
        !            46: #import <sys/user.h>
        !            47: #include <kern/ast.h>
        !            48: 
        !            49: 
        !            50: #ifdef MACHINE_AST
        !            51: void
        !            52: astoff(int mycpu)
        !            53: {
        !            54:        printf("astoff: turning off needast, cpu=%x\n",mycpu);
        !            55: }
        !            56: 
        !            57: 
        !            58: 
        !            59: void
        !            60: aston(int mycpu)
        !            61: {
        !            62:        printf("aston: setting needast, cpu=%x\n",mycpu);
        !            63: }
        !            64: #endif
        !            65: 
        !            66: 
        !            67: 
        !            68: void
        !            69: check_for_ast(void)
        !            70: {
        !            71:     thread_t    thread;
        !            72:     struct proc        *p;
        !            73:     ppc_saved_state_t  *saved_state;
        !            74: 
        !            75: 
        !            76:     thread = current_thread();
        !            77:     p = current_proc();
        !            78:     saved_state = &thread->pcb->ss;
        !            79: 
        !            80:     while (TRUE) {
        !            81:        ast_t   reasons;
        !            82:        int     mycpu = cpu_number();
        !            83:        int     signum;
        !            84:        
        !            85:        reasons = ast_needed(mycpu);
        !            86: 
        !            87:        if (p) {
        !            88:            if ((p->p_flag & P_OWEUPC) && (p->p_flag & P_PROFIL)) {
        !            89:                        addupc_task(p, saved_state->srr0, 1);
        !            90:                        p->p_flag &= ~P_OWEUPC;
        !            91:                }
        !            92: 
        !            93:            ast_off(mycpu, AST_UNIX);
        !            94: 
        !            95:            if (CHECK_SIGNALS(p, thread, thread->_uthread)) {
        !            96:                        signum = issignal(p);
        !            97:                        if (signum) {
        !            98:                        postsig(signum);
        !            99:                        }
        !           100:            }
        !           101:        }
        !           102: 
        !           103:        ast_off(mycpu, reasons);
        !           104: 
        !           105:        if (thread_should_halt(thread))
        !           106:                        thread_halt_self();
        !           107:        else if ((reasons & AST_BLOCK) || 
        !           108:                csw_needed(thread, current_processor())) {
        !           109:                p->p_stats->p_ru.ru_nivcsw++;
        !           110:                thread_block_with_continuation(thread_exception_return);
        !           111:        }
        !           112:        else
        !           113:                break;
        !           114:     }
        !           115:        
        !           116: }

unix.superglobalmegacorp.com

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