|
|
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) 1990 NeXT, Inc. ! 27: * ! 28: * History: ! 29: * ! 30: * 18-Jul-90: Brian Pinkerton at NeXT ! 31: * created ! 32: */ ! 33: #import <mach/machine/vm_types.h> ! 34: #import <mach/machine/vm_param.h> ! 35: #import <kern/queue.h> ! 36: ! 37: /* ! 38: * Public procedures ! 39: */ ! 40: void initKernelStacks(); /* initialize the module */ ! 41: vm_offset_t allocStack(); /* allocate a new kernel stack */ ! 42: void freeStack(vm_offset_t stack); /* free a kernel stack */ ! 43: void swapOutStack(vm_offset_t stack); /* try to swap out a stack */ ! 44: void swapInStack(vm_offset_t stack); /* swap in a stack */ ! 45: ! 46: ! 47: /* ! 48: * The struct _kernelStack sits at the beginning of a kernel stack (under the ! 49: * pcb & u area). We declare it here because the size of the kernel stack depends ! 50: * on it. ! 51: */ ! 52: enum stackStatus { STACK_FREE, STACK_SWAPPED, STACK_IN_USE }; ! 53: ! 54: typedef struct _kernelStack { ! 55: queue_chain_t freeList; ! 56: enum stackStatus status; ! 57: } *kernelStack; ! 58: ! 59: /* ! 60: * The size of the kernel stack returned from allocStack(). ! 61: * KERNSTACK_SIZE is defined in <mach/machine/vm_param.h> ! 62: */ ! 63: #define KERNEL_STACK_SIZE (KERNSTACK_SIZE - sizeof(struct _kernelStack))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.