X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/060df5ea7c632b1ac8cc8aac1fb59758165c2084..a39ff7e25e19b3a8c3020042a3872ca9ec9659f1:/iokit/IOKit/IOKitDebug.h?ds=sidebyside diff --git a/iokit/IOKit/IOKitDebug.h b/iokit/IOKit/IOKitDebug.h index 96fb7c5a0..a6c64b8eb 100644 --- a/iokit/IOKit/IOKitDebug.h +++ b/iokit/IOKit/IOKitDebug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 1998-2010 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -25,13 +25,6 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ -/* - * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. - * - * HISTORY - * - */ - #ifndef _IOKIT_IOKITDEBUG_H #define _IOKIT_IOKITDEBUG_H @@ -51,10 +44,10 @@ class IOKitDiagnostics : public OSObject public: static OSObject * diagnostics( void ); - virtual bool serialize(OSSerialize *s) const; + virtual bool serialize(OSSerialize *s) const APPLE_KEXT_OVERRIDE; private: static void updateOffset( OSDictionary * dict, - UInt32 value, const char * name ); + UInt64 value, const char * name ); }; #endif /* __cplusplus */ @@ -82,15 +75,44 @@ enum { kOSRegistryModsMode = 0x00040000ULL, // Change default registry modification handling - panic vs. log // kIOTraceIOService = 0x00080000ULL, // Obsolete: Use iotrace=0x00080000ULL to enable now kIOLogHibernate = 0x00100000ULL, + kIOStatistics = 0x04000000ULL, + kIOSleepWakeWdogOff = 0x40000000ULL, + kIOKextSpinDump = 0x80000000ULL, // debug aids - change behaviour kIONoFreeObjects = 0x00100000ULL, - kIOLogSynchronous = 0x00200000ULL, // IOLog completes synchronously - kOSTraceObjectAlloc = 0x00400000ULL, +// kIOLogSynchronous = 0x00200000ULL, // IOLog completes synchronously -- obsolete + kIOTracking = 0x00400000ULL, + kIOWaitQuietPanics = 0x00800000ULL, + kIOWaitQuietBeforeRoot = 0x01000000ULL, + kIOTrackingBoot = 0x02000000ULL, _kIODebugTopFlag = 0x8000000000000000ULL // force enum to be 64 bits }; +enum { + kIOKitDebugUserOptions = 0 + | kIOLogAttach + | kIOLogProbe + | kIOLogStart + | kIOLogRegister + | kIOLogMatch + | kIOLogConfig + | kIOLogYield + | kIOLogPower + | kIOLogMapping + | kIOLogCatalogue + | kIOLogTracePower + | kIOLogDebugPower + | kOSLogRegistryMods + | kIOLogPMRootDomain + | kOSRegistryModsMode + | kIOLogHibernate + | kIOSleepWakeWdogOff + | kIOKextSpinDump + | kIOWaitQuietPanics +}; + enum { kIOTraceInterrupts = 0x00000001ULL, // Trace primary interrupts kIOTraceWorkLoops = 0x00000002ULL, // Trace workloop activity @@ -108,20 +130,152 @@ enum { extern SInt64 gIOKitDebug; extern SInt64 gIOKitTrace; -extern UInt64 gIOInterruptThresholdNS; - #ifdef __cplusplus extern "C" { #endif -struct IORegistryPlane; -extern void IOPrintPlane( const struct IORegistryPlane * plane ); +#ifdef __cplusplus +class IORegistryPlane; +#endif + +extern void IOPrintPlane( +#ifdef __cplusplus + const IORegistryPlane * plane +#else + const struct IORegistryPlane * plane +#endif + ); #ifndef _OSCPPDEBUG_H extern void OSPrintMemory( void ); #endif #define IOPrintMemory OSPrintMemory + + +#define kIOKitDiagnosticsClientClassName "IOKitDiagnosticsClient" + +enum +{ + kIOKitDiagnosticsClientType = 0x99000002 +}; + + +struct IOKitDiagnosticsParameters +{ + size_t size; + uint64_t value; + uint32_t options; + uint32_t tag; + uint32_t zsize; + uint32_t reserved[8]; +}; +typedef struct IOKitDiagnosticsParameters IOKitDiagnosticsParameters; + +enum +{ + kIOTrackingCallSiteBTs = 16, +}; + +struct IOTrackingCallSiteInfo +{ + uint32_t count; + pid_t addressPID; + mach_vm_address_t address; + mach_vm_size_t size[2]; + pid_t btPID; + mach_vm_address_t bt[2][kIOTrackingCallSiteBTs]; +}; + +#define kIOMallocTrackingName "IOMalloc" +#define kIOWireTrackingName "IOWire" +#define kIOMapTrackingName "IOMap" + +#if XNU_KERNEL_PRIVATE && IOTRACKING + +struct IOTrackingQueue; +struct IOTrackingCallSite; + +struct IOTracking +{ + queue_chain_t link; + IOTrackingCallSite * site; +#if !defined(__LP64__) + uint32_t flags; +#endif +}; + +struct IOTrackingAddress +{ + IOTracking tracking; + uintptr_t address; + size_t size; +#if defined(__LP64__) + uint32_t flags; +#endif +}; + +struct IOTrackingUser +{ + queue_chain_t link; + pid_t btPID; + uint8_t user32; + uint8_t userCount; + uintptr_t bt[kIOTrackingCallSiteBTs]; + uintptr_t btUser[kIOTrackingCallSiteBTs]; +}; + +enum +{ + kIOTrackingQueueTypeDefaultOn = 0x00000001, + kIOTrackingQueueTypeAlloc = 0x00000002, + kIOTrackingQueueTypeMap = 0x00000004, + kIOTrackingQueueTypeUser = 0x00000008, +}; + + +void IOTrackingInit(void); +IOTrackingQueue * IOTrackingQueueAlloc(const char * name, uintptr_t btEntry, + size_t allocSize, size_t minCaptureSize, + uint32_t type, uint32_t numSiteQs); +void IOTrackingQueueFree(IOTrackingQueue * head); +void IOTrackingAdd(IOTrackingQueue * head, IOTracking * mem, size_t size, bool address, vm_tag_t tag); +void IOTrackingRemove(IOTrackingQueue * head, IOTracking * mem, size_t size); +void IOTrackingAddUser(IOTrackingQueue * queue, IOTrackingUser * mem, vm_size_t size); +void IOTrackingRemoveUser(IOTrackingQueue * head, IOTrackingUser * tracking); + +void IOTrackingAlloc(IOTrackingQueue * head, uintptr_t address, size_t size); +void IOTrackingFree(IOTrackingQueue * head, uintptr_t address, size_t size); +void IOTrackingReset(IOTrackingQueue * head); +void IOTrackingAccumSize(IOTrackingQueue * head, IOTracking * mem, size_t size); +kern_return_t IOTrackingDebug(uint32_t selector, uint32_t options, + const char * names, size_t namesLen, + size_t size, OSObject ** result); + +extern IOTrackingQueue * gIOMallocTracking; +extern IOTrackingQueue * gIOWireTracking; +extern IOTrackingQueue * gIOMapTracking; + +#endif /* XNU_KERNEL_PRIVATE && IOTRACKING */ + +enum +{ + kIOTrackingExcludeNames = 0x00000001, +}; + +enum +{ + kIOTrackingGetTracking = 0x00000001, + kIOTrackingGetMappings = 0x00000002, + kIOTrackingResetTracking = 0x00000003, + kIOTrackingStartCapture = 0x00000004, + kIOTrackingStopCapture = 0x00000005, + kIOTrackingSetMinCaptureSize = 0x00000006, + kIOTrackingLeaks = 0x00000007, + kIOTrackingInvalid = 0xFFFFFFFE, +}; + + #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */