|
|
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.0 (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: #import <objc/Object.h> ! 25: ! 26: #import <mach.h> ! 27: ! 28: #import <objc/Storage.h> ! 29: ! 30: typedef struct _Region { ! 31: vm_address_t address; ! 32: vm_size_t size; ! 33: vm_prot_t protection; ! 34: vm_prot_t maxProtection; ! 35: vm_inherit_t inheritance; ! 36: boolean_t shared; ! 37: port_t objectName; ! 38: vm_offset_t offset; ! 39: pointer_t data; ! 40: unsigned int dataCount; ! 41: vm_address_t maxAddress; ! 42: long displacement; ! 43: pointer_t maxData; ! 44: } Region; ! 45: ! 46: #define WARP(p) \ ! 47: ((typeof(p))[regionManager pointerFor: p withSize: sizeof(*p)]) ! 48: ! 49: #define WARPID(id) \ ! 50: ([regionManager pointerForID: id]) ! 51: ! 52: #define UNWARP(p) \ ! 53: ((typeof(p))[regionManager originalPointerFor: p]) ! 54: ! 55: #define AREF(array, index) \ ! 56: (*(typeof(array))[regionManager pointerFor: array + index]) ! 57: ! 58: @interface RegionManager : Object ! 59: { ! 60: Storage *regions; ! 61: vm_task_t task; ! 62: } ! 63: ! 64: +newTask: (vm_task_t)theTask; ! 65: -(Region *)regionFor: (void *)pointer; ! 66: -(void *)pointerFor: (void *)pointer; ! 67: -(void *)pointerFor: (void *)pointer withSize: (int)size; ! 68: -(void *)originalPointerFor: (void *)pointer; ! 69: -(BOOL)getDataAt: (void *)start for: (int)numBytes into: (void *)data; ! 70: -(struct mach_header **)getMachHeaders; ! 71: -(struct mach_header *)getMachHeader; ! 72: -(void *)getSectData: (STR)segName section: (STR)sectName size: (int *)pSize forHeader: (struct mach_header *)header; ! 73: -(void *)getSectData: (STR)segName section: (STR)sectName size: (int *)pSize; ! 74: -(void *)originalPointerFor: (void *)pointer; ! 75: -invalidate; ! 76: -(id)pointerForID: (id)pointer; ! 77: ! 78: @end ! 79: ! 80: extern void *getsectdatafromheader(struct mach_header *, char *, char *, int *); ! 81: ! 82: ! 83: ! 84: ! 85: ! 86: ! 87: ! 88: ! 89: ! 90: ! 91: ! 92: ! 93:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.