Annotation of kernel/machdep/ppc/thread.h, revision 1.1.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:  * Mach Operating System
                     27:  * Copyright (c) 1989 Carnegie-Mellon University
                     28:  * Copyright (c) 1988 Carnegie-Mellon University
                     29:  * Copyright (c) 1987 Carnegie-Mellon University
                     30:  * All rights reserved.  The CMU software License Agreement specifies
                     31:  * the terms and conditions for use and redistribution.
                     32:  */
                     33: /*
                     34:  *     File:   vax/thread.h
                     35:  *     Author: Avadis Tevanian, Jr.
                     36:  *
                     37:  *     Copyright (C) 1987, Avadis Tevanian, Jr.
                     38:  *
                     39:  *     This file defines machine specific, thread related structures,
                     40:  *     variables and macros.
                     41:  */
                     42: 
                     43: #ifndef        _MACHDEP_PPC_THREAD_
                     44: #define _MACHDEP_PPC_THREAD_
                     45: 
                     46: #include <kern/kernel_stack.h>
                     47: #include <mach/ppc/thread_status.h>
                     48: 
                     49: #define CURRENT_THREAD
                     50: #include <machdep/ppc/cpu_data.h>
                     51: 
                     52: /*
                     53:  * PPC process control block
                     54:  *
                     55:  * In the continuation model, the PCB holds the user context. It is used
                     56:  * on entry to the kernel from user mode, either by system call or trap,
                     57:  * to store the necessary user registers and other state.
                     58:  */
                     59: struct pcb
                     60: {
                     61:        struct ppc_saved_state ss;
                     62:        struct ppc_exception_state es;
                     63:        struct ppc_float_state fs;
                     64:        unsigned ksp;                   /* points to TOP OF STACK or zero */
                     65:        unsigned sr0;           /* TODO NMGS hack?? sort out user space */
                     66:        unsigned long cthread_self;     /* for use of cthread package */
                     67:         unsigned flags;
                     68: };
                     69: 
                     70: typedef struct pcb *pcb_t;
                     71: 
                     72: struct ppc_kernel_state
                     73: {
                     74:         pcb_t    pcb;           /* Efficiency hack, I am told :-) */
                     75:         unsigned r1;            /* Stack pointer */
                     76:         unsigned r2;            /* TOC/GOT pointer */
                     77:         unsigned r13[32-13];    /* Callee saved `non-volatile' registers */
                     78:         unsigned lr;            /* `return address' used in continuation */
                     79:         unsigned cr;
                     80:                                 /* Floating point not used, so not saved */
                     81: };
                     82: 
                     83: #include <machdep/ppc/fpu.h>
                     84: #define pcb_synch(thread) fp_state_save(thread)
                     85: 
                     86: #define USER_REGS(thread)       (&(thread)->pcb->ss)
                     87: 
                     88: #define STACK_IKS(stack)                \
                     89:         (((struct ppc_kernel_state *)(((vm_offset_t)stack)+KERNEL_STACK_SIZE))-1)
                     90: 
                     91: #ifndef __ASSEMBLER__
                     92: /*
                     93:  * These routines are called from from task_create() to 
                     94:  * manage any pcb state common to all threads in a task 
                     95:  * via the "task->pcb_common" pointer. Currently null for sparc.
                     96:  */
                     97: #define pcb_common_init(task)
                     98: #define pcb_common_terminate(task)
                     99: #endif  /* !__ASSEMBLER__ */
                    100: 
                    101: #endif /* _MACHDEP_PPC_THREAD_ */

unix.superglobalmegacorp.com

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