Repository: hrtowii/Serotonin
Branch: A12restart
Commit: a2a05595f301
Files: 191
Total size: 21.3 MB
Directory structure:
gitextract_ym5s8a6q/
├── .gitignore
├── .gitmodules
├── Makefile
├── README.md
├── RootHelperSample/
│ ├── CoreServices.h
│ ├── Makefile
│ ├── RemoteLog.h
│ ├── RootHelperSample.xcodeproj/
│ │ └── project.pbxproj
│ ├── TSUtil.h
│ ├── TSUtil.m
│ ├── control
│ ├── entitlements.plist
│ ├── external/
│ │ ├── include/
│ │ │ └── choma/
│ │ │ ├── Base64.h
│ │ │ ├── BufferedStream.h
│ │ │ ├── CSBlob.h
│ │ │ ├── CodeDirectory.h
│ │ │ ├── FAT.h
│ │ │ ├── FileStream.h
│ │ │ ├── Host.h
│ │ │ ├── MachO.h
│ │ │ ├── MachOByteOrder.h
│ │ │ ├── MachOLoadCommand.h
│ │ │ ├── MemoryStream.h
│ │ │ ├── PatchFinder.h
│ │ │ ├── SignOSSL.h
│ │ │ ├── Signing.h
│ │ │ └── Util.h
│ │ └── lib/
│ │ ├── libchoma.a
│ │ └── libcrypto.a
│ ├── insert_dylib.h
│ ├── insert_dylib.m
│ ├── launchdshim/
│ │ ├── .gitignore
│ │ ├── SpringBoardShim/
│ │ │ ├── Makefile
│ │ │ ├── SpringBoardEnts.plist
│ │ │ ├── SpringBoardEntsBedtime.plist
│ │ │ ├── SpringBoardHook/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Makefile
│ │ │ │ ├── SpringBoardHook.plist
│ │ │ │ ├── Tweak.x
│ │ │ │ ├── build.sh
│ │ │ │ └── control
│ │ │ ├── build.sh
│ │ │ ├── main.c
│ │ │ └── springboardshimsignedinjected
│ │ ├── build.sh
│ │ ├── launchdentitlements.plist
│ │ └── launchdhook/
│ │ ├── Frameworks/
│ │ │ └── IOMobileFramebuffer.framework/
│ │ │ └── IOMobileFramebuffer.tbd
│ │ ├── IOMobileFramebuffer.h
│ │ ├── LICENCE
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── build.sh
│ │ ├── control
│ │ ├── entitlements.plist
│ │ ├── fishhook.c
│ │ ├── fishhook.h
│ │ ├── main.m
│ │ └── verbose/
│ │ ├── IOMobileFramebuffer.h
│ │ ├── console/
│ │ │ ├── iso_font.c
│ │ │ ├── msgbuf.h
│ │ │ ├── serial_protos.h
│ │ │ ├── video_console.c
│ │ │ ├── video_console.h
│ │ │ └── video_scroll.c
│ │ └── verbose_boot.m
│ └── main.m
├── Serotonin.xcodeproj/
│ ├── project.pbxproj
│ ├── project.xcworkspace/
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata/
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata/
│ │ └── hariz.xcuserdatad/
│ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata/
│ ├── hariz.xcuserdatad/
│ │ └── xcschemes/
│ │ └── xcschememanagement.plist
│ └── ibarahime.xcuserdatad/
│ ├── xcdebugger/
│ │ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes/
│ └── xcschememanagement.plist
├── build.sh
├── ent.plist
└── usprebooter/
├── Assets.xcassets/
│ ├── AccentColor.colorset/
│ │ └── Contents.json
│ ├── AppIcon.appiconset/
│ │ └── Contents.json
│ ├── Contents.json
│ ├── accent.colorset/
│ │ └── Contents.json
│ ├── alfienick.imageset/
│ │ └── Contents.json
│ ├── bedtime.imageset/
│ │ └── Contents.json
│ ├── duy.imageset/
│ │ └── Contents.json
│ ├── fish.imageset/
│ │ └── Contents.json
│ ├── haxi0.imageset/
│ │ └── Contents.json
│ └── htrowii.imageset/
│ └── Contents.json
├── ContentView.swift
├── External/
│ ├── FluidGradient/
│ │ ├── BlobLayer.swift
│ │ ├── CGPoint+Extensions.swift
│ │ ├── FluidGradient.swift
│ │ ├── FluidGradientView.swift
│ │ └── ResizableLayer.swift
│ ├── SwiftBackports/
│ │ ├── Backport.swift
│ │ ├── CoreTransferable/
│ │ │ ├── Representations/
│ │ │ │ ├── Codable+Representation.swift
│ │ │ │ ├── Data+Representation.swift
│ │ │ │ ├── File+Representations.swift
│ │ │ │ ├── Never+Representation.swift
│ │ │ │ ├── Tuple+Representation.swift
│ │ │ │ └── _ConditionalRepresentation.swift
│ │ │ ├── Support/
│ │ │ │ ├── NSItemProvider+Transferable.swift
│ │ │ │ ├── ReceivedTransferredFile.swift
│ │ │ │ ├── SentTransferredFile.swift
│ │ │ │ └── Visibility.swift
│ │ │ ├── TransferRepresentationBuilder.swift
│ │ │ ├── Transferable.swift
│ │ │ ├── TransferableRepresentation.swift
│ │ │ └── Transferables/
│ │ │ ├── AttributedString+Transferable.swift
│ │ │ ├── Data+Transferable.swift
│ │ │ ├── Never+Transferable.swift
│ │ │ ├── String+Transferable.swift
│ │ │ └── URL+Transferable.swift
│ │ ├── URLSession/
│ │ │ └── URLSession+Async.swift
│ │ └── UniformTypeIdentifiers/
│ │ ├── CoreTypes.swift
│ │ ├── UTTagClass.swift
│ │ └── UTType.swift
│ └── SwiftUIBackports/
│ ├── Internal/
│ │ ├── Environment+String.swift
│ │ ├── Environment.swift
│ │ ├── Inspect.swift
│ │ ├── NSItemProvider+Async.swift
│ │ ├── OwningController.swift
│ │ ├── Platforms.swift
│ │ ├── SafeArea.swift
│ │ ├── String+LocalizationKey.swift
│ │ ├── UIScene.swift
│ │ └── VisualEffects/
│ │ ├── VisualEffect+iOS.swift
│ │ └── VisualEffect+macOS.swift
│ ├── UIBackport.swift
│ └── iOS/
│ └── Presentation/
│ └── Detents.swift
├── Info.plist
├── Log.swift
├── Private Headers I stole from the macOS SDK/
│ ├── bootstrap.h
│ └── xpc/
│ ├── activity.h
│ ├── availability.h
│ ├── base.h
│ ├── debug.h
│ ├── endpoint.h
│ ├── launch.h
│ ├── listener.h
│ ├── rich_error.h
│ ├── session.h
│ ├── xpc.h
│ └── xpc_connection.h
├── TheCoolerContentView.swift
├── boot-happy.jp2
├── boot-sad.jp2
├── ct_bypass_signed
├── fun/
│ ├── cs_blobs.h
│ ├── cs_blobs.m
│ ├── dir.h
│ ├── dir.m
│ ├── fun.h
│ ├── fun.m
│ ├── krw.c
│ ├── krw.h
│ ├── offsets.h
│ ├── offsets.m
│ ├── proc.c
│ ├── proc.h
│ ├── thanks_opa334dev_htrowii.h
│ ├── thanks_opa334dev_htrowii.m
│ ├── utils.h
│ ├── utils.m
│ ├── vnode.h
│ └── vnode.m
├── ldid
├── libkfd/
│ ├── common.h
│ ├── info/
│ │ ├── dynamic_info.h
│ │ └── static_info.h
│ ├── info.h
│ ├── krkw/
│ │ ├── kread/
│ │ │ ├── kread_kqueue_workloop_ctl.h
│ │ │ └── kread_sem_open.h
│ │ └── kwrite/
│ │ ├── kwrite_dup.h
│ │ └── kwrite_sem_open.h
│ ├── krkw.h
│ ├── perf.h
│ ├── puaf/
│ │ ├── landa.h
│ │ ├── physpuppet.h
│ │ └── smith.h
│ └── puaf.h
├── libkfd.h
├── memoryControl.h
├── memoryControl.m
├── overwriter.h
├── overwriter.m
├── troller.h
├── troller.m
├── usprebooter-Bridging-Header.h
├── usprebooterApp.swift
├── util.h
├── util.m
├── vm_unaligned_copy_switch_race.c
└── vm_unaligned_copy_switch_race.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
build
build/
.theos
Payload
.DS_Store
usprebooter.xcodeproj/xcuserdata
usprebooter.xcodeproj/project.xcworkspace/xcuserdata
*.ipa
*.tipa
RootHelperSample/RootHelperSample.xcodeproj/xcuserdata
RootHelperSample/build
RootHelperSample/launchdshim/launchdhook/.theos
apple-include
ChOma_host
================================================
FILE: .gitmodules
================================================
[submodule "ChOma"]
path = ChOma
url = https://github.com/opa334/ChOma
================================================
FILE: Makefile
================================================
CC = clang
SHELL = /usr/bin/env bash
LDID = ldid
MACOSX_SYSROOT = $(shell xcrun -sdk macosx --show-sdk-path)
TARGET_SYSROOT = $(shell xcrun -sdk iphoneos --show-sdk-path)
all: Serotonin.tipa
Serotonin.tipa: $(wildcard **/*.c **/*.m **/*.swift **/*.plist **/*.xml)
echo "[*] Building ChOma for host"
$(MAKE) -C ChOma
cp -r ChOma ChOma_host
echo "[*] Building ChOma for target"
$(MAKE) -C ChOma TARGET=ios
echo "[*] Building fastPathSign"
$(MAKE) -C RootHelperSample/Exploits/fastPathSign
echo "[*] Building lunchd hook"
$(MAKE) -C RootHelperSample/launchdshim/launchdhook
echo "[*] Signing lunchd hook"
$(shell test -f RootHelperSample/launchdshim/launchdhook/launchdhooksigned.dylib || ./ChOma_host/output/tests/ct_bypass -i RootHelperSample/launchdshim/launchdhook/.theos/obj/debug/launchdhook.dylib -o RootHelperSample/launchdshim/launchdhook/launchdhooksigned.dylib)
echo "[*] Building SpringBoard Hook"
$(MAKE) -C RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook
echo "[*] Signing SB hook"
$(shell test -f RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/springboardhooksigned.dylib || ./ChOma_host/output/tests/ct_bypass -i RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/.theos/obj/debug/SpringBoardHook.dylib -o RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/springboardhooksigned.dylib)
# jank workaround at best, can someone else please fix this weird file dependency? – bomberfish
echo "[*] Copying fastPathSign"
mkdir -p ChOma/output/ios/tests
cp RootHelperSample/Exploits/fastPathSign/fastPathSign ChOma/output/ios/tests
echo "[*] Building Serotonin"
xcodebuild clean build -project Serotonin.xcodeproj -sdk iphoneos -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED="NO"
echo "[*] Done building. Packaging for TS..."
$(MAKE) -C RootHelperSample
rm -rf Payload
rm -rf Serotonin.tipa
mkdir Payload
cp -a build/Release-iphoneos/usprebooter.app Payload
cp RootHelperSample/.theos/obj/debug/arm64/trolltoolsroothelper Payload/usprebooter.app/trolltoolsroothelper
install -m755 RootHelperSample/launchdshim/launchdhook/launchdhooksigned.dylib Payload/usprebooter.app/launchdhooksigned.dylib
install -m755 RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/springboardhooksigned.dylib Payload/usprebooter.app/springboardhooksigned.dylib
$(LDID) -S./RootHelperSample/entitlements.plist -Cadhoc Payload/usprebooter.app/{fastPathSign,ldid,trolltoolsroothelper}
$(LDID) -Sent.plist -Cadhoc Payload/usprebooter.app/usprebooter
zip -vr9 Serotonin.tipa Payload/ -x "*.DS_Store"
apple-include:
mkdir -p apple-include/{bsm,objc,os/internal,sys,firehose,CoreFoundation,FSEvents,IOSurface,IOKit/kext,libkern,kern,arm,{mach/,}machine,CommonCrypto,Security,CoreSymbolication,Kernel/{kern,IOKit,libkern},rpc,rpcsvc,xpc/private,ktrace,mach-o,dispatch}
cp -af $(MACOSX_SYSROOT)/usr/include/{arpa,bsm,hfs,net,xpc,netinet,servers,timeconv.h,launch.h} apple-include
cp -af $(MACOSX_SYSROOT)/usr/include/objc/objc-runtime.h apple-include/objc
cp -af $(MACOSX_SYSROOT)/usr/include/libkern/{OSDebug.h,OSKextLib.h,OSReturn.h,OSThermalNotification.h,OSTypes.h,machine} apple-include/libkern
cp -af $(MACOSX_SYSROOT)/usr/include/kern apple-include
cp -af $(MACOSX_SYSROOT)/usr/include/sys/{tty*,ptrace,kern*,random,reboot,user,vnode,disk,vmmeter,conf}.h apple-include/sys
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/sys/disklabel.h apple-include/sys
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/IOKit.framework/Headers/{AppleConvergedIPCKeys.h,IOBSD.h,IOCFBundle.h,IOCFPlugIn.h,IOCFURLAccess.h,IOKitServer.h,IORPC.h,IOSharedLock.h,IOUserServer.h,audio,avc,firewire,graphics,hid,hidsystem,i2c,iokitmig.h,kext,ndrvsupport,network,ps,pwr_mgt,sbp2,scsi,serial,storage,stream,usb,video} apple-include/IOKit
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/Security.framework/Headers/{mds_schema,oidsalg,SecKeychainSearch,certextensions,Authorization,eisl,SecDigestTransform,SecKeychainItem,oidscrl,cssmcspi,CSCommon,cssmaci,SecCode,CMSDecoder,oidscert,SecRequirement,AuthSession,SecReadTransform,oids,cssmconfig,cssmkrapi,SecPolicySearch,SecAccess,cssmtpi,SecACL,SecEncryptTransform,cssmapi,cssmcli,mds,x509defs,oidsbase,SecSignVerifyTransform,cssmspi,cssmkrspi,SecTask,cssmdli,SecAsn1Coder,cssm,SecTrustedApplication,SecCodeHost,SecCustomTransform,oidsattr,SecIdentitySearch,cssmtype,SecAsn1Types,emmtype,SecTransform,SecTrustSettings,SecStaticCode,emmspi,SecTransformReadTransform,SecKeychain,SecDecodeTransform,CodeSigning,AuthorizationPlugin,cssmerr,AuthorizationTags,CMSEncoder,SecEncodeTransform,SecureDownload,SecAsn1Templates,AuthorizationDB,SecCertificateOIDs,cssmapple}.h apple-include/Security
cp -af $(MACOSX_SYSROOT)/usr/include/{ar,bootstrap,launch,libc,libcharset,localcharset,nlist,NSSystemDirectories,tzfile,vproc}.h apple-include
cp -af $(MACOSX_SYSROOT)/usr/include/mach/{*.defs,{mach_vm,shared_region}.h} apple-include/mach
cp -af $(MACOSX_SYSROOT)/usr/include/mach/machine/*.defs apple-include/mach/machine
cp -af $(MACOSX_SYSROOT)/usr/include/rpc/pmap_clnt.h apple-include/rpc
cp -af $(MACOSX_SYSROOT)/usr/include/rpcsvc/yp{_prot,clnt}.h apple-include/rpcsvc
cp -af $(TARGET_SYSROOT)/usr/include/mach/machine/thread_state.h apple-include/mach/machine
cp -af $(TARGET_SYSROOT)/usr/include/mach/arm apple-include/mach
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/IOKit.framework/Headers/* apple-include/IOKit
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/IOSurface.framework/Headers/* apple-include/IOSurface
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/stdlib.h > apple-include/stdlib.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/time.h > apple-include/time.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/unistd.h > apple-include/unistd.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/mach/task.h > apple-include/mach/task.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/mach/mach_host.h > apple-include/mach/mach_host.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/ucontext.h > apple-include/ucontext.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/signal.h > apple-include/signal.h
gsed -E /'__API_UNAVAILABLE'/d < $(TARGET_SYSROOT)/usr/include/pthread.h > apple-include/pthread.h
@if [ -f $(TARGET_SYSROOT)/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h ]; then gsed -E 's/API_UNAVAILABLE\(ios, watchos, tvos\)//g' < $(TARGET_SYSROOT)/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h > apple-include/CoreFoundation/CFUserNotification.h; fi
gsed -i -E s/'__API_UNAVAILABLE\(.*\)'// apple-include/IOKit/IOKitLib.h
clean:
rm -rf Payload build RootHelperSample/.theos apple-include RootHelperSample/build FUCK.tipa Serotonin.tipa
.PHONY: all clean
================================================
FILE: README.md
================================================
# This repository's code is now unmaintained and is merged into [the new Serotonin fork with Mineek](https://github.com/mineek/Serotonin)
Serotonin
not/semi-jailbreak
Supports iOS/iPadOS 16.2 - 16.6.1
## How do I use this?
To use this app, you need to be on a supported version (mentioned above), and have [TrollStore](https://github.com/opa334/TrollStore/) installed. You can follow [this guide](https://ios.cfw.guide/installing-trollstore/) to install it on your device. Please note that this tool doesn't support iOS 17.0 despite of it having TrollStore.
1. Download and install [Bootstrap from RootHide](https://github.com/RootHide/Bootstrap)
2. Install ElleKit from Sileo
3. Download the `.tipa` file from the [latest release](https://github.com/hrtowii/Serotonin/releases/latest)
4. Install the downloaded file in TrollStore
5. Open the app and press the Jelbrek button. Your device should userspace reboot, and you should be (not/semi) jailbroken!
## How was this done?
- It replaces launchd by searching through /sbin's vp_namecache, finds launchd's name cache and kwrites it with a patch to `lunchd`, our patched `launchd` (*you can have a look at a better explanation from AlfieCG [here](https://www.reddit.com/r/jailbreak/comments/18zehl2/comment/kgi5ya3/)*)
- Patched launchd hooks posix_spawnp of SpringBoard and execs our own SpringBoard with springboardhook.dylib
- Springboardhook loads in tweaks, ellekit, etc.
- CoreTrust Bug found by [AlfieCG](https://github.com/alfiecg24)
- [KFD Exploit](https://github.com/felix-pb/kfd)
## TODO
- Try adding support for lower iOS versions by overwriting NSGetExecutablePath
- Add support for arm64
- Add a boot splash screen (SOON)
- Fix some Makefile jankiness
- Fix `puaf_pages` picker crash in new UI
## Credits
- [DuyKhanhTran](https://github.com/khanhduytran0) - launchd and SpringBoard hooks
- [NSBedtime](https://twitter.com/NSBedtime) - initial launchdhax, helped out a ton!
- [AlfieCG](https://github.com/alfiecg24) - helped out a ton!
- [Nick Chan](https://github.com/asdfugil) - helped out a ton!
- [BomberFish](https://github.com/BomberFish) - Icon, new UI, `lunchd` name idea :trollface:
- [haxi0](https://github.com/haxi0) - old UI
- [Evelyne](https://github.com/evelyneee) for showing it was possible.
================================================
FILE: RootHelperSample/CoreServices.h
================================================
@interface LSBundleProxy
@property (nonatomic,readonly) NSString * bundleIdentifier;
@property (nonatomic) NSURL* dataContainerURL;
-(NSString*)localizedName;
@end
@interface LSApplicationProxy : LSBundleProxy
+ (instancetype)applicationProxyForIdentifier:(NSString*)identifier;
@property NSURL* bundleURL;
@property NSString* bundleType;
@property NSString* canonicalExecutablePath;
@property (nonatomic,readonly) NSDictionary* groupContainerURLs;
@property (nonatomic,readonly) NSArray* plugInKitPlugins;
@property (getter=isInstalled,nonatomic,readonly) BOOL installed;
@property (getter=isPlaceholder,nonatomic,readonly) BOOL placeholder;
@property (getter=isRestricted,nonatomic,readonly) BOOL restricted;
@property (nonatomic,readonly) NSSet * claimedURLSchemes;
@end
@interface LSApplicationWorkspace : NSObject
+ (instancetype)defaultWorkspace;
- (BOOL)registerApplicationDictionary:(NSDictionary*)dict;
- (BOOL)unregisterApplication:(id)arg1;
- (BOOL)_LSPrivateRebuildApplicationDatabasesForSystemApps:(BOOL)arg1 internal:(BOOL)arg2 user:(BOOL)arg3;
- (BOOL)uninstallApplication:(NSString*)arg1 withOptions:(id)arg2;
- (BOOL)openApplicationWithBundleID:(NSString *)arg1 ;
- (void)enumerateApplicationsOfType:(NSUInteger)type block:(void (^)(LSApplicationProxy*))block;
@end
@interface LSEnumerator : NSEnumerator
@property (nonatomic,copy) NSPredicate * predicate;
+ (instancetype)enumeratorForApplicationProxiesWithOptions:(NSUInteger)options;
@end
@interface LSPlugInKitProxy : LSBundleProxy
@property (nonatomic,readonly) NSString* pluginIdentifier;
@property (nonatomic,readonly) NSDictionary * pluginKitDictionary;
+ (instancetype)pluginKitProxyForIdentifier:(NSString*)arg1;
@end
@interface MCMContainer : NSObject
+ (id)containerWithIdentifier:(id)arg1 createIfNecessary:(BOOL)arg2 existed:(BOOL*)arg3 error:(id*)arg4;
@property (nonatomic,readonly) NSURL * url;
@end
@interface MCMDataContainer : MCMContainer
@end
@interface MCMAppDataContainer : MCMDataContainer
@end
@interface MCMAppContainer : MCMContainer
@end
@interface MCMPluginKitPluginDataContainer : MCMDataContainer
@end
================================================
FILE: RootHelperSample/Makefile
================================================
TARGET := iphone:clang:16.5:14.0
ARCHS = arm64
include $(THEOS)/makefiles/common.mk
TOOL_NAME = trolltoolsroothelper
trolltoolsroothelper_FILES = $(wildcard *.m) Exploits/fastPathSign/src/coretrust_bug.c Exploits/fastPathSign/src/codesign.m
trolltoolsroothelper_LDFLAGS = -Lexternal/lib -lcrypto -lchoma
trolltoolsroothelper_CFLAGS = -fobjc-arc $(shell pkg-config --cflags libcrypto) -Iexternal/include -Wmissing-braces -IExploits/fastPathSign/src
trolltoolsroothelper_CODESIGN_FLAGS = -Sentitlements.plist
trolltoolsroothelper_INSTALL_PATH = /usr/local/bin
trolltoolsroothelper_LIBRARIES = archive
trolltoolsroothelper_PRIVATE_FRAMEWORKS = SpringBoardServices BackBoardServices MobileCoreServices MobileContainerManager IOKit
include $(THEOS_MAKE_PATH)/tool.mk
================================================
FILE: RootHelperSample/RemoteLog.h
================================================
#ifndef _REMOTE_LOG_H_
#define _REMOTE_LOG_H_
#import
#import
#import
#import
// change this to match your destination (server) IP address
#define RLOG_IP_ADDRESS "192.168.0.24"
#define RLOG_PORT 11909
__attribute__((unused)) static void RLogv(NSString* format, va_list args)
{
NSString* str = [[NSString alloc] initWithFormat:format arguments:args];
int sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sd <= 0)
{
NSLog(@"[RemoteLog] Error: Could not open socket");
return;
}
int broadcastEnable = 1;
int ret = setsockopt(sd, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));
if (ret)
{
NSLog(@"[RemoteLog] Error: Could not open set socket to broadcast mode");
close(sd);
return;
}
struct sockaddr_in broadcastAddr;
memset(&broadcastAddr, 0, sizeof broadcastAddr);
broadcastAddr.sin_family = AF_INET;
inet_pton(AF_INET, RLOG_IP_ADDRESS, &broadcastAddr.sin_addr);
broadcastAddr.sin_port = htons(RLOG_PORT);
char* request = (char*)[str UTF8String];
ret = sendto(sd, request, strlen(request), 0, (struct sockaddr*)&broadcastAddr, sizeof broadcastAddr);
if (ret < 0)
{
NSLog(@"[RemoteLog] Error: Could not send broadcast");
close(sd);
return;
}
close(sd);
}
__attribute__((unused)) static void RLog(NSString* format, ...)
{
va_list args;
va_start(args, format);
RLogv(format, args);
va_end(args);
}
#endif
================================================
FILE: RootHelperSample/RootHelperSample.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXFileReference section */
C82AFEFB2B1762CD0070EA49 /* .DS_Store */ = {isa = PBXFileReference; lastKnownFileType = file; path = .DS_Store; sourceTree = ""; };
C82AFEFC2B1762CD0070EA49 /* uicache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uicache.h; sourceTree = ""; };
C82AFEFD2B1762CD0070EA49 /* .theos */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .theos; sourceTree = ""; };
C82AFEFE2B1762CD0070EA49 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; };
C82AFEFF2B1762CD0070EA49 /* entitlements.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = entitlements.plist; sourceTree = ""; };
C82AFF002B1762CD0070EA49 /* TSUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TSUtil.m; sourceTree = ""; };
C82AFF012B1762CD0070EA49 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
C82AFF022B1762CD0070EA49 /* uicache.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = uicache.m; sourceTree = ""; };
C82AFF032B1762CD0070EA49 /* TSUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TSUtil.h; sourceTree = ""; };
C82AFF042B1762CD0070EA49 /* CoreServices.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreServices.h; sourceTree = ""; };
C82AFF052B1762CD0070EA49 /* RemoteLog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteLog.h; sourceTree = ""; };
C82AFF062B1762CD0070EA49 /* control */ = {isa = PBXFileReference; lastKnownFileType = text; path = control; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
C82AFEF52B1762CD0070EA49 = {
isa = PBXGroup;
children = (
C82AFEFB2B1762CD0070EA49 /* .DS_Store */,
C82AFEFC2B1762CD0070EA49 /* uicache.h */,
C82AFEFD2B1762CD0070EA49 /* .theos */,
C82AFEFE2B1762CD0070EA49 /* Makefile */,
C82AFEFF2B1762CD0070EA49 /* entitlements.plist */,
C82AFF002B1762CD0070EA49 /* TSUtil.m */,
C82AFF012B1762CD0070EA49 /* main.m */,
C82AFF022B1762CD0070EA49 /* uicache.m */,
C82AFF032B1762CD0070EA49 /* TSUtil.h */,
C82AFF042B1762CD0070EA49 /* CoreServices.h */,
C82AFF052B1762CD0070EA49 /* RemoteLog.h */,
C82AFF062B1762CD0070EA49 /* control */,
);
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */
C82AFEFA2B1762CD0070EA49 /* RootHelperSample */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION)";
buildConfigurationList = C82AFF072B1762CD0070EA49 /* Build configuration list for PBXLegacyTarget "RootHelperSample" */;
buildPhases = (
);
buildToolPath = "bash /Users/ibarahime/usprebooter/build.sh";
buildWorkingDirectory = /Users/ibarahime/usprebooter/RootHelperSample;
dependencies = (
);
name = RootHelperSample;
passBuildSettingsInEnvironment = 1;
productName = RootHelperSample;
};
/* End PBXLegacyTarget section */
/* Begin PBXProject section */
C82AFEF62B1762CD0070EA49 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
};
buildConfigurationList = C82AFEF92B1762CD0070EA49 /* Build configuration list for PBXProject "RootHelperSample" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = C82AFEF52B1762CD0070EA49;
projectDirPath = "";
projectRoot = "";
targets = (
C82AFEFA2B1762CD0070EA49 /* RootHelperSample */,
);
};
/* End PBXProject section */
/* Begin XCBuildConfiguration section */
C82AFEF72B1762CD0070EA49 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.6;
};
name = Debug;
};
C82AFEF82B1762CD0070EA49 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
SDKROOT = macosx10.6;
};
name = Release;
};
C82AFF082B1762CD0070EA49 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
DEBUGGING_SYMBOLS = YES;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = RootHelperSample;
};
name = Debug;
};
C82AFF092B1762CD0070EA49 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = RootHelperSample;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C82AFEF92B1762CD0070EA49 /* Build configuration list for PBXProject "RootHelperSample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C82AFEF72B1762CD0070EA49 /* Debug */,
C82AFEF82B1762CD0070EA49 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C82AFF072B1762CD0070EA49 /* Build configuration list for PBXLegacyTarget "RootHelperSample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C82AFF082B1762CD0070EA49 /* Debug */,
C82AFF092B1762CD0070EA49 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = C82AFEF62B1762CD0070EA49 /* Project object */;
}
================================================
FILE: RootHelperSample/TSUtil.h
================================================
@import Foundation;
#import "CoreServices.h"
#define TrollStoreErrorDomain @"TrollStoreErrorDomain"
extern void chineseWifiFixup(void);
extern void loadMCMFramework(void);
extern NSString* safe_getExecutablePath();
extern NSString* rootHelperPath(void);
extern NSString* getNSStringFromFile(int fd);
extern void printMultilineNSString(NSString* stringToPrint);
extern int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr);
extern void killall(NSString* processName);
extern void respring(void);
char* getPatchedLaunchdCopy(void);
================================================
FILE: RootHelperSample/TSUtil.m
================================================
#import "TSUtil.h"
#import
#import
#import
#include
@interface PSAppDataUsagePolicyCache : NSObject
+ (instancetype)sharedInstance;
- (void)setUsagePoliciesForBundle:(NSString*)bundleId cellular:(BOOL)cellular wifi:(BOOL)wifi;
@end
#define POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE 1
extern int posix_spawnattr_set_persona_np(const posix_spawnattr_t* __restrict, uid_t, uint32_t);
extern int posix_spawnattr_set_persona_uid_np(const posix_spawnattr_t* __restrict, uid_t);
extern int posix_spawnattr_set_persona_gid_np(const posix_spawnattr_t* __restrict, uid_t);
void loadMCMFramework(void)
{
static dispatch_once_t onceToken;
dispatch_once (&onceToken, ^{
NSBundle* mcmBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"];
[mcmBundle load];
});
}
extern char*** _NSGetArgv();
NSString* safe_getExecutablePath()
{
char* executablePathC = **_NSGetArgv();
return [NSString stringWithUTF8String:executablePathC];
}
#ifdef EMBEDDED_ROOT_HELPER
NSString* rootHelperPath(void)
{
return safe_getExecutablePath();
}
#else
NSString* rootHelperPath(void)
{
return [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"trolltoolsroothelper"];
}
#endif
NSString* getNSStringFromFile(int fd)
{
NSMutableString* ms = [NSMutableString new];
ssize_t num_read;
char c;
while((num_read = read(fd, &c, sizeof(c))))
{
[ms appendString:[NSString stringWithFormat:@"%c", c]];
}
return ms.copy;
}
void printMultilineNSString(NSString* stringToPrint)
{
NSCharacterSet *separator = [NSCharacterSet newlineCharacterSet];
NSArray* lines = [stringToPrint componentsSeparatedByCharactersInSet:separator];
for(NSString* line in lines)
{
NSLog(@"%@", line);
}
}
int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr)
{
NSMutableArray* argsM = args.mutableCopy ?: [NSMutableArray new];
[argsM insertObject:path.lastPathComponent atIndex:0];
NSUInteger argCount = [argsM count];
char **argsC = (char **)malloc((argCount + 1) * sizeof(char*));
for (NSUInteger i = 0; i < argCount; i++)
{
argsC[i] = strdup([[argsM objectAtIndex:i] UTF8String]);
}
argsC[argCount] = NULL;
posix_spawnattr_t attr;
posix_spawnattr_init(&attr);
posix_spawnattr_set_persona_np(&attr, 99, POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE);
posix_spawnattr_set_persona_uid_np(&attr, 0);
posix_spawnattr_set_persona_gid_np(&attr, 0);
posix_spawn_file_actions_t action;
posix_spawn_file_actions_init(&action);
int outErr[2];
if(stdErr)
{
pipe(outErr);
posix_spawn_file_actions_adddup2(&action, outErr[1], STDERR_FILENO);
posix_spawn_file_actions_addclose(&action, outErr[0]);
}
int out[2];
if(stdOut)
{
pipe(out);
posix_spawn_file_actions_adddup2(&action, out[1], STDOUT_FILENO);
posix_spawn_file_actions_addclose(&action, out[0]);
}
pid_t task_pid;
int status = -200;
int spawnError = posix_spawn(&task_pid, [path UTF8String], &action, &attr, (char* const*)argsC, NULL);
posix_spawnattr_destroy(&attr);
for (NSUInteger i = 0; i < argCount; i++)
{
free(argsC[i]);
}
free(argsC);
if(spawnError != 0)
{
NSLog(@"posix_spawn error %d\n", spawnError);
return spawnError;
}
do
{
if (waitpid(task_pid, &status, 0) != -1) {
NSLog(@"Child status %d", WEXITSTATUS(status));
} else
{
perror("waitpid");
return -222;
}
} while (!WIFEXITED(status) && !WIFSIGNALED(status));
if(stdOut)
{
close(out[1]);
NSString* output = getNSStringFromFile(out[0]);
*stdOut = output;
}
if(stdErr)
{
close(outErr[1]);
NSString* errorOutput = getNSStringFromFile(outErr[0]);
*stdErr = errorOutput;
}
return WEXITSTATUS(status);
}
void enumerateProcessesUsingBlock(void (^enumerator)(pid_t pid, NSString* executablePath, BOOL* stop))
{
static int maxArgumentSize = 0;
if (maxArgumentSize == 0) {
size_t size = sizeof(maxArgumentSize);
if (sysctl((int[]){ CTL_KERN, KERN_ARGMAX }, 2, &maxArgumentSize, &size, NULL, 0) == -1) {
perror("sysctl argument size");
maxArgumentSize = 4096; // Default
}
}
int mib[3] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL};
struct kinfo_proc *info;
size_t length;
int count;
if (sysctl(mib, 3, NULL, &length, NULL, 0) < 0)
return;
if (!(info = malloc(length)))
return;
if (sysctl(mib, 3, info, &length, NULL, 0) < 0) {
free(info);
return;
}
count = length / sizeof(struct kinfo_proc);
for (int i = 0; i < count; i++) {
@autoreleasepool {
pid_t pid = info[i].kp_proc.p_pid;
if (pid == 0) {
continue;
}
size_t size = maxArgumentSize;
char* buffer = (char *)malloc(length);
if (sysctl((int[]){ CTL_KERN, KERN_PROCARGS2, pid }, 3, buffer, &size, NULL, 0) == 0) {
NSString* executablePath = [NSString stringWithCString:(buffer+sizeof(int)) encoding:NSUTF8StringEncoding];
BOOL stop = NO;
enumerator(pid, executablePath, &stop);
if(stop)
{
free(buffer);
break;
}
}
free(buffer);
}
}
free(info);
}
void killall(NSString* processName)
{
enumerateProcessesUsingBlock(^(pid_t pid, NSString* executablePath, BOOL* stop)
{
if([executablePath.lastPathComponent isEqualToString:processName])
{
kill(pid, SIGTERM);
}
});
}
void respring(void)
{
killall(@"SpringBoard");
exit(0);
}
int get_boot_manifest_hash(char hash[97])
{
const UInt8 *bytes;
CFIndex length;
io_registry_entry_t chosen = IORegistryEntryFromPath(0, "IODeviceTree:/chosen");
if (!MACH_PORT_VALID(chosen)) return 1;
CFDataRef manifestHash = (CFDataRef)IORegistryEntryCreateCFProperty(chosen, CFSTR("boot-manifest-hash"), kCFAllocatorDefault, 0);
IOObjectRelease(chosen);
if (manifestHash == NULL || CFGetTypeID(manifestHash) != CFDataGetTypeID())
{
if (manifestHash != NULL) CFRelease(manifestHash);
return 1;
}
length = CFDataGetLength(manifestHash);
bytes = CFDataGetBytePtr(manifestHash);
for (int i = 0; i < length; i++)
{
snprintf(&hash[i * 2], 3, "%02X", bytes[i]);
}
CFRelease(manifestHash);
return 0;
}
char* return_boot_manifest_hash_main(void) {
static char hash[97];
int ret = get_boot_manifest_hash(hash);
if (ret != 0) {
fprintf(stderr, "could not get boot manifest hash\n");
return "lmao";
}
static char result[115];
sprintf(result, "/private/preboot/%s", hash);
return result;
}
char* getPatchedLaunchdCopy(void) {
char* prebootpath = return_boot_manifest_hash_main();
static char originallaunchd[256];
sprintf(originallaunchd, "%s/%s", prebootpath, "patchedlaunchd");
NSLog(@"patchedlaunchd: %s", originallaunchd);
return originallaunchd;
}
char* getOriginalLaunchdCopy(void) {
char* prebootpath = return_boot_manifest_hash_main();
static char originallaunchd[256];
sprintf(originallaunchd, "%s/%s", prebootpath, "patchedlaunchd");
NSLog(@"patchedlaunchd: %s", originallaunchd);
return originallaunchd;
}
================================================
FILE: RootHelperSample/control
================================================
Package: net.sourceloc.trolltoolsroothelper
Name: trolltoolsroothelper
Version: 1.0
Architecture: iphoneos-arm
Description: TrollToolsRootHelper
Maintainer: sourcelocation
Author: sourcelocation
Section: System
Tag: role::hacker
================================================
FILE: RootHelperSample/entitlements.plist
================================================
com.apple.private.domain-extension
com.apple.private.security.container-required
com.apple.private.security.no-container
com.apple.private.xpc.domain-extension
com.apple.private.xpc.domain-extension.proxy
com.apple.private.xpc.launchd.app-state-manager
com.apple.private.xpc.launchd.enable-disable-system-services
com.apple.private.xpc.launchd.event-monitor
com.apple.private.xpc.launchd.loginitem-bootstrapper
com.apple.private.xpc.launchd.loginitem-outside-bundle
com.apple.private.xpc.launchd.obliterator
com.apple.private.xpc.launchd.per-user-create.mbsetupuser
com.apple.private.xpc.launchd.per-user-lookup
com.apple.private.xpc.launchd.reboot
com.apple.private.xpc.launchd.service-hold
com.apple.private.xpc.launchd.userspace-reboot
com.apple.private.xpc.launchd.userspace-reboot-now
com.apple.private.xpc.persona-creator
com.apple.private.xpc.persona-manager
com.apple.private.persona-mgmt
com.apple.private.xpc.service-attach
com.apple.private.xpc.service-configure
platform-application
get-task-allow
com.apple.private.security.storage.AppBundles
com.apple.private.security.storage.AppDataContainers
com.apple.security.exception.mach-lookup.global-name
com.apple.mmaintenanced
com.apple.memory-maintenance
================================================
FILE: RootHelperSample/external/include/choma/Base64.h
================================================
#ifndef BASE64_H
#define BASE64_H
#include
#include
char *base64_encode(const unsigned char *data,
size_t input_length,
size_t *output_length);
#endif // BASE64_H
================================================
FILE: RootHelperSample/external/include/choma/BufferedStream.h
================================================
#ifndef BUFFERED_STREAM_H
#define BUFFERED_STREAM_H
#include "MemoryStream.h"
#include
#define BUFFERED_STREAM_FLAG_AUTO_EXPAND (1 << 0)
typedef struct BufferedStreamContext {
uint8_t *buffer;
size_t bufferSize;
uint32_t subBufferStart;
size_t subBufferSize;
} BufferedStreamContext;
MemoryStream *buffered_stream_init_from_buffer_nocopy(void *buffer, size_t bufferSize, uint32_t flags);
MemoryStream *buffered_stream_init_from_buffer(void *buffer, size_t bufferSize, uint32_t flags);
#endif // BUFFERED_STREAM_H
================================================
FILE: RootHelperSample/external/include/choma/CSBlob.h
================================================
#ifndef CS_BLOB_H
#define CS_BLOB_H
#include
#include
#include
#include
#include "FAT.h"
#include "MachO.h"
#include "MemoryStream.h"
// Blob index
typedef struct __BlobIndex {
uint32_t type;
uint32_t offset;
} CS_BlobIndex;
// CMS superblob
typedef struct __SuperBlob {
uint32_t magic;
uint32_t length;
uint32_t count;
CS_BlobIndex index[];
} CS_SuperBlob;
typedef struct __GenericBlob {
uint32_t magic; /* magic number */
uint32_t length; /* total length of blob */
char data[];
} CS_GenericBlob;
// CMS blob magic types
enum {
CSBLOB_REQUIREMENT = 0xfade0c00,
CSBLOB_REQUIREMENTS = 0xfade0c01,
CSBLOB_CODEDIRECTORY = 0xfade0c02,
CSBLOB_EMBEDDED_SIGNATURE = 0xfade0cc0,
CSBLOB_DETACHED_SIGNATURE = 0xfade0cc1,
CSBLOB_ENTITLEMENTS = 0xfade7171,
CSBLOB_DER_ENTITLEMENTS = 0xfade7172,
CSBLOB_SIGNATURE_BLOB = 0xfade0b01
} CS_BlobType;
enum {
CSSLOT_CODEDIRECTORY = 0,
CSSLOT_INFOSLOT = 1,
CSSLOT_REQUIREMENTS = 2,
CSSLOT_RESOURCEDIR = 3,
CSSLOT_APPLICATION = 4,
CSSLOT_ENTITLEMENTS = 5,
CSSLOT_DER_ENTITLEMENTS = 7,
CSSLOT_ALTERNATE_CODEDIRECTORIES = 0x1000,
CSSLOT_ALTERNATE_CODEDIRECTORY_MAX = 5,
CSSLOT_ALTERNATE_CODEDIRECTORY_LIMIT = CSSLOT_ALTERNATE_CODEDIRECTORIES + CSSLOT_ALTERNATE_CODEDIRECTORY_MAX,
CSSLOT_SIGNATURESLOT = 0x10000
} CS_SlotType;
typedef struct s_CS_DecodedBlob {
struct s_CS_DecodedBlob *next;
uint32_t type;
MemoryStream *stream;
} CS_DecodedBlob;
typedef struct s_CS_DecodedSuperBlob {
uint32_t magic;
struct s_CS_DecodedBlob *firstBlob;
} CS_DecodedSuperBlob;
// Convert blob magic to readable blob type string
char *cs_blob_magic_to_string(int magic);
// Extract Code Signature to file
int macho_extract_cs_to_file(MachO *macho, CS_SuperBlob *superblob);
int macho_find_code_signature_bounds(MachO *macho, uint32_t *offsetOut, uint32_t *sizeOut);
CS_SuperBlob *macho_read_code_signature(MachO *macho);
int macho_replace_code_signature(MachO *macho, CS_SuperBlob *superblob);
int update_load_commands(MachO *macho, CS_SuperBlob *superblob, uint64_t originalSize);
CS_DecodedBlob *csd_blob_init(uint32_t type, CS_GenericBlob *blobData);
int csd_blob_read(CS_DecodedBlob *blob, uint64_t offset, size_t size, void *outBuf);
int csd_blob_write(CS_DecodedBlob *blob, uint64_t offset, size_t size, const void *inBuf);
int csd_blob_insert(CS_DecodedBlob *blob, uint64_t offset, size_t size, const void *inBuf);
int csd_blob_delete(CS_DecodedBlob *blob, uint64_t offset, size_t size);
int csd_blob_read_string(CS_DecodedBlob *blob, uint64_t offset, char **outString);
int csd_blob_write_string(CS_DecodedBlob *blob, uint64_t offset, const char *string);
int csd_blob_get_size(CS_DecodedBlob *blob);
uint32_t csd_blob_get_type(CS_DecodedBlob *blob);
void csd_blob_set_type(CS_DecodedBlob *blob, uint32_t type);
void csd_blob_free(CS_DecodedBlob *blob);
CS_DecodedSuperBlob *csd_superblob_decode(CS_SuperBlob *superblob);
CS_SuperBlob *csd_superblob_encode(CS_DecodedSuperBlob *decodedSuperblob);
CS_DecodedBlob *csd_superblob_find_blob(CS_DecodedSuperBlob *superblob, uint32_t type, uint32_t *indexOut);
int csd_superblob_insert_blob_after_blob(CS_DecodedSuperBlob *superblob, CS_DecodedBlob *blobToInsert, CS_DecodedBlob *afterBlob);
int csd_superblob_insert_blob_at_index(CS_DecodedSuperBlob *superblob, CS_DecodedBlob *blobToInsert, uint32_t atIndex);
int csd_superblob_append_blob(CS_DecodedSuperBlob *superblob, CS_DecodedBlob *blobToAppend);
int csd_superblob_remove_blob(CS_DecodedSuperBlob *superblob, CS_DecodedBlob *blobToRemove); // <- Important: When calling this, caller is responsible for freeing blobToRemove
int csd_superblob_remove_blob_at_index(CS_DecodedSuperBlob *superblob, uint32_t atIndex);
int csd_superblob_print_content(CS_DecodedSuperBlob *decodedSuperblob, MachO *macho, bool printAllSlots, bool verifySlots);
void csd_superblob_free(CS_DecodedSuperBlob *decodedSuperblob);
#endif // CS_BLOB_H
================================================
FILE: RootHelperSample/external/include/choma/CodeDirectory.h
================================================
#ifndef CODE_DIRECTORY_H
#define CODE_DIRECTORY_H
#include
#include
#include
#include "MachO.h"
#include "CSBlob.h"
#include "FAT.h"
#include "MachOByteOrder.h"
#include "MachOLoadCommand.h"
#include "MemoryStream.h"
// Code directory blob header
typedef struct __CodeDirectory {
uint32_t magic;
uint32_t length;
uint32_t version;
uint32_t flags;
uint32_t hashOffset;
uint32_t identOffset;
uint32_t nSpecialSlots;
uint32_t nCodeSlots;
uint32_t codeLimit;
uint8_t hashSize;
uint8_t hashType;
uint8_t spare1;
uint8_t pageSize;
uint32_t spare2;
uint32_t scatterOffset;
uint32_t teamOffset;
} CS_CodeDirectory;
enum CS_HashType {
CS_HASHTYPE_SHA160_160 = 1,
CS_HASHTYPE_SHA256_256 = 2,
CS_HASHTYPE_SHA256_160 = 3,
CS_HASHTYPE_SHA384_384 = 4,
};
char *csd_code_directory_copy_identity(CS_DecodedBlob *codeDirBlob, uint32_t *offsetOut);
char *csd_code_directory_copy_team_id(CS_DecodedBlob *codeDirBlob, uint32_t *offsetOut);
int csd_code_directory_set_team_id(CS_DecodedBlob *codeDirBlob, char *newTeamID);
uint32_t csd_code_directory_get_flags(CS_DecodedBlob *codeDirBlob);
void csd_code_directory_set_flags(CS_DecodedBlob *codeDirBlob, uint32_t flags);
uint8_t csd_code_directory_get_hash_type(CS_DecodedBlob *codeDirBlob);
void csd_code_directory_set_hash_type(CS_DecodedBlob *codeDirBlob, uint8_t hashType);
int csd_code_directory_print_content(CS_DecodedBlob *codeDirBlob, MachO *macho, bool printSlots, bool verifySlots);
void csd_code_directory_update(CS_DecodedBlob *codeDirBlob, MachO *macho);
#endif // CODE_DIRECTORY_H
================================================
FILE: RootHelperSample/external/include/choma/FAT.h
================================================
#ifndef MACHO_H
#define MACHO_H
#include
#include
#include
#include
#include
#include
#include "MemoryStream.h"
typedef struct MachO MachO;
// A FAT structure can either represent a FAT file with multiple slices, in which the slices will be loaded into the slices attribute
// Or a single slice MachO, in which case it serves as a compatibility layer and the single slice will also be loaded into the slices attribute
typedef struct FAT
{
MemoryStream *stream;
MachO **slices;
uint32_t slicesCount;
int fileDescriptor;
} FAT;
int fat_read_at_offset(FAT *fat, uint64_t offset, size_t size, void *outBuf);
MemoryStream *fat_get_stream(FAT *fat);
// Initialise a FAT structure from a memory stream
FAT *fat_init_from_memory_stream(MemoryStream *stream);
// Initialise a FAT structure using the path to the file
FAT *fat_init_from_path(const char *filePath);
//FAT *fat_init_from_path_for_writing(const char *filePath);
// Find macho with cputype and cpusubtype in FAT, returns NULL if not found
MachO *fat_find_slice(FAT *fat, cpu_type_t cputype, cpu_subtype_t cpusubtype);
// Free all elements of the FAT structure
void fat_free(FAT *fat);
#endif // MACHO_H
================================================
FILE: RootHelperSample/external/include/choma/FileStream.h
================================================
#ifndef FILE_STREAM_H
#define FILE_STREAM_H
#include "MemoryStream.h"
#define FILE_STREAM_SIZE_AUTO 0
#define FILE_STREAM_FLAG_WRITABLE (1 << 0)
#define FILE_STREAM_FLAG_AUTO_EXPAND (1 << 1)
typedef struct FileStreamContext {
int fd;
size_t fileSize;
uint32_t bufferStart;
size_t bufferSize;
} FileStreamContext;
MemoryStream *file_stream_init_from_file_descriptor_nodup(int fd, uint32_t bufferStart, size_t bufferSize, uint32_t flags);
MemoryStream *file_stream_init_from_file_descriptor(int fd, uint32_t bufferStart, size_t bufferSize, uint32_t flags);
MemoryStream *file_stream_init_from_path(const char *path, uint32_t bufferStart, size_t bufferSize, uint32_t flags);
#endif // FILE_STREAM_H
================================================
FILE: RootHelperSample/external/include/choma/Host.h
================================================
#ifndef HOST_H
#define HOST_H
#include "FAT.h"
// Retrieve the preferred MachO slice from a FAT
// Preferred slice as in the slice that the kernel would use when loading the file
MachO *fat_find_preferred_slice(FAT *fat);
#endif // HOST_H
================================================
FILE: RootHelperSample/external/include/choma/MachO.h
================================================
#ifndef MACHO_SLICE_H
#define MACHO_SLICE_H
#include
#include
#include
#include "MemoryStream.h"
#include "FAT.h"
typedef struct MachOSegment
{
struct segment_command_64 command;
struct section_64 sections[];
} __attribute__((__packed__)) MachOSegment;
typedef struct FilesetMachO {
char *entry_id;
uint64_t vmaddr;
uint64_t fileoff;
FAT *underlyingMachO;
} FilesetMachO;
typedef struct MachO {
MemoryStream *stream;
bool isSupported;
struct mach_header_64 machHeader;
struct fat_arch_64 archDescriptor;
uint32_t filesetCount;
FilesetMachO *filesetMachos;
uint32_t segmentCount;
MachOSegment **segments;
} MachO;
// Read data from a MachO at a specified offset
int macho_read_at_offset(MachO *macho, uint64_t offset, size_t size, void *outBuf);
// Write data from a MachO at a specified offset, auto expands, only works if opened via macho_init_for_writing
int macho_write_at_offset(MachO *macho, uint64_t offset, size_t size, void *inBuf);
MemoryStream *macho_get_stream(MachO *macho);
uint32_t macho_get_filetype(MachO *macho);
// Perform translation between file offsets and virtual addresses
int macho_translate_fileoff_to_vmaddr(MachO *macho, uint64_t fileoff, uint64_t *vmaddrOut, MachOSegment **segmentOut);
int macho_translate_vmaddr_to_fileoff(MachO *macho, uint64_t vmaddr, uint64_t *fileoffOut, MachOSegment **segmentOut);
// Read data from a MachO at a specified virtual address
int macho_read_at_vmaddr(MachO *macho, uint64_t vmaddr, size_t size, void *outBuf);
int macho_enumerate_load_commands(MachO *macho, void (^enumeratorBlock)(struct load_command loadCommand, uint64_t offset, void *cmd, bool *stop));
// Initialise a MachO object from a MemoryStream and it's corresponding FAT arch descriptor
MachO *macho_init(MemoryStream *stream, struct fat_arch_64 archDescriptor);
// Initialize a single slice macho for writing to it
MachO *macho_init_for_writing(const char *filePath);
void macho_free(MachO *macho);
#endif // MACHO_SLICE_H
================================================
FILE: RootHelperSample/external/include/choma/MachOByteOrder.h
================================================
#ifndef MACHO_BYTE_ORDER_H
#define MACHO_BYTE_ORDER_H
#include
#include
// 8-bit integers needed for CodeDirectory
#define BIG_TO_HOST(n) _Generic((n), \
int8_t: n, \
uint8_t: n, \
int16_t: OSSwapBigToHostInt16(n), \
uint16_t: OSSwapBigToHostInt16(n), \
int32_t: OSSwapBigToHostInt32(n), \
uint32_t: OSSwapBigToHostInt32(n), \
int64_t: OSSwapBigToHostInt64(n), \
uint64_t: OSSwapBigToHostInt64(n) \
)
#define HOST_TO_BIG(n) _Generic((n), \
int8_t: n, \
uint8_t: n, \
uint16_t: OSSwapHostToBigInt16(n), \
int16_t: OSSwapHostToBigInt16(n), \
int32_t: OSSwapHostToBigInt32(n), \
uint32_t: OSSwapHostToBigInt32(n), \
int64_t: OSSwapHostToBigInt64(n), \
uint64_t: OSSwapHostToBigInt64(n) \
)
#define LITTLE_TO_HOST(n) _Generic((n), \
int8_t: n, \
uint8_t: n, \
int16_t: OSSwapLittleToHostInt16(n), \
uint16_t: OSSwapLittleToHostInt16(n), \
int32_t: OSSwapLittleToHostInt32(n), \
uint32_t: OSSwapLittleToHostInt32(n), \
int64_t: OSSwapLittleToHostInt64(n), \
uint64_t: OSSwapLittleToHostInt64(n) \
)
#define HOST_TO_LITTLE(n) _Generic((n), \
int8_t: n, \
uint8_t: n, \
int16_t: OSSwapHostToLittleInt16(n), \
uint16_t: OSSwapHostToLittleInt16(n), \
int32_t: OSSwapHostToLittleInt32(n), \
uint32_t: OSSwapHostToLittleInt32(n), \
int64_t: OSSwapHostToLittleInt64(n), \
uint64_t: OSSwapHostToLittleInt64(n) \
)
#define HOST_TO_LITTLE_APPLIER(instance, member) \
(instance)->member = HOST_TO_LITTLE((instance)->member)
#define HOST_TO_BIG_APPLIER(instance, member) \
(instance)->member = HOST_TO_BIG((instance)->member)
#define LITTLE_TO_HOST_APPLIER(instance, member) \
(instance)->member = LITTLE_TO_HOST((instance)->member)
#define BIG_TO_HOST_APPLIER(instance, member) \
(instance)->member = BIG_TO_HOST((instance)->member)
#define FAT_HEADER_APPLY_BYTE_ORDER(fh, applier) \
applier(fh, magic); \
applier(fh, nfat_arch);
#define FAT_ARCH_APPLY_BYTE_ORDER(arch, applier) \
applier(arch, cputype); \
applier(arch, cpusubtype); \
applier(arch, offset); \
applier(arch, size); \
applier(arch, align); \
#define FAT_ARCH_64_APPLY_BYTE_ORDER(arch, applier) \
applier(arch, cputype); \
applier(arch, cpusubtype); \
applier(arch, offset); \
applier(arch, size); \
applier(arch, align); \
applier(arch, reserved); \
#define MACH_HEADER_APPLY_BYTE_ORDER(mh, applier) \
applier(mh, magic); \
applier(mh, cputype); \
applier(mh, cpusubtype); \
applier(mh, filetype); \
applier(mh, ncmds); \
applier(mh, sizeofcmds); \
applier(mh, reserved);
#define LOAD_COMMAND_APPLY_BYTE_ORDER(lc, applier) \
applier(lc, cmd); \
applier(lc, cmdsize);
#define LINKEDIT_DATA_COMMAND_APPLY_BYTE_ORDER(lc, applier) \
applier(lc, cmd); \
applier(lc, cmdsize); \
applier(lc, dataoff); \
applier(lc, datasize);
#define BLOB_INDEX_APPLY_BYTE_ORDER(bi, applier) \
applier(bi, type); \
applier(bi, offset);
#define SUPERBLOB_APPLY_BYTE_ORDER(sb, applier) \
applier(sb, magic); \
applier(sb, length); \
applier(sb, count);
#define GENERIC_BLOB_APPLY_BYTE_ORDER(gb, applier) \
applier(gb, magic); \
applier(gb, length);
#define CODE_DIRECTORY_APPLY_BYTE_ORDER(cd, applier) \
applier(cd, magic); \
applier(cd, length); \
applier(cd, version); \
applier(cd, flags); \
applier(cd, hashOffset); \
applier(cd, identOffset); \
applier(cd, nSpecialSlots); \
applier(cd, nCodeSlots); \
applier(cd, codeLimit); \
applier(cd, hashSize); \
applier(cd, hashType); \
applier(cd, spare1); \
applier(cd, pageSize); \
applier(cd, spare2); \
applier(cd, scatterOffset); \
applier(cd, teamOffset);
#define SEGMENT_COMMAND_64_APPLY_BYTE_ORDER(sc64, applier) \
applier(sc64, cmd); \
applier(sc64, cmdsize); \
applier(sc64, fileoff); \
applier(sc64, filesize); \
applier(sc64, vmaddr); \
applier(sc64, vmsize); \
applier(sc64, flags); \
applier(sc64, initprot); \
applier(sc64, maxprot); \
applier(sc64, nsects);
#define SECTION_64_APPLY_BYTE_ORDER(sc64, applier) \
applier(sc64, addr); \
applier(sc64, align); \
applier(sc64, flags); \
applier(sc64, nreloc); \
applier(sc64, offset); \
applier(sc64, reserved1); \
applier(sc64, reserved2); \
applier(sc64, reserved3); \
applier(sc64, size);
#define FILESET_ENTRY_COMMAND_APPLY_BYTE_ORDER(fse, applier) \
applier(fse, cmd); \
applier(fse, cmdsize); \
applier(fse, vmaddr); \
applier(fse, fileoff); \
applier(fse, entry_id.offset); \
applier(fse, reserved); \
#endif // MACHO_BYTE_ORDER_H
================================================
FILE: RootHelperSample/external/include/choma/MachOLoadCommand.h
================================================
#ifndef MACHO_LOAD_COMMAND_H
#define MACHO_LOAD_COMMAND_H
#include
#include "MachO.h"
#include "CSBlob.h"
#include "FileStream.h"
#include "MachOByteOrder.h"
// Convert load command to load command name
char *load_command_to_string(int loadCommand);
void update_segment_command_64(MachO *macho, const char *segmentName, uint64_t vmaddr, uint64_t vmsize, uint64_t fileoff, uint64_t filesize);
void update_lc_code_signature(MachO *macho, uint64_t size);
int update_load_commands_for_coretrust_bypass(MachO *macho, CS_SuperBlob *superblob, uint64_t originalCodeSignatureSize, uint64_t originalMachOSize);
#endif // MACHO_LOAD_COMMAND_H
================================================
FILE: RootHelperSample/external/include/choma/MemoryStream.h
================================================
#ifndef MEMORY_STREAM_H
#define MEMORY_STREAM_H
#include
#include
#include
#include
#include
#include
#include
#define MEMORY_STREAM_FLAG_OWNS_DATA (1 << 0)
#define MEMORY_STREAM_FLAG_MUTABLE (1 << 1)
#define MEMORY_STREAM_FLAG_AUTO_EXPAND (1 << 2)
#define MEMORY_STREAM_SIZE_INVALID (size_t)-1
// A generic memory IO interface that is used throughout this project
// Can be backed by anything, just the functions have to be implemented
typedef struct s_MemoryStream {
void *context;
uint32_t flags;
int (*read)(struct s_MemoryStream *stream, uint64_t offset, size_t size, void *outBuf);
int (*write)(struct s_MemoryStream *stream, uint64_t offset, size_t size, const void *inBuf);
int (*getSize)(struct s_MemoryStream *stream, size_t *sizeOut);
uint8_t *(*getRawPtr)(struct s_MemoryStream *stream);
int (*trim)(struct s_MemoryStream *stream, size_t trimAtStart, size_t trimAtEnd);
int (*expand)(struct s_MemoryStream *stream, size_t expandAtStart, size_t expandAtEnd);
struct s_MemoryStream *(*hardclone)(struct s_MemoryStream *stream);
struct s_MemoryStream *(*softclone)(struct s_MemoryStream *stream);
void (*free)(struct s_MemoryStream *stream);
} MemoryStream;
int memory_stream_read(MemoryStream *stream, uint64_t offset, size_t size, void *outBuf);
int memory_stream_write(MemoryStream *stream, uint64_t offset, size_t size, const void *inBuf);
int memory_stream_insert(MemoryStream *stream, uint64_t offset, size_t size, const void *inBuf);
int memory_stream_delete(MemoryStream *stream, uint64_t offset, size_t size);
int memory_stream_read_string(MemoryStream *stream, uint64_t offset, char **outString);
int memory_stream_write_string(MemoryStream *stream, uint64_t offset, const char *string);
size_t memory_stream_get_size(MemoryStream *stream);
uint8_t *memory_stream_get_raw_pointer(MemoryStream *stream);
uint32_t memory_stream_get_flags(MemoryStream *stream);
MemoryStream *memory_stream_softclone(MemoryStream *stream);
MemoryStream *memory_stream_hardclone(MemoryStream *stream);
int memory_stream_trim(MemoryStream *stream, size_t trimAtStart, size_t trimAtEnd);
int memory_stream_expand(MemoryStream *stream, size_t expandAtStart, size_t expandAtEnd);
void memory_stream_free(MemoryStream *stream);
int memory_stream_copy_data(MemoryStream *originStream, uint64_t originOffset, MemoryStream *targetStream, uint64_t targetOffset, size_t size);
int memory_stream_find_memory(MemoryStream *stream, uint64_t searchOffset, size_t searchSize, void *bytes, void *mask, size_t nbytes, uint16_t alignment, uint64_t *foundOffsetOut);
#endif // MEMORY_STREAM_H
================================================
FILE: RootHelperSample/external/include/choma/PatchFinder.h
================================================
#include
#include "MachO.h"
#define METRIC_TYPE_PATTERN 1
#define METRIC_TYPE_STRING_XREF 2
#define METRIC_TYPE_FUNCTION_XREF 3
typedef struct PFSection {
uint64_t fileoff;
uint64_t vmaddr;
uint64_t size;
uint8_t *cache;
bool ownsCache;
} PFSection;
PFSection *macho_patchfinder_create_section(MachO *macho, const char *filesetEntryId, const char *segName, const char *sectName);
int macho_patchfinder_cache_section(PFSection *section, MachO *fromMacho);
void macho_patchfinder_section_free(PFSection *section);
typedef struct MetricShared {
uint32_t type;
PFSection *section;
} MetricShared;
typedef enum {
BYTE_PATTERN_ALIGN_8_BIT,
BYTE_PATTERN_ALIGN_16_BIT,
BYTE_PATTERN_ALIGN_32_BIT,
BYTE_PATTERN_ALIGN_64_BIT,
} BytePatternAlignment;
typedef struct BytePatternMetric {
MetricShared shared;
void *bytes;
void *mask;
size_t nbytes;
BytePatternAlignment alignment;
} BytePatternMetric;
BytePatternMetric *macho_patchfinder_create_byte_pattern_metric(PFSection *section, void *bytes, void *mask, size_t nbytes, BytePatternAlignment alignment);
void macho_patchfinder_run_metric(MachO *macho, void *metric, void (^matchBlock)(uint64_t vmaddr, bool *stop));
================================================
FILE: RootHelperSample/external/include/choma/SignOSSL.h
================================================
#ifndef SIGN_OSSL_H
#define SIGN_OSSL_H
#include
#include
#include
#include
#include
#include
#include
unsigned char *signWithRSA(unsigned char *inputData, size_t inputDataLength, unsigned char *key, size_t key_len, size_t *outputDataLength);
#endif // SIGN_OSSL_H
// 0xA422
================================================
FILE: RootHelperSample/external/include/choma/Signing.h
================================================
#ifndef SIGNING_H
#define SIGNING_H
#include
#include
#include
#include
#include
// int signWithRSA(const char *certificateFile, const char *inputFile, const char *outputFile);
#endif // SIGNING_H
================================================
FILE: RootHelperSample/external/include/choma/Util.h
================================================
#include
#include
uint64_t align_to_size(int size, int alignment);
int count_digits(int64_t num);
void print_hash(uint8_t *hash, size_t size);
================================================
FILE: RootHelperSample/external/lib/libcrypto.a
================================================
[File too large to display: 18.6 MB]
================================================
FILE: RootHelperSample/insert_dylib.h
================================================
//
// insert_dylib.h
// kfd
//
// Created by Alfie on 02/01/2024.
//
#ifndef insert_dylib_h
#define insert_dylib_h
int insert_dylib_main(const char *dylib_path, const char *binary_path);
#endif /* insert_dylib_h */
================================================
FILE: RootHelperSample/insert_dylib.m
================================================
// https://github.com/tyilo/insert_dylib
// thanks Alfie
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "insert_dylib.h"
#include
void NSLogC(const char *format, ...) {
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
va_start(args, format);
NSString *logString = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args];
NSLog(@"%@", logString);
va_end(args);
}
#define IS_64_BIT(x) ((x) == MH_MAGIC_64 || (x) == MH_CIGAM_64)
#define IS_LITTLE_ENDIAN(x) ((x) == FAT_CIGAM || (x) == MH_CIGAM_64 || (x) == MH_CIGAM)
#define SWAP32(x, magic) (IS_LITTLE_ENDIAN(magic)? OSSwapInt32(x): (x))
#define SWAP64(x, magic) (IS_LITTLE_ENDIAN(magic)? OSSwapInt64(x): (x))
#define ROUND_UP(x, y) (((x) + (y) - 1) & -(y))
#define ABSDIFF(x, y) ((x) > (y)? (uintmax_t)(x) - (uintmax_t)(y): (uintmax_t)(y) - (uintmax_t)(x))
#define BUFSIZE 512
void fbzero(FILE *f, off_t offset, size_t len) {
static unsigned char zeros[BUFSIZE] = {0};
fseeko(f, offset, SEEK_SET);
while(len != 0) {
size_t size = MIN(len, sizeof(zeros));
fwrite(zeros, size, 1, f);
len -= size;
}
}
void fmemmove(FILE *f, off_t dst, off_t src, size_t len) {
static unsigned char buf[BUFSIZE];
while(len != 0) {
size_t size = MIN(len, sizeof(buf));
fseeko(f, src, SEEK_SET);
fread(&buf, size, 1, f);
fseeko(f, dst, SEEK_SET);
fwrite(buf, size, 1, f);
len -= size;
src += size;
dst += size;
}
}
int inplace_flag = false;
int weak_flag = false;
int overwrite_flag = false;
int codesig_flag = 0;
int yes_flag = false;
static struct option long_options[] = {
{"inplace", no_argument, &inplace_flag, true},
{"weak", no_argument, &weak_flag, true},
{"overwrite", no_argument, &overwrite_flag, true},
{"strip-codesig", no_argument, &codesig_flag, 1},
{"no-strip-codesig", no_argument, &codesig_flag, 2},
{"all-yes", no_argument, &yes_flag, true},
{NULL, 0, NULL, 0}
};
__attribute__((noreturn)) void usage(void) {
NSLogC("[kfdHaxx] insert_dylib: Usage: insert_dylib dylib_path binary_path [new_binary_path]\n");
NSLogC("[kfdHaxx] insert_dylib: Option flags:");
struct option *opt = long_options;
while(opt->name != NULL) {
NSLogC("[kfdHaxx] insert_dylib: --%s", opt->name);
opt++;
}
NSLogC("[kfdHaxx] insert_dylib: \n");
exit(1);
}
__attribute__((format(printf, 1, 2))) bool ask(const char *format, ...) {
char *question;
asprintf(&question, "%s [y/n] ", format);
va_list args;
va_start(args, format);
vprintf(question, args);
va_end(args);
free(question);
while(true) {
char *line = NULL;
size_t size;
if(yes_flag) {
puts("y");
line = "y";
} else {
getline(&line, &size, stdin);
}
switch(line[0]) {
case 'y':
case 'Y':
return true;
break;
case 'n':
case 'N':
return false;
break;
default:
// NSLogC("[kfdHaxx] insert_dylib: Please enter y or n: ");
return true;
}
}
}
size_t fpeek(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream) {
off_t pos = ftello(stream);
size_t result = fread(ptr, size, nitems, stream);
fseeko(stream, pos, SEEK_SET);
return result;
}
void *read_load_command(FILE *f, uint32_t cmdsize) {
void *lc = malloc(cmdsize);
fpeek(lc, cmdsize, 1, f);
return lc;
}
bool check_load_commands(FILE *f, struct mach_header *mh, size_t header_offset, size_t commands_offset, const char *dylib_path, off_t *slice_size) {
fseeko(f, commands_offset, SEEK_SET);
uint32_t ncmds = SWAP32(mh->ncmds, mh->magic);
off_t linkedit_32_pos = -1;
off_t linkedit_64_pos = -1;
struct segment_command linkedit_32;
struct segment_command_64 linkedit_64;
off_t symtab_pos = -1;
uint32_t symtab_size = 0;
for(int i = 0; i < ncmds; i++) {
struct load_command lc;
fpeek(&lc, sizeof(lc), 1, f);
uint32_t cmdsize = SWAP32(lc.cmdsize, mh->magic);
uint32_t cmd = SWAP32(lc.cmd, mh->magic);
switch(cmd) {
case LC_CODE_SIGNATURE:
if(i == ncmds - 1) {
if(codesig_flag == 2) {
return true;
}
if(codesig_flag == 0 && !ask("LC_CODE_SIGNATURE load command found. Remove it?")) {
return true;
}
struct linkedit_data_command *cmd = read_load_command(f, cmdsize);
fbzero(f, ftello(f), cmdsize);
uint32_t dataoff = SWAP32(cmd->dataoff, mh->magic);
uint32_t datasize = SWAP32(cmd->datasize, mh->magic);
free(cmd);
uint64_t linkedit_fileoff = 0;
uint64_t linkedit_filesize = 0;
if(linkedit_32_pos != -1) {
linkedit_fileoff = SWAP32(linkedit_32.fileoff, mh->magic);
linkedit_filesize = SWAP32(linkedit_32.filesize, mh->magic);
} else if(linkedit_64_pos != -1) {
linkedit_fileoff = SWAP64(linkedit_64.fileoff, mh->magic);
linkedit_filesize = SWAP64(linkedit_64.filesize, mh->magic);
} else {
fprintf(stderr, "Warning: __LINKEDIT segment not found.\n");
}
if(linkedit_32_pos != -1 || linkedit_64_pos != -1) {
if(linkedit_fileoff + linkedit_filesize != *slice_size) {
fprintf(stderr, "Warning: __LINKEDIT segment is not at the end of the file, so codesign will not work on the patched binary.\n");
} else {
if(dataoff + datasize != *slice_size) {
fprintf(stderr, "Warning: Codesignature is not at the end of __LINKEDIT segment, so codesign will not work on the patched binary.\n");
} else {
*slice_size -= datasize;
//int64_t diff_size = 0;
if(symtab_pos == -1) {
fprintf(stderr, "Warning: LC_SYMTAB load command not found. codesign might not work on the patched binary.\n");
} else {
fseeko(f, symtab_pos, SEEK_SET);
struct symtab_command *symtab = read_load_command(f, symtab_size);
uint32_t strsize = SWAP32(symtab->strsize, mh->magic);
int64_t diff_size = SWAP32(symtab->stroff, mh->magic) + strsize - (int64_t)*slice_size;
if(-0x10 <= diff_size && diff_size <= 0) {
symtab->strsize = SWAP32((uint32_t)(strsize - diff_size), mh->magic);
fwrite(symtab, symtab_size, 1, f);
} else {
fprintf(stderr, "Warning: String table doesn't appear right before code signature. codesign might not work on the patched binary. (0x%llx)\n", diff_size);
}
free(symtab);
}
linkedit_filesize -= datasize;
uint64_t linkedit_vmsize = ROUND_UP(linkedit_filesize, 0x1000);
if(linkedit_32_pos != -1) {
linkedit_32.filesize = SWAP32((uint32_t)linkedit_filesize, mh->magic);
linkedit_32.vmsize = SWAP32((uint32_t)linkedit_vmsize, mh->magic);
fseeko(f, linkedit_32_pos, SEEK_SET);
fwrite(&linkedit_32, sizeof(linkedit_32), 1, f);
} else {
linkedit_64.filesize = SWAP64(linkedit_filesize, mh->magic);
linkedit_64.vmsize = SWAP64(linkedit_vmsize, mh->magic);
fseeko(f, linkedit_64_pos, SEEK_SET);
fwrite(&linkedit_64, sizeof(linkedit_64), 1, f);
}
goto fix_header;
}
}
}
// If we haven't truncated the file, zero out the code signature
fbzero(f, header_offset + dataoff, datasize);
fix_header:
mh->ncmds = SWAP32(ncmds - 1, mh->magic);
mh->sizeofcmds = SWAP32(SWAP32(mh->sizeofcmds, mh->magic) - cmdsize, mh->magic);
return true;
} else {
NSLogC("[kfdHaxx] insert_dylib: LC_CODE_SIGNATURE is not the last load command, so couldn't remove.\n");
}
break;
case LC_LOAD_DYLIB:
case LC_LOAD_WEAK_DYLIB: {
struct dylib_command *dylib_command = read_load_command(f, cmdsize);
union lc_str offset = dylib_command->dylib.name;
char *name = &((char *)dylib_command)[SWAP32(offset.offset, mh->magic)];
int cmp = strcmp(name, dylib_path);
free(dylib_command);
if(cmp == 0) {
if(!ask("Binary already contains a load command for that dylib. Continue anyway?")) {
return false;
}
}
break;
}
case LC_SEGMENT:
case LC_SEGMENT_64:
if(cmd == LC_SEGMENT) {
struct segment_command *cmd = read_load_command(f, cmdsize);
if(strcmp(cmd->segname, "__LINKEDIT") == 0) {
linkedit_32_pos = ftello(f);
linkedit_32 = *cmd;
}
free(cmd);
} else {
struct segment_command_64 *cmd = read_load_command(f, cmdsize);
if(strcmp(cmd->segname, "__LINKEDIT") == 0) {
linkedit_64_pos = ftello(f);
linkedit_64 = *cmd;
}
free(cmd);
}
case LC_SYMTAB:
symtab_pos = ftello(f);
symtab_size = cmdsize;
}
fseeko(f, SWAP32(lc.cmdsize, mh->magic), SEEK_CUR);
}
return true;
}
bool insert_dylib(FILE *f, size_t header_offset, const char *dylib_path, off_t *slice_size) {
fseeko(f, header_offset, SEEK_SET);
struct mach_header mh;
fread(&mh, sizeof(struct mach_header), 1, f);
if(mh.magic != MH_MAGIC_64 && mh.magic != MH_CIGAM_64 && mh.magic != MH_MAGIC && mh.magic != MH_CIGAM) {
NSLogC("[kfdHaxx] insert_dylib: Unknown magic: 0x%x\n", mh.magic);
return false;
}
size_t commands_offset = header_offset + (IS_64_BIT(mh.magic)? sizeof(struct mach_header_64): sizeof(struct mach_header));
bool cont = check_load_commands(f, &mh, header_offset, commands_offset, dylib_path, slice_size);
if(!cont) {
return true;
}
// Even though a padding of 4 works for x86_64, codesign doesn't like it
size_t path_padding = 8;
size_t dylib_path_len = strlen(dylib_path);
size_t dylib_path_size = (dylib_path_len & ~(path_padding - 1)) + path_padding;
uint32_t cmdsize = (uint32_t)(sizeof(struct dylib_command) + dylib_path_size);
struct dylib_command dylib_command = {
.cmd = SWAP32(weak_flag? LC_LOAD_WEAK_DYLIB: LC_LOAD_DYLIB, mh.magic),
.cmdsize = SWAP32(cmdsize, mh.magic),
.dylib = {
.name = {SWAP32(sizeof(struct dylib_command), mh.magic)},
.timestamp = 0,
.current_version = 0,
.compatibility_version = 0
}
};
uint32_t sizeofcmds = SWAP32(mh.sizeofcmds, mh.magic);
fseeko(f, commands_offset + sizeofcmds, SEEK_SET);
char space[cmdsize];
fread(&space, cmdsize, 1, f);
bool empty = true;
for(int i = 0; i < cmdsize; i++) {
if(space[i] != 0) {
empty = false;
break;
}
}
if(!empty) {
if(!ask("It doesn't seem like there is enough empty space. Continue anyway?")) {
return false;
}
}
fseeko(f, -((off_t)cmdsize), SEEK_CUR);
char *dylib_path_padded = calloc(dylib_path_size, 1);
memcpy(dylib_path_padded, dylib_path, dylib_path_len);
fwrite(&dylib_command, sizeof(dylib_command), 1, f);
fwrite(dylib_path_padded, dylib_path_size, 1, f);
free(dylib_path_padded);
mh.ncmds = SWAP32(SWAP32(mh.ncmds, mh.magic) + 1, mh.magic);
sizeofcmds += cmdsize;
mh.sizeofcmds = SWAP32(sizeofcmds, mh.magic);
fseeko(f, header_offset, SEEK_SET);
fwrite(&mh, sizeof(mh), 1, f);
return true;
}
int insert_dylib_main(const char *dylib_path, const char *binary_path) {
struct stat s;
if(stat(binary_path, &s) != 0) {
perror(binary_path);
return -1;
}
FILE *f = fopen(binary_path, "r+");
if(!f) {
NSLogC("[kfdHaxx] insert_dylib: Couldn't open file %s\n", binary_path);
return -1;
}
bool success = true;
fseeko(f, 0, SEEK_END);
off_t file_size = ftello(f);
rewind(f);
uint32_t magic;
fread(&magic, sizeof(uint32_t), 1, f);
switch(magic) {
case MH_MAGIC_64:
case MH_CIGAM_64:
case MH_MAGIC:
case MH_CIGAM:
if(insert_dylib(f, 0, dylib_path, &file_size)) {
ftruncate(fileno(f), file_size);
NSLogC("[kfdHaxx] insert_dylib: Added load command to %s\n", binary_path);
} else {
NSLogC("[kfdHaxx] insert_dylib: Failed to add load command!\n");
success = false;
}
break;
default:
NSLogC("[kfdHaxx] insert_dylib: Unknown magic: 0x%x\n", magic);
return -1;
}
fclose(f);
if(!success) {
return -1;
}
return 0;
}
================================================
FILE: RootHelperSample/launchdshim/.gitignore
================================================
launchd
launchdinjected
launchdsignedinjected
launchdhook/launchdhooksigned.dylib
SpringBoardShim/launchdsignedinjected
SpringBoardShim/springboardshiminjected
SpringBoardShim/springboardshimsignedinjected
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/Makefile
================================================
TARGET := iphone:clang:latest
ARCHS = arm64e
include $(THEOS)/makefiles/common.mk
TOOL_NAME = springboardshim
springboardshim_FILES = main.c
springboardshim_CFLAGS = -fobjc-arc -isystem
springboardshim_LDFLAGS = -L./ -lbsm
springboardshim_CODESIGN_FLAGS = -SSpringBoardEnts.plist
#springboardshim_PRIVATE_FRAMEWORKS = SpringBoard SpringBoardServices Foundation // adding SpringBoard to privateframeworks here will add it into load command before the tweak dylib is loaded, which causes the platform check to fail - thanks DuyKhanhTran
after-package::
ct_bypass -i .theos/obj/debug/springboardshim -o springboardshimsigned
include $(THEOS_MAKE_PATH)/tool.mk
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardEnts.plist
================================================
allow-obliterate-device
application-identifier
com.apple.springboard
com.apple.private.security.no-sandbox
com.apple.private.domain-extension
com.apple.private.security.container-required
com.apple.private.security.no-container
com.apple.private.skip-library-validation
com.apple.private.xpc.domain-extension
com.apple.private.xpc.domain-extension.proxy
com.apple.private.xpc.launchd.app-state-manager
com.apple.private.xpc.launchd.enable-disable-system-services
com.apple.private.xpc.launchd.event-monitor
com.apple.private.xpc.launchd.loginitem-bootstrapper
com.apple.private.xpc.launchd.loginitem-outside-bundle
com.apple.private.xpc.launchd.obliterator
com.apple.private.xpc.launchd.per-user-create.mbsetupuser
com.apple.private.xpc.launchd.per-user-lookup
com.apple.private.xpc.launchd.reboot
com.apple.private.xpc.launchd.service-hold
com.apple.private.xpc.launchd.userspace-reboot
com.apple.private.xpc.launchd.userspace-reboot-now
com.apple.private.xpc.persona-creator
com.apple.private.xpc.persona-manager
com.apple.private.persona-mgmt
com.apple.private.xpc.service-attach
com.apple.private.xpc.service-configure
platform-application
get-task-allow
task_for_pid-allow
com.apple.security.network.server
aps-connection-initiate
backupd-connection-initiate
checklessPersistentURLTranslation
com.apple.BTServer.allowRestrictedServices
com.apple.BTServer.programmaticPairing
com.apple.CallHistory.sync.allow
com.apple.CommCenter.StormBreaker
com.apple.CommCenter.fine-grained
spi
preferences-reset
voice
identity
phone
carrier-settings
com.apple.CompanionLink
com.apple.Contacts.database-allow
com.apple.CoreRoutine.LocationOfInterest
com.apple.MobileInternetSharing.allow
com.apple.ModeEntityScorer
com.apple.Pasteboard.trusted-authentication-message-request
com.apple.PerformanceTrace.Tracing
com.apple.QuartzCore.cache-asynchronous
com.apple.QuartzCore.debug
com.apple.QuartzCore.displayable-context
com.apple.QuartzCore.flipbook
com.apple.QuartzCore.global-capture
com.apple.QuartzCore.occlusion-override
com.apple.QuartzCore.secure-capture
com.apple.QuartzCore.secure-mode
com.apple.QuartzCore.system-layers
com.apple.SystemConfiguration.SCDynamicStore-write-access
com.apple.SystemConfiguration.SCPreferences-write-access
com.apple.AutoWake.xml
preferences.plist
com.apple.radios.plist
com.apple.TapToRadarKit.service-access
com.apple.abm.helper.mobile.allow
com.apple.accounts.appleaccount.fullaccess
com.apple.assistant.announcement_state
com.apple.assistant.client
com.apple.assistant.settings
com.apple.authkit.client.private
com.apple.authkit.writer.internal
com.apple.avfoundation.allow-identifying-output-device-details
com.apple.avfoundation.allow-still-image-capture-shutter-sound-manipulation
com.apple.avfoundation.allow-system-wide-context
com.apple.avfoundation.allows-access-to-device-list
com.apple.avfoundation.allows-set-output-device
com.apple.backboard.client
com.apple.backboard.display.archive
com.apple.backboard.displaybrightness
com.apple.backboardd.cancelsTouchesInHostedContent
com.apple.backboardd.displayArrangement
com.apple.backboardd.eventAuthenticationVerification
com.apple.backboardd.global-pointer-event-routing
com.apple.backboardd.hostCanRequireTouchesFromHostedContent
com.apple.backboardd.lastUserEventTime
com.apple.backboardd.launchapplications
com.apple.backboardd.pointerAutomation
com.apple.backboardd.pointerRepositioning
com.apple.backboardd.touchDeliveryObservation
com.apple.backboardd.transferTouches
com.apple.backboardd.virtualDisplay
com.apple.bannerkit.post
com.apple.biome.PublicStreamAccessService
com.apple.bluetooth.system
com.apple.bulletinboard
com.apple.bulletinboard.dataprovider
com.apple.bulletinboard.observer
com.apple.bulletinboard.serverconduit
com.apple.bulletinboard.settings
com.apple.bulletinboard.systemstate
com.apple.bulletinboard.utilities
com.apple.cards.all-access
com.apple.chronod.toolservices
com.apple.chronoservices
com.apple.coreaudio.CanRecordPastData
com.apple.coreaudio.allow-amr-decode
com.apple.coreaudio.allow-opus-codec
com.apple.coreaudio.allow-speex-codec
com.apple.coreduetd.allow
com.apple.coreduetd.batterysaver.allow
com.apple.coreduetd.context
com.apple.coreduetd.knowledge
com.apple.coremedia.allow-pre-wiring-pixel-buffers
com.apple.coremedia.allow-protected-content-playback
com.apple.coremedia.virtualdisplaysession
com.apple.developer.extension-host.widget-extension
com.apple.developer.homekit
com.apple.developer.ubiquity-kvstore-identifier
com.apple.springboard
com.apple.duet.activityscheduler.allow
com.apple.duet.expertcenter.consumer
com.apple.extensionkit.host.extension-point-identifiers
com.apple.SoundScapesViewServices.ViewService
com.apple.fileprovider.acl-write
com.apple.fileprovider.enumerate
com.apple.fileprovider.fetch-url
com.apple.frontboard.app-badge-value-access
com.apple.frontboard.launchapplications
com.apple.frontboard.shutdown
com.apple.frontboardservices.display-layout-monitor
com.apple.geoservices.navigation_info
com.apple.homekit.private-spi-access
com.apple.iapd.accessibility
com.apple.icloud.findmydeviced.access
com.apple.icloud.findmydeviced.findmydevice-user-agent.access
com.apple.icloud.fmfd.access
com.apple.icloud.searchpartyd.beaconmanager
com.apple.idle-timer-services
com.apple.imagent
com.apple.imagent.av
com.apple.imagent.chat
com.apple.intents.extension.discovery
com.apple.intents.uiextension.discovery
com.apple.internal.seserviced.all.endpoints.and.cas
com.apple.internal.seserviced.ptattestation
com.apple.itunesstored.private
com.apple.keystore.device
com.apple.keystore.lockassertion
com.apple.keystore.stash.access
com.apple.launchservices.clearadvertisingid
com.apple.localizationswitcher
com.apple.locationd.activity
com.apple.locationd.asmanager
com.apple.locationd.authorizeapplications
com.apple.locationd.effective_bundle
com.apple.locationd.motion_alarms
com.apple.locationd.place_inference
com.apple.locationd.prompt_behavior
com.apple.locationd.region_proxy_service
com.apple.locationd.status
com.apple.locationd.usage_oracle
com.apple.locationd.vehicle_data
com.apple.logind.client.entitlement
com.apple.lsapplicationproxy.deviceidentifierforvendor
com.apple.managedconfiguration.mdmd-access
com.apple.managedconfiguration.profiled-access
com.apple.mediaremote.ui-control
com.apple.mediastream.mstreamd-access
com.apple.messages.composeclient
com.apple.mkb.usersession.info
com.apple.mkb.usersession.loginwindow
com.apple.mobile.deleted.AllowFreeSpace
com.apple.mobile.keybagd.UserManager.logoutcritical
com.apple.mobilemail.mailservices
com.apple.multitasking.systemappassertions
com.apple.multitasking.termination
com.apple.nano.nanoregistry.generalaccess
com.apple.nfcd.hwmanager
com.apple.nfcd.radio.powertoggle
com.apple.nfcd.seshat
com.apple.nfcd.session.ecommerce
com.apple.nfcd.session.fieldOperations
com.apple.nfcd.session.peerpayment
com.apple.nfcd.session.reader.internal
com.apple.nfcd.session.se
com.apple.nfcd.session.trust
com.apple.nfcd.singleUser
com.apple.notificationcenter.widgetcontrollerhascontent
com.apple.osanalytics.otatasking-service-access
com.apple.payment.configuration
com.apple.payment.presentation
com.apple.photos.bourgeoisie
com.apple.pointerui.persistentlyHidePointer
com.apple.pointerui.service-keep-alive-assertion
com.apple.pointerui.set-system-cursor-interaction-context
com.apple.posterboardservices.data-store
com.apple.posterboardservices.data-store.accessSwitcherConfiguration
com.apple.powerd.lowpowermode.allow
com.apple.private.CallHistory.read
com.apple.private.ClipServices
com.apple.private.CoreAuthentication.SPI
com.apple.private.InstallCoordination.allowed
com.apple.private.MobileContainerManager.otherIdLookup
com.apple.private.MobileGestalt.AllowedProtectedKeys
InverseDeviceID
com.apple.private.ReplayKitAngel.client
com.apple.private.SafariServices.PasswordPicker.setRemoteAppProperties
com.apple.private.ShazamKit
com.apple.private.WebClips.read-write
com.apple.private.accessories.showallconnections
com.apple.private.accounts.allaccounts
com.apple.private.activitykit.activityAuthorizer
com.apple.private.activitykit.activityEnder
com.apple.private.activitykit.alertPresenter
com.apple.private.activitykit.assertionRequester
com.apple.private.activitykit.listener
com.apple.private.activitykit.presentationAssertionRequester
com.apple.private.activitykit.prominenceObserver
com.apple.private.airdrop.settings
com.apple.private.appleaccount.app-hidden-from-icloud-settings
com.apple.private.applecredentialmanager.allow
com.apple.private.appstored
Repair
TestFlightFeedback
StoreKitExternalNotification
Update
com.apple.private.assets.accessible-asset-types
com.apple.MobileAsset.DuetExpertCenterAsset
com.apple.private.attentionawareness
com.apple.private.attentionawareness.poll
com.apple.private.attribution.implicitly-assumed-identity
type
path
value
/System/Library/CoreServices/SpringBoard.app/SpringBoard
com.apple.private.barcodesupport.allowNotifications
com.apple.private.biome.read-only
AppLaunch
InferredMode
Notification
ScreenSharing
HomeKitClientAccessoryControl
HomeKitClientMediaAccessoryControl
HomeKitClientActionSet
com.apple.private.biome.read-write
SiriUI
Device.Display.Appearance
Device.Display.AlwaysOn
OSAnalytics.Hardware.Reliability
com.apple.private.biome.realTimeSensorSession
com.apple.private.bmk.allow
com.apple.private.calendar.allow-suggestions
com.apple.private.canGetAppLinkInfo
com.apple.private.canModifyAppLinkPermissions
com.apple.private.carkit
com.apple.private.carkit.app
com.apple.private.carkit.dnd
com.apple.private.clouddocs.can-grant-access-to-document
com.apple.private.contactsui
com.apple.private.coordination.alarms
com.apple.private.coordination.timers
com.apple.private.coreaudio.borrowaudiosession.allow
com.apple.private.coreaudio.mxsessionPropertyPipe
com.apple.private.coremedia.interruptions.phonecallpriority.allow
com.apple.private.corerecents
com.apple.private.coreservices.canmaplsdatabase
com.apple.private.coreservices.canopenactivity
com.apple.private.coreservices.lsuseractivityd.bestappsuggestion
com.apple.private.corespotlight.internal
com.apple.private.corespotlight.search.internal
com.apple.private.corewifi.internal
com.apple.private.dmd.policy
com.apple.private.donotdisturb.behavior.resolution.client-identifiers
com.apple.springboard.SBBulletinSpokenObserverGateway
com.apple.springboard.NCBulletinNotificationSource
com.apple.private.donotdisturb.mode.assertion.client-identifiers
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.hid
com.apple.focus.activity-manager
com.apple.private.donotdisturb.mode.assertion.user-requested.client-identifiers
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.hid
com.apple.focus.activity-manager
com.apple.private.donotdisturb.modeconfiguration.modify.client-identifiers
com.apple.focus.activity-manager
com.apple.focussettingsui.activity-config
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.NCModeManager
com.apple.private.donotdisturb.modeconfiguration.request.client-identifiers
com.apple.focus.activity-manager
com.apple.focussettingsui.activity-config
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.NCModeManager
com.apple.proactive.AppPredictionClient
com.apple.springboard.focusappconfigurationcontextmonitor
com.apple.private.donotdisturb.modeconfiguration.updates.client-identifiers
com.apple.focus.activity-manager
com.apple.focussettingsui.activity-config
com.apple.springboard.donotdisturb.notifications
com.apple.proactive.AppPredictionClient
com.apple.springboard.SBIconController
com.apple.springboard.NCModeManager
com.apple.springboard.focusappconfigurationcontextmonitor
com.apple.FocusSettings
com.apple.private.donotdisturb.settings.request.client-identifiers
com.apple.springboard.donotdisturb.notifications
com.apple.donotdisturb.control-center.module
com.apple.focus.activity-manager
com.apple.springboard.SBIconController
com.apple.proactive.AppPredictionClient
com.apple.private.donotdisturb.settings.updates.client-identifiers
com.apple.springboard.donotdisturb.notifications
com.apple.private.donotdisturb.state.request.client-identifiers
com.apple.springboard.SBIconController
com.apple.springboard.SBDashBoardCombinedListViewController
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.awdmetrics
com.apple.springboard.dashboard.bedtime
com.apple.accessibility.visual.alerts
com.apple.springboard.donotdisturb.hid
com.apple.springboard.SBDoNotDisturbMetric
com.apple.focus.activity-manager
com.apple.springboard.NCModeManager
com.apple.springboard.dndstatemonitor
com.apple.springboard.CoverSheetDiscoveryProvider
com.apple.private.donotdisturb.state.updates.client-identifiers
com.apple.springboard.SBIconController
com.apple.springboard.SBDashBoardCombinedListViewController
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.awdmetrics
com.apple.springboard.dashboard.bedtime
com.apple.accessibility.visual.alerts
com.apple.springboard.donotdisturb.hid
com.apple.springboard.SBDoNotDisturbMetric
com.apple.focus.activity-manager
com.apple.springboard.NCModeManager
com.apple.springboard.dndstatemonitor
com.apple.springboard.CoverSheetDiscoveryProvider
com.apple.private.externalaccessory.showallaccessories
com.apple.private.followup
com.apple.private.game-center
Account
Games
com.apple.private.game-center.bypass-authentication
com.apple.private.healthkit
com.apple.private.healthkit.feature-availability.read
SleepCoaching
com.apple.private.healthkit.read_authorization_override
HKCategoryTypeIdentifierSleepAnalysis
com.apple.private.healthkit.source_override
com.apple.mobiletimer
com.apple.private.healthkit.write_authorization_override
HKCategoryTypeIdentifierSleepAnalysis
com.apple.private.hid.client.event-dispatch
com.apple.private.hid.client.service-protected
com.apple.private.hid.manager.client
com.apple.private.homekit
com.apple.private.homekit.allow-secure-access
com.apple.private.icfcallserver
com.apple.private.ids.idsquery
com.apple.private.ids.messaging
com.apple.private.alloy.bulletinboard
com.apple.private.alloy.donotdisturb
com.apple.madrid
com.apple.private.alloy.siri.phrasespotter
com.apple.private.ids.messaging.urgent-priority
com.apple.private.alloy.bulletinboard
com.apple.private.alloy.donotdisturb
com.apple.private.alloy.siri.phrasespotter
com.apple.private.ids.registration-reset
com.apple.private.imavcore.imavagent
com.apple.private.imcore.imdpersistence.database-access
com.apple.private.imcore.imremoteurlconnection
com.apple.private.imcore.spi.database-access
com.apple.private.in-app-payments
com.apple.private.iokit.powersource-control
com.apple.private.kernel.darkboot
com.apple.private.kernel.jetsam
com.apple.private.librarian.can-get-application-info
com.apple.private.lockdown.finegrained-get
NULL/ActivationState
NULL/BrickState
NULL/SBLockdownEverRegisteredKey
com.apple.xcode.developerdomain/DeveloperStatus
NULL/BuildExpireTime
com.apple.private.lockdown.finegrained-remove
com.apple.mobile.iTunes.store/AppleID
com.apple.mobile.data_sync/Contacts
com.apple.mobile.data_sync/Calendars
com.apple.mobile.data_sync/Bookmarks
com.apple.mobile.data_sync/Mail Accounts
com.apple.private.mediaexperience.allowemergencyalertpriority
com.apple.private.mediasafetynet.exception.notificationappex
com.apple.private.mis.online_auth_agent
com.apple.private.mobileinstall.allowedSPI
UninstallForLaunchServices
SetCapabilities
Lookup
com.apple.private.mobilesafari.searchengine
com.apple.private.mobilestoredemo.enabledemo
Manage
com.apple.private.mobiletimerd
com.apple.private.nearbyinteraction.system-shutdown
com.apple.private.network.socket-delegate
com.apple.private.networkextension.configuration
com.apple.private.persona.read
com.apple.private.photos.service.demo
com.apple.private.photos.service.multilibrary
com.apple.private.ppm.superclient
com.apple.private.replay-kit
com.apple.private.rtcreportingd
com.apple.private.screen-time
com.apple.private.security.container-manager
com.apple.private.security.storage.AppDataContainers
com.apple.private.security.storage.Calendar
com.apple.private.security.storage.Photos
com.apple.private.security.storage.clipserviced
com.apple.private.security.storage.familycircled
com.apple.private.security.storage.triald
com.apple.private.sessionkit.alertPresenter
com.apple.private.sessionkit.assertionRequester
com.apple.private.sessionkit.custom-platter-target
com.apple.private.sessionkit.listener
com.apple.private.sessionkit.permitMultipleProcessInputs
com.apple.private.sessionkit.presentationAssertionRequester
com.apple.private.sessionkit.prominenceObserver
com.apple.private.sessionkit.sessionFinisher
com.apple.private.sessionkit.sessionRequest
com.apple.private.sharing.unlock-manager
com.apple.private.shazamkit.allow-external-audio-recording
com.apple.private.shazamkit.allow-internal-audio-recording
com.apple.private.sleepd
com.apple.private.suggestions.contacts
com.apple.private.suggestions.events
com.apple.private.system-keychain
com.apple.private.tcc.allow
kTCCServiceAddressBook
kTCCServiceCalendar
kTCCServiceReminders
kTCCServicePhotos
kTCCServicePhotosAdd
kTCCServiceMediaLibrary
kTCCServiceMicrophone
kTCCServiceCamera
kTCCServiceWillow
kTCCServiceFaceID
kTCCServiceBluetoothAlways
com.apple.private.tcc.manager.access.read
kTCCServiceFocusStatus
com.apple.private.tipsd.discoverability
com.apple.private.tty.settings
com.apple.private.ubiquity-kvstore-access
com.apple.weather
com.apple.stocks
com.apple.backboardd
com.apple.Accessibility
com.apple.Accessibility.SwitchControl
com.apple.Accessibility.TouchAccommodations
com.apple.AssistiveTouch
com.apple.HearingAids
com.apple.SpeakSelection
com.apple.VoiceOverTouch
com.apple.ZoomTouch
com.apple.private.usernotifications.bundle-identifiers
com.apple.donotdisturb
com.apple.mobiletimer
com.apple.usernotifications.example
com.apple.private.usernotifications.settings
read
com.apple.private.vfs.allow-low-space-writes
com.apple.private.vfs.open-by-id
com.apple.private.wallpaperkit.service.migration
com.apple.private.xpc.launchd.app-server
com.apple.proactive.ActionPrediction.predictions
com.apple.proactive.AppPrediction.predictions
com.apple.proactive.DefaultWidgetSuggester
com.apple.proactive.NotificationDigest.xpc
com.apple.proactive.ProactiveSuggestionClientModel.xpc
com.apple.proactive.SuggestedPages
com.apple.proactive.UserEducationSuggestion.server-listener.xpc
com.apple.proactive.appDirectory
com.apple.proactive.eventtracker
com.apple.proactive.hero.AppPrediction.predictions
com.apple.proactive.infoSuggestion.xpc
com.apple.purplebuddy.budd.access
com.apple.remotenotification.access
com.apple.remotenotification.preferences
com.apple.rootless.storage.com.apple.MobileAsset.DuetExpertCenterAsset
com.apple.rootless.storage.coreduet_knowledge_store
com.apple.rootless.storage.proactivepredictions
com.apple.runningboard.hereditarygrantoriginator
com.apple.runningboard.posterkit.host
com.apple.runningboard.primitiveattribute
com.apple.runningboard.process-state
com.apple.runningboard.request.identity
com.apple.runningboard.terminateprocess
com.apple.runningboard.underlyingassertion
com.apple.securebackupd.access
com.apple.security.application-groups
group.com.apple.weather
group.com.apple.stocks
com.apple.Home.group
com.apple.security.enterprise-volume-access
com.apple.security.exception.files.absolute-path.read-only
/private/var/mobile/Library/Trial/NamespaceDescriptors/
/private/var/mobile/Library/Trial/Treatments/180/
com.apple.security.exception.mach-lookup.global-name
com.apple.sirittsd
com.apple.proactive.UserEducationSuggestion.server-listener.xpc
com.apple.Photos.MultiLibrary
com.apple.abm.helper.mobile
com.apple.siri.activation.service
com.apple.springboard.SBRendererService
com.apple.appstored.xpc
com.apple.appstored.xpc.request
com.apple.PointerUI.pointeruid.service-launching
com.apple.proactive.appDirectory
com.apple.CarPlayApp.service
com.apple.sleepd.sleepserver
com.apple.donotdisturb.service
com.apple.coordination.alarms
com.apple.coordination.timers
com.apple.tipsd
com.apple.ModeEntityScorer
com.apple.proactive.NotificationDigest.xpc
com.apple.assistant.announcement_state.service
com.apple.icloud.searchpartyd.beaconmanager
com.apple.server.bluetooth.general.xpc
com.apple.powerd.smartpowernap
com.apple.biomesyncd.realTimeSession
com.apple.sessionservices
aps-connection-initiate
com.apple.mobileassetd.v2
com.apple.HearingApp
com.apple.security.exception.shared-preference.read-only
com.apple.appstored
com.apple.itunesstored
com.apple.suggestions
com.apple.security.iokit-user-client-class
AGXCommandQueue
AGXDevice
AGXDeviceUserClient
AGXSharedUserClient
AppleCredentialManagerUserClient
AppleJPEGDriverUserClient
ApplePPMUserClient
AppleSPUHIDDeviceUserClient
AppleSPUHIDDriverUserClient
IOAccelContext
IOAccelContext2
IOAccelDevice
IOAccelDevice2
IOAccelSharedUserClient
IOAccelSharedUserClient2
IOAccelSubmitter2
IOHIDEventServiceFastPathUserClient
IOHIDLibUserClient
IOMobileFramebufferUserClient
IOReportUserClient
IOSurfaceAcceleratorClient
IOSurfaceRootUserClient
RootDomainUserClient
IOGPUDeviceUserClient
com.apple.security.system-container
com.apple.security.system-groups
systemgroup.com.apple.sharedpclogging
systemgroup.com.apple.regulatory_images
systemgroup.com.apple.userimagecache
com.apple.seld.tsmamnager
com.apple.seserviced.key
com.apple.seserviced.kmlXpcService
com.apple.sharing.Client
com.apple.sharing.CoordinatedAlerts
com.apple.sharing.Diagnostics
com.apple.sharing.Session
com.apple.siri.VoiceShortcuts.xpc
com.apple.siri.activation.assertion
com.apple.siri.activation.button-event.listener
com.apple.siri.activation.service
com.apple.siri.client_lite
com.apple.siri.external_request
com.apple.sos.trigger
com.apple.soundscapes.picker
com.apple.splashboard.launch-image-capture
com.apple.springboard-ui.client
com.apple.springboard.activateRemoteAlert
com.apple.springboard.activateawayviewplugins
com.apple.springboard.allowallcallurls
com.apple.springboard.application-removability.proxy
com.apple.springboard.display-lookup
com.apple.springboard.lockScreenContentAssertion
com.apple.springboard.multiwindow.triggerShowAllWindows
com.apple.springboard.opensensitiveurl
com.apple.springboard.openurlswhenlocked
com.apple.springboard.setbadgestring
com.apple.springboard.shortcutitems.fullaccess
com.apple.springboard.statusbarstyleoverrides
com.apple.springboard.statusbarstyleoverrides.coordinator
UIStatusBarStyleOverrideAutoAirPlayReady
UIStatusBarStyleOverrideAutoAirPlayPlaying
com.apple.symptom_analytics.query
com.apple.symptom_analytics.refresh
com.apple.symptoms.NetworkOfInterest
com.apple.telephonyutilities.callservicesd
access-calls
modify-calls
access-call-providers
access-moments
com.apple.timed
com.apple.trial.client
962
com.apple.tzlink.allow
com.apple.ui-services-discovery
com.apple.videoconference.allow-conferencing
com.apple.visualvoicemail.client
com.apple.voiceservices.tts.customvoice
com.apple.voicetrigger.voicetriggerservice
com.apple.wallet.banner
com.apple.watchlist.private
com.apple.wifi.manager-access
com.apple.wipedevice
fairplay-client
1172857363
keychain-access-groups
apple
com.apple.preferences
vm-pressure-level
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardEntsBedtime.plist
================================================
platform-application
com.apple.private.security.container-required
allow-obliterate-device
application-identifier
com.apple.springboard
aps-connection-initiate
backupd-connection-initiate
checklessPersistentURLTranslation
com.apple.BTServer.allowRestrictedServices
com.apple.BTServer.programmaticPairing
com.apple.CallHistory.sync.allow
com.apple.CommCenter.StormBreaker
com.apple.CommCenter.fine-grained
spi
preferences-reset
voice
identity
phone
carrier-settings
com.apple.CompanionLink
com.apple.Contacts.database-allow
com.apple.CoreRoutine.LocationOfInterest
com.apple.MobileInternetSharing.allow
com.apple.ModeEntityScorer
com.apple.Pasteboard.trusted-authentication-message-request
com.apple.PerformanceTrace.Tracing
com.apple.QuartzCore.cache-asynchronous
com.apple.QuartzCore.debug
com.apple.QuartzCore.displayable-context
com.apple.QuartzCore.flipbook
com.apple.QuartzCore.global-capture
com.apple.QuartzCore.occlusion-override
com.apple.QuartzCore.secure-capture
com.apple.QuartzCore.secure-mode
com.apple.QuartzCore.system-layers
com.apple.SystemConfiguration.SCDynamicStore-write-access
com.apple.SystemConfiguration.SCPreferences-write-access
com.apple.AutoWake.xml
preferences.plist
com.apple.radios.plist
com.apple.TapToRadarKit.service-access
com.apple.abm.helper.mobile.allow
com.apple.accounts.appleaccount.fullaccess
com.apple.assistant.announcement_state
com.apple.assistant.client
com.apple.assistant.settings
com.apple.authkit.client.private
com.apple.authkit.writer.internal
com.apple.avfoundation.allow-identifying-output-device-details
com.apple.avfoundation.allow-still-image-capture-shutter-sound-manipulation
com.apple.avfoundation.allow-system-wide-context
com.apple.avfoundation.allows-access-to-device-list
com.apple.avfoundation.allows-set-output-device
com.apple.backboard.client
com.apple.backboard.display.archive
com.apple.backboard.displaybrightness
com.apple.backboardd.cancelsTouchesInHostedContent
com.apple.backboardd.displayArrangement
com.apple.backboardd.eventAuthenticationVerification
com.apple.backboardd.global-pointer-event-routing
com.apple.backboardd.hostCanRequireTouchesFromHostedContent
com.apple.backboardd.lastUserEventTime
com.apple.backboardd.launchapplications
com.apple.backboardd.pointerAutomation
com.apple.backboardd.pointerRepositioning
com.apple.backboardd.touchDeliveryObservation
com.apple.backboardd.transferTouches
com.apple.backboardd.virtualDisplay
com.apple.bannerkit.post
com.apple.biome.PublicStreamAccessService
com.apple.bluetooth.system
com.apple.bulletinboard
com.apple.bulletinboard.dataprovider
com.apple.bulletinboard.observer
com.apple.bulletinboard.serverconduit
com.apple.bulletinboard.settings
com.apple.bulletinboard.systemstate
com.apple.bulletinboard.utilities
com.apple.cards.all-access
com.apple.chronod.toolservices
com.apple.chronoservices
com.apple.coreaudio.CanRecordPastData
com.apple.coreaudio.allow-amr-decode
com.apple.coreaudio.allow-opus-codec
com.apple.coreaudio.allow-speex-codec
com.apple.coreduetd.allow
com.apple.coreduetd.batterysaver.allow
com.apple.coreduetd.context
com.apple.coreduetd.knowledge
com.apple.coremedia.allow-pre-wiring-pixel-buffers
com.apple.coremedia.allow-protected-content-playback
com.apple.coremedia.virtualdisplaysession
com.apple.developer.extension-host.widget-extension
com.apple.developer.homekit
com.apple.developer.ubiquity-kvstore-identifier
com.apple.springboard
com.apple.duet.activityscheduler.allow
com.apple.duet.expertcenter.consumer
com.apple.extensionkit.host.extension-point-identifiers
com.apple.SoundScapesViewServices.ViewService
com.apple.fileprovider.acl-write
com.apple.fileprovider.enumerate
com.apple.fileprovider.fetch-url
com.apple.frontboard.app-badge-value-access
com.apple.frontboard.launchapplications
com.apple.frontboard.shutdown
com.apple.frontboardservices.display-layout-monitor
com.apple.geoservices.navigation_info
com.apple.homekit.private-spi-access
com.apple.iapd.accessibility
com.apple.icloud.findmydeviced.access
com.apple.icloud.findmydeviced.findmydevice-user-agent.access
com.apple.icloud.fmfd.access
com.apple.icloud.searchpartyd.beaconmanager
com.apple.idle-timer-services
com.apple.imagent
com.apple.imagent.av
com.apple.imagent.chat
com.apple.intents.extension.discovery
com.apple.intents.uiextension.discovery
com.apple.internal.seserviced.all.endpoints.and.cas
com.apple.internal.seserviced.ptattestation
com.apple.itunesstored.private
com.apple.keystore.device
com.apple.keystore.lockassertion
com.apple.keystore.stash.access
com.apple.launchservices.clearadvertisingid
com.apple.localizationswitcher
com.apple.locationd.activity
com.apple.locationd.asmanager
com.apple.locationd.authorizeapplications
com.apple.locationd.effective_bundle
com.apple.locationd.motion_alarms
com.apple.locationd.place_inference
com.apple.locationd.prompt_behavior
com.apple.locationd.region_proxy_service
com.apple.locationd.status
com.apple.locationd.usage_oracle
com.apple.locationd.vehicle_data
com.apple.logind.client.entitlement
com.apple.lsapplicationproxy.deviceidentifierforvendor
com.apple.managedconfiguration.mdmd-access
com.apple.managedconfiguration.profiled-access
com.apple.mediaremote.ui-control
com.apple.mediastream.mstreamd-access
com.apple.messages.composeclient
com.apple.mkb.usersession.info
com.apple.mkb.usersession.loginwindow
com.apple.mobile.deleted.AllowFreeSpace
com.apple.mobile.keybagd.UserManager.logoutcritical
com.apple.mobilemail.mailservices
com.apple.multitasking.systemappassertions
com.apple.multitasking.termination
com.apple.nano.nanoregistry.generalaccess
com.apple.nfcd.hwmanager
com.apple.nfcd.radio.powertoggle
com.apple.nfcd.seshat
com.apple.nfcd.session.ecommerce
com.apple.nfcd.session.fieldOperations
com.apple.nfcd.session.peerpayment
com.apple.nfcd.session.reader.internal
com.apple.nfcd.session.se
com.apple.nfcd.session.trust
com.apple.nfcd.singleUser
com.apple.notificationcenter.widgetcontrollerhascontent
com.apple.osanalytics.otatasking-service-access
com.apple.payment.configuration
com.apple.payment.presentation
com.apple.photos.bourgeoisie
com.apple.pointerui.persistentlyHidePointer
com.apple.pointerui.service-keep-alive-assertion
com.apple.pointerui.set-system-cursor-interaction-context
com.apple.posterboardservices.data-store
com.apple.posterboardservices.data-store.accessSwitcherConfiguration
com.apple.powerd.lowpowermode.allow
com.apple.private.CallHistory.read
com.apple.private.ClipServices
com.apple.private.CoreAuthentication.SPI
com.apple.private.InstallCoordination.allowed
com.apple.private.MobileContainerManager.otherIdLookup
com.apple.private.MobileGestalt.AllowedProtectedKeys
InverseDeviceID
com.apple.private.ReplayKitAngel.client
com.apple.private.SafariServices.PasswordPicker.setRemoteAppProperties
com.apple.private.ShazamKit
com.apple.private.WebClips.read-write
com.apple.private.accessories.showallconnections
com.apple.private.accounts.allaccounts
com.apple.private.activitykit.activityAuthorizer
com.apple.private.activitykit.activityEnder
com.apple.private.activitykit.alertPresenter
com.apple.private.activitykit.assertionRequester
com.apple.private.activitykit.listener
com.apple.private.activitykit.presentationAssertionRequester
com.apple.private.activitykit.prominenceObserver
com.apple.private.airdrop.settings
com.apple.private.appleaccount.app-hidden-from-icloud-settings
com.apple.private.applecredentialmanager.allow
com.apple.private.appstored
Repair
TestFlightFeedback
StoreKitExternalNotification
Update
com.apple.private.assets.accessible-asset-types
com.apple.MobileAsset.DuetExpertCenterAsset
com.apple.private.attentionawareness
com.apple.private.attentionawareness.poll
com.apple.private.attribution.implicitly-assumed-identity
type
path
value
/System/Library/CoreServices/SpringBoard.app/SpringBoard
com.apple.private.barcodesupport.allowNotifications
com.apple.private.biome.read-only
AppLaunch
InferredMode
Notification
ScreenSharing
HomeKitClientAccessoryControl
HomeKitClientMediaAccessoryControl
HomeKitClientActionSet
com.apple.private.biome.read-write
SiriUI
Device.Display.Appearance
Device.Display.AlwaysOn
OSAnalytics.Hardware.Reliability
com.apple.private.biome.realTimeSensorSession
com.apple.private.bmk.allow
com.apple.private.calendar.allow-suggestions
com.apple.private.canGetAppLinkInfo
com.apple.private.canModifyAppLinkPermissions
com.apple.private.carkit
com.apple.private.carkit.app
com.apple.private.carkit.dnd
com.apple.private.clouddocs.can-grant-access-to-document
com.apple.private.contactsui
com.apple.private.coordination.alarms
com.apple.private.coordination.timers
com.apple.private.coreaudio.borrowaudiosession.allow
com.apple.private.coreaudio.mxsessionPropertyPipe
com.apple.private.coremedia.interruptions.phonecallpriority.allow
com.apple.private.corerecents
com.apple.private.coreservices.canmaplsdatabase
com.apple.private.coreservices.canopenactivity
com.apple.private.coreservices.lsuseractivityd.bestappsuggestion
com.apple.private.corespotlight.internal
com.apple.private.corespotlight.search.internal
com.apple.private.corewifi.internal
com.apple.private.dmd.policy
com.apple.private.donotdisturb.behavior.resolution.client-identifiers
com.apple.springboard.SBBulletinSpokenObserverGateway
com.apple.springboard.NCBulletinNotificationSource
com.apple.private.donotdisturb.mode.assertion.client-identifiers
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.hid
com.apple.focus.activity-manager
com.apple.private.donotdisturb.mode.assertion.user-requested.client-identifiers
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.hid
com.apple.focus.activity-manager
com.apple.private.donotdisturb.modeconfiguration.modify.client-identifiers
com.apple.focus.activity-manager
com.apple.focussettingsui.activity-config
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.NCModeManager
com.apple.private.donotdisturb.modeconfiguration.request.client-identifiers
com.apple.focus.activity-manager
com.apple.focussettingsui.activity-config
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.NCModeManager
com.apple.proactive.AppPredictionClient
com.apple.springboard.focusappconfigurationcontextmonitor
com.apple.private.donotdisturb.modeconfiguration.updates.client-identifiers
com.apple.focus.activity-manager
com.apple.focussettingsui.activity-config
com.apple.springboard.donotdisturb.notifications
com.apple.proactive.AppPredictionClient
com.apple.springboard.SBIconController
com.apple.springboard.NCModeManager
com.apple.springboard.focusappconfigurationcontextmonitor
com.apple.FocusSettings
com.apple.private.donotdisturb.settings.request.client-identifiers
com.apple.springboard.donotdisturb.notifications
com.apple.donotdisturb.control-center.module
com.apple.focus.activity-manager
com.apple.springboard.SBIconController
com.apple.proactive.AppPredictionClient
com.apple.private.donotdisturb.settings.updates.client-identifiers
com.apple.springboard.donotdisturb.notifications
com.apple.private.donotdisturb.state.request.client-identifiers
com.apple.springboard.SBIconController
com.apple.springboard.SBDashBoardCombinedListViewController
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.awdmetrics
com.apple.springboard.dashboard.bedtime
com.apple.accessibility.visual.alerts
com.apple.springboard.donotdisturb.hid
com.apple.springboard.SBDoNotDisturbMetric
com.apple.focus.activity-manager
com.apple.springboard.NCModeManager
com.apple.springboard.dndstatemonitor
com.apple.springboard.CoverSheetDiscoveryProvider
com.apple.private.donotdisturb.state.updates.client-identifiers
com.apple.springboard.SBIconController
com.apple.springboard.SBDashBoardCombinedListViewController
com.apple.donotdisturb.control-center.module
com.apple.springboard.donotdisturb.notifications
com.apple.springboard.donotdisturb.awdmetrics
com.apple.springboard.dashboard.bedtime
com.apple.accessibility.visual.alerts
com.apple.springboard.donotdisturb.hid
com.apple.springboard.SBDoNotDisturbMetric
com.apple.focus.activity-manager
com.apple.springboard.NCModeManager
com.apple.springboard.dndstatemonitor
com.apple.springboard.CoverSheetDiscoveryProvider
com.apple.private.externalaccessory.showallaccessories
com.apple.private.followup
com.apple.private.game-center
Account
Games
com.apple.private.game-center.bypass-authentication
com.apple.private.healthkit
com.apple.private.healthkit.feature-availability.read
SleepCoaching
com.apple.private.healthkit.read_authorization_override
HKCategoryTypeIdentifierSleepAnalysis
com.apple.private.healthkit.source_override
com.apple.mobiletimer
com.apple.private.healthkit.write_authorization_override
HKCategoryTypeIdentifierSleepAnalysis
com.apple.private.hid.client.event-dispatch
com.apple.private.hid.client.service-protected
com.apple.private.hid.manager.client
com.apple.private.homekit
com.apple.private.homekit.allow-secure-access
com.apple.private.icfcallserver
com.apple.private.ids.idsquery
com.apple.private.ids.messaging
com.apple.private.alloy.bulletinboard
com.apple.private.alloy.donotdisturb
com.apple.madrid
com.apple.private.alloy.siri.phrasespotter
com.apple.private.ids.messaging.urgent-priority
com.apple.private.alloy.bulletinboard
com.apple.private.alloy.donotdisturb
com.apple.private.alloy.siri.phrasespotter
com.apple.private.ids.registration-reset
com.apple.private.imavcore.imavagent
com.apple.private.imcore.imdpersistence.database-access
com.apple.private.imcore.imremoteurlconnection
com.apple.private.imcore.spi.database-access
com.apple.private.in-app-payments
com.apple.private.iokit.powersource-control
com.apple.private.kernel.darkboot
com.apple.private.kernel.jetsam
com.apple.private.librarian.can-get-application-info
com.apple.private.lockdown.finegrained-get
NULL/ActivationState
NULL/BrickState
NULL/SBLockdownEverRegisteredKey
com.apple.xcode.developerdomain/DeveloperStatus
NULL/BuildExpireTime
com.apple.private.lockdown.finegrained-remove
com.apple.mobile.iTunes.store/AppleID
com.apple.mobile.data_sync/Contacts
com.apple.mobile.data_sync/Calendars
com.apple.mobile.data_sync/Bookmarks
com.apple.mobile.data_sync/Mail Accounts
com.apple.private.mediaexperience.allowemergencyalertpriority
com.apple.private.mediasafetynet.exception.notificationappex
com.apple.private.mis.online_auth_agent
com.apple.private.mobileinstall.allowedSPI
UninstallForLaunchServices
SetCapabilities
Lookup
com.apple.private.mobilesafari.searchengine
com.apple.private.mobilestoredemo.enabledemo
Manage
com.apple.private.mobiletimerd
com.apple.private.nearbyinteraction.system-shutdown
com.apple.private.network.socket-delegate
com.apple.private.networkextension.configuration
com.apple.private.persona.read
com.apple.private.photos.service.demo
com.apple.private.photos.service.multilibrary
com.apple.private.ppm.superclient
com.apple.private.replay-kit
com.apple.private.rtcreportingd
com.apple.private.screen-time
com.apple.private.security.container-manager
com.apple.private.security.storage.AppDataContainers
com.apple.private.security.storage.Calendar
com.apple.private.security.storage.Photos
com.apple.private.security.storage.clipserviced
com.apple.private.security.storage.familycircled
com.apple.private.security.storage.triald
com.apple.private.sessionkit.alertPresenter
com.apple.private.sessionkit.assertionRequester
com.apple.private.sessionkit.custom-platter-target
com.apple.private.sessionkit.listener
com.apple.private.sessionkit.permitMultipleProcessInputs
com.apple.private.sessionkit.presentationAssertionRequester
com.apple.private.sessionkit.prominenceObserver
com.apple.private.sessionkit.sessionFinisher
com.apple.private.sessionkit.sessionRequest
com.apple.private.sharing.unlock-manager
com.apple.private.shazamkit.allow-external-audio-recording
com.apple.private.shazamkit.allow-internal-audio-recording
com.apple.private.sleepd
com.apple.private.suggestions.contacts
com.apple.private.suggestions.events
com.apple.private.system-keychain
com.apple.private.tcc.allow
kTCCServiceAddressBook
kTCCServiceCalendar
kTCCServiceReminders
kTCCServicePhotos
kTCCServicePhotosAdd
kTCCServiceMediaLibrary
kTCCServiceMicrophone
kTCCServiceCamera
kTCCServiceWillow
kTCCServiceFaceID
kTCCServiceBluetoothAlways
com.apple.private.tcc.manager.access.read
kTCCServiceFocusStatus
com.apple.private.tipsd.discoverability
com.apple.private.tty.settings
com.apple.private.ubiquity-kvstore-access
com.apple.weather
com.apple.stocks
com.apple.backboardd
com.apple.Accessibility
com.apple.Accessibility.SwitchControl
com.apple.Accessibility.TouchAccommodations
com.apple.AssistiveTouch
com.apple.HearingAids
com.apple.SpeakSelection
com.apple.VoiceOverTouch
com.apple.ZoomTouch
com.apple.private.usernotifications.bundle-identifiers
com.apple.donotdisturb
com.apple.mobiletimer
com.apple.usernotifications.example
com.apple.private.usernotifications.settings
read
com.apple.private.vfs.allow-low-space-writes
com.apple.private.vfs.open-by-id
com.apple.private.wallpaperkit.service.migration
com.apple.private.xpc.launchd.app-server
com.apple.proactive.ActionPrediction.predictions
com.apple.proactive.AppPrediction.predictions
com.apple.proactive.DefaultWidgetSuggester
com.apple.proactive.NotificationDigest.xpc
com.apple.proactive.ProactiveSuggestionClientModel.xpc
com.apple.proactive.SuggestedPages
com.apple.proactive.UserEducationSuggestion.server-listener.xpc
com.apple.proactive.appDirectory
com.apple.proactive.eventtracker
com.apple.proactive.hero.AppPrediction.predictions
com.apple.proactive.infoSuggestion.xpc
com.apple.purplebuddy.budd.access
com.apple.remotenotification.access
com.apple.remotenotification.preferences
com.apple.rootless.storage.com.apple.MobileAsset.DuetExpertCenterAsset
com.apple.rootless.storage.coreduet_knowledge_store
com.apple.rootless.storage.proactivepredictions
com.apple.runningboard.hereditarygrantoriginator
com.apple.runningboard.posterkit.host
com.apple.runningboard.primitiveattribute
com.apple.runningboard.process-state
com.apple.runningboard.request.identity
com.apple.runningboard.terminateprocess
com.apple.runningboard.underlyingassertion
com.apple.securebackupd.access
com.apple.security.application-groups
group.com.apple.weather
group.com.apple.stocks
com.apple.Home.group
com.apple.security.enterprise-volume-access
com.apple.security.exception.files.absolute-path.read-only
/private/var/mobile/Library/Trial/NamespaceDescriptors/
/private/var/mobile/Library/Trial/Treatments/180/
com.apple.security.exception.mach-lookup.global-name
com.apple.sirittsd
com.apple.proactive.UserEducationSuggestion.server-listener.xpc
com.apple.Photos.MultiLibrary
com.apple.abm.helper.mobile
com.apple.siri.activation.service
com.apple.springboard.SBRendererService
com.apple.appstored.xpc
com.apple.appstored.xpc.request
com.apple.PointerUI.pointeruid.service-launching
com.apple.proactive.appDirectory
com.apple.CarPlayApp.service
com.apple.sleepd.sleepserver
com.apple.donotdisturb.service
com.apple.coordination.alarms
com.apple.coordination.timers
com.apple.tipsd
com.apple.ModeEntityScorer
com.apple.proactive.NotificationDigest.xpc
com.apple.assistant.announcement_state.service
com.apple.icloud.searchpartyd.beaconmanager
com.apple.server.bluetooth.general.xpc
com.apple.powerd.smartpowernap
com.apple.biomesyncd.realTimeSession
com.apple.sessionservices
aps-connection-initiate
com.apple.mobileassetd.v2
com.apple.HearingApp
com.apple.security.exception.shared-preference.read-only
com.apple.appstored
com.apple.itunesstored
com.apple.suggestions
com.apple.security.iokit-user-client-class
IOUserClient
com.apple.security.system-container
com.apple.security.system-groups
systemgroup.com.apple.sharedpclogging
systemgroup.com.apple.regulatory_images
systemgroup.com.apple.userimagecache
com.apple.seld.tsmamnager
com.apple.seserviced.key
com.apple.seserviced.kmlXpcService
com.apple.sharing.Client
com.apple.sharing.CoordinatedAlerts
com.apple.sharing.Diagnostics
com.apple.sharing.Session
com.apple.siri.VoiceShortcuts.xpc
com.apple.siri.activation.assertion
com.apple.siri.activation.button-event.listener
com.apple.siri.activation.service
com.apple.siri.client_lite
com.apple.siri.external_request
com.apple.sos.trigger
com.apple.soundscapes.picker
com.apple.splashboard.launch-image-capture
com.apple.springboard-ui.client
com.apple.springboard.activateRemoteAlert
com.apple.springboard.activateawayviewplugins
com.apple.springboard.allowallcallurls
com.apple.springboard.application-removability.proxy
com.apple.springboard.display-lookup
com.apple.springboard.lockScreenContentAssertion
com.apple.springboard.multiwindow.triggerShowAllWindows
com.apple.springboard.opensensitiveurl
com.apple.springboard.openurlswhenlocked
com.apple.springboard.setbadgestring
com.apple.springboard.shortcutitems.fullaccess
com.apple.springboard.statusbarstyleoverrides
com.apple.springboard.statusbarstyleoverrides.coordinator
UIStatusBarStyleOverrideAutoAirPlayReady
UIStatusBarStyleOverrideAutoAirPlayPlaying
com.apple.symptom_analytics.query
com.apple.symptom_analytics.refresh
com.apple.symptoms.NetworkOfInterest
com.apple.telephonyutilities.callservicesd
access-calls
modify-calls
access-call-providers
access-moments
com.apple.timed
com.apple.trial.client
962
com.apple.tzlink.allow
com.apple.ui-services-discovery
com.apple.videoconference.allow-conferencing
com.apple.visualvoicemail.client
com.apple.voiceservices.tts.customvoice
com.apple.voicetrigger.voicetriggerservice
com.apple.wallet.banner
com.apple.watchlist.private
com.apple.wifi.manager-access
com.apple.wipedevice
fairplay-client
1172857363
get-task-allow
keychain-access-groups
apple
com.apple.preferences
vm-pressure-level
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/.gitignore
================================================
.theos/
packages/
.DS_Store
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/Makefile
================================================
TARGET := iphone:clang:latest:15.0
ARCHS = arm64e
THEOS_PACKAGE_SCHEME=roothide
INSTALL_TARGET_PROCESSES = SpringBoard
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = SpringBoardHook
SpringBoardHook_FILES = Tweak.x
SpringBoardHook_CFLAGS = -fobjc-arc -lbsm
after-package::
echo "[*] Signing SB hook"
../../../ChOma/output/tests/ct_bypass -i .theos/obj/debug/springboardhook.dylib -o springboardhooksigned.dylib
include $(THEOS_MAKE_PATH)/tweak.mk
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/SpringBoardHook.plist
================================================
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/Tweak.x
================================================
#include
#include
#include
#include
#include
#include
#include
#include
#define POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE 1
int posix_spawnattr_set_persona_np(const posix_spawnattr_t* __restrict, uid_t, uint32_t);
int posix_spawnattr_set_persona_uid_np(const posix_spawnattr_t* __restrict, uid_t);
int posix_spawnattr_set_persona_gid_np(const posix_spawnattr_t* __restrict, uid_t);
int fd_is_valid(int fd)
{
return fcntl(fd, F_GETFD) != -1 || errno != EBADF;
}
NSString* getNSStringFromFile(int fd)
{
NSMutableString* ms = [NSMutableString new];
ssize_t num_read;
char c;
if(!fd_is_valid(fd)) return @"";
while((num_read = read(fd, &c, sizeof(c))))
{
[ms appendString:[NSString stringWithFormat:@"%c", c]];
if(c == '\n') break;
}
return ms.copy;
}
int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr)
{
NSMutableArray* argsM = args.mutableCopy ?: [NSMutableArray new];
[argsM insertObject:path.lastPathComponent atIndex:0];
NSUInteger argCount = [argsM count];
char **argsC = (char **)malloc((argCount + 1) * sizeof(char*));
for (NSUInteger i = 0; i < argCount; i++)
{
argsC[i] = strdup([[argsM objectAtIndex:i] UTF8String]);
}
argsC[argCount] = NULL;
posix_spawnattr_t attr;
posix_spawnattr_init(&attr);
posix_spawnattr_set_persona_np(&attr, 99, POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE);
posix_spawnattr_set_persona_uid_np(&attr, 0);
posix_spawnattr_set_persona_gid_np(&attr, 0);
posix_spawn_file_actions_t action;
posix_spawn_file_actions_init(&action);
int outErr[2];
if(stdErr)
{
pipe(outErr);
posix_spawn_file_actions_adddup2(&action, outErr[1], STDERR_FILENO);
posix_spawn_file_actions_addclose(&action, outErr[0]);
}
int out[2];
if(stdOut)
{
pipe(out);
posix_spawn_file_actions_adddup2(&action, out[1], STDOUT_FILENO);
posix_spawn_file_actions_addclose(&action, out[0]);
}
pid_t task_pid;
int status = -200;
int spawnError = posix_spawn(&task_pid, [path UTF8String], &action, &attr, (char* const*)argsC, NULL);
posix_spawnattr_destroy(&attr);
for (NSUInteger i = 0; i < argCount; i++)
{
free(argsC[i]);
}
free(argsC);
if(spawnError != 0)
{
NSLog(@"posix_spawn error %d\n", spawnError);
return spawnError;
}
do
{
if (waitpid(task_pid, &status, 0) != -1) {
NSLog(@"Child status %d", WEXITSTATUS(status));
} else
{
perror("waitpid");
return -222;
}
} while (!WIFEXITED(status) && !WIFSIGNALED(status));
if(stdOut)
{
close(out[1]);
NSString* output = getNSStringFromFile(out[0]);
*stdOut = output;
}
if(stdErr)
{
close(outErr[1]);
NSString* errorOutput = getNSStringFromFile(outErr[0]);
*stdErr = errorOutput;
}
return WEXITSTATUS(status);
}
%hook CSStatusTextView
- (void)setInternalLegalText:(NSString *)string {
%orig(@":troll:");
}
%end
bool OpenedTweaks = false;
bool os_variant_has_internal_content(const char* subsystem);
%hookf(bool, os_variant_has_internal_content, const char* subsystem) {
if (OpenedTweaks == false) {
//const char* path = jbroot("/Library/MobileSubstrate/DynamicLibraries");
//DIR *dir;
//struct dirent *ent;
// if ((dir = opendir(path)) != NULL) {
// while ((ent = readdir(dir)) != NULL) {
// if (ent->d_type == DT_REG && strstr(ent->d_name, ".dylib")) {
// char filePath[256];
// snprintf(filePath, sizeof(filePath), "%s/%s", path, ent->d_name);
// dlopen(filePath, RTLD_NOW | RTLD_GLOBAL);
// }
// }
spawnRoot(jbroot(@"/basebin/bootstrapd"), @[@"daemon",@"-f"], nil, nil);
dlopen(jbroot(@"/basebin/bootstrap.dylib").UTF8String, RTLD_GLOBAL | RTLD_NOW);
OpenedTweaks = true;
return true;
} else {
return true;
}
}
#define CS_DEBUGGED 0x10000000
int csops(pid_t pid, unsigned int ops, void *useraddr, size_t usersize);
int fork();
int ptrace(int, int, int, int);
int isJITEnabled() {
int flags;
csops(getpid(), 0, &flags, sizeof(flags));
return (flags & CS_DEBUGGED) != 0;
}
%ctor {
if (!isJITEnabled()) {
// Enable JIT
int pid = fork();
if (pid == 0) {
ptrace(0, 0, 0, 0);
exit(0);
} else if (pid > 0) {
while (wait(NULL) > 0) {
usleep(1000);
}
}
}
}
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/build.sh
================================================
make
ldid -S../../launchdentitlements.plist -Cadhoc .theos/obj/debug/SpringBoardHook.dylib
/Users/ibarahime/ChOma/ct_bypass -i .theos/obj/debug/SpringBoardHook.dylib -r -o springboardhooksigned.dylib
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/SpringBoardHook/control
================================================
Package: com.yourcompany.springboardhook
Name: SpringBoardHook
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome MobileSubstrate tweak!
Maintainer: LL
Author: LL
Section: Tweaks
Depends: mobilesubstrate (>= 0.9.5000)
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/build.sh
================================================
function replaceByte() {
printf "\x00\x00\x00\x00" | dd of="$1" bs=1 seek=$2 count=4 conv=notrunc &> /dev/null
}
make
# /Users/ibarahime/insert_dylib/insert_dylib/insert_dylib /var/jb/usr/lib/ellekit/libinjector.dylib .theos/obj/debug/arm64e/springboardshim springboardshiminjected --all-yes
# /Users/ibarahime/insert_dylib/insert_dylib/insert_dylib /var/jb/usr/lib/libellekit.dylib springboardshiminjected springboardshiminjected --all-yes
/Users/ibarahime/insert_dylib/insert_dylib/insert_dylib @loader_path/springboardhook.dylib .theos/obj/debug/arm64e/springboardshim springboardshiminjected --all-yes
# replaceByte 'springboardshiminjected' 8
ldid -SSpringBoardEnts.plist springboardshiminjected
/Users/ibarahime/ChOma/ct_bypass -i springboardshiminjected -r -o springboardshimsignedinjected
================================================
FILE: RootHelperSample/launchdshim/SpringBoardShim/main.c
================================================
#include
#include
#include
#include
#include
int (*SBSystemAppMain)(int argc, char *argv[], char *envp[], char* apple[]);
int main(int argc, char *argv[], char *envp[], char* apple[]) {
void *handle = dlopen("/System/Library/PrivateFrameworks/SpringBoard.framework/SpringBoard", RTLD_GLOBAL);
SBSystemAppMain = dlsym(handle, "SBSystemAppMain");
return SBSystemAppMain(argc, argv, envp, apple);
}
================================================
FILE: RootHelperSample/launchdshim/build.sh
================================================
function replaceByte() {
printf "\x00\x00\x00\x00" | dd of="$1" bs=1 seek=$2 count=4 conv=notrunc &> /dev/null
}
replaceByte 'launchd' 8
# /Users/ibarahime/insert_dylib/insert_dylib/insert_dylib /var/jb/usr/lib/ellekit/libinjector.dylib .theos/obj/debug/arm64e/springboardshim springboardshiminjected --all-yes
# /Users/ibarahime/insert_dylib/insert_dylib/insert_dylib /var/jb/usr/lib/libellekit.dylib springboardshiminjected springboardshiminjected --all-yes
/Users/ibarahime/insert_dylib/insert_dylib/insert_dylib @loader_path/launchdhook.dylib launchd launchdinjected --all-yes
ldid -Slaunchdentitlements.plist launchdinjected
/Users/ibarahime/ChOma/ct_bypass -i launchdinjected -r -o launchdsignedinjected
================================================
FILE: RootHelperSample/launchdshim/launchdentitlements.plist
================================================
com.apple.private.security.no-sandbox
com.apple.private.domain-extension
com.apple.private.security.container-required
com.apple.private.security.no-container
com.apple.private.skip-library-validation
com.apple.private.xpc.domain-extension
com.apple.private.xpc.domain-extension.proxy
com.apple.private.xpc.launchd.app-state-manager
com.apple.private.xpc.launchd.enable-disable-system-services
com.apple.private.xpc.launchd.event-monitor
com.apple.private.xpc.launchd.loginitem-bootstrapper
com.apple.private.xpc.launchd.loginitem-outside-bundle
com.apple.private.xpc.launchd.obliterator
com.apple.private.xpc.launchd.per-user-create.mbsetupuser
com.apple.private.xpc.launchd.per-user-lookup
com.apple.private.xpc.launchd.reboot
com.apple.private.xpc.launchd.service-hold
com.apple.private.xpc.launchd.userspace-reboot
com.apple.private.xpc.launchd.userspace-reboot-now
com.apple.private.xpc.persona-creator
com.apple.private.xpc.persona-manager
com.apple.private.persona-mgmt
com.apple.private.xpc.service-attach
com.apple.private.xpc.service-configure
platform-application
get-task-allow
task_for_pid-allow
com.apple.private.set-launch-type.internal
com.apple.security.exception.mach-lookup.global-name
com.apple.mmaintenanced
com.apple.memory-maintenance
com.apple.apfs.get-dev-by-role
com.apple.private.amfi.can-allow-non-platform
com.apple.private.iokit.system-nvram-allow
com.apple.private.kernel.system-override
com.apple.private.persona-mgmt
com.apple.private.pmap.load-trust-cache
cryptex1.boot.os
cryptex1.boot.app
cryptex1.safari-downlevel
com.apple.private.record_system_event
com.apple.private.roots-installed-read-write
com.apple.private.security.disk-device-access
com.apple.private.security.storage.driverkitd
com.apple.private.security.storage.launchd
com.apple.private.security.system-mount-authority
com.apple.private.set-atm-diagnostic-flag
com.apple.private.spawn-panic-crash-behavior
com.apple.private.spawn-subsystem-root
com.apple.private.vfs.allow-low-space-writes
com.apple.private.vfs.graftdmg
com.apple.private.vfs.pivot-root
com.apple.rootless.restricted-block-devices
com.apple.rootless.storage.early_boot_mount
com.apple.rootless.volume.Preboot
com.apple.security.network.server
================================================
FILE: RootHelperSample/launchdshim/launchdhook/Frameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer.tbd
================================================
--- !tapi-tbd-v3
archs: [ armv7, armv7s, arm64, arm64e ]
platform: ios
flags: [ flat_namespace ]
install-name: /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
current-version: 1
compatibility-version: 1
exports:
- archs: [ armv7, armv7s, arm64, arm64e ]
symbols: [ _IOMobileFrameBufferEnableDebugTracing,
_IOMobileFrameBufferEnableVBLTraces,
_IOMobileFrameBufferGetDebugTraces,
_IOMobileFrameBufferGetMirroringCapability,
_IOMobileFrameBufferPrintDebugTraces,
_IOMobileFrameBufferSetLogLevel,
_IOMobileFrameBufferprintDisplayRegs,
_IOMobileFramebufferALSSEnableWindows,
_IOMobileFramebufferALSSGetRGBCoeffs,
_IOMobileFramebufferALSSGetWindows,
_IOMobileFramebufferALSSGetWindowsSums,
_IOMobileFramebufferALSSSetRGBCoeffs,
_IOMobileFramebufferALSSSetWindows,
_IOMobileFramebufferChangeFrameInfo,
_IOMobileFramebufferCopyLayerDisplayedSurface,
_IOMobileFramebufferCopyProperty,
_IOMobileFramebufferCreateDisplayList,
_IOMobileFramebufferCreateStatistics,
_IOMobileFramebufferDisableCRCNotifications,
_IOMobileFramebufferDisableHotPlugDetectNotifications,
_IOMobileFramebufferDisablePowerNotifications,
_IOMobileFramebufferDisableVSyncNotifications,
_IOMobileFramebufferEnableCRCNotifications,
_IOMobileFramebufferEnableDisableDithering,
_IOMobileFramebufferEnableDisableVideoPowerSavings,
_IOMobileFramebufferEnableHotPlugDetectNotifications,
_IOMobileFramebufferEnableMirroring,
_IOMobileFramebufferEnablePowerNotifications,
_IOMobileFramebufferEnableStatistics,
_IOMobileFramebufferEnableVSyncNotifications,
_IOMobileFramebufferFactoryPortal,
_IOMobileFramebufferFrameInfo,
_IOMobileFramebufferGetBlock,
_IOMobileFramebufferGetBrightnessControlCapabilities,
_IOMobileFramebufferGetBrightnessControlInfo,
_IOMobileFramebufferGetBufBlock,
_IOMobileFramebufferGetCRCNotifyMessageCount,
_IOMobileFramebufferGetCRCRunLoopSource,
_IOMobileFramebufferGetCanvasSizes,
_IOMobileFramebufferGetColorRemapMode,
_IOMobileFramebufferGetCurrentAbsoluteTime,
_IOMobileFramebufferGetDigitalOutState,
_IOMobileFramebufferGetDisplayArea,
_IOMobileFramebufferGetDisplaySize,
_IOMobileFramebufferGetDotPitch,
_IOMobileFramebufferGetFrameworkInfo,
_IOMobileFramebufferGetGammaTable,
_IOMobileFramebufferGetHDCPAuthenticationProtocol,
_IOMobileFramebufferGetHDCPDownstreamState,
_IOMobileFramebufferGetHDCPRunLoopSource,
_IOMobileFramebufferGetHotPlugRunLoopSource,
_IOMobileFramebufferGetID,
_IOMobileFramebufferGetLayerDefaultSurface,
_IOMobileFramebufferGetLinkQuality,
_IOMobileFramebufferGetMainDisplay,
_IOMobileFramebufferGetMatrix,
_IOMobileFramebufferGetMirrorError,
_IOMobileFramebufferGetProtectionOptions,
_IOMobileFramebufferGetRunLoopSource,
_IOMobileFramebufferGetSecondaryDisplay,
_IOMobileFramebufferGetServiceObject,
_IOMobileFramebufferGetSupportedDigitalOutModes,
_IOMobileFramebufferGetTypeID,
_IOMobileFramebufferGetVSyncRunLoopSource,
_IOMobileFramebufferGetWirelessSurface,
_IOMobileFramebufferGetWirelessSurfaceWithOptions,
_IOMobileFramebufferHDCPGetReply,
_IOMobileFramebufferHDCPSendRequest,
_IOMobileFramebufferInstallVirtualDisplay,
_IOMobileFramebufferInstallVirtualDisplays,
_IOMobileFramebufferIsMainDisplay,
_IOMobileFramebufferKernelTests,
_IOMobileFramebufferOpen,
_IOMobileFramebufferOpenByName,
_IOMobileFramebufferReadyForSwap,
_IOMobileFramebufferRequestPowerChange,
_IOMobileFramebufferSPLCGetBrightness,
_IOMobileFramebufferSPLCSetBrightness,
_IOMobileFramebufferScheduleWithDispatchQueue,
_IOMobileFramebufferSetBlock,
_IOMobileFramebufferSetBrightnessControlCallback,
_IOMobileFramebufferSetBrightnessCorrection,
_IOMobileFramebufferSetCanvasSize,
_IOMobileFramebufferSetColorRemapMode,
_IOMobileFramebufferSetContrast,
_IOMobileFramebufferSetDebugFlags,
_IOMobileFramebufferSetDigitalOutMode,
_IOMobileFramebufferSetDisplayDevice,
_IOMobileFramebufferSetDroppable,
_IOMobileFramebufferSetFlags,
_IOMobileFramebufferSetGammaTable,
_IOMobileFramebufferSetIdleBuffer,
_IOMobileFramebufferSetLine21Data,
_IOMobileFramebufferSetMatrix,
_IOMobileFramebufferSetMirrorContentRegion,
_IOMobileFramebufferSetParameter,
_IOMobileFramebufferSetRenderingAngle,
_IOMobileFramebufferSetTVOutMode,
_IOMobileFramebufferSetTVOutSignalType,
_IOMobileFramebufferSetUnderrunColor,
_IOMobileFramebufferSetVideoDACGain,
_IOMobileFramebufferSetWSSInfo,
_IOMobileFramebufferSetWhiteOnBlackMode,
_IOMobileFramebufferSupportedFrameInfo,
_IOMobileFramebufferSurfaceIsReplaceable,
_IOMobileFramebufferSwapActiveRegion,
_IOMobileFramebufferSwapBegin,
_IOMobileFramebufferSwapCancel,
_IOMobileFramebufferSwapCancelAll,
_IOMobileFramebufferSwapDirtyRegion,
_IOMobileFramebufferSwapEnd,
_IOMobileFramebufferSwapSetBackgroundColor,
_IOMobileFramebufferSwapSetBrightness,
_IOMobileFramebufferSwapSetBrightnessLimit,
_IOMobileFramebufferSwapSetColorMatrix,
_IOMobileFramebufferSwapSetDisplayEdr,
_IOMobileFramebufferSwapSetGammaTable,
_IOMobileFramebufferSwapSetICCCurve,
_IOMobileFramebufferSwapSetICCMatrix,
_IOMobileFramebufferSwapSetLayer,
_IOMobileFramebufferSwapSetParams,
_IOMobileFramebufferSwapSetTimestamp,
_IOMobileFramebufferSwapSetTimestamps,
_IOMobileFramebufferSwapSetUISubRegion,
_IOMobileFramebufferSwapSetVideoDestEdgeAlpha,
_IOMobileFramebufferSwapSignal,
_IOMobileFramebufferSwapSubtitleRegion,
_IOMobileFramebufferSwapUIEdgeBlendMode,
_IOMobileFramebufferSwapWait,
_IOMobileFramebufferSwapWaitWithTimeout,
_IOMobileFramebufferSwapWorkaroundSettings,
_IOMobileFramebufferUnscheduleFromDispatchQueue,
_IOMobileFramebufferWaitSurface, _kIOMFB_TotalSwaps,
_kIOMFB_TotalVBLs ]
...
================================================
FILE: RootHelperSample/launchdshim/launchdhook/IOMobileFramebuffer.h
================================================
#ifndef IOMOBILEFRAMEBUFFER_IOMOBILEFRAMEBUFFER_H
#define IOMOBILEFRAMEBUFFER_IOMOBILEFRAMEBUFFER_H
#include
#include
#include
#include
typedef IOReturn IOMobileFramebufferReturn;
typedef struct __IOMobileFramebuffer *IOMobileFramebufferRef;
typedef CGSize IOMobileFramebufferDisplaySize;
__BEGIN_DECLS
IOMobileFramebufferReturn
IOMobileFramebufferGetMainDisplay(IOMobileFramebufferRef *pointer);
IOMobileFramebufferReturn
IOMobileFramebufferGetDisplaySize(IOMobileFramebufferRef pointer, IOMobileFramebufferDisplaySize *size);
IOMobileFramebufferReturn
IOMobileFramebufferGetLayerDefaultSurface(IOMobileFramebufferRef pointer, int surface, IOSurfaceRef *buffer);
IOMobileFramebufferReturn
IOMobileFramebufferSwapBegin(IOMobileFramebufferRef pointer, int *token);
IOMobileFramebufferReturn
IOMobileFramebufferSwapEnd(IOMobileFramebufferRef pointer);
IOMobileFramebufferReturn
IOMobileFramebufferSwapSetLayer(IOMobileFramebufferRef pointer, int layerid, IOSurfaceRef buffer, CGRect bounds, CGRect frame, int flags);
__END_DECLS
#endif
================================================
FILE: RootHelperSample/launchdshim/launchdhook/LICENCE
================================================
MIT License
Copyright (c) 2023 Hariz Shirazi (https://bomberfish.ca)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: RootHelperSample/launchdshim/launchdhook/Makefile
================================================
TARGET := iphone:clang:latest:15.0
ARCHS = arm64e
THEOS_PACKAGE_SCHEME = roothide
include $(THEOS)/makefiles/common.mk
LIBRARY_NAME = launchdhook
launchdhook_FILES = $(wildcard *.m) $(wildcard *.c) $(wildcard verbose/*.m)
launchdhook_CFLAGS = -fobjc-arc -isystem "../../../usprebooter/Private Headers I stole from the macOS SDK" -Wno-error
launchdhook_CODESIGN_FLAGS = -S../launchdentitlements.plist
launchdhook_LDFLAGS = -F./Frameworks
launchdhook_EXTRA_FRAMEWORKS += IOMobileFramebuffer IOSurface
after-package::
echo "[*] Signing lunchd hook"
../../../ChOma/output/tests/ct_bypass -i .theos/obj/debug/launchdhook.dylib -o launchdhooksigned.dylib
include $(THEOS_MAKE_PATH)/library.mk
================================================
FILE: RootHelperSample/launchdshim/launchdhook/README.md
================================================
# FBWrite
Write text to the framebuffer, with style.
================================================
FILE: RootHelperSample/launchdshim/launchdhook/build.sh
================================================
make
/Users/ibarahime/ChOma/ct_bypass -i .theos/obj/debug/launchdhook.dylib -r -o launchdhooksigned.dylib
================================================
FILE: RootHelperSample/launchdshim/launchdhook/control
================================================
Package: ca.bomberfish.fbwrite
Name: FBWrite
Version: 0.0.1
Architecture: iphoneos-arm
Description: Write to the framebuffer with style.
Maintainer: BomberFish Industries
Author: BomberFish Industries
Section: System
Tag: role::hacker
================================================
FILE: RootHelperSample/launchdshim/launchdhook/entitlements.plist
================================================
get-task-allow
platform-application
com.apple.private.security.no-container
com.apple.private.allow-explicit-graphics-priority
com.apple.security.iokit-user-client-class
IOSurfaceRootUserClient
IOMobileFramebufferUserClient
IOHIDEventServiceUserClient
================================================
FILE: RootHelperSample/launchdshim/launchdhook/fishhook.c
================================================
// Copyright (c) 2013, Facebook, Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name Facebook nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific
// prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "fishhook.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#if __has_include()
#include
#endif
#ifdef __LP64__
typedef struct mach_header_64 mach_header_t;
typedef struct segment_command_64 segment_command_t;
typedef struct section_64 section_t;
typedef struct nlist_64 nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64
#else
typedef struct mach_header mach_header_t;
typedef struct segment_command segment_command_t;
typedef struct section section_t;
typedef struct nlist nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT
#endif
#ifndef SEG_DATA_CONST
#define SEG_DATA_CONST "__DATA_CONST"
#endif
struct rebindings_entry {
struct rebinding *rebindings;
size_t rebindings_nel;
struct rebindings_entry *next;
};
static struct rebindings_entry *_rebindings_head;
static int prepend_rebindings(struct rebindings_entry **rebindings_head,
struct rebinding rebindings[],
size_t nel) {
struct rebindings_entry *new_entry = (struct rebindings_entry *) malloc(sizeof(struct rebindings_entry));
if (!new_entry) {
return -1;
}
new_entry->rebindings = (struct rebinding *) malloc(sizeof(struct rebinding) * nel);
if (!new_entry->rebindings) {
free(new_entry);
return -1;
}
memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel);
new_entry->rebindings_nel = nel;
new_entry->next = *rebindings_head;
*rebindings_head = new_entry;
return 0;
}
#if 0
static int get_protection(void *addr, vm_prot_t *prot, vm_prot_t *max_prot) {
mach_port_t task = mach_task_self();
vm_size_t size = 0;
vm_address_t address = (vm_address_t)addr;
memory_object_name_t object;
#ifdef __LP64__
mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64;
vm_region_basic_info_data_64_t info;
kern_return_t info_ret = vm_region_64(
task, &address, &size, VM_REGION_BASIC_INFO_64, (vm_region_info_64_t)&info, &count, &object);
#else
mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT;
vm_region_basic_info_data_t info;
kern_return_t info_ret = vm_region(task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&info, &count, &object);
#endif
if (info_ret == KERN_SUCCESS) {
if (prot != NULL)
*prot = info.protection;
if (max_prot != NULL)
*max_prot = info.max_protection;
return 0;
}
return -1;
}
#endif
static void perform_rebinding_with_section(struct rebindings_entry *rebindings,
section_t *section,
intptr_t slide,
nlist_t *symtab,
char *strtab,
uint32_t *indirect_symtab) {
uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1;
void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr);
for (uint i = 0; i < section->size / sizeof(void *); i++) {
uint32_t symtab_index = indirect_symbol_indices[i];
if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL ||
symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) {
continue;
}
uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx;
char *symbol_name = strtab + strtab_offset;
bool symbol_name_longer_than_1 = symbol_name[0] && symbol_name[1];
struct rebindings_entry *cur = rebindings;
while (cur) {
for (uint j = 0; j < cur->rebindings_nel; j++) {
if (symbol_name_longer_than_1 && strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {
kern_return_t err;
if (cur->rebindings[j].replaced != NULL && indirect_symbol_bindings[i] != cur->rebindings[j].replacement)
*(cur->rebindings[j].replaced) = indirect_symbol_bindings[i];
/**
* 1. Moved the vm protection modifying codes to here to reduce the
* changing scope.
* 2. Adding VM_PROT_WRITE mode unconditionally because vm_region
* API on some iOS/Mac reports mismatch vm protection attributes.
* -- Lianfu Hao Jun 16th, 2021
**/
err = vm_protect (mach_task_self (), (uintptr_t)indirect_symbol_bindings, section->size, 0, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_COPY);
if (err == KERN_SUCCESS) {
/**
* Once we failed to change the vm protection, we
* MUST NOT continue the following write actions!
* iOS 15 has corrected the const segments prot.
* -- Lionfore Hao Jun 11th, 2021
**/
#if !__has_feature(ptrauth_calls)
indirect_symbol_bindings[i] = cur->rebindings[j].replacement;
#else
void *replacement = cur->rebindings[j].replacement;
if (!strcmp(section->sectname, "__auth_got")) {
void *stripped = ptrauth_strip(replacement, ptrauth_key_process_independent_code);
replacement = ptrauth_sign_unauthenticated(stripped, ptrauth_key_process_independent_code, &indirect_symbol_bindings[i]);
}
indirect_symbol_bindings[i] = replacement;
#endif
}
goto symbol_loop;
}
}
cur = cur->next;
}
symbol_loop:;
}
}
static void rebind_symbols_for_image(struct rebindings_entry *rebindings,
const struct mach_header *header,
intptr_t slide) {
Dl_info info;
if (dladdr(header, &info) == 0) {
return;
}
segment_command_t *cur_seg_cmd;
segment_command_t *linkedit_segment = NULL;
struct symtab_command* symtab_cmd = NULL;
struct dysymtab_command* dysymtab_cmd = NULL;
uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {
cur_seg_cmd = (segment_command_t *)cur;
if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) {
linkedit_segment = cur_seg_cmd;
}
} else if (cur_seg_cmd->cmd == LC_SYMTAB) {
symtab_cmd = (struct symtab_command*)cur_seg_cmd;
} else if (cur_seg_cmd->cmd == LC_DYSYMTAB) {
dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd;
}
}
if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment ||
!dysymtab_cmd->nindirectsyms) {
return;
}
// Find base symbol/string table addresses
uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff;
nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff);
char *strtab = (char *)(linkedit_base + symtab_cmd->stroff);
// Get indirect symbol table (array of uint32_t indices into symbol table)
uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff);
cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {
cur_seg_cmd = (segment_command_t *)cur;
if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 &&
strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) {
continue;
}
for (uint j = 0; j < cur_seg_cmd->nsects; j++) {
section_t *sect =
(section_t *)(cur + sizeof(segment_command_t)) + j;
if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) {
perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);
}
if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) {
perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);
}
}
}
}
}
static void _rebind_symbols_for_image(const struct mach_header *header,
intptr_t slide) {
rebind_symbols_for_image(_rebindings_head, header, slide);
}
int rebind_symbols_image(void *header,
intptr_t slide,
struct rebinding rebindings[],
size_t rebindings_nel) {
struct rebindings_entry *rebindings_head = NULL;
int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel);
rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide);
if (rebindings_head) {
free(rebindings_head->rebindings);
}
free(rebindings_head);
return retval;
}
int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) {
int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel);
if (retval < 0) {
return retval;
}
// If this was the first call, register callback for image additions (which is also invoked for
// existing images, otherwise, just run on existing images
if (!_rebindings_head->next) {
_dyld_register_func_for_add_image(_rebind_symbols_for_image);
} else {
uint32_t c = _dyld_image_count();
for (uint32_t i = 0; i < c; i++) {
_rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i));
}
}
return retval;
}
================================================
FILE: RootHelperSample/launchdshim/launchdhook/fishhook.h
================================================
// Copyright (c) 2013, Facebook, Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name Facebook nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific
// prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef fishhook_h
#define fishhook_h
#include
#include
#if !defined(FISHHOOK_EXPORT)
#define FISHHOOK_VISIBILITY __attribute__((visibility("hidden")))
#else
#define FISHHOOK_VISIBILITY __attribute__((visibility("default")))
#endif
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
/*
* A structure representing a particular intended rebinding from a symbol
* name to its replacement
*/
struct rebinding {
const char *name;
void *replacement;
void **replaced;
};
/*
* For each rebinding in rebindings, rebinds references to external, indirect
* symbols with the specified name to instead point at replacement for each
* image in the calling process as well as for all future images that are loaded
* by the process. If rebind_functions is called more than once, the symbols to
* rebind are added to the existing list of rebindings, and if a given symbol
* is rebound more than once, the later rebinding will take precedence.
*/
FISHHOOK_VISIBILITY
int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel);
/*
* Rebinds as above, but only in the specified image. The header should point
* to the mach-o header, the slide should be the slide offset. Others as above.
*/
FISHHOOK_VISIBILITY
int rebind_symbols_image(void *header,
intptr_t slide,
struct rebinding rebindings[],
size_t rebindings_nel);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //fishhook_h
================================================
FILE: RootHelperSample/launchdshim/launchdhook/main.m
================================================
#include
#include
#include
#include
#include
#include
#include "fishhook.h"
#include
#include
#include
#include
#include
#include
#include
#define PT_DETACH 11 /* stop tracing a process */
#define PT_ATTACHEXC 14 /* attach to running process with signal exception */
int ptrace(int request, pid_t pid, caddr_t addr, int data);
int posix_spawnattr_set_launch_type_np(posix_spawnattr_t *attr, uint8_t launch_type);
int (*orig_csops)(pid_t pid, unsigned int ops, void * useraddr, size_t usersize);
int (*orig_csops_audittoken)(pid_t pid, unsigned int ops, void * useraddr, size_t usersize, audit_token_t * token);
int (*orig_posix_spawn)(pid_t * __restrict pid, const char * __restrict path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t * __restrict attrp,
char *const argv[ __restrict], char *const envp[ __restrict]);
int (*orig_posix_spawnp)(pid_t *restrict pid, const char *restrict path, const posix_spawn_file_actions_t *restrict file_actions, const posix_spawnattr_t *restrict attrp, char *const argv[restrict], char *const envp[restrict]);
int hooked_csops(pid_t pid, unsigned int ops, void *useraddr, size_t usersize) {
int result = orig_csops(pid, ops, useraddr, usersize);
if (result != 0) return result;
if (ops == 0) { // CS_OPS_STATUS
*((uint32_t *)useraddr) |= 0x4000000; // CS_PLATFORM_BINARY
}
return result;
}
int hooked_csops_audittoken(pid_t pid, unsigned int ops, void * useraddr, size_t usersize, audit_token_t * token) {
int result = orig_csops_audittoken(pid, ops, useraddr, usersize, token);
if (result != 0) return result;
if (ops == 0) { // CS_OPS_STATUS
*((uint32_t *)useraddr) |= 0x4000000; // CS_PLATFORM_BINARY
}
return result;
}
void change_launchtype(const posix_spawnattr_t *attrp, const char *restrict path) {
const char *prefixes[] = {
"/private/var",
"/var",
"/private/preboot"
};
if (__builtin_available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)) {
for (size_t i = 0; i < sizeof(prefixes) / sizeof(prefixes[0]); ++i) {
size_t prefix_len = strlen(prefixes[i]);
if (strncmp(path, prefixes[i], prefix_len) == 0) {
// FILE *file = fopen("/var/mobile/lunchd.log", "a");
if (/*file && */attrp != 0) {
// char output[1024];
// sprintf(output, "[lunchd] setting launch type path %s to 0\n", path);
// fputs(output, file);
// fclose(file);
posix_spawnattr_set_launch_type_np((posix_spawnattr_t *)attrp, 0); // needs ios 16.0 sdk
}
break;
}
}
}
}
int hooked_posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *attrp, char *const argv[], char *const envp[]) {
change_launchtype(attrp, path);
// const char *launchdPath = "/sbin/launchd";
// const char *coolerLaunchd = jbroot("lunchd");
// if (!strncmp(path, launchdPath, strlen(launchdPath))) {
// posix_spawnattr_set_launch_type_np((posix_spawnattr_t *)attrp, 0);
// path = coolerLaunchd;
// return orig_posix_spawn(pid, path, file_actions, attrp, argv, envp);
// }
return orig_posix_spawn(pid, path, file_actions, attrp, argv, envp);
}
int hooked_posix_spawnp(pid_t *restrict pid, const char *restrict path, const posix_spawn_file_actions_t *restrict file_actions, posix_spawnattr_t *attrp, char *const argv[restrict], char *const envp[restrict]) {
change_launchtype(attrp, path);
const char *springboardPath = "/System/Library/CoreServices/SpringBoard.app/SpringBoard";
const char *coolerSpringboard = jbroot("/System/Library/CoreServices/SpringBoard.app/SpringBoard");
if (!strncmp(path, springboardPath, strlen(springboardPath))) {
posix_spawnattr_set_launch_type_np((posix_spawnattr_t *)attrp, 0);
// FILE *file = fopen("/var/mobile/lunchd.log", "a");
// char output[1024];
// sprintf(output, "[lunchd] changing path %s to %s\n", path, coolerSpringboard);
// fputs(output, file);
path = coolerSpringboard;
// fclose(file);
return posix_spawnp(pid, path, file_actions, (posix_spawnattr_t *)attrp, argv, envp);
}
return orig_posix_spawnp(pid, path, file_actions, (posix_spawnattr_t *)attrp, argv, envp);
}
bool (*xpc_dictionary_get_bool_orig)(xpc_object_t dictionary, const char *key);
bool hook_xpc_dictionary_get_bool(xpc_object_t dictionary, const char *key) {
if (!strcmp(key, "LogPerformanceStatistics")) return true;
else return xpc_dictionary_get_bool_orig(dictionary, key);
}
void initVerboseFramebuffer(void);
__attribute__((constructor)) static void init(int argc, char **argv) {
// FILE *file;
// file = fopen("/var/mobile/lunchd.log", "w");
// char output[1024];
// sprintf(output, "[lunchd] launchdhook pid %d", getpid());
// printf("[lunchd] launchdhook pid %d", getpid());
// fputs(output, file);
// fclose(file);
// sync();
bool verboseBoot = false;
NSString *verboseBootPath = @"/var/mobile/.serotonin_verbose";
NSString *happyMac = @"/var/mobile/boot-happy.jp2";
NSString *sadMac = @"/var/mobile/boot-sad.jp2";
if ([NSFileManager.defaultManager fileExistsAtPath:verboseBootPath]) {
verboseBoot = true;
}
if (verboseBoot) {
initVerboseFramebuffer();
} else {
// TODO: Boot splash
}
printf("[lunchd] launchdhook pid %d", getpid());
if (getpid() == 1) {
printf("============\n");
printf("== WE ARE ==\n");
printf("== PID1 ==\n");
printf("============\n\n");
printf("Also, my parent is %d\n", getppid());
}
struct rebinding rebindings[] = (struct rebinding[]){
{"csops", hooked_csops, (void *)&orig_csops},
{"csops_audittoken", hooked_csops_audittoken, (void *)&orig_csops_audittoken},
{"posix_spawn", hooked_posix_spawn, (void *)&orig_posix_spawn},
{"posix_spawnp", hooked_posix_spawnp, (void *)&orig_posix_spawnp},
{"xpc_dictionary_get_bool", hook_xpc_dictionary_get_bool, (void *)&xpc_dictionary_get_bool_orig},
};
rebind_symbols(rebindings, sizeof(rebindings)/sizeof(struct rebinding));
}
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/IOMobileFramebuffer.h
================================================
#ifndef IOMOBILEFRAMEBUFFER_IOMOBILEFRAMEBUFFER_H
#define IOMOBILEFRAMEBUFFER_IOMOBILEFRAMEBUFFER_H
#include
#include
#include
#include
typedef IOReturn IOMobileFramebufferReturn;
typedef struct __IOMobileFramebuffer *IOMobileFramebufferRef;
typedef CGSize IOMobileFramebufferDisplaySize;
__BEGIN_DECLS
IOMobileFramebufferReturn
IOMobileFramebufferGetMainDisplay(IOMobileFramebufferRef *pointer);
IOMobileFramebufferReturn
IOMobileFramebufferGetDisplaySize(IOMobileFramebufferRef pointer, IOMobileFramebufferDisplaySize *size);
IOMobileFramebufferReturn
IOMobileFramebufferGetLayerDefaultSurface(IOMobileFramebufferRef pointer, int surface, IOSurfaceRef *buffer);
IOMobileFramebufferReturn
IOMobileFramebufferSwapBegin(IOMobileFramebufferRef pointer, int *token);
IOMobileFramebufferReturn
IOMobileFramebufferSwapEnd(IOMobileFramebufferRef pointer);
IOMobileFramebufferReturn
IOMobileFramebufferSwapSetLayer(IOMobileFramebufferRef pointer, int layerid, IOSurfaceRef buffer, CGRect bounds, CGRect frame, int flags);
__END_DECLS
#endif
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/console/iso_font.c
================================================
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* ISO Latin-1 Font
*
* Copyright (c) 2000
* Ka-Ping Yee
*
* This font may be freely used for any purpose.
*/
/*
* adjusted 'A' 'V' to improve their dense appearance (ie. lightened)
* adjusted 'i' 'l' to improve their flow within a word (ie. widened)
* adjusted 'E' 'F' '#'
*/
unsigned char iso_font[256 * 16] = {
/* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 2 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 3 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 4 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 5 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 6 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 8 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 9 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 10 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 11 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 12 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 13 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 14 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 15 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 16 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 18 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 19 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 20 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 21 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 22 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 23 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 24 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 25 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 26 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 28 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 29 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 30 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 31 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 32 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 33 */ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 34 */ 0x00, 0x00, 0x6c, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 35 */ 0x00, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x36, 0x36, 0x7f, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 36 */ 0x00, 0x08, 0x08, 0x3e, 0x6b, 0x0b, 0x0b, 0x3e, 0x68, 0x68, 0x6b, 0x3e, 0x08, 0x08, 0x00, 0x00,
/* 37 */ 0x00, 0x00, 0x00, 0x33, 0x13, 0x18, 0x08, 0x0c, 0x04, 0x06, 0x32, 0x33, 0x00, 0x00, 0x00, 0x00,
/* 38 */ 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x6c, 0x3e, 0x33, 0x33, 0x7b, 0xce, 0x00, 0x00, 0x00, 0x00,
/* 39 */ 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 40 */ 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
/* 41 */ 0x00, 0x00, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00,
/* 42 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x1c, 0x7f, 0x1c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 43 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 44 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00,
/* 45 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 46 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 47 */ 0x00, 0x00, 0x60, 0x20, 0x30, 0x10, 0x18, 0x08, 0x0c, 0x04, 0x06, 0x02, 0x03, 0x00, 0x00, 0x00,
/* 48 */ 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x6b, 0x6b, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 49 */ 0x00, 0x00, 0x18, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 50 */ 0x00, 0x00, 0x3e, 0x63, 0x60, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 51 */ 0x00, 0x00, 0x3e, 0x63, 0x60, 0x60, 0x3c, 0x60, 0x60, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 52 */ 0x00, 0x00, 0x30, 0x38, 0x3c, 0x36, 0x33, 0x7f, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
/* 53 */ 0x00, 0x00, 0x7f, 0x03, 0x03, 0x3f, 0x60, 0x60, 0x60, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 54 */ 0x00, 0x00, 0x3c, 0x06, 0x03, 0x03, 0x3f, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 55 */ 0x00, 0x00, 0x7f, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
/* 56 */ 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 57 */ 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x7e, 0x60, 0x60, 0x60, 0x30, 0x1e, 0x00, 0x00, 0x00, 0x00,
/* 58 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 59 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00,
/* 60 */ 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
/* 61 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 62 */ 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
/* 63 */ 0x00, 0x00, 0x3e, 0x63, 0x60, 0x30, 0x30, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 64 */ 0x00, 0x00, 0x3c, 0x66, 0x73, 0x7b, 0x6b, 0x6b, 0x7b, 0x33, 0x06, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 65 */ 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 66 */ 0x00, 0x00, 0x3f, 0x63, 0x63, 0x63, 0x3f, 0x63, 0x63, 0x63, 0x63, 0x3f, 0x00, 0x00, 0x00, 0x00,
/* 67 */ 0x00, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 68 */ 0x00, 0x00, 0x1f, 0x33, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x33, 0x1f, 0x00, 0x00, 0x00, 0x00,
/* 69 */ 0x00, 0x00, 0x7f, 0x03, 0x03, 0x03, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 70 */ 0x00, 0x00, 0x7f, 0x03, 0x03, 0x03, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
/* 71 */ 0x00, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x03, 0x73, 0x63, 0x63, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
/* 72 */ 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 73 */ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 74 */ 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00,
/* 75 */ 0x00, 0x00, 0x63, 0x33, 0x1b, 0x0f, 0x07, 0x07, 0x0f, 0x1b, 0x33, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 76 */ 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 77 */ 0x00, 0x00, 0x63, 0x63, 0x77, 0x7f, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 78 */ 0x00, 0x00, 0x63, 0x63, 0x67, 0x6f, 0x6f, 0x7b, 0x7b, 0x73, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 79 */ 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 80 */ 0x00, 0x00, 0x3f, 0x63, 0x63, 0x63, 0x63, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
/* 81 */ 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x6f, 0x7b, 0x3e, 0x30, 0x60, 0x00, 0x00,
/* 82 */ 0x00, 0x00, 0x3f, 0x63, 0x63, 0x63, 0x63, 0x3f, 0x1b, 0x33, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 83 */ 0x00, 0x00, 0x3e, 0x63, 0x03, 0x03, 0x0e, 0x38, 0x60, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 84 */ 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 85 */ 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 86 */ 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x36, 0x36, 0x1c, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00,
/* 87 */ 0x00, 0x00, 0x63, 0x63, 0x6b, 0x6b, 0x6b, 0x6b, 0x7f, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00,
/* 88 */ 0x00, 0x00, 0x63, 0x63, 0x36, 0x36, 0x1c, 0x1c, 0x36, 0x36, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 89 */ 0x00, 0x00, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 90 */ 0x00, 0x00, 0x7f, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 91 */ 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 92 */ 0x00, 0x00, 0x03, 0x02, 0x06, 0x04, 0x0c, 0x08, 0x18, 0x10, 0x30, 0x20, 0x60, 0x00, 0x00, 0x00,
/* 93 */ 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 94 */ 0x00, 0x08, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 95 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
/* 96 */ 0x00, 0x00, 0x0c, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x60, 0x7e, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 98 */ 0x00, 0x00, 0x03, 0x03, 0x03, 0x3b, 0x67, 0x63, 0x63, 0x63, 0x67, 0x3b, 0x00, 0x00, 0x00, 0x00,
/* 99 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x03, 0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 100 */ 0x00, 0x00, 0x60, 0x60, 0x60, 0x6e, 0x73, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 101 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x63, 0x7f, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 102 */ 0x00, 0x00, 0x3c, 0x66, 0x06, 0x1f, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
/* 103 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x73, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x60, 0x63, 0x3e, 0x00,
/* 104 */ 0x00, 0x00, 0x03, 0x03, 0x03, 0x3b, 0x67, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 105 */ 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
/* 106 */ 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x00,
/* 107 */ 0x00, 0x00, 0x03, 0x03, 0x03, 0x63, 0x33, 0x1b, 0x0f, 0x1f, 0x33, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 108 */ 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
/* 109 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00,
/* 110 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x67, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 111 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x67, 0x63, 0x63, 0x63, 0x67, 0x3b, 0x03, 0x03, 0x03, 0x00,
/* 113 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x73, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x60, 0xe0, 0x60, 0x00,
/* 114 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x67, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
/* 115 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x0e, 0x38, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 116 */ 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x3e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
/* 117 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 118 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x36, 0x36, 0x1c, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00,
/* 119 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x3e, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00,
/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x36, 0x1c, 0x1c, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 121 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x36, 0x36, 0x1c, 0x1c, 0x0c, 0x0c, 0x06, 0x03, 0x00,
/* 122 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 123 */ 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00,
/* 124 */ 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
/* 125 */ 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00,
/* 126 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 127 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 129 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 130 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 131 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 132 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 133 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 134 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 135 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 137 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 138 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 139 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 140 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 141 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 142 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 143 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 145 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 146 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 147 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 148 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 149 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 150 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 151 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 153 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 154 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 155 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 156 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 157 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 158 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 159 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 161 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
/* 162 */ 0x00, 0x00, 0x00, 0x08, 0x08, 0x3e, 0x6b, 0x0b, 0x0b, 0x0b, 0x6b, 0x3e, 0x08, 0x08, 0x00, 0x00,
/* 163 */ 0x00, 0x00, 0x1c, 0x36, 0x06, 0x06, 0x1f, 0x06, 0x06, 0x07, 0x6f, 0x3b, 0x00, 0x00, 0x00, 0x00,
/* 164 */ 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 165 */ 0x00, 0x00, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 166 */ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 167 */ 0x00, 0x3c, 0x66, 0x0c, 0x1e, 0x33, 0x63, 0x66, 0x3c, 0x18, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00,
/* 168 */ 0x00, 0x00, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 169 */ 0x00, 0x00, 0x3c, 0x42, 0x99, 0xa5, 0x85, 0xa5, 0x99, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 170 */ 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x3b, 0x36, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 171 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x36, 0x1b, 0x1b, 0x36, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 172 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 173 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 174 */ 0x00, 0x00, 0x3c, 0x42, 0x9d, 0xa5, 0x9d, 0xa5, 0xa5, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 175 */ 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 176 */ 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 177 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 178 */ 0x00, 0x1e, 0x33, 0x18, 0x0c, 0x06, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 179 */ 0x00, 0x1e, 0x33, 0x18, 0x30, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 180 */ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 181 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x76, 0x6e, 0x06, 0x06, 0x03, 0x00,
/* 182 */ 0x00, 0x00, 0x7e, 0x2f, 0x2f, 0x2f, 0x2e, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00,
/* 183 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 184 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x1e, 0x00,
/* 185 */ 0x00, 0x0c, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 186 */ 0x00, 0x1e, 0x33, 0x33, 0x33, 0x33, 0x1e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 187 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x36, 0x6c, 0x6c, 0x36, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 188 */ 0x00, 0x10, 0x1c, 0x18, 0x18, 0x18, 0x00, 0x7f, 0x00, 0x18, 0x1c, 0x1a, 0x3e, 0x18, 0x00, 0x00,
/* 189 */ 0x00, 0x10, 0x1c, 0x18, 0x18, 0x18, 0x00, 0x7f, 0x00, 0x1c, 0x36, 0x18, 0x0c, 0x3e, 0x00, 0x00,
/* 190 */ 0x00, 0x1c, 0x36, 0x18, 0x36, 0x1c, 0x00, 0x7f, 0x00, 0x18, 0x1c, 0x1a, 0x3e, 0x18, 0x00, 0x00,
/* 191 */ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x63, 0x3e, 0x00, 0x00,
/* 192 */ 0x0c, 0x18, 0x3e, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 193 */ 0x18, 0x0c, 0x3e, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 194 */ 0x08, 0x14, 0x3e, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 195 */ 0x6e, 0x3b, 0x3e, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 196 */ 0x36, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 197 */ 0x1c, 0x36, 0x3e, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 198 */ 0x00, 0x00, 0xfe, 0x33, 0x33, 0x33, 0xff, 0x33, 0x33, 0x33, 0x33, 0xf3, 0x00, 0x00, 0x00, 0x00,
/* 199 */ 0x00, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x66, 0x3c, 0x18, 0x30, 0x1e, 0x00,
/* 200 */ 0x0c, 0x18, 0x7f, 0x03, 0x03, 0x03, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 201 */ 0x18, 0x0c, 0x7f, 0x03, 0x03, 0x03, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 202 */ 0x08, 0x14, 0x7f, 0x03, 0x03, 0x03, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 203 */ 0x36, 0x00, 0x7f, 0x03, 0x03, 0x03, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* 204 */ 0x0c, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 205 */ 0x30, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 206 */ 0x18, 0x24, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 207 */ 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 208 */ 0x00, 0x00, 0x1e, 0x36, 0x66, 0x66, 0x6f, 0x66, 0x66, 0x66, 0x36, 0x1e, 0x00, 0x00, 0x00, 0x00,
/* 209 */ 0x6e, 0x3b, 0x63, 0x63, 0x67, 0x6f, 0x6f, 0x7b, 0x7b, 0x73, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 210 */ 0x06, 0x0c, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 211 */ 0x30, 0x18, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 212 */ 0x08, 0x14, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 213 */ 0x6e, 0x3b, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 214 */ 0x36, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 215 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 216 */ 0x00, 0x20, 0x3e, 0x73, 0x73, 0x6b, 0x6b, 0x6b, 0x6b, 0x67, 0x67, 0x3e, 0x02, 0x00, 0x00, 0x00,
/* 217 */ 0x0c, 0x18, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 218 */ 0x18, 0x0c, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 219 */ 0x08, 0x14, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 220 */ 0x36, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 221 */ 0x30, 0x18, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
/* 222 */ 0x00, 0x00, 0x0f, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x00,
/* 223 */ 0x00, 0x00, 0x1e, 0x33, 0x33, 0x1b, 0x33, 0x63, 0x63, 0x63, 0x63, 0x3b, 0x00, 0x00, 0x00, 0x00,
/* 224 */ 0x00, 0x0c, 0x18, 0x30, 0x00, 0x3e, 0x60, 0x7e, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 225 */ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x3e, 0x60, 0x7e, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 226 */ 0x00, 0x08, 0x1c, 0x36, 0x00, 0x3e, 0x60, 0x7e, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 227 */ 0x00, 0x00, 0x6e, 0x3b, 0x00, 0x3e, 0x60, 0x7e, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 228 */ 0x00, 0x00, 0x36, 0x36, 0x00, 0x3e, 0x60, 0x7e, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 229 */ 0x00, 0x1c, 0x36, 0x1c, 0x00, 0x3e, 0x60, 0x7e, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 230 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xdb, 0xd8, 0xfe, 0x1b, 0xdb, 0x76, 0x00, 0x00, 0x00, 0x00,
/* 231 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x03, 0x03, 0x03, 0x63, 0x3e, 0x18, 0x30, 0x1e, 0x00,
/* 232 */ 0x00, 0x0c, 0x18, 0x30, 0x00, 0x3e, 0x63, 0x63, 0x7f, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 233 */ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x3e, 0x63, 0x63, 0x7f, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 234 */ 0x00, 0x08, 0x1c, 0x36, 0x00, 0x3e, 0x63, 0x63, 0x7f, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 235 */ 0x00, 0x00, 0x36, 0x36, 0x00, 0x3e, 0x63, 0x63, 0x7f, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 236 */ 0x00, 0x06, 0x0c, 0x18, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
/* 237 */ 0x00, 0x18, 0x0c, 0x06, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
/* 238 */ 0x00, 0x08, 0x1c, 0x36, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
/* 239 */ 0x00, 0x00, 0x36, 0x36, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
/* 240 */ 0x00, 0x00, 0x2c, 0x18, 0x34, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
/* 241 */ 0x00, 0x00, 0x6e, 0x3b, 0x00, 0x3b, 0x67, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
/* 242 */ 0x00, 0x06, 0x0c, 0x18, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 243 */ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 244 */ 0x00, 0x08, 0x1c, 0x36, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 245 */ 0x00, 0x00, 0x6e, 0x3b, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 246 */ 0x00, 0x00, 0x36, 0x36, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* 247 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 248 */ 0x00, 0x00, 0x00, 0x00, 0x20, 0x3e, 0x73, 0x6b, 0x6b, 0x6b, 0x67, 0x3e, 0x02, 0x00, 0x00, 0x00,
/* 249 */ 0x00, 0x06, 0x0c, 0x18, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 250 */ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 251 */ 0x00, 0x08, 0x1c, 0x36, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 252 */ 0x00, 0x00, 0x36, 0x36, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x73, 0x6e, 0x00, 0x00, 0x00, 0x00,
/* 253 */ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x63, 0x63, 0x36, 0x36, 0x1c, 0x1c, 0x0c, 0x0c, 0x06, 0x03, 0x00,
/* 254 */ 0x00, 0x00, 0x0f, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x0f, 0x00,
/* 255 */ 0x00, 0x00, 0x36, 0x36, 0x00, 0x63, 0x63, 0x36, 0x36, 0x1c, 0x1c, 0x0c, 0x0c, 0x06, 0x03, 0x00
};
#define ISO_CHAR_MIN 0x00
#define ISO_CHAR_MAX 0xFF
#define ISO_CHAR_WIDTH 8
#define ISO_CHAR_HEIGHT 16
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/console/msgbuf.h
================================================
/*
* Copyright (c) 2000-2010 Apple, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
/*
* Copyright (c) 1981, 1984, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)msgbuf.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _SYS_MSGBUF_H_
#define _SYS_MSGBUF_H_
#include
#define MAX_MSG_BSIZE (1*1024*1024)
struct msgbuf {
#define MSG_MAGIC 0x063061
int msg_magic;
int msg_size;
int msg_bufx; /* write pointer */
int msg_bufr; /* read pointer */
char *msg_bufc; /* buffer */
};
#ifdef XNU_KERNEL_PRIVATE
__BEGIN_DECLS
extern struct msgbuf *msgbufp;
extern struct msgbuf *aslbufp;
extern void log_putc(char);
extern void log_putc_locked(struct msgbuf *, char);
extern int log_setsize(int size);
extern int log_dmesg(user_addr_t, uint32_t, int32_t *);
__END_DECLS
#endif /* XNU_KERNEL_PRIVATE */
#endif /* !_SYS_MSGBUF_H_ */
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/console/serial_protos.h
================================================
/*
* Copyright (c) 2005-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* @APPLE_FREE_COPYRIGHT@
*/
#ifndef _CONSOLE_SERIAL_PROTOS_H_
#define _CONSOLE_SERIAL_PROTOS_H_
#ifdef __cplusplus
extern "C" {
#endif
void serial_keyboard_init(void);
void serial_keyboard_start(void) __dead2;
void serial_keyboard_poll(void) __dead2;
extern uint32_t serialmode;
#define SERIALMODE_OUTPUT 0x1
#define SERIALMODE_INPUT 0x2
#define SERIALMODE_SYNCDRAIN 0x4
#define SERIALMODE_BASE_TTY 0x8 /* Load Base/Recovery/FVUnlock TTY */
extern uint32_t cons_ops_index;
extern const uint32_t nconsops;
extern unsigned int disable_serial_output;
#if defined(__arm__) || defined(__arm64__)
/* ARM64_TODO */
extern void *console_cpu_alloc(boolean_t);
extern void console_cpu_free(void *);
void console_init(void);
#endif
int _serial_getc(int unit, int line, boolean_t wait, boolean_t raw);
struct console_ops {
void (*putc)(int, int, int);
int (*getc)(int, int, boolean_t, boolean_t);
};
boolean_t console_is_serial(void);
int switch_to_serial_console(void);
int switch_to_video_console(void);
void switch_to_old_console(int old_console);
#define SERIAL_CONS_OPS 0
#define VC_CONS_OPS 1
#ifdef XNU_KERNEL_PRIVATE
#define SERIAL_CONS_BUF_SIZE 256
struct console_printbuf_state {
int pos;
int total;
int flags;
#define CONS_PB_WRITE_NEWLINE 0x1
#define CONS_PB_CANBLOCK 0x2
char str[SERIAL_CONS_BUF_SIZE];
};
extern int console_printbuf_drain_initialized;
void console_printbuf_state_init(struct console_printbuf_state * data, int write_on_newline, int can_block);
void console_printbuf_putc(int ch, void *arg);
void console_printbuf_clear(struct console_printbuf_state * info);
int console_write_try(char * str, int size);
#endif /* XNU_KERNEL_PRIVATE */
#ifdef __cplusplus
}
#endif
#endif /* _CONSOLE_SERIAL_PROTOS_H_ */
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/console/video_console.c
================================================
/*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_FREE_COPYRIGHT@
*
*/
/*
* @APPLE_FREE_COPYRIGHT@
*/
/*
* NetBSD: ite.c,v 1.16 1995/07/17 01:24:34 briggs Exp
*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Utah $Hdr: ite.c 1.28 92/12/20$
*
* @(#)ite.c 8.2 (Berkeley) 1/12/94
*/
/*
* ite.c
*
* The ite module handles the system console; that is, stuff printed
* by the kernel and by user programs while "desktop" and X aren't
* running. Some (very small) parts are based on hp300's 4.4 ite.c,
* hence the above copyright.
*
* -- Brad and Lawrence, June 26th, 1994
*
*/
#include "video_console.h"
#include "video_scroll.c"
#include "serial_protos.h"
//#include
//#include
//#include
//#include
//#include
//#include
//#include
//#include
//#include
//#include
//#include
#include
#include
#include
#include
#include
#include "iso_font.c"
#if defined(XNU_TARGET_OS_OSX)
#include "progress_meter_data.c"
#endif
#include "msgbuf.h"
#define kPEGraphicsMode 1
#define kPETextMode 2
#define kPETextScreen 3
#define kPEAcquireScreen 4
#define kPEReleaseScreen 5
#define kPEEnableScreen 6
#define kPEDisableScreen 7
#define kPEBaseAddressChange 8
#define kPERefreshBootGraphics 9
#if __has_attribute(fallthrough)
#define OS_FALLTHROUGH __attribute__((__fallthrough__))
#else
#define OS_FALLTHROUGH
#endif
#define NEVER 0
#define ALWAYS 1
#define MACRO_BEGIN do {
#define MACRO_END } while (NEVER)
#define console_is_serial() 0
int switch_to_serial_console() {return 0;}
#define KHEAP_DATA_BUFFERS 0
#define Z_WAITOK
#define kheap_alloc(a, b, c) malloc(b)
#define kheap_free(a, b, c) free(b)
#define LCK_GRP_NULL 0
#define decl_simple_lock_data(a, b)
#define simple_lock_init(a, b)
#define simple_lock(a, b)
#define simple_unlock(a)
typedef unsigned spl_t;
#define splhigh() (spl_t) 0
#define splx(x)
struct thread_call {};
typedef struct thread_call thread_call_data_t;
#define thread_call_setup(a, b, c)
#define thread_call_enter_delayed(a, b) // TODO: implement for the progress bar
#define thread_call_cancel(a)
#define os_add_overflow __builtin_add_overflow
// FIXME correct value?
#define rtclock_sec_divisor 10
enum {
kPEScaleFactorUnknown = 0,
kPEScaleFactor1x = 1,
kPEScaleFactor2x = 2,
};
struct PE_Video {
unsigned long v_baseAddr; /* Base address of video memory */
unsigned long v_rowBytes; /* Number of bytes per pixel row */
unsigned long v_width; /* Width */
unsigned long v_height; /* Height */
unsigned long v_depth; /* Pixel Depth */
unsigned long v_display; /* Text or Graphics */
char v_pixelFormat[64];
unsigned long v_offset; /* offset into video memory to start at */
unsigned long v_length; /* length of video memory (0 for v_rowBytes * v_height) */
unsigned char v_rotate; /* Rotation: 0:normal, 1:right 90, 2:left 180, 3:left 90 */
unsigned char v_scale; /* Scale Factor for both X & Y */
char reserved1[2];
#ifdef __LP64__
long reserved2;
#else
long v_baseAddrHigh;
#endif
};
typedef struct PE_Video PE_Video;
void
clock_deadline_for_periodic_event(
uint64_t interval,
uint64_t abstime,
uint64_t *deadline)
{
assert(interval != 0);
// *deadline += interval;
if (os_add_overflow(*deadline, interval, deadline)) {
*deadline = UINT64_MAX;
}
if (*deadline <= abstime) {
// *deadline = abstime + interval;
if (os_add_overflow(abstime, interval, deadline)) {
*deadline = UINT64_MAX;
}
abstime = mach_absolute_time();
if (*deadline <= abstime) {
// *deadline = abstime + interval;
if (os_add_overflow(abstime, interval, deadline)) {
*deadline = UINT64_MAX;
}
}
}
}
void
clock_interval_to_absolutetime_interval(uint32_t interval,
uint32_t scale_factor,
uint64_t * result)
{
uint64_t nanosecs = (uint64_t) interval * scale_factor;
uint64_t t64;
*result = (t64 = nanosecs / NSEC_PER_SEC) * rtclock_sec_divisor;
nanosecs -= (t64 * NSEC_PER_SEC);
*result += (nanosecs * rtclock_sec_divisor) / NSEC_PER_SEC;
}
void
clock_interval_to_deadline(
uint32_t interval,
uint32_t scale_factor,
uint64_t *result)
{
uint64_t abstime;
clock_interval_to_absolutetime_interval(interval, scale_factor, &abstime);
if (os_add_overflow(mach_absolute_time(), abstime, result)) {
*result = UINT64_MAX;
}
}
/*
* Generic Console (Front-End)
* ---------------------------
*/
struct vc_info vinfo;
void noroot_icon_test(void);
//extern
int disableConsoleOutput;
static boolean_t gc_enabled = FALSE;
static boolean_t gc_initialized = FALSE;
static boolean_t vm_initialized = FALSE;
static struct {
void (*initialize)(struct vc_info * info);
void (*enable)(boolean_t enable);
void (*paint_char)(unsigned int xx, unsigned int yy, unsigned char ch,
int attrs, unsigned char ch_previous,
int attrs_previous);
void (*clear_screen)(unsigned int xx, unsigned int yy, unsigned int top,
unsigned int bottom, int which);
void (*scroll_down)(int num, unsigned int top, unsigned int bottom);
void (*scroll_up)(int num, unsigned int top, unsigned int bottom);
void (*hide_cursor)(unsigned int xx, unsigned int yy);
void (*show_cursor)(unsigned int xx, unsigned int yy);
void (*update_color)(int color, boolean_t fore);
} gc_ops;
static unsigned char *gc_buffer_attributes;
static unsigned char *gc_buffer_characters;
static unsigned char *gc_buffer_colorcodes;
static unsigned char *gc_buffer_tab_stops;
static uint32_t gc_buffer_columns;
static uint32_t gc_buffer_rows;
static uint32_t gc_buffer_size;
//LCK_GRP_DECLARE(vconsole_lck_grp, "vconsole");
//static lck_ticket_t vcputc_lock;
#define VCPUTC_LOCK_INIT() \
MACRO_BEGIN \
/* lck_ticket_init(&vcputc_lock, &vconsole_lck_grp); */ \
MACRO_END
#define VCPUTC_LOCK_LOCK() \
MACRO_BEGIN \
/* lck_ticket_lock(&vcputc_lock, &vconsole_lck_grp); */ \
MACRO_END
#define VCPUTC_LOCK_UNLOCK() \
MACRO_BEGIN \
/* lck_ticket_unlock(&vcputc_lock); */ \
MACRO_END
/*
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
*/
#define ATTR_NONE 0
#define ATTR_BOLD 1
#define ATTR_UNDER 2
#define ATTR_REVERSE 4
#define COLOR_BACKGROUND 0
#define COLOR_FOREGROUND 7
#define COLOR_CODE_GET(code, fore) (((code) & ((fore) ? 0xF0 : 0x0F)) >> ((fore) ? 4 : 0))
#define COLOR_CODE_SET(code, color, fore) (((code) & ((fore) ? 0x0F : 0xF0)) | ((color) << ((fore) ? 4 : 0)))
static unsigned char gc_color_code;
/* VT100 state: */
#define MAXPARS 16
static unsigned int gc_x, gc_y, gc_savex, gc_savey;
static unsigned int gc_par[MAXPARS], gc_numpars, gc_hanging_cursor, gc_attr, gc_saveattr;
/* VT100 scroll region */
static unsigned int gc_scrreg_top, gc_scrreg_bottom;
enum vt100state_e {
ESnormal, /* Nothing yet */
ESesc, /* Got ESC */
ESsquare, /* Got ESC [ */
ESgetpars, /* About to get or getting the parameters */
ESgotpars, /* Finished getting the parameters */
ESfunckey, /* Function key */
EShash, /* DEC-specific stuff (screen align, etc.) */
ESsetG0, /* Specify the G0 character set */
ESsetG1, /* Specify the G1 character set */
ESask,
EScharsize,
ESignore /* Ignore this sequence */
} gc_vt100state = ESnormal;
enum{
/* secs */
kProgressAcquireDelay = 0,
#if !defined(XNU_TARGET_OS_OSX)
kProgressReacquireDelay = 5,
#else
kProgressReacquireDelay = 5,
#endif
};
static int8_t vc_rotate_matr[4][2][2] = {
{ { 1, 0 },
{ 0, 1 } },
{ { 0, 1 },
{ -1, 0 } },
{ { -1, 0 },
{ 0, -1 } },
{ { 0, -1 },
{ 1, 0 } }
};
static int gc_wrap_mode = 1, gc_relative_origin = 0;
static int gc_charset_select = 0, gc_save_charset_s = 0;
static int gc_charset[2] = { 0, 0 };
static int gc_charset_save[2] = { 0, 0 };
static void gc_clear_line(unsigned int xx, unsigned int yy, int which);
static void gc_clear_screen(unsigned int xx, unsigned int yy, int top,
unsigned int bottom, int which);
static void gc_enable(boolean_t enable);
static void gc_hide_cursor(unsigned int xx, unsigned int yy);
static void gc_initialize(struct vc_info * info);
static boolean_t gc_is_tab_stop(unsigned int column);
static void gc_paint_char(unsigned int xx, unsigned int yy, unsigned char ch,
int attrs);
static void gc_putchar(char ch);
static void gc_putc_askcmd(unsigned char ch);
static void gc_putc_charsetcmd(int charset, unsigned char ch);
static void gc_putc_charsizecmd(unsigned char ch);
static void gc_putc_esc(unsigned char ch);
static void gc_putc_getpars(unsigned char ch);
static void gc_putc_gotpars(unsigned char ch);
static void gc_putc_normal(unsigned char ch);
static void gc_putc_square(unsigned char ch);
static void gc_reset_screen(void);
static void gc_reset_tabs(void);
static void gc_reset_vt100(void);
static void gc_scroll_down(int num, unsigned int top, unsigned int bottom);
static void gc_scroll_up(int num, unsigned int top, unsigned int bottom);
static void gc_set_tab_stop(unsigned int column, boolean_t enabled);
static void gc_show_cursor(unsigned int xx, unsigned int yy);
static void gc_update_color(int color, boolean_t fore);
static void
gc_clear_line(unsigned int xx, unsigned int yy, int which)
{
unsigned int start, end, i;
/*
* This routine runs extremely slowly. I don't think it's
* used all that often, except for To end of line. I'll go
* back and speed this up when I speed up the whole vc
* module. --LK
*/
switch (which) {
case 0: /* To end of line */
start = xx;
end = vinfo.v_columns - 1;
break;
case 1: /* To start of line */
start = 0;
end = xx;
break;
case 2: /* Whole line */
start = 0;
end = vinfo.v_columns - 1;
break;
default:
return;
}
for (i = start; i <= end; i++) {
gc_paint_char(i, yy, ' ', ATTR_NONE);
}
}
static void
gc_clear_screen(unsigned int xx, unsigned int yy, int top, unsigned int bottom,
int which)
{
if (!gc_buffer_size) {
return;
}
if (xx < gc_buffer_columns && yy < gc_buffer_rows && bottom <= gc_buffer_rows) {
uint32_t start, end;
switch (which) {
case 0: /* To end of screen */
start = (yy * gc_buffer_columns) + xx;
end = (bottom * gc_buffer_columns) - 1;
break;
case 1: /* To start of screen */
start = (top * gc_buffer_columns);
end = (yy * gc_buffer_columns) + xx;
break;
case 2: /* Whole screen */
start = (top * gc_buffer_columns);
end = (bottom * gc_buffer_columns) - 1;
break;
default:
start = 0;
end = 0;
break;
}
memset(gc_buffer_attributes + start, ATTR_NONE, end - start + 1);
memset(gc_buffer_characters + start, ' ', end - start + 1);
memset(gc_buffer_colorcodes + start, gc_color_code, end - start + 1);
}
gc_ops.clear_screen(xx, yy, top, bottom, which);
}
static void
// FIXME: This always segfaults
gc_enable( boolean_t enable )
{
unsigned char *buffer_attributes = NULL;
unsigned char *buffer_characters = NULL;
unsigned char *buffer_colorcodes = NULL;
unsigned char *buffer_tab_stops = NULL;
uint32_t buffer_columns = 0;
uint32_t buffer_rows = 0;
uint32_t buffer_size = 0;
spl_t s;
if (enable == FALSE) {
printf("[*] gc_enable(FALSE)\n");
// only disable console output if it goes to the graphics console
if (console_is_serial() == FALSE) {
disableConsoleOutput = TRUE;
}
gc_enabled = FALSE;
gc_ops.enable(FALSE);
}
s = splhigh();
printf("[*] VCPUTC_LOCK_LOCK\n");
VCPUTC_LOCK_LOCK();
if (gc_buffer_size) {
buffer_attributes = gc_buffer_attributes;
buffer_characters = gc_buffer_characters;
buffer_colorcodes = gc_buffer_colorcodes;
buffer_tab_stops = gc_buffer_tab_stops;
buffer_columns = gc_buffer_columns;
buffer_rows = gc_buffer_rows;
buffer_size = gc_buffer_size;
gc_buffer_attributes = NULL;
gc_buffer_characters = NULL;
gc_buffer_colorcodes = NULL;
gc_buffer_tab_stops = NULL;
gc_buffer_columns = 0;
gc_buffer_rows = 0;
gc_buffer_size = 0;
printf("[*] VCPUTC_LOCK_UNLOCK\n");
VCPUTC_LOCK_UNLOCK();
splx( s );
kheap_free( KHEAP_DATA_BUFFERS, buffer_attributes, buffer_size );
kheap_free( KHEAP_DATA_BUFFERS, buffer_characters, buffer_size );
kheap_free( KHEAP_DATA_BUFFERS, buffer_colorcodes, buffer_size );
kheap_free( KHEAP_DATA_BUFFERS, buffer_tab_stops, buffer_columns );
} else {
printf("[*] VCPUTC_LOCK_UNLOCK\n");
VCPUTC_LOCK_UNLOCK();
splx( s );
}
if (enable) {
printf("[*] gc_enable(TRUE)\n");
if (vm_initialized) {
printf("[*] buffer setup\n");
buffer_columns = vinfo.v_columns;
buffer_rows = vinfo.v_rows;
buffer_size = buffer_columns * buffer_rows;
if (buffer_size) {
printf("[*] moar buffer setup\n");
buffer_attributes = kheap_alloc( KHEAP_DATA_BUFFERS, buffer_size, Z_WAITOK );
buffer_characters = kheap_alloc( KHEAP_DATA_BUFFERS, buffer_size, Z_WAITOK );
buffer_colorcodes = kheap_alloc( KHEAP_DATA_BUFFERS, buffer_size, Z_WAITOK );
buffer_tab_stops = kheap_alloc( KHEAP_DATA_BUFFERS, buffer_columns, Z_WAITOK );
if (buffer_attributes == NULL ||
buffer_characters == NULL ||
buffer_colorcodes == NULL ||
buffer_tab_stops == NULL) {
printf("[*] even moar buffer setup\n");
if (buffer_attributes) {
kheap_free( KHEAP_DATA_BUFFERS, buffer_attributes, buffer_size );
}
if (buffer_characters) {
kheap_free( KHEAP_DATA_BUFFERS, buffer_characters, buffer_size );
}
if (buffer_colorcodes) {
kheap_free( KHEAP_DATA_BUFFERS, buffer_colorcodes, buffer_size );
}
if (buffer_tab_stops) {
kheap_free( KHEAP_DATA_BUFFERS, buffer_tab_stops, buffer_columns );
}
buffer_attributes = NULL;
buffer_characters = NULL;
buffer_colorcodes = NULL;
buffer_tab_stops = NULL;
buffer_columns = 0;
buffer_rows = 0;
buffer_size = 0;
} else {
memset( buffer_attributes, ATTR_NONE, buffer_size );
memset( buffer_characters, ' ', buffer_size );
memset( buffer_colorcodes, COLOR_CODE_SET( 0, COLOR_FOREGROUND, TRUE ), buffer_size );
memset( buffer_tab_stops, 0, buffer_columns );
}
}
}
s = splhigh();
printf("[*] VCPUTC_LOCK_LOCK\n");
VCPUTC_LOCK_LOCK();
gc_buffer_attributes = buffer_attributes;
gc_buffer_characters = buffer_characters;
gc_buffer_colorcodes = buffer_colorcodes;
gc_buffer_tab_stops = buffer_tab_stops;
gc_buffer_columns = buffer_columns;
gc_buffer_rows = buffer_rows;
gc_buffer_size = buffer_size;
printf("[*] resetting screen\n");
gc_reset_screen();
printf("[*] VCPUTC_LOCK_UNLOCK\n");
VCPUTC_LOCK_UNLOCK();
splx( s );
printf("[*] clearing screen\n");
gc_ops.clear_screen(gc_x, gc_y, 0, vinfo.v_rows, 2);
printf("[*] showing cursor at %d,%d\n", gc_x, gc_y);
gc_ops.show_cursor(gc_x, gc_y);
printf("[*] gc enable\n");
gc_ops.enable(TRUE);
gc_enabled = TRUE;
disableConsoleOutput = FALSE;
printf("[*] gc_enable over and out.\n");
}
}
static void
gc_hide_cursor(unsigned int xx, unsigned int yy)
{
if (xx < gc_buffer_columns && yy < gc_buffer_rows) {
uint32_t index = (yy * gc_buffer_columns) + xx;
unsigned char attribute = gc_buffer_attributes[index];
unsigned char character = gc_buffer_characters[index];
unsigned char colorcode = gc_buffer_colorcodes[index];
unsigned char colorcodesave = gc_color_code;
gc_update_color(COLOR_CODE_GET(colorcode, TRUE ), TRUE );
gc_update_color(COLOR_CODE_GET(colorcode, FALSE), FALSE);
gc_ops.paint_char(xx, yy, character, attribute, 0, 0);
gc_update_color(COLOR_CODE_GET(colorcodesave, TRUE ), TRUE );
gc_update_color(COLOR_CODE_GET(colorcodesave, FALSE), FALSE);
} else {
gc_ops.hide_cursor(xx, yy);
}
}
static void
gc_initialize(struct vc_info * info)
{
if (gc_initialized == FALSE) {
/* Init our lock */
VCPUTC_LOCK_INIT();
gc_initialized = TRUE;
}
gc_ops.initialize(info);
gc_reset_vt100();
gc_x = gc_y = 0;
}
static void
gc_paint_char(unsigned int xx, unsigned int yy, unsigned char ch, int attrs)
{
if (xx < gc_buffer_columns && yy < gc_buffer_rows) {
uint32_t index = (yy * gc_buffer_columns) + xx;
gc_buffer_attributes[index] = attrs;
gc_buffer_characters[index] = ch;
gc_buffer_colorcodes[index] = gc_color_code;
}
gc_ops.paint_char(xx, yy, ch, attrs, 0, 0);
}
static void
gc_putchar(char ch)
{
if (!ch) {
return; /* ignore null characters */
}
switch (gc_vt100state) {
default:
gc_vt100state = ESnormal;
OS_FALLTHROUGH;
case ESnormal:
gc_putc_normal(ch);
break;
case ESesc:
gc_putc_esc(ch);
break;
case ESsquare:
gc_putc_square(ch);
break;
case ESgetpars:
gc_putc_getpars(ch);
break;
case ESgotpars:
gc_putc_gotpars(ch);
break;
case ESask:
gc_putc_askcmd(ch);
break;
case EScharsize:
gc_putc_charsizecmd(ch);
break;
case ESsetG0:
gc_putc_charsetcmd(0, ch);
break;
case ESsetG1:
gc_putc_charsetcmd(1, ch);
break;
}
if (gc_x >= vinfo.v_columns) {
if (0 == vinfo.v_columns) {
gc_x = 0;
} else {
gc_x = vinfo.v_columns - 1;
}
}
if (gc_y >= vinfo.v_rows) {
if (0 == vinfo.v_rows) {
gc_y = 0;
} else {
gc_y = vinfo.v_rows - 1;
}
}
}
static void
gc_putc_askcmd(unsigned char ch)
{
if (ch >= '0' && ch <= '9') {
gc_par[gc_numpars] = (10 * gc_par[gc_numpars]) + (ch - '0');
return;
}
gc_vt100state = ESnormal;
switch (gc_par[0]) {
case 6:
gc_relative_origin = ch == 'h';
break;
case 7: /* wrap around mode h=1, l=0*/
gc_wrap_mode = ch == 'h';
break;
default:
break;
}
}
static void
gc_putc_charsetcmd(int charset, unsigned char ch)
{
gc_vt100state = ESnormal;
switch (ch) {
case 'A':
case 'B':
default:
gc_charset[charset] = 0;
break;
case '0': /* Graphic characters */
case '2':
gc_charset[charset] = 0x21;
break;
}
}
static void
gc_putc_charsizecmd(unsigned char ch)
{
gc_vt100state = ESnormal;
switch (ch) {
case '3':
case '4':
case '5':
case '6':
break;
case '8': /* fill 'E's */
{
unsigned int xx, yy;
for (yy = 0; yy < vinfo.v_rows; yy++) {
for (xx = 0; xx < vinfo.v_columns; xx++) {
gc_paint_char(xx, yy, 'E', ATTR_NONE);
}
}
}
break;
}
}
static void
gc_putc_esc(unsigned char ch)
{
gc_vt100state = ESnormal;
switch (ch) {
case '[':
gc_vt100state = ESsquare;
break;
case 'c': /* Reset terminal */
gc_reset_vt100();
gc_clear_screen(gc_x, gc_y, 0, vinfo.v_rows, 2);
gc_x = gc_y = 0;
break;
case 'D': /* Line feed */
case 'E':
if (gc_y >= gc_scrreg_bottom - 1) {
gc_scroll_up(1, gc_scrreg_top, gc_scrreg_bottom);
gc_y = gc_scrreg_bottom - 1;
} else {
gc_y++;
}
if (ch == 'E') {
gc_x = 0;
}
break;
case 'H': /* Set tab stop */
gc_set_tab_stop(gc_x, TRUE);
break;
case 'M': /* Cursor up */
if (gc_y <= gc_scrreg_top) {
gc_scroll_down(1, gc_scrreg_top, gc_scrreg_bottom);
gc_y = gc_scrreg_top;
} else {
gc_y--;
}
break;
case '>':
gc_reset_vt100();
break;
case '7': /* Save cursor */
gc_savex = gc_x;
gc_savey = gc_y;
gc_saveattr = gc_attr;
gc_save_charset_s = gc_charset_select;
gc_charset_save[0] = gc_charset[0];
gc_charset_save[1] = gc_charset[1];
break;
case '8': /* Restore cursor */
gc_x = gc_savex;
gc_y = gc_savey;
gc_attr = gc_saveattr;
gc_charset_select = gc_save_charset_s;
gc_charset[0] = gc_charset_save[0];
gc_charset[1] = gc_charset_save[1];
break;
case 'Z': /* return terminal ID */
break;
case '#': /* change characters height */
gc_vt100state = EScharsize;
break;
case '(':
gc_vt100state = ESsetG0;
break;
case ')': /* character set sequence */
gc_vt100state = ESsetG1;
break;
case '=':
break;
default:
/* Rest not supported */
break;
}
}
static void
gc_putc_getpars(unsigned char ch)
{
if (ch == '?') {
gc_vt100state = ESask;
return;
}
if (ch == '[') {
gc_vt100state = ESnormal;
/* Not supported */
return;
}
if (ch == ';' && gc_numpars < MAXPARS - 1) {
gc_numpars++;
} else if (ch >= '0' && ch <= '9') {
gc_par[gc_numpars] *= 10;
gc_par[gc_numpars] += ch - '0';
} else {
gc_numpars++;
gc_vt100state = ESgotpars;
gc_putc_gotpars(ch);
}
}
static void
gc_putc_gotpars(unsigned char ch)
{
unsigned int i;
if (ch < ' ') {
/* special case for vttest for handling cursor
* movement in escape sequences */
gc_putc_normal(ch);
gc_vt100state = ESgotpars;
return;
}
gc_vt100state = ESnormal;
switch (ch) {
case 'A': /* Up */
gc_y -= gc_par[0] ? gc_par[0] : 1;
if (gc_y < gc_scrreg_top) {
gc_y = gc_scrreg_top;
}
break;
case 'B': /* Down */
gc_y += gc_par[0] ? gc_par[0] : 1;
if (gc_y >= gc_scrreg_bottom) {
gc_y = gc_scrreg_bottom - 1;
}
break;
case 'C': /* Right */
gc_x += gc_par[0] ? gc_par[0] : 1;
if (gc_x >= vinfo.v_columns) {
gc_x = vinfo.v_columns - 1;
}
break;
case 'D': /* Left */
if (gc_par[0] > gc_x) {
gc_x = 0;
} else if (gc_par[0]) {
gc_x -= gc_par[0];
} else if (gc_x) {
--gc_x;
}
break;
case 'H': /* Set cursor position */
case 'f':
gc_x = gc_par[1] ? gc_par[1] - 1 : 0;
gc_y = gc_par[0] ? gc_par[0] - 1 : 0;
if (gc_relative_origin) {
gc_y += gc_scrreg_top;
}
gc_hanging_cursor = 0;
break;
case 'X': /* clear p1 characters */
if (gc_numpars) {
for (i = gc_x; i < gc_x + gc_par[0]; i++) {
gc_paint_char(i, gc_y, ' ', ATTR_NONE);
}
}
break;
case 'J': /* Clear part of screen */
gc_clear_screen(gc_x, gc_y, 0, vinfo.v_rows, gc_par[0]);
break;
case 'K': /* Clear part of line */
gc_clear_line(gc_x, gc_y, gc_par[0]);
break;
case 'g': /* tab stops */
switch (gc_par[0]) {
case 1:
case 2: /* reset tab stops */
/* gc_reset_tabs(); */
break;
case 3: /* Clear every tabs */
{
for (i = 0; i <= vinfo.v_columns; i++) {
gc_set_tab_stop(i, FALSE);
}
}
break;
case 0:
gc_set_tab_stop(gc_x, FALSE);
break;
}
break;
case 'm': /* Set attribute */
for (i = 0; i < gc_numpars; i++) {
switch (gc_par[i]) {
case 0:
gc_attr = ATTR_NONE;
gc_update_color(COLOR_BACKGROUND, FALSE);
gc_update_color(COLOR_FOREGROUND, TRUE );
break;
case 1:
gc_attr |= ATTR_BOLD;
break;
case 4:
gc_attr |= ATTR_UNDER;
break;
case 7:
gc_attr |= ATTR_REVERSE;
break;
case 22:
gc_attr &= ~ATTR_BOLD;
break;
case 24:
gc_attr &= ~ATTR_UNDER;
break;
case 27:
gc_attr &= ~ATTR_REVERSE;
break;
case 5:
case 25: /* blink/no blink */
break;
default:
if (gc_par[i] >= 30 && gc_par[i] <= 37) {
gc_update_color(gc_par[i] - 30, TRUE);
}
if (gc_par[i] >= 40 && gc_par[i] <= 47) {
gc_update_color(gc_par[i] - 40, FALSE);
}
break;
}
}
break;
case 'r': /* Set scroll region */
gc_x = gc_y = 0;
/* ensure top < bottom, and both within limits */
if ((gc_numpars > 0) && (gc_par[0] < vinfo.v_rows)) {
gc_scrreg_top = gc_par[0] ? gc_par[0] - 1 : 0;
} else {
gc_scrreg_top = 0;
}
if ((gc_numpars > 1) && (gc_par[1] <= vinfo.v_rows) && (gc_par[1] > gc_par[0])) {
gc_scrreg_bottom = gc_par[1];
if (gc_scrreg_bottom > vinfo.v_rows) {
gc_scrreg_bottom = vinfo.v_rows;
}
} else {
gc_scrreg_bottom = vinfo.v_rows;
}
if (gc_relative_origin) {
gc_y = gc_scrreg_top;
}
break;
}
}
static void
gc_putc_normal(unsigned char ch)
{
switch (ch) {
case '\a': /* Beep */
break;
case 127: /* Delete */
case '\b': /* Backspace */
if (gc_hanging_cursor) {
gc_hanging_cursor = 0;
} else if (gc_x > 0) {
gc_x--;
}
break;
case '\t': /* Tab */
if (gc_buffer_tab_stops) {
while (gc_x < vinfo.v_columns && !gc_is_tab_stop(++gc_x)) {
;
}
}
if (gc_x >= vinfo.v_columns) {
gc_x = vinfo.v_columns - 1;
}
break;
case 0x0b:
case 0x0c:
case '\n': /* Line feed */
if (gc_y >= gc_scrreg_bottom - 1) {
gc_scroll_up(1, gc_scrreg_top, gc_scrreg_bottom);
gc_y = gc_scrreg_bottom - 1;
} else {
gc_y++;
}
break;
case '\r': /* Carriage return */
gc_x = 0;
gc_hanging_cursor = 0;
break;
case 0x0e: /* Select G1 charset (Control-N) */
gc_charset_select = 1;
break;
case 0x0f: /* Select G0 charset (Control-O) */
gc_charset_select = 0;
break;
case 0x18: /* CAN : cancel */
case 0x1A: /* like cancel */
/* well, i do nothing here, may be later */
break;
case '\033': /* Escape */
gc_vt100state = ESesc;
gc_hanging_cursor = 0;
break;
default:
if (ch >= ' ') {
if (gc_hanging_cursor) {
gc_x = 0;
if (gc_y >= gc_scrreg_bottom - 1) {
gc_scroll_up(1, gc_scrreg_top, gc_scrreg_bottom);
gc_y = gc_scrreg_bottom - 1;
} else {
gc_y++;
}
gc_hanging_cursor = 0;
}
gc_paint_char(gc_x, gc_y, (ch >= 0x60 && ch <= 0x7f) ? ch + gc_charset[gc_charset_select]
: ch, gc_attr);
if (gc_x == vinfo.v_columns - 1) {
gc_hanging_cursor = gc_wrap_mode;
} else {
gc_x++;
}
}
break;
}
}
static void
gc_putc_square(unsigned char ch)
{
int i;
for (i = 0; i < MAXPARS; i++) {
gc_par[i] = 0;
}
gc_numpars = 0;
gc_vt100state = ESgetpars;
gc_putc_getpars(ch);
}
static void
gc_reset_screen(void)
{
printf("[*] gc_reset_screen\n");
gc_reset_vt100();
gc_x = gc_y = 0;
printf("[√] screen reset\n");
}
static void
gc_reset_tabs(void)
{
unsigned int i;
if (!gc_buffer_tab_stops) {
return;
}
for (i = 0; i < vinfo.v_columns; i++) {
gc_buffer_tab_stops[i] = ((i % 8) == 0);
}
}
static void
gc_set_tab_stop(unsigned int column, boolean_t enabled)
{
if (gc_buffer_tab_stops && (column < vinfo.v_columns)) {
gc_buffer_tab_stops[column] = enabled;
}
}
static boolean_t
gc_is_tab_stop(unsigned int column)
{
if (gc_buffer_tab_stops == NULL) {
return (column % 8) == 0;
}
if (column < vinfo.v_columns) {
return gc_buffer_tab_stops[column];
} else {
return FALSE;
}
}
static void
gc_reset_vt100(void)
{
gc_reset_tabs();
gc_scrreg_top = 0;
gc_scrreg_bottom = vinfo.v_rows;
gc_attr = ATTR_NONE;
gc_charset[0] = gc_charset[1] = 0;
gc_charset_select = 0;
gc_wrap_mode = 1;
gc_relative_origin = 0;
gc_update_color(COLOR_BACKGROUND, FALSE);
gc_update_color(COLOR_FOREGROUND, TRUE);
}
static void
gc_scroll_down(int num, unsigned int top, unsigned int bottom)
{
if (!gc_buffer_size) {
return;
}
if (bottom <= gc_buffer_rows) {
unsigned char colorcodesave = gc_color_code;
uint32_t column, row;
uint32_t index, jump;
jump = num * gc_buffer_columns;
for (row = bottom - 1; row >= top + num; row--) {
index = row * gc_buffer_columns;
for (column = 0; column < gc_buffer_columns; index++, column++) {
if (gc_buffer_attributes[index] != gc_buffer_attributes[index - jump] ||
gc_buffer_characters[index] != gc_buffer_characters[index - jump] ||
gc_buffer_colorcodes[index] != gc_buffer_colorcodes[index - jump]) {
if (gc_color_code != gc_buffer_colorcodes[index - jump]) {
gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes[index - jump], TRUE ), TRUE );
gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes[index - jump], FALSE), FALSE);
}
if (gc_buffer_colorcodes[index] != gc_buffer_colorcodes[index - jump]) {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ gc_buffer_characters[index - jump],
/* attrs */ gc_buffer_attributes[index - jump],
/* ch_previous */ 0,
/* attrs_previous */ 0 );
} else {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ gc_buffer_characters[index - jump],
/* attrs */ gc_buffer_attributes[index - jump],
/* ch_previous */ gc_buffer_characters[index],
/* attrs_previous */ gc_buffer_attributes[index] );
}
gc_buffer_attributes[index] = gc_buffer_attributes[index - jump];
gc_buffer_characters[index] = gc_buffer_characters[index - jump];
gc_buffer_colorcodes[index] = gc_buffer_colorcodes[index - jump];
}
}
}
if (colorcodesave != gc_color_code) {
gc_update_color(COLOR_CODE_GET(colorcodesave, TRUE ), TRUE );
gc_update_color(COLOR_CODE_GET(colorcodesave, FALSE), FALSE);
}
/* Now set the freed up lines to the background colour */
for (row = top; row < top + num; row++) {
index = row * gc_buffer_columns;
for (column = 0; column < gc_buffer_columns; index++, column++) {
if (gc_buffer_attributes[index] != ATTR_NONE ||
gc_buffer_characters[index] != ' ' ||
gc_buffer_colorcodes[index] != gc_color_code) {
if (gc_buffer_colorcodes[index] != gc_color_code) {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ ' ',
/* attrs */ ATTR_NONE,
/* ch_previous */ 0,
/* attrs_previous */ 0 );
} else {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ ' ',
/* attrs */ ATTR_NONE,
/* ch_previous */ gc_buffer_characters[index],
/* attrs_previous */ gc_buffer_attributes[index] );
}
gc_buffer_attributes[index] = ATTR_NONE;
gc_buffer_characters[index] = ' ';
gc_buffer_colorcodes[index] = gc_color_code;
}
}
}
} else {
gc_ops.scroll_down(num, top, bottom);
/* Now set the freed up lines to the background colour */
gc_clear_screen(vinfo.v_columns - 1, top + num - 1, top, bottom, 1);
}
}
static void
gc_scroll_up(int num, unsigned int top, unsigned int bottom)
{
if (!gc_buffer_size) {
return;
}
if (bottom <= gc_buffer_rows) {
unsigned char colorcodesave = gc_color_code;
uint32_t column, row;
uint32_t index, jump;
jump = num * gc_buffer_columns;
for (row = top; row < bottom - num; row++) {
index = row * gc_buffer_columns;
for (column = 0; column < gc_buffer_columns; index++, column++) {
if (gc_buffer_attributes[index] != gc_buffer_attributes[index + jump] ||
gc_buffer_characters[index] != gc_buffer_characters[index + jump] ||
gc_buffer_colorcodes[index] != gc_buffer_colorcodes[index + jump]) {
if (gc_color_code != gc_buffer_colorcodes[index + jump]) {
gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes[index + jump], TRUE ), TRUE );
gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes[index + jump], FALSE), FALSE);
}
if (gc_buffer_colorcodes[index] != gc_buffer_colorcodes[index + jump]) {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ gc_buffer_characters[index + jump],
/* attrs */ gc_buffer_attributes[index + jump],
/* ch_previous */ 0,
/* attrs_previous */ 0 );
} else {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ gc_buffer_characters[index + jump],
/* attrs */ gc_buffer_attributes[index + jump],
/* ch_previous */ gc_buffer_characters[index],
/* attrs_previous */ gc_buffer_attributes[index] );
}
gc_buffer_attributes[index] = gc_buffer_attributes[index + jump];
gc_buffer_characters[index] = gc_buffer_characters[index + jump];
gc_buffer_colorcodes[index] = gc_buffer_colorcodes[index + jump];
}
}
}
if (colorcodesave != gc_color_code) {
gc_update_color(COLOR_CODE_GET(colorcodesave, TRUE ), TRUE );
gc_update_color(COLOR_CODE_GET(colorcodesave, FALSE), FALSE);
}
/* Now set the freed up lines to the background colour */
for (row = bottom - num; row < bottom; row++) {
index = row * gc_buffer_columns;
for (column = 0; column < gc_buffer_columns; index++, column++) {
if (gc_buffer_attributes[index] != ATTR_NONE ||
gc_buffer_characters[index] != ' ' ||
gc_buffer_colorcodes[index] != gc_color_code) {
if (gc_buffer_colorcodes[index] != gc_color_code) {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ ' ',
/* attrs */ ATTR_NONE,
/* ch_previous */ 0,
/* attrs_previous */ 0 );
} else {
gc_ops.paint_char( /* xx */ column,
/* yy */ row,
/* ch */ ' ',
/* attrs */ ATTR_NONE,
/* ch_previous */ gc_buffer_characters[index],
/* attrs_previous */ gc_buffer_attributes[index] );
}
gc_buffer_attributes[index] = ATTR_NONE;
gc_buffer_characters[index] = ' ';
gc_buffer_colorcodes[index] = gc_color_code;
}
}
}
} else {
gc_ops.scroll_up(num, top, bottom);
/* Now set the freed up lines to the background colour */
gc_clear_screen(0, bottom - num, top, bottom, 0);
}
}
static void
gc_show_cursor(unsigned int xx, unsigned int yy)
{
if (xx < gc_buffer_columns && yy < gc_buffer_rows) {
uint32_t index = (yy * gc_buffer_columns) + xx;
unsigned char attribute = gc_buffer_attributes[index];
unsigned char character = gc_buffer_characters[index];
unsigned char colorcode = gc_buffer_colorcodes[index];
unsigned char colorcodesave = gc_color_code;
gc_update_color(COLOR_CODE_GET(colorcode, FALSE), TRUE );
gc_update_color(COLOR_CODE_GET(colorcode, TRUE ), FALSE);
gc_ops.paint_char(xx, yy, character, attribute, 0, 0);
gc_update_color(COLOR_CODE_GET(colorcodesave, TRUE ), TRUE );
gc_update_color(COLOR_CODE_GET(colorcodesave, FALSE), FALSE);
} else {
gc_ops.show_cursor(xx, yy);
}
}
static void
gc_update_color(int color, boolean_t fore)
{
assert(gc_ops.update_color);
gc_color_code = COLOR_CODE_SET(gc_color_code, color, fore);
gc_ops.update_color(color, fore);
}
void
vcputc(__unused int l, __unused int u, int c)
{
if (gc_initialized && gc_enabled) {
VCPUTC_LOCK_LOCK();
if (gc_enabled) {
gc_hide_cursor(gc_x, gc_y);
gc_putchar(c);
gc_show_cursor(gc_x, gc_y);
}
VCPUTC_LOCK_UNLOCK();
}
}
/*
* Video Console (Back-End)
* ------------------------
*/
/*
* For the color support (Michel Pollet)
*/
static unsigned char vc_color_index_table[33] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 2 };
static uint32_t vc_colors[8][4] = {
{ 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000 }, /* black */
{ 0x23232323, 0x7C007C00, 0x00FF0000, 0x3FF00000 }, /* red */
{ 0xb9b9b9b9, 0x03e003e0, 0x0000FF00, 0x000FFC00 }, /* green */
{ 0x05050505, 0x7FE07FE0, 0x00FFFF00, 0x3FFFFC00 }, /* yellow */
{ 0xd2d2d2d2, 0x001f001f, 0x000000FF, 0x000003FF }, /* blue */
// { 0x80808080, 0x31933193, 0x00666699, 0x00000000 }, /* blue */
{ 0x18181818, 0x7C1F7C1F, 0x00FF00FF, 0x3FF003FF }, /* magenta */
{ 0xb4b4b4b4, 0x03FF03FF, 0x0000FFFF, 0x000FFFFF }, /* cyan */
{ 0x00000000, 0x7FFF7FFF, 0x00FFFFFF, 0x3FFFFFFF } /* white */
};
static uint32_t vc_color_fore = 0;
static uint32_t vc_color_back = 0;
/*
* New Rendering code from Michel Pollet
*/
/* Rendered Font Buffer */
static unsigned char *vc_rendered_font = NULL;
/* Rendered Font Size */
static uint32_t vc_rendered_font_size = 0;
/* Size of a character in the table (bytes) */
static int vc_rendered_char_size = 0;
#define REN_MAX_DEPTH 32
static unsigned char vc_rendered_char[ISO_CHAR_HEIGHT * ((REN_MAX_DEPTH / 8) * ISO_CHAR_WIDTH)];
#if defined(XNU_TARGET_OS_OSX)
#define CONFIG_VC_PROGRESS_METER_SUPPORT 1
#endif /* XNU_TARGET_OS_OSX */
#if defined(XNU_TARGET_OS_OSX)
static void
internal_set_progressmeter(int new_value);
static void
internal_enable_progressmeter(int new_value);
enum{
kProgressMeterOff = FALSE,
kProgressMeterUser = TRUE,
kProgressMeterKernel = 3,
};
enum{
kProgressMeterMax = 1024,
kProgressMeterEnd = 512,
};
#endif /* defined(XNU_TARGET_OS_OSX) */
static boolean_t vc_progress_white =
#ifdef CONFIG_VC_PROGRESS_WHITE
TRUE;
#else /* !CONFIG_VC_PROGRESS_WHITE */
FALSE;
#endif /* !CONFIG_VC_PROGRESS_WHITE */
static int vc_acquire_delay = kProgressAcquireDelay;
static void
vc_clear_screen(unsigned int xx, unsigned int yy, unsigned int scrreg_top,
unsigned int scrreg_bottom, int which)
{
uint32_t *p, *endp, *row;
int linelongs, col;
int rowline, rowlongs;
if (!vinfo.v_depth) {
return;
}
linelongs = vinfo.v_rowbytes * (ISO_CHAR_HEIGHT >> 2);
rowline = vinfo.v_rowscanbytes >> 2;
rowlongs = vinfo.v_rowbytes >> 2;
p = (uint32_t*) vinfo.v_baseaddr;
endp = (uint32_t*) vinfo.v_baseaddr;
switch (which) {
case 0: /* To end of screen */
gc_clear_line(xx, yy, 0);
if (yy < scrreg_bottom - 1) {
p += (yy + 1) * linelongs;
endp += scrreg_bottom * linelongs;
}
break;
case 1: /* To start of screen */
gc_clear_line(xx, yy, 1);
if (yy > scrreg_top) {
p += scrreg_top * linelongs;
endp += yy * linelongs;
}
break;
case 2: /* Whole screen */
p += scrreg_top * linelongs;
if (scrreg_bottom == vinfo.v_rows) {
endp += rowlongs * vinfo.v_height;
} else {
endp += scrreg_bottom * linelongs;
}
break;
}
for (row = p; row < endp; row += rowlongs) {
for (col = 0; col < rowline; col++) {
*(row + col) = vc_color_back;
}
}
}
static void
vc_render_char(unsigned char ch, unsigned char *renderptr, short newdepth)
{
union {
unsigned char *charptr;
unsigned short *shortptr;
uint32_t *longptr;
} current; /* current place in rendered font, multiple types. */
unsigned char *theChar; /* current char in iso_font */
int line;
current.charptr = renderptr;
theChar = iso_font + (ch * ISO_CHAR_HEIGHT);
for (line = 0; line < ISO_CHAR_HEIGHT; line++) {
unsigned char mask = 1;
do {
switch (newdepth) {
case 8:
*current.charptr++ = (*theChar & mask) ? 0xFF : 0;
break;
case 16:
*current.shortptr++ = (*theChar & mask) ? 0xFFFF : 0;
break;
case 30:
case 32:
*current.longptr++ = (*theChar & mask) ? 0xFFFFFFFF : 0;
break;
}
mask <<= 1;
} while (mask); /* while the single bit drops to the right */
theChar++;
}
}
static void
vc_paint_char_8(unsigned int xx, unsigned int yy, unsigned char ch, int attrs,
__unused unsigned char ch_previous, __unused int attrs_previous)
{
uint32_t *theChar;
uint32_t *where;
int i;
if (vc_rendered_font) {
theChar = (uint32_t*)(vc_rendered_font + (ch * vc_rendered_char_size));
} else {
vc_render_char(ch, vc_rendered_char, 8);
theChar = (uint32_t*)(vc_rendered_char);
}
where = (uint32_t*)(vinfo.v_baseaddr +
(yy * ISO_CHAR_HEIGHT * vinfo.v_rowbytes) +
(xx * ISO_CHAR_WIDTH));
if (!attrs) {
for (i = 0; i < ISO_CHAR_HEIGHT; i++) { /* No attr? FLY !*/
uint32_t *store = where;
int x;
for (x = 0; x < 2; x++) {
uint32_t val = *theChar++;
val = (vc_color_back & ~val) | (vc_color_fore & val);
*store++ = val;
}
where = (uint32_t*)(((unsigned char*)where) + vinfo.v_rowbytes);
}
} else {
for (i = 0; i < ISO_CHAR_HEIGHT; i++) { /* a little slower */
uint32_t *store = where, lastpixel = 0;
int x;
for (x = 0; x < 2; x++) {
uint32_t val = *theChar++, save = val;
if (attrs & ATTR_BOLD) { /* bold support */
if (lastpixel && !(save & 0xFF000000)) {
val |= 0xff000000;
}
if ((save & 0xFFFF0000) == 0xFF000000) {
val |= 0x00FF0000;
}
if ((save & 0x00FFFF00) == 0x00FF0000) {
val |= 0x0000FF00;
}
if ((save & 0x0000FFFF) == 0x0000FF00) {
val |= 0x000000FF;
}
}
if (attrs & ATTR_REVERSE) {
val = ~val;
}
if (attrs & ATTR_UNDER && i == ISO_CHAR_HEIGHT - 1) {
val = ~val;
}
val = (vc_color_back & ~val) | (vc_color_fore & val);
*store++ = val;
lastpixel = save & 0xff;
}
where = (uint32_t*)(((unsigned char*)where) + vinfo.v_rowbytes);
}
}
}
static void
vc_paint_char_16(unsigned int xx, unsigned int yy, unsigned char ch, int attrs,
__unused unsigned char ch_previous,
__unused int attrs_previous)
{
uint32_t *theChar;
uint32_t *where;
int i;
if (vc_rendered_font) {
theChar = (uint32_t*)(vc_rendered_font + (ch * vc_rendered_char_size));
} else {
vc_render_char(ch, vc_rendered_char, 16);
theChar = (uint32_t*)(vc_rendered_char);
}
where = (uint32_t*)(vinfo.v_baseaddr +
(yy * ISO_CHAR_HEIGHT * vinfo.v_rowbytes) +
(xx * ISO_CHAR_WIDTH * 2));
if (!attrs) {
for (i = 0; i < ISO_CHAR_HEIGHT; i++) { /* No attrs ? FLY ! */
uint32_t *store = where;
int x;
for (x = 0; x < 4; x++) {
uint32_t val = *theChar++;
val = (vc_color_back & ~val) | (vc_color_fore & val);
*store++ = val;
}
where = (uint32_t*)(((unsigned char*)where) + vinfo.v_rowbytes);
}
} else {
for (i = 0; i < ISO_CHAR_HEIGHT; i++) { /* a little bit slower */
uint32_t *store = where, lastpixel = 0;
int x;
for (x = 0; x < 4; x++) {
uint32_t val = *theChar++, save = val;
if (attrs & ATTR_BOLD) { /* bold support */
if (save == 0xFFFF0000) {
val |= 0xFFFF;
} else if (lastpixel && !(save & 0xFFFF0000)) {
val |= 0xFFFF0000;
}
}
if (attrs & ATTR_REVERSE) {
val = ~val;
}
if (attrs & ATTR_UNDER && i == ISO_CHAR_HEIGHT - 1) {
val = ~val;
}
val = (vc_color_back & ~val) | (vc_color_fore & val);
*store++ = val;
lastpixel = save & 0x7fff;
}
where = (uint32_t*)(((unsigned char*)where) + vinfo.v_rowbytes);
}
}
}
static void
vc_paint_char_32(unsigned int xx, unsigned int yy, unsigned char ch, int attrs,
unsigned char ch_previous, int attrs_previous)
{
uint32_t *theChar;
uint32_t *theCharPrevious;
uint32_t *where;
int i;
if (vc_rendered_font) {
theChar = (uint32_t*)(vc_rendered_font + (ch * vc_rendered_char_size));
theCharPrevious = (uint32_t*)(vc_rendered_font + (ch_previous * vc_rendered_char_size));
} else {
vc_render_char(ch, vc_rendered_char, 32);
theChar = (uint32_t*)(vc_rendered_char);
theCharPrevious = NULL;
}
if (!ch_previous) {
theCharPrevious = NULL;
}
if (attrs_previous) {
theCharPrevious = NULL;
}
where = (uint32_t*)(vinfo.v_baseaddr +
(yy * ISO_CHAR_HEIGHT * vinfo.v_rowbytes) +
(xx * ISO_CHAR_WIDTH * 4));
if (!attrs) {
for (i = 0; i < ISO_CHAR_HEIGHT; i++) { /* No attrs ? FLY ! */
uint32_t *store = where;
int x;
for (x = 0; x < 8; x++) {
uint32_t val = *theChar++;
if (theCharPrevious == NULL || val != *theCharPrevious++) {
val = (vc_color_back & ~val) | (vc_color_fore & val);
*store++ = val;
} else {
store++;
}
}
where = (uint32_t *)(((unsigned char*)where) + vinfo.v_rowbytes);
}
} else {
for (i = 0; i < ISO_CHAR_HEIGHT; i++) { /* a little slower */
uint32_t *store = where, lastpixel = 0;
int x;
for (x = 0; x < 8; x++) {
uint32_t val = *theChar++, save = val;
if (attrs & ATTR_BOLD) { /* bold support */
if (lastpixel && !save) {
val = 0xFFFFFFFF;
}
}
if (attrs & ATTR_REVERSE) {
val = ~val;
}
if (attrs & ATTR_UNDER && i == ISO_CHAR_HEIGHT - 1) {
val = ~val;
}
val = (vc_color_back & ~val) | (vc_color_fore & val);
*store++ = val;
lastpixel = save;
}
where = (uint32_t*)(((unsigned char*)where) + vinfo.v_rowbytes);
}
}
}
static void
vc_paint_char(unsigned int xx, unsigned int yy, unsigned char ch, int attrs,
unsigned char ch_previous, int attrs_previous)
{
if (!vinfo.v_depth) {
return;
}
switch (vinfo.v_depth) {
case 8:
vc_paint_char_8(xx, yy, ch, attrs, ch_previous, attrs_previous);
break;
case 16:
vc_paint_char_16(xx, yy, ch, attrs, ch_previous,
attrs_previous);
break;
case 30:
case 32:
vc_paint_char_32(xx, yy, ch, attrs, ch_previous,
attrs_previous);
break;
}
}
static void
vc_render_font(short newdepth)
{
static short olddepth = 0;
int charindex; /* index in ISO font */
unsigned char *rendered_font;
unsigned int rendered_font_size;
int rendered_char_size;
spl_t s;
if (vm_initialized == FALSE) {
return; /* nothing to do */
}
if (olddepth == newdepth && vc_rendered_font) {
return; /* nothing to do */
}
s = splhigh();
VCPUTC_LOCK_LOCK();
rendered_font = vc_rendered_font;
rendered_font_size = vc_rendered_font_size;
rendered_char_size = vc_rendered_char_size;
vc_rendered_font = NULL;
vc_rendered_font_size = 0;
vc_rendered_char_size = 0;
VCPUTC_LOCK_UNLOCK();
splx(s);
if (rendered_font) {
kheap_free(KHEAP_DATA_BUFFERS, rendered_font, rendered_font_size);
rendered_font = NULL;
}
if (newdepth) {
rendered_char_size = ISO_CHAR_HEIGHT * (((newdepth + 7) / 8) * ISO_CHAR_WIDTH);
rendered_font_size = (ISO_CHAR_MAX - ISO_CHAR_MIN + 1) * rendered_char_size;
rendered_font = kheap_alloc(KHEAP_DATA_BUFFERS, rendered_font_size, Z_WAITOK);
}
if (rendered_font == NULL) {
return;
}
for (charindex = ISO_CHAR_MIN; charindex <= ISO_CHAR_MAX; charindex++) {
vc_render_char(charindex, rendered_font + (charindex * rendered_char_size), newdepth);
}
olddepth = newdepth;
s = splhigh();
VCPUTC_LOCK_LOCK();
vc_rendered_font = rendered_font;
vc_rendered_font_size = rendered_font_size;
vc_rendered_char_size = rendered_char_size;
VCPUTC_LOCK_UNLOCK();
splx(s);
}
static void
vc_enable(boolean_t enable)
{
vc_render_font(enable ? vinfo.v_depth : 0);
}
static void
vc_reverse_cursor(unsigned int xx, unsigned int yy)
{
uint32_t *where;
int line, col;
if (!vinfo.v_depth) {
return;
}
where = (uint32_t*)(vinfo.v_baseaddr +
(yy * ISO_CHAR_HEIGHT * vinfo.v_rowbytes) +
(xx /** ISO_CHAR_WIDTH*/ * vinfo.v_depth));
for (line = 0; line < ISO_CHAR_HEIGHT; line++) {
switch (vinfo.v_depth) {
case 8:
where[0] = ~where[0];
where[1] = ~where[1];
break;
case 16:
for (col = 0; col < 4; col++) {
where[col] = ~where[col];
}
break;
case 32:
for (col = 0; col < 8; col++) {
where[col] = ~where[col];
}
break;
}
where = (uint32_t*)(((unsigned char*)where) + vinfo.v_rowbytes);
}
}
static void
vc_scroll_down(int num, unsigned int scrreg_top, unsigned int scrreg_bottom)
{
uint32_t *from, *to, linelongs, i, line, rowline, rowscanline;
if (!vinfo.v_depth) {
return;
}
linelongs = vinfo.v_rowbytes * (ISO_CHAR_HEIGHT >> 2);
rowline = vinfo.v_rowbytes >> 2;
rowscanline = vinfo.v_rowscanbytes >> 2;
to = (uint32_t *) vinfo.v_baseaddr + (linelongs * scrreg_bottom)
- (rowline - rowscanline);
from = to - (linelongs * num); /* handle multiple line scroll (Michel Pollet) */
i = (scrreg_bottom - scrreg_top) - num;
while (i-- > 0) {
for (line = 0; line < ISO_CHAR_HEIGHT; line++) {
/*
* Only copy what is displayed
*/
video_scroll_down(from,
(from - (vinfo.v_rowscanbytes >> 2)),
to);
from -= rowline;
to -= rowline;
}
}
}
static void
vc_scroll_up(int num, unsigned int scrreg_top, unsigned int scrreg_bottom)
{
uint32_t *from, *to, linelongs, i, line, rowline, rowscanline;
if (!vinfo.v_depth) {
return;
}
linelongs = vinfo.v_rowbytes * (ISO_CHAR_HEIGHT >> 2);
rowline = vinfo.v_rowbytes >> 2;
rowscanline = vinfo.v_rowscanbytes >> 2;
to = (uint32_t *) vinfo.v_baseaddr + (scrreg_top * linelongs);
from = to + (linelongs * num); /* handle multiple line scroll (Michel Pollet) */
i = (scrreg_bottom - scrreg_top) - num;
while (i-- > 0) {
for (line = 0; line < ISO_CHAR_HEIGHT; line++) {
/*
* Only copy what is displayed
*/
video_scroll_up(from,
(from + (vinfo.v_rowscanbytes >> 2)),
to);
from += rowline;
to += rowline;
}
}
}
static void
vc_update_color(int color, boolean_t fore)
{
if (!vinfo.v_depth) {
return;
}
if (fore) {
vc_color_fore = vc_colors[color][vc_color_index_table[vinfo.v_depth]];
} else {
vc_color_back = vc_colors[color][vc_color_index_table[vinfo.v_depth]];
}
}
/*
* Video Console (Back-End): Icon Control
* --------------------------------------
*/
static vc_progress_element * vc_progress;
enum { kMaxProgressData = 3 };
static const unsigned char * vc_progress_data[kMaxProgressData];
static const unsigned char * vc_progress_alpha;
static boolean_t vc_progress_enable;
static const unsigned char * vc_clut;
static const unsigned char * vc_clut8;
static unsigned char vc_revclut8[256];
static uint32_t vc_progress_interval;
static uint32_t vc_progress_count;
static uint32_t vc_progress_angle;
static uint64_t vc_progress_deadline;
static thread_call_data_t vc_progress_call;
static boolean_t vc_needsave;
static void * vc_saveunder;
static vm_size_t vc_saveunder_len;
static int8_t vc_uiscale = 1;
vc_progress_user_options vc_progress_options;
vc_progress_user_options vc_user_options;
decl_simple_lock_data(, vc_progress_lock);
#if defined(XNU_TARGET_OS_OSX)
static int vc_progress_withmeter = 3;
int vc_progressmeter_enable;
static int vc_progressmeter_drawn;
int vc_progressmeter_value;
static uint32_t vc_progressmeter_count;
static uint32_t vc_progress_meter_start;
static uint32_t vc_progress_meter_end;
static uint64_t vc_progressmeter_interval;
static uint64_t vc_progressmeter_deadline;
static thread_call_data_t vc_progressmeter_call;
static void * vc_progressmeter_backbuffer;
static uint32_t vc_progressmeter_diskspeed = 256;
#endif /* defined(XNU_TARGET_OS_OSX) */
enum {
kSave = 0x10,
kDataIndexed = 0x20,
kDataAlpha = 0x40,
kDataBack = 0x80,
kDataRotate = 0x03,
};
static void vc_blit_rect(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
void * backBuffer,
unsigned int flags);
static void vc_blit_rect_8(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
unsigned char * backBuffer,
unsigned int flags);
static void vc_blit_rect_16(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
unsigned short * backBuffer,
unsigned int flags);
static void vc_blit_rect_32(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
unsigned int * backBuffer,
unsigned int flags);
static void vc_blit_rect_30(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
unsigned int * backBuffer,
unsigned int flags);
static void vc_progress_task( void * arg0, void * arg );
#if defined(XNU_TARGET_OS_OSX)
static void vc_progressmeter_task( void * arg0, void * arg );
#endif /* defined(XNU_TARGET_OS_OSX) */
static void
vc_blit_rect(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
void * backBuffer,
unsigned int flags)
{
if (!vinfo.v_depth) {
return;
}
if (((unsigned int)(x + width)) > vinfo.v_width) {
return;
}
if (((unsigned int)(y + height)) > vinfo.v_height) {
return;
}
switch (vinfo.v_depth) {
case 8:
if (vc_clut8 == vc_clut) {
vc_blit_rect_8( x, y, bx, width, height, sourceWidth, sourceHeight, sourceRow, backRow, dataPtr, (unsigned char *) backBuffer, flags );
}
break;
case 16:
vc_blit_rect_16( x, y, bx, width, height, sourceWidth, sourceHeight, sourceRow, backRow, dataPtr, (unsigned short *) backBuffer, flags );
break;
case 32:
vc_blit_rect_32( x, y, bx, width, height, sourceWidth, sourceHeight, sourceRow, backRow, dataPtr, (unsigned int *) backBuffer, flags );
break;
case 30:
vc_blit_rect_30( x, y, bx, width, height, sourceWidth, sourceHeight, sourceRow, backRow, dataPtr, (unsigned int *) backBuffer, flags );
break;
}
}
static void
vc_blit_rect_8(int x, int y, __unused int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, __unused int backRow,
const unsigned char * dataPtr,
__unused unsigned char * backBuffer,
__unused unsigned int flags)
{
volatile unsigned short * dst;
int line, col;
unsigned int data = 0, out = 0;
int sx, sy, a, b, c, d;
int scale = 0x10000;
a = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][0] * scale;
b = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][1] * scale;
c = vc_rotate_matr[kDataRotate & flags][1][0] * scale;
d = vc_rotate_matr[kDataRotate & flags][1][1] * scale;
sx = ((a + b) < 0) ? ((sourceWidth * scale) - 0x8000) : 0;
sy = ((c + d) < 0) ? ((sourceHeight * scale) - 0x8000) : 0;
if (!sourceRow) {
data = (unsigned int)(uintptr_t)dataPtr;
}
dst = (volatile unsigned short *) (vinfo.v_baseaddr +
(y * vinfo.v_rowbytes) +
(x * 4));
for (line = 0; line < height; line++) {
for (col = 0; col < width; col++) {
if (sourceRow) {
data = dataPtr[((sx + (col * a) + (line * b)) >> 16)
+ sourceRow * (((sy + (col * c) + (line * d)) >> 16))];
}
if (kDataAlpha & flags) {
out = vc_revclut8[data];
} else {
out = data;
}
*(dst + col) = out;
}
dst = (volatile unsigned short *) (((volatile char*)dst) + vinfo.v_rowbytes);
}
}
/* For ARM, 16-bit is 565 (RGB); it is 1555 (XRGB) on other platforms */
#ifdef __arm__
#define CLUT_MASK_R 0xf8
#define CLUT_MASK_G 0xfc
#define CLUT_MASK_B 0xf8
#define CLUT_SHIFT_R << 8
#define CLUT_SHIFT_G << 3
#define CLUT_SHIFT_B >> 3
#define MASK_R 0xf800
#define MASK_G 0x07e0
#define MASK_B 0x001f
#define MASK_R_8 0x7f800
#define MASK_G_8 0x01fe0
#define MASK_B_8 0x000ff
#else
#define CLUT_MASK_R 0xf8
#define CLUT_MASK_G 0xf8
#define CLUT_MASK_B 0xf8
#define CLUT_SHIFT_R << 7
#define CLUT_SHIFT_G << 2
#define CLUT_SHIFT_B >> 3
#define MASK_R 0x7c00
#define MASK_G 0x03e0
#define MASK_B 0x001f
#define MASK_R_8 0x3fc00
#define MASK_G_8 0x01fe0
#define MASK_B_8 0x000ff
#endif
static void
vc_blit_rect_16( int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
unsigned short * backPtr,
unsigned int flags)
{
volatile unsigned short * dst;
int line, col;
unsigned int data = 0, out = 0, back = 0;
int sx, sy, a, b, c, d;
int scale = 0x10000;
a = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][0] * scale;
b = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][1] * scale;
c = vc_rotate_matr[kDataRotate & flags][1][0] * scale;
d = vc_rotate_matr[kDataRotate & flags][1][1] * scale;
sx = ((a + b) < 0) ? ((sourceWidth * scale) - 0x8000) : 0;
sy = ((c + d) < 0) ? ((sourceHeight * scale) - 0x8000) : 0;
if (!sourceRow) {
data = (unsigned int)(uintptr_t)dataPtr;
}
if (backPtr) {
backPtr += bx;
}
dst = (volatile unsigned short *) (vinfo.v_baseaddr +
(y * vinfo.v_rowbytes) +
(x * 2));
for (line = 0; line < height; line++) {
for (col = 0; col < width; col++) {
if (sourceRow) {
data = dataPtr[((sx + (col * a) + (line * b)) >> 16)
+ sourceRow * (((sy + (col * c) + (line * d)) >> 16))];
}
if (backPtr) {
if (kSave & flags) {
back = *(dst + col);
*backPtr++ = back;
} else {
back = *backPtr++;
}
}
if (kDataIndexed & flags) {
out = ((CLUT_MASK_R & (vc_clut[data * 3 + 0]))CLUT_SHIFT_R)
| ((CLUT_MASK_G & (vc_clut[data * 3 + 1]))CLUT_SHIFT_G)
| ((CLUT_MASK_B & (vc_clut[data * 3 + 2]))CLUT_SHIFT_B);
} else if (kDataAlpha & flags) {
out = (((((back & MASK_R) * data) + MASK_R_8) >> 8) & MASK_R)
| (((((back & MASK_G) * data) + MASK_G_8) >> 8) & MASK_G)
| (((((back & MASK_B) * data) + MASK_B_8) >> 8) & MASK_B);
if (vc_progress_white) {
out += (((0xff - data) & CLUT_MASK_R)CLUT_SHIFT_R)
| (((0xff - data) & CLUT_MASK_G)CLUT_SHIFT_G)
| (((0xff - data) & CLUT_MASK_B)CLUT_SHIFT_B);
}
} else if (kDataBack & flags) {
out = back;
} else {
out = data;
}
*(dst + col) = out;
}
dst = (volatile unsigned short *) (((volatile char*)dst) + vinfo.v_rowbytes);
if (backPtr) {
backPtr += backRow - width;
}
}
}
static void
vc_blit_rect_32(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
unsigned int * backPtr,
unsigned int flags)
{
volatile unsigned int * dst;
int line, col;
unsigned int data = 0, out = 0, back = 0;
int sx, sy, a, b, c, d;
int scale = 0x10000;
a = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][0] * scale;
b = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][1] * scale;
c = vc_rotate_matr[kDataRotate & flags][1][0] * scale;
d = vc_rotate_matr[kDataRotate & flags][1][1] * scale;
sx = ((a + b) < 0) ? ((sourceWidth * scale) - 0x8000) : 0;
sy = ((c + d) < 0) ? ((sourceHeight * scale) - 0x8000) : 0;
if (!sourceRow) {
data = (unsigned int)(uintptr_t)dataPtr;
}
if (backPtr) {
backPtr += bx;
}
dst = (volatile unsigned int *) (vinfo.v_baseaddr +
(y * vinfo.v_rowbytes) +
(x * 4));
for (line = 0; line < height; line++) {
for (col = 0; col < width; col++) {
if (sourceRow) {
data = dataPtr[((sx + (col * a) + (line * b)) >> 16)
+ sourceRow * (((sy + (col * c) + (line * d)) >> 16))];
}
if (backPtr) {
if (kSave & flags) {
back = *(dst + col);
*backPtr++ = back;
} else {
back = *backPtr++;
}
}
if (kDataIndexed & flags) {
out = (vc_clut[data * 3 + 0] << 16)
| (vc_clut[data * 3 + 1] << 8)
| (vc_clut[data * 3 + 2]);
} else if (kDataAlpha & flags) {
out = (((((back & 0x00ff00ff) * data) + 0x00ff00ff) >> 8) & 0x00ff00ff)
| (((((back & 0x0000ff00) * data) + 0x0000ff00) >> 8) & 0x0000ff00);
if (vc_progress_white) {
out += ((0xff - data) << 16)
| ((0xff - data) << 8)
| (0xff - data);
}
} else if (kDataBack & flags) {
out = back;
} else {
out = data;
}
*(dst + col) = out;
}
dst = (volatile unsigned int *) (((volatile char*)dst) + vinfo.v_rowbytes);
if (backPtr) {
backPtr += backRow - width;
}
}
}
static void
vc_blit_rect_30(int x, int y, int bx,
int width, int height,
int sourceWidth, int sourceHeight,
int sourceRow, int backRow,
const unsigned char * dataPtr,
unsigned int * backPtr,
unsigned int flags)
{
volatile unsigned int * dst;
int line, col;
unsigned int data = 0, out = 0, back = 0;
unsigned long long exp;
int sx, sy, a, b, c, d;
int scale = 0x10000;
a = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][0] * scale;
b = (sourceRow == 1) ? 0 : vc_rotate_matr[kDataRotate & flags][0][1] * scale;
c = vc_rotate_matr[kDataRotate & flags][1][0] * scale;
d = vc_rotate_matr[kDataRotate & flags][1][1] * scale;
sx = ((a + b) < 0) ? ((sourceWidth * scale) - 0x8000) : 0;
sy = ((c + d) < 0) ? ((sourceHeight * scale) - 0x8000) : 0;
if (!sourceRow) {
data = (unsigned int)(uintptr_t)dataPtr;
}
if (backPtr) {
backPtr += bx;
}
dst = (volatile unsigned int *) (vinfo.v_baseaddr +
(y * vinfo.v_rowbytes) +
(x * 4));
for (line = 0; line < height; line++) {
for (col = 0; col < width; col++) {
if (sourceRow) {
data = dataPtr[((sx + (col * a) + (line * b)) >> 16)
+ sourceRow * (((sy + (col * c) + (line * d)) >> 16))];
}
if (backPtr) {
if (kSave & flags) {
back = *(dst + col);
*backPtr++ = back;
} else {
back = *backPtr++;
}
}
if (kDataIndexed & flags) {
out = (vc_clut[data * 3 + 0] << 22)
| (vc_clut[data * 3 + 1] << 12)
| (vc_clut[data * 3 + 2] << 2);
} else if (kDataAlpha & flags) {
exp = back;
exp = (((((exp & 0x3FF003FF) * data) + 0x0FF000FF) >> 8) & 0x3FF003FF)
| (((((exp & 0x000FFC00) * data) + 0x0003FC00) >> 8) & 0x000FFC00);
out = (unsigned int)exp;
if (vc_progress_white) {
out += ((0xFF - data) << 22)
| ((0xFF - data) << 12)
| ((0xFF - data) << 2);
}
} else if (kDataBack & flags) {
out = back;
} else {
out = data;
}
*(dst + col) = out;
}
dst = (volatile unsigned int *) (((volatile char*)dst) + vinfo.v_rowbytes);
if (backPtr) {
backPtr += backRow - width;
}
}
}
static void
vc_clean_boot_graphics(void)
{
#if defined(XNU_TARGET_OS_OSX)
// clean up possible FDE login graphics
vc_progress_set(FALSE, 0);
const unsigned char *
color = (typeof(color))(uintptr_t)(vc_progress_white ? 0x00000000 : 0xBFBFBFBF);
vc_blit_rect(0, 0, 0, vinfo.v_width, vinfo.v_height, vinfo.v_width, vinfo.v_height, 0, 0, color, NULL, 0);
#endif
}
/*
* Routines to render the lzss image format
*/
struct lzss_image_state {
uint32_t col;
uint32_t row;
uint32_t width;
uint32_t height;
uint32_t bytes_per_row;
volatile uint32_t * row_start;
const uint8_t* clut;
};
typedef struct lzss_image_state lzss_image_state;
// returns 0 if OK, 1 if error
static inline int
vc_decompress_lzss_next_pixel(int next_data, lzss_image_state* state)
{
uint32_t palette_index = 0;
uint32_t pixel_value = 0;
palette_index = next_data * 3;
pixel_value = ((uint32_t) state->clut[palette_index + 0] << 16)
| ((uint32_t) state->clut[palette_index + 1] << 8)
| ((uint32_t) state->clut[palette_index + 2]);
*(state->row_start + state->col) = pixel_value;
if (++state->col >= state->width) {
state->col = 0;
if (++state->row >= state->height) {
return 1;
}
state->row_start = (volatile uint32_t *) (((uintptr_t)state->row_start) + state->bytes_per_row);
}
return 0;
}
/*
* Blit an lzss compressed image to the framebuffer
* Assumes 32 bit screen (which is everything we ship at the moment)
* The function vc_display_lzss_icon was copied from libkern/mkext.c, then modified.
*/
/*
* TODO: Does lzss use too much stack? 4096 plus bytes...
* Can probably chop it down by 1/2.
*/
/**************************************************************
* LZSS.C -- A Data Compression Program
***************************************************************
* 4/6/1989 Haruhiko Okumura
* Use, distribute, and modify this program freely.
* Please send me your improved versions.
* PC-VAN SCIENCE
* NIFTY-Serve PAF01022
* CompuServe 74050,1022
*
**************************************************************/
#define N 4096 /* size of ring buffer - must be power of 2 */
#define F 18 /* upper limit for match_length */
#define THRESHOLD 2 /* encode string into position and length
* if match_length is greater than this */
// returns 0 if OK, 1 if error
// x and y indicate upper left corner of image location on screen
int
vc_display_lzss_icon(uint32_t dst_x, uint32_t dst_y,
uint32_t image_width, uint32_t image_height,
const uint8_t *compressed_image,
uint32_t compressed_size,
const uint8_t *clut)
{
uint32_t* image_start;
uint32_t bytes_per_pixel = 4;
uint32_t bytes_per_row = vinfo.v_rowbytes;
vc_clean_boot_graphics();
image_start = (uint32_t *) (vinfo.v_baseaddr + (dst_y * bytes_per_row) + (dst_x * bytes_per_pixel));
lzss_image_state state = {0, 0, image_width, image_height, bytes_per_row, image_start, clut};
int rval = 0;
const uint8_t *src = compressed_image;
uint32_t srclen = compressed_size;
/* ring buffer of size N, with extra F-1 bytes to aid string comparison */
uint8_t text_buf[N + F - 1];
const uint8_t *srcend = src + srclen;
int i, j, k, r, c;
unsigned int flags;
srcend = src + srclen;
for (i = 0; i < N - F; i++) {
text_buf[i] = ' ';
}
r = N - F;
flags = 0;
for (;;) {
if (((flags >>= 1) & 0x100) == 0) {
if (src < srcend) {
c = *src++;
} else {
break;
}
flags = c | 0xFF00; /* uses higher byte cleverly */
} /* to count eight */
if (flags & 1) {
if (src < srcend) {
c = *src++;
} else {
break;
}
rval = vc_decompress_lzss_next_pixel(c, &state);
if (rval != 0) {
return rval;
}
text_buf[r++] = c;
r &= (N - 1);
} else {
if (src < srcend) {
i = *src++;
} else {
break;
}
if (src < srcend) {
j = *src++;
} else {
break;
}
i |= ((j & 0xF0) << 4);
j = (j & 0x0F) + THRESHOLD;
for (k = 0; k <= j; k++) {
c = text_buf[(i + k) & (N - 1)];
rval = vc_decompress_lzss_next_pixel(c, &state);
if (rval != 0) {
return rval;
}
text_buf[r++] = c;
r &= (N - 1);
}
}
}
return 0;
}
void
noroot_icon_test(void)
{
boolean_t o_vc_progress_enable = vc_progress_enable;
vc_progress_enable = 1;
//PE_display_icon( 0, "noroot");
vc_progress_enable = o_vc_progress_enable;
}
void
vc_display_icon( vc_progress_element * desc,
const unsigned char * data )
{
int x, y, width, height;
if (vc_progress_enable && vc_clut) {
vc_clean_boot_graphics();
width = desc->width;
height = desc->height;
x = desc->dx;
y = desc->dy;
if (1 & desc->flags) {
x += ((vinfo.v_width - width) / 2);
y += ((vinfo.v_height - height) / 2);
}
vc_blit_rect( x, y, 0, width, height, width, height, width, 0, data, NULL, kDataIndexed );
}
}
void
vc_progress_initialize( vc_progress_element * desc,
const unsigned char * data1x,
const unsigned char * data2x,
const unsigned char * data3x,
const unsigned char * clut )
{
uint64_t abstime;
if ((!clut) || (!desc) || (!data1x)) {
return;
}
vc_clut = clut;
vc_clut8 = clut;
vc_progress = desc;
vc_progress_data[0] = data1x;
vc_progress_data[1] = data2x;
vc_progress_data[2] = data3x;
if (2 & vc_progress->flags) {
vc_progress_alpha = data1x
+ vc_progress->count * vc_progress->width * vc_progress->height;
} else {
vc_progress_alpha = NULL;
}
thread_call_setup(&vc_progress_call, vc_progress_task, NULL);
clock_interval_to_absolutetime_interval(vc_progress->time, 1000 * 1000, &abstime);
vc_progress_interval = (uint32_t)abstime;
#if defined(XNU_TARGET_OS_OSX)
thread_call_setup(&vc_progressmeter_call, vc_progressmeter_task, NULL);
clock_interval_to_absolutetime_interval(1000 / 8, 1000 * 1000, &abstime);
vc_progressmeter_interval = (uint32_t)abstime;
#endif /* defined(XNU_TARGET_OS_OSX) */
}
void
vc_progress_set(boolean_t enable, uint32_t vc_delay)
{
spl_t s;
void *saveBuf = NULL;
vm_size_t saveLen = 0;
unsigned int count;
unsigned int index;
unsigned char pdata8;
unsigned short pdata16;
unsigned short * buf16;
unsigned int pdata32;
unsigned int * buf32;
if (!vc_progress) {
return;
}
#if defined(CONFIG_VC_PROGRESS_METER_SUPPORT)
#if defined (__x86_64__)
if (kBootArgsFlagBlack & ((boot_args *) PE_state.bootArgs)->flags) {
return;
}
#endif /* defined (__x86_64__) */
if (1 & vc_progress_withmeter) {
if (enable) {
internal_enable_progressmeter(kProgressMeterKernel);
}
s = splhigh();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
if (vc_progress_enable != enable) {
vc_progress_enable = enable;
if (enable) {
vc_progressmeter_count = 0;
clock_interval_to_deadline(vc_delay,
1000 * 1000 * 1000 /*second scale*/,
&vc_progressmeter_deadline);
thread_call_enter_delayed(&vc_progressmeter_call, vc_progressmeter_deadline);
} else {
thread_call_cancel(&vc_progressmeter_call);
}
}
simple_unlock(&vc_progress_lock);
splx(s);
if (!enable) {
internal_enable_progressmeter(kProgressMeterOff);
}
return;
}
#endif /* defined(CONFIG_VC_PROGRESS_METER_SUPPORT) */
if (enable) {
saveLen = (vc_progress->width * vc_uiscale) * (vc_progress->height * vc_uiscale) * ((vinfo.v_depth + 7) / 8);
saveBuf = kheap_alloc( KHEAP_DATA_BUFFERS, saveLen, Z_WAITOK );
switch (vinfo.v_depth) {
case 8:
for (count = 0; count < 256; count++) {
vc_revclut8[count] = vc_clut[0x01 * 3];
pdata8 = (vc_clut[0x01 * 3] * count + 0x0ff) >> 8;
for (index = 0; index < 256; index++) {
if ((pdata8 == vc_clut[index * 3 + 0]) &&
(pdata8 == vc_clut[index * 3 + 1]) &&
(pdata8 == vc_clut[index * 3 + 2])) {
vc_revclut8[count] = index;
break;
}
}
}
memset( saveBuf, 0x01, saveLen );
break;
case 16:
buf16 = (unsigned short *) saveBuf;
pdata16 = ((vc_clut[0x01 * 3 + 0] & CLUT_MASK_R)CLUT_SHIFT_R)
| ((vc_clut[0x01 * 3 + 0] & CLUT_MASK_G)CLUT_SHIFT_G)
| ((vc_clut[0x01 * 3 + 0] & CLUT_MASK_B)CLUT_SHIFT_B);
for (count = 0; count < saveLen / 2; count++) {
buf16[count] = pdata16;
}
break;
case 32:
buf32 = (unsigned int *) saveBuf;
pdata32 = ((vc_clut[0x01 * 3 + 0] & 0xff) << 16)
| ((vc_clut[0x01 * 3 + 1] & 0xff) << 8)
| ((vc_clut[0x01 * 3 + 2] & 0xff) << 0);
for (count = 0; count < saveLen / 4; count++) {
buf32[count] = pdata32;
}
break;
}
}
s = splhigh();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
if (vc_progress_enable != enable) {
vc_progress_enable = enable;
if (enable) {
vc_needsave = TRUE;
vc_saveunder = saveBuf;
vc_saveunder_len = saveLen;
saveBuf = NULL;
saveLen = 0;
vc_progress_count = 0;
vc_progress_angle = 0;
clock_interval_to_deadline(vc_delay,
1000 * 1000 * 1000 /*second scale*/,
&vc_progress_deadline);
thread_call_enter_delayed(&vc_progress_call, vc_progress_deadline);
} else {
if (vc_saveunder) {
saveBuf = vc_saveunder;
saveLen = vc_saveunder_len;
vc_saveunder = NULL;
vc_saveunder_len = 0;
}
thread_call_cancel(&vc_progress_call);
}
}
simple_unlock(&vc_progress_lock);
splx(s);
if (saveBuf) {
kheap_free( KHEAP_DATA_BUFFERS, saveBuf, saveLen );
}
}
#if defined(XNU_TARGET_OS_OSX)
static uint32_t
vc_progressmeter_range(uint32_t pos)
{
uint32_t ret;
if (pos > kProgressMeterEnd) {
pos = kProgressMeterEnd;
}
ret = vc_progress_meter_start
+ ((pos * (vc_progress_meter_end - vc_progress_meter_start)) / kProgressMeterEnd);
return ret;
}
static void
vc_progressmeter_task(__unused void *arg0, __unused void *arg)
{
spl_t s;
uint64_t interval;
s = splhigh();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
if (kProgressMeterKernel == vc_progressmeter_enable) {
uint32_t pos = (vc_progressmeter_count >> 13);
internal_set_progressmeter(vc_progressmeter_range(pos));
if (pos < kProgressMeterEnd) {
static uint16_t incr[8] = { 10000, 10000, 8192, 4096, 2048, 384, 384, 64 };
vc_progressmeter_count += incr[(pos * 8) / kProgressMeterEnd];
interval = vc_progressmeter_interval;
interval = ((interval * 256) / vc_progressmeter_diskspeed);
clock_deadline_for_periodic_event(interval, mach_absolute_time(), &vc_progressmeter_deadline);
thread_call_enter_delayed(&vc_progressmeter_call, vc_progressmeter_deadline);
}
}
simple_unlock(&vc_progress_lock);
splx(s);
}
void
vc_progress_setdiskspeed(uint32_t speed)
{
vc_progressmeter_diskspeed = speed;
}
#endif /* defined(XNU_TARGET_OS_OSX) */
static void
vc_progress_task(__unused void *arg0, __unused void *arg)
{
spl_t s;
int x, y, width, height;
uint64_t x_pos, y_pos;
const unsigned char * data;
s = splhigh();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
if (vc_progress_enable) {
do {
vc_progress_count++;
if (vc_progress_count >= vc_progress->count) {
vc_progress_count = 0;
vc_progress_angle++;
}
width = (vc_progress->width * vc_uiscale);
height = (vc_progress->height * vc_uiscale);
data = vc_progress_data[vc_uiscale - 1];
if (!data) {
break;
}
if (kVCUsePosition & vc_progress_options.options) {
/* Rotation: 0:normal, 1:right 90, 2:left 180, 3:left 90 */
switch (3 & vinfo.v_rotate) {
case kDataRotate0:
x_pos = vc_progress_options.x_pos;
y_pos = vc_progress_options.y_pos;
break;
case kDataRotate180:
x_pos = 0xFFFFFFFF - vc_progress_options.x_pos;
y_pos = 0xFFFFFFFF - vc_progress_options.y_pos;
break;
case kDataRotate90:
x_pos = 0xFFFFFFFF - vc_progress_options.y_pos;
y_pos = vc_progress_options.x_pos;
break;
case kDataRotate270:
x_pos = vc_progress_options.y_pos;
y_pos = 0xFFFFFFFF - vc_progress_options.x_pos;
break;
}
x = (uint32_t)((x_pos * (uint64_t) vinfo.v_width) / 0xFFFFFFFFULL);
y = (uint32_t)((y_pos * (uint64_t) vinfo.v_height) / 0xFFFFFFFFULL);
x -= (width / 2);
y -= (height / 2);
} else {
x = (vc_progress->dx * vc_uiscale);
y = (vc_progress->dy * vc_uiscale);
if (1 & vc_progress->flags) {
x += ((vinfo.v_width - width) / 2);
y += ((vinfo.v_height - height) / 2);
}
}
if ((x + width) > (int)vinfo.v_width) {
break;
}
if ((y + height) > (int)vinfo.v_height) {
break;
}
data += vc_progress_count * width * height;
vc_blit_rect( x, y, 0,
width, height, width, height, width, width,
data, vc_saveunder,
kDataAlpha
| (vc_progress_angle & kDataRotate)
| (vc_needsave ? kSave : 0));
vc_needsave = FALSE;
clock_deadline_for_periodic_event(vc_progress_interval, mach_absolute_time(), &vc_progress_deadline);
thread_call_enter_delayed(&vc_progress_call, vc_progress_deadline);
}while (FALSE);
}
simple_unlock(&vc_progress_lock);
splx(s);
}
/*
* Generic Console (Front-End): Master Control
* -------------------------------------------
*/
#if defined (__i386__) || defined (__x86_64__)
#include
#endif
static boolean_t gc_acquired = FALSE;
static boolean_t gc_graphics_boot = FALSE;
static boolean_t gc_desire_text = FALSE;
static boolean_t gc_paused_progress;
static void
gc_pause( boolean_t pause, boolean_t graphics_now )
{
spl_t s;
s = splhigh();
VCPUTC_LOCK_LOCK();
disableConsoleOutput = (pause && !console_is_serial());
gc_enabled = (!pause && !graphics_now);
VCPUTC_LOCK_UNLOCK();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
if (pause) {
gc_paused_progress = vc_progress_enable;
vc_progress_enable = FALSE;
} else {
vc_progress_enable = gc_paused_progress;
}
if (vc_progress_enable) {
#if defined(XNU_TARGET_OS_OSX)
if (1 & vc_progress_withmeter) {
thread_call_enter_delayed(&vc_progressmeter_call, vc_progressmeter_deadline);
} else
#endif /* defined(XNU_TARGET_OS_OSX) */
thread_call_enter_delayed(&vc_progress_call, vc_progress_deadline);
}
simple_unlock(&vc_progress_lock);
splx(s);
}
static void
vc_initialize(__unused struct vc_info * vinfo_p)
{
#ifdef __arm__
unsigned long cnt, data16, data32;
if (vinfo.v_depth == 16) {
for (cnt = 0; cnt < 8; cnt++) {
data32 = vc_colors[cnt][2];
data16 = (data32 & 0x0000F8) << 8;
data16 |= (data32 & 0x00FC00) >> 5;
data16 |= (data32 & 0xF80000) >> 19;
data16 |= data16 << 16;
vc_colors[cnt][1] = data16;
}
}
#endif
vinfo.v_rows = vinfo.v_height / ISO_CHAR_HEIGHT;
vinfo.v_columns = vinfo.v_width / ISO_CHAR_WIDTH;
vinfo.v_rowscanbytes = ((vinfo.v_depth + 7) / 8) * vinfo.v_width;
vc_uiscale = vinfo.v_scale;
if (vc_uiscale > kMaxProgressData) {
//vc_uiscale = kMaxProgressData;
} else if (!vc_uiscale) {
vc_uiscale = 1;
}
}
void initialize_prescreen(struct vc_info new_vinfo) {
vm_initialized = TRUE;
vinfo = new_vinfo;
printf("[i] initialize_screen: b=%08llX, w=%08X, h=%08X, r=%08X, d=%08X\n", /* (BRINGUP) */
new_vinfo.v_physaddr, new_vinfo.v_width, new_vinfo.v_height, new_vinfo.v_rowbytes, new_vinfo.v_type); /* (BRINGUP) */
gc_ops.initialize = vc_initialize;
gc_ops.enable = vc_enable;
gc_ops.paint_char = vc_paint_char;
gc_ops.scroll_down = vc_scroll_down;
gc_ops.scroll_up = vc_scroll_up;
gc_ops.clear_screen = vc_clear_screen;
gc_ops.hide_cursor = vc_reverse_cursor;
gc_ops.show_cursor = vc_reverse_cursor;
gc_ops.update_color = vc_update_color;
printf("[*] gc_initialize\n");
gc_initialize(&vinfo);
gc_graphics_boot = TRUE;
gc_desire_text = FALSE;
vc_progress_options = vc_user_options;
bzero(&vc_user_options, sizeof(vc_user_options));
vc_progress_white = TRUE;
printf("[*] vc_progress_set\n");
vc_progress_set( TRUE /* graphics_now */, 1 /* delay */ );
printf("[*] gc_enable\n");
gc_enable( TRUE );
printf("[√] acquired gc\n");
gc_acquired = TRUE;
}
void
initialize_screen(PE_Video * boot_vinfo, unsigned int op)
{
unsigned int newMapSize = 0;
vm_offset_t newVideoVirt = 0;
boolean_t graphics_now;
uint32_t delay;
if (boot_vinfo) {
struct vc_info new_vinfo = vinfo;
boolean_t makeMapping = FALSE;
/*
* Copy parameters
*/
if (kPEBaseAddressChange != op) {
new_vinfo.v_width = (unsigned int)boot_vinfo->v_width;
new_vinfo.v_height = (unsigned int)boot_vinfo->v_height;
new_vinfo.v_depth = (unsigned int)boot_vinfo->v_depth;
new_vinfo.v_rowbytes = (unsigned int)boot_vinfo->v_rowBytes;
//if (kernel_map == VM_MAP_NULL) {
// only booter supplies HW rotation
new_vinfo.v_rotate = (unsigned int)boot_vinfo->v_rotate;
//}
#if defined(__i386__) || defined(__x86_64__)
new_vinfo.v_type = (unsigned int)boot_vinfo->v_display;
#else
new_vinfo.v_type = 0;
#endif
unsigned int scale = (unsigned int)boot_vinfo->v_scale;
if (scale == kPEScaleFactor1x) {
new_vinfo.v_scale = kPEScaleFactor1x;
} else if (scale == kPEScaleFactor2x) {
new_vinfo.v_scale = kPEScaleFactor2x;
}
else { /* Scale factor not set, default to 1x */
new_vinfo.v_scale = kPEScaleFactor1x;
}
}
new_vinfo.v_name[0] = 0;
new_vinfo.v_physaddr = 0;
/*
* Check if we are have to map the framebuffer
* If VM is up, we are given a virtual address, unless b0 is set to indicate physical.
*/
newVideoVirt = boot_vinfo->v_baseAddr;
makeMapping = 1; //(kernel_map == VM_MAP_NULL) || (0 != (1 & newVideoVirt));
if (makeMapping) {
newVideoVirt = 0;
new_vinfo.v_physaddr = boot_vinfo->v_baseAddr & ~3UL; /* Get the physical address */
#ifndef __LP64__
new_vinfo.v_physaddr |= (((uint64_t) boot_vinfo->v_baseAddrHigh) << 32);
#endif
printf("initialize_screen: b=%08llX, w=%08X, h=%08X, r=%08X, d=%08X\n", /* (BRINGUP) */
new_vinfo.v_physaddr, new_vinfo.v_width, new_vinfo.v_height, new_vinfo.v_rowbytes, new_vinfo.v_type); /* (BRINGUP) */
}
if (!newVideoVirt && !new_vinfo.v_physaddr) { /* Check to see if we have a framebuffer */
printf("initialize_screen: No video - forcing serial mode\n"); /* (BRINGUP) */
new_vinfo.v_depth = 0; /* vc routines are nop */
(void)switch_to_serial_console(); /* Switch into serial mode */
gc_graphics_boot = FALSE; /* Say we are not in graphics mode */
disableConsoleOutput = FALSE; /* Allow printfs to happen */
gc_acquired = TRUE;
} else {
if (makeMapping) {
unsigned int flags = 0; //VM_WIMG_IO;
if (boot_vinfo->v_length != 0) {
newMapSize = (unsigned int) round_page(boot_vinfo->v_length);
} else {
newMapSize = (unsigned int) round_page(new_vinfo.v_height * new_vinfo.v_rowbytes); /* Remember size */
}
abort(); // TODO
//newVideoVirt = io_map_spec((vm_map_offset_t)new_vinfo.v_physaddr, newMapSize, flags); /* Allocate address space for framebuffer */
}
new_vinfo.v_baseaddr = newVideoVirt + boot_vinfo->v_offset; /* Set the new framebuffer address */
}
#if defined(__x86_64__)
// Adjust the video buffer pointer to point to where it is in high virtual (above the hole)
new_vinfo.v_baseaddr |= (VM_MIN_KERNEL_ADDRESS & ~LOW_4GB_MASK);
#endif
/* Update the vinfo structure atomically with respect to the vc_progress task if running */
if (vc_progress) {
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
vinfo = new_vinfo;
simple_unlock(&vc_progress_lock);
} else {
vinfo = new_vinfo;
}
if (kPEBaseAddressChange != op) {
// Graphics mode setup by the booter.
gc_ops.initialize = vc_initialize;
gc_ops.enable = vc_enable;
gc_ops.paint_char = vc_paint_char;
gc_ops.scroll_down = vc_scroll_down;
gc_ops.scroll_up = vc_scroll_up;
gc_ops.clear_screen = vc_clear_screen;
gc_ops.hide_cursor = vc_reverse_cursor;
gc_ops.show_cursor = vc_reverse_cursor;
gc_ops.update_color = vc_update_color;
gc_initialize(&vinfo);
}
}
graphics_now = gc_graphics_boot && !gc_desire_text;
switch (op) {
case kPEGraphicsMode:
gc_graphics_boot = TRUE;
gc_desire_text = FALSE;
break;
case kPETextMode:
gc_graphics_boot = FALSE;
break;
case kPEAcquireScreen:
if (gc_acquired) {
break;
}
vc_progress_options = vc_user_options;
bzero(&vc_user_options, sizeof(vc_user_options));
if (kVCAcquireImmediate & vc_progress_options.options) {
delay = 0;
} else if (kVCDarkReboot & vc_progress_options.options) {
delay = 120;
} else {
delay = vc_acquire_delay;
}
if (kVCDarkBackground & vc_progress_options.options) {
vc_progress_white = TRUE;
} else if (kVCLightBackground & vc_progress_options.options) {
vc_progress_white = FALSE;
}
#if !defined(XNU_TARGET_OS_BRIDGE)
vc_progress_set( graphics_now, delay );
#endif /* !defined(XNU_TARGET_OS_BRIDGE) */
gc_enable( !graphics_now );
gc_acquired = TRUE;
gc_desire_text = FALSE;
break;
case kPEDisableScreen:
if (gc_acquired) {
gc_pause( TRUE, graphics_now );
}
break;
case kPEEnableScreen:
if (gc_acquired) {
gc_pause( FALSE, graphics_now );
}
break;
case kPETextScreen:
if (console_is_serial()) {
break;
}
if (gc_acquired == FALSE) {
gc_desire_text = TRUE;
break;
}
if (gc_graphics_boot == FALSE) {
break;
}
vc_progress_set( FALSE, 0 );
#if defined(XNU_TARGET_OS_OSX)
vc_enable_progressmeter( FALSE );
#endif
gc_enable( TRUE );
break;
case kPEReleaseScreen:
gc_acquired = FALSE;
gc_desire_text = FALSE;
gc_enable( FALSE );
if (gc_graphics_boot == FALSE) {
break;
}
vc_progress_set( FALSE, 0 );
vc_acquire_delay = kProgressReacquireDelay;
vc_progress_white = TRUE;
#if defined(XNU_TARGET_OS_OSX)
vc_enable_progressmeter(FALSE);
vc_progress_withmeter &= ~1;
#endif
vc_clut8 = NULL;
break;
#if defined(__x86_64__)
case kPERefreshBootGraphics:
{
spl_t s;
boolean_t save;
if (kBootArgsFlagBlack & ((boot_args *) PE_state.bootArgs)->flags) {
break;
}
save = vc_progress_white;
vc_progress_white = (0 != (kBootArgsFlagBlackBg & ((boot_args *) PE_state.bootArgs)->flags));
internal_enable_progressmeter(kProgressMeterKernel);
s = splhigh();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
vc_progressmeter_drawn = 0;
internal_set_progressmeter(vc_progressmeter_range(vc_progressmeter_count >> 13));
simple_unlock(&vc_progress_lock);
splx(s);
internal_enable_progressmeter(kProgressMeterOff);
vc_progress_white = save;
}
#endif
}
}
void vcattach(void); /* XXX gcc 4 warning cleanup */
void
vcattach(void)
{
vm_initialized = TRUE;
#if defined(CONFIG_VC_PROGRESS_METER_SUPPORT)
const boot_args * bootargs = (typeof(bootargs))PE_state.bootArgs;
PE_parse_boot_argn("meter", &vc_progress_withmeter, sizeof(vc_progress_withmeter));
#if defined(__x86_64__)
vc_progress_white = (0 != ((kBootArgsFlagBlackBg | kBootArgsFlagLoginUI)
& bootargs->flags));
if (kBootArgsFlagInstallUI & bootargs->flags) {
vc_progress_meter_start = (bootargs->bootProgressMeterStart * kProgressMeterMax) / 65535;
vc_progress_meter_end = (bootargs->bootProgressMeterEnd * kProgressMeterMax) / 65535;
} else {
vc_progress_meter_start = 0;
vc_progress_meter_end = kProgressMeterEnd;
}
#else
vc_progress_meter_start = 0;
vc_progress_meter_end = kProgressMeterEnd;
#endif /* defined(__x86_64__ */
#endif /* defined(CONFIG_VC_PROGRESS_METER_SUPPORT) */
simple_lock_init(&vc_progress_lock, 0);
// will never reach this
/*
if (gc_graphics_boot == FALSE) {
long index;
if (gc_acquired) {
initialize_screen(NULL, kPEReleaseScreen);
}
initialize_screen(NULL, kPEAcquireScreen);
for (index = 0; index < msgbufp->msg_bufx; index++) {
if (msgbufp->msg_bufc[index] == '\0') {
continue;
}
vcputc( 0, 0, msgbufp->msg_bufc[index] );
if (msgbufp->msg_bufc[index] == '\n') {
vcputc( 0, 0, '\r' );
}
}
}
*/
}
#if defined(XNU_TARGET_OS_OSX)
// redraw progress meter between pixels start, end, position at pos,
// options (including rotation) passed in flags
static void
vc_draw_progress_meter(unsigned int flags, int start, int end, int pos)
{
const unsigned char *data;
int i, width, bx, srcRow, backRow;
int rectX, rectY, rectW, rectH;
int endCapPos, endCapStart;
int barWidth = kProgressBarWidth * vc_uiscale;
int barHeight = kProgressBarHeight * vc_uiscale;
int capWidth = kProgressBarCapWidth * vc_uiscale;
// 1 rounded fill, 0 square end
int style = (0 == (2 & vc_progress_withmeter));
// 1 white, 0 greyed out
int onoff;
for (i = start; i < end; i += width) {
onoff = (i < pos);
endCapPos = ((style && onoff) ? pos : barWidth);
endCapStart = endCapPos - capWidth;
if (flags & kDataBack) { // restore back bits
width = end;// loop done after this iteration
data = NULL;
srcRow = 0;
} else if (i < capWidth) { // drawing the left cap
width = (end < capWidth) ? (end - i) : (capWidth - i);
data = progressmeter_leftcap[vc_uiscale >= 2][onoff];
data += i;
srcRow = capWidth;
} else if (i < endCapStart) { // drawing the middle
width = (end < endCapStart) ? (end - i) : (endCapStart - i);
data = progressmeter_middle[vc_uiscale >= 2][onoff];
srcRow = 1;
} else { // drawing the right cap
width = endCapPos - i;
data = progressmeter_rightcap[vc_uiscale >= 2][onoff];
data += i - endCapStart;
srcRow = capWidth;
}
switch (flags & kDataRotate) {
case kDataRotate90: // left middle, bar goes down
rectW = barHeight;
rectH = width;
rectX = ((vinfo.v_width / 3) - (barHeight / 2));
rectY = ((vinfo.v_height - barWidth) / 2) + i;
bx = i * barHeight;
backRow = barHeight;
break;
case kDataRotate180: // middle upper, bar goes left
rectW = width;
rectH = barHeight;
rectX = ((vinfo.v_width - barWidth) / 2) + barWidth - width - i;
rectY = (vinfo.v_height / 3) - (barHeight / 2);
bx = barWidth - width - i;
backRow = barWidth;
break;
case kDataRotate270: // right middle, bar goes up
rectW = barHeight;
rectH = width;
rectX = (vinfo.v_width - (vinfo.v_width / 3) - (barHeight / 2));
rectY = ((vinfo.v_height - barWidth) / 2) + barWidth - width - i;
bx = (barWidth - width - i) * barHeight;
backRow = barHeight;
break;
default:
case kDataRotate0: // middle lower, bar goes right
rectW = width;
rectH = barHeight;
rectX = ((vinfo.v_width - barWidth) / 2) + i;
rectY = vinfo.v_height - (vinfo.v_height / 3) - (barHeight / 2);
bx = i;
backRow = barWidth;
break;
}
vc_blit_rect(rectX, rectY, bx, rectW, rectH, width, barHeight,
srcRow, backRow, data, vc_progressmeter_backbuffer, flags);
}
}
extern void IORecordProgressBackbuffer(void * buffer, size_t size, uint32_t theme);
static void
internal_enable_progressmeter(int new_value)
{
spl_t s;
void * new_buffer;
boolean_t stashBackbuffer;
int flags = vinfo.v_rotate;
stashBackbuffer = FALSE;
new_buffer = NULL;
if (new_value) {
new_buffer = kheap_alloc(KHEAP_DATA_BUFFERS,
(kProgressBarWidth * vc_uiscale) *
(kProgressBarHeight * vc_uiscale) * sizeof(int), Z_WAITOK);
}
s = splhigh();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
if (kProgressMeterUser == new_value) {
if (gc_enabled || !gc_acquired || !gc_graphics_boot) {
new_value = vc_progressmeter_enable;
}
}
if (new_value != vc_progressmeter_enable) {
if (new_value) {
if (kProgressMeterOff == vc_progressmeter_enable) {
vc_progressmeter_backbuffer = new_buffer;
vc_draw_progress_meter(kDataAlpha | kSave | flags, 0, (kProgressBarWidth * vc_uiscale), 0);
new_buffer = NULL;
vc_progressmeter_drawn = 0;
}
vc_progressmeter_enable = new_value;
} else if (vc_progressmeter_backbuffer) {
if (kProgressMeterUser == vc_progressmeter_enable) {
vc_draw_progress_meter(kDataBack | flags, 0, (kProgressBarWidth * vc_uiscale), vc_progressmeter_drawn);
} else {
stashBackbuffer = TRUE;
}
new_buffer = vc_progressmeter_backbuffer;
vc_progressmeter_backbuffer = NULL;
vc_progressmeter_enable = FALSE;
}
}
simple_unlock(&vc_progress_lock);
splx(s);
if (new_buffer) {
if (stashBackbuffer) {
IORecordProgressBackbuffer(new_buffer,
(kProgressBarWidth * vc_uiscale)
* (kProgressBarHeight * vc_uiscale)
* sizeof(int),
vc_progress_white);
}
kheap_free(KHEAP_DATA_BUFFERS, new_buffer,
(kProgressBarWidth * vc_uiscale) *
(kProgressBarHeight * vc_uiscale) * sizeof(int));
}
}
static void
internal_set_progressmeter(int new_value)
{
int x1, x3;
int capRedraw;
// 1 rounded fill, 0 square end
int style = (0 == (2 & vc_progress_withmeter));
int flags = kDataAlpha | vinfo.v_rotate;
if ((new_value < 0) || (new_value > kProgressMeterMax)) {
return;
}
if (vc_progressmeter_enable) {
vc_progressmeter_value = new_value;
capRedraw = (style ? (kProgressBarCapWidth * vc_uiscale) : 0);
x3 = (((kProgressBarWidth * vc_uiscale) - 2 * capRedraw) * vc_progressmeter_value) / kProgressMeterMax;
x3 += (2 * capRedraw);
if (x3 > vc_progressmeter_drawn) {
x1 = capRedraw;
if (x1 > vc_progressmeter_drawn) {
x1 = vc_progressmeter_drawn;
}
vc_draw_progress_meter(flags, vc_progressmeter_drawn - x1, x3, x3);
} else {
vc_draw_progress_meter(flags, x3 - capRedraw, vc_progressmeter_drawn, x3);
}
vc_progressmeter_drawn = x3;
}
}
void
vc_enable_progressmeter(int new_value)
{
internal_enable_progressmeter(new_value ? kProgressMeterUser : kProgressMeterOff);
}
void
vc_set_progressmeter(int new_value)
{
spl_t s;
s = splhigh();
simple_lock(&vc_progress_lock, LCK_GRP_NULL);
if (vc_progressmeter_enable) {
if (kProgressMeterKernel != vc_progressmeter_enable) {
internal_set_progressmeter(new_value);
}
} else {
vc_progressmeter_value = new_value;
}
simple_unlock(&vc_progress_lock);
splx(s);
}
#endif /* defined(XNU_TARGET_OS_OSX) */
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/console/video_console.h
================================================
/*
* Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* @APPLE_FREE_COPYRIGHT@
*/
#ifndef _VIDEO_CONSOLE_H_
#define _VIDEO_CONSOLE_H_
#include
#ifdef __cplusplus
extern "C" {
#endif
#define kVCSysctlProgressOptions "kern.progressoptions"
#define kVCSysctlConsoleOptions "kern.consoleoptions"
#define kVCSysctlProgressMeterEnable "kern.progressmeterenable"
#define kVCSysctlProgressMeter "kern.progressmeter"
enum{
kVCDarkReboot = 0x00000001,
kVCAcquireImmediate = 0x00000002,
kVCUsePosition = 0x00000004,
kVCDarkBackground = 0x00000008,
kVCLightBackground = 0x00000010,
};
enum {
kDataRotate0 = 0,
kDataRotate90 = 1,
kDataRotate180 = 2,
kDataRotate270 = 3
};
struct vc_progress_user_options {
uint32_t options;
// fractional position of middle of spinner 0 (0.0) - 0xFFFFFFFF (1.0)
uint32_t x_pos;
uint32_t y_pos;
uint32_t resv[8];
};
typedef struct vc_progress_user_options vc_progress_user_options;
// #if XNU_KERNEL_PRIVATE
void vcputc(int, int, int);
int vcgetc( int l,
int u,
boolean_t wait,
boolean_t raw );
void video_scroll_up( void *start,
void *end,
void *dest );
void video_scroll_down( void *start, /* HIGH addr */
void *end, /* LOW addr */
void *dest ); /* HIGH addr */
struct vc_info {
unsigned int v_height; /* pixels */
unsigned int v_width; /* pixels */
unsigned int v_depth;
unsigned int v_rowbytes;
unsigned long v_baseaddr;
unsigned int v_type;
char v_name[32];
uint64_t v_physaddr;
unsigned int v_rows; /* characters */
unsigned int v_columns; /* characters */
unsigned int v_rowscanbytes; /* Actualy number of bytes used for display per row*/
unsigned int v_scale;
unsigned int v_rotate;
unsigned int v_reserved[3];
};
struct vc_progress_element {
unsigned int version;
unsigned int flags;
unsigned int time;
unsigned char count;
unsigned char res[3];
int width;
int height;
int dx;
int dy;
int transparent;
unsigned int res2[3];
};
typedef struct vc_progress_element vc_progress_element;
extern struct vc_progress_user_options vc_user_options;
void vc_progress_initialize( vc_progress_element * desc,
const unsigned char * data1x,
const unsigned char * data2x,
const unsigned char * data3x,
const unsigned char * clut );
void vc_progress_set(boolean_t enable, uint32_t vc_delay);
void vc_display_icon( vc_progress_element * desc, const unsigned char * data );
int vc_display_lzss_icon(uint32_t dst_x, uint32_t dst_y,
uint32_t image_width, uint32_t image_height,
const uint8_t *compressed_image,
uint32_t compressed_size,
const uint8_t *clut);
#if defined(XNU_TARGET_OS_OSX)
extern void vc_enable_progressmeter(int new_value);
extern void vc_set_progressmeter(int new_value);
extern int vc_progressmeter_enable;
extern int vc_progressmeter_value;
extern void vc_progress_setdiskspeed(uint32_t speed);
#endif /* defined(XNU_TARGET_OS_OSX) */
// #endif /* XNU_KERNEL_PRIVATE */
#ifdef __cplusplus
}
#endif
#endif /* _VIDEO_CONSOLE_H_ */
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/console/video_scroll.c
================================================
/*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#include
#include "video_console.h"
void
video_scroll_up(void * start, void * end, void * dest)
{
bcopy(start, dest, ((char *)end - (char *)start) << 2);
}
void
video_scroll_down(void * start, /* HIGH addr */
void * end, /* LOW addr */
void * dest) /* HIGH addr */
{
bcopy(end, dest, ((char *)start - (char *)end) << 2);
}
================================================
FILE: RootHelperSample/launchdshim/launchdhook/verbose/verbose_boot.m
================================================
#import
#include
#import
#import
#import
#import
#import "IOMobileFramebuffer.h"
#include
#include
#include
#include
#include "console/video_console.c"
//void IOMobileFramebufferSwapDirtyRegion(IOMobileFramebufferRef conn);
IOMobileFramebufferRef fbConn;
IOSurfaceRef surface, oldSurface;
pthread_t logger;
// int pfd[2];
// void initialize_prescreen(struct vc_info vinfo);
void initFramebuffer() {
CGContextRef context;
printf("[*] Connection init\n");
printf("[*] size variable init\n");
IOMobileFramebufferDisplaySize size;
printf("[*] getting main display\n");
IOMobileFramebufferGetMainDisplay(&fbConn);
printf("[*] getting display size\n");
IOMobileFramebufferGetDisplaySize(fbConn, &size);
printf("[i] found size %f*%f\n", size.height, size.width);
printf("[*] getting iosurface\n");
NSDictionary *properties = @{
(id)kIOSurfaceIsGlobal: @(NO),
(id)kIOSurfaceWidth: @(size.width),
(id)kIOSurfaceHeight: @(size.height),
(id)kIOSurfacePixelFormat: @((uint32_t)'BGRA'),
(id)kIOSurfaceBytesPerElement: @(4)
};
surface = IOSurfaceCreate((__bridge CFDictionaryRef)properties);
//IOMobileFramebufferGetLayerDefaultSurface
//IOMobileFramebufferCopyLayerDisplayedSurface(fbConn, 0, &surface);
printf("[i] got surface %p\n", surface);
printf("[*] vinfo setup\n");
struct vc_info vinfo;
vinfo.v_width = IOSurfaceGetWidth(surface);
vinfo.v_height = IOSurfaceGetHeight(surface);
vinfo.v_depth = 32; // 16, 32?
vinfo.v_type = 0;
vinfo.v_scale = 2; //kPEScaleFactor2x;
vinfo.v_name[0] = 0;
vinfo.v_rowbytes = IOSurfaceGetBytesPerRow(surface);
vinfo.v_baseaddr = (unsigned long)IOSurfaceGetBaseAddress(surface);
printf("[*] initializing\n");
IOSurfaceLock(surface, 0, nil);
//memset((void *)vinfo.v_baseaddr, 0xFFFFFFFF, vinfo.v_width * vinfo.v_height);
initialize_prescreen(vinfo);
IOSurfaceUnlock(surface, 0, 0);
printf("[√] PTR %p\n", IOSurfaceGetBaseAddress(surface));
int token;
CGRect frame = CGRectMake(0, 0, vinfo.v_width, vinfo.v_height);
IOMobileFramebufferSwapBegin(fbConn, &token);
IOMobileFramebufferSwapSetLayer(fbConn, 0, surface, frame, frame, 0);
IOMobileFramebufferSwapEnd(fbConn);
}
void printText(char *str) {
//CGRect frame = CGRectMake(0, 0, IOSurfaceGetWidth(surface), IOSurfaceGetHeight(surface));
for (int i = 0; str[i]; i++) {
//IOSurfaceLock(surface, 0, nil);
char c = str[i];
vcputc(0, 0, c);
if (c == '\n' || !str[i+1]) {
vcputc(0, 0, '\r');
//IOSurfaceUnlock(surface, 0, 0);
//IOMobileFramebufferSwapBegin(fbConn, NULL);
//IOMobileFramebufferSwapSetLayer(fbConn, 0, surface, frame, frame);
//IOMobileFramebufferSwapEnd(fbConn);
}
}
}
pthread_t logger;
int pfd[2];
static void *logger_thread() {
initFramebuffer();
CGRect frame = CGRectMake(0, 0, IOSurfaceGetWidth(surface), IOSurfaceGetHeight(surface));
setvbuf(stdout, 0, _IOLBF, 0);
setvbuf(stderr, 0, _IONBF, 0);
pipe(pfd);
dup2(pfd[1], 1);
dup2(pfd[1], 2);
//ssize_t rsize;
char c;
uint8_t linesPrinted = 0;
while (read(pfd[0], &c, 1) > 0) {
vcputc(0, 0, c);
if (c == '\n') {
vcputc(0, 0, '\r');
static int lines = 0;
if (lines++ > 100) return NULL;
CGRect frame = CGRectMake(0, 0, vinfo.v_width, vinfo.v_height);
IOMobileFramebufferSwapBegin(fbConn, NULL);
IOMobileFramebufferSwapSetLayer(fbConn, 0, surface, frame, frame, 0);
IOMobileFramebufferSwapEnd(fbConn);
}
}
return NULL;
}
void initVerboseFramebuffer() {
pthread_create(&logger, 0, logger_thread, 0);
pthread_detach(logger);
for (int i = 0; i < 4; i++) {
printf(" \n");
}
printf("Done: initVerboseFramebuffer\n");
}
================================================
FILE: RootHelperSample/main.m
================================================
#import
@import Foundation;
#import
#import
#import
#import
#import "TSUtil.h"
#import
#import
#import
#import "codesign.h"
#import "coretrust_bug.h"
#import
#import
#import
#import
#include
#include "insert_dylib.h"
/* Attach to a process that is already running. */
//PTRACE_ATTACH = 16,
#define PT_ATTACH 16
/* Detach from a process attached to with PTRACE_ATTACH. */
//PTRACE_DETACH = 17,
#define PT_DETACH 17
#define PT_ATTACHEXC 14 /* attach to running process with signal exception */
#define PT_TRACE_ME 0
int ptrace(int, pid_t, caddr_t, int);
#define JB_ROOT_PREFIX ".jbroot-"
#define JB_RAND_LENGTH (sizeof(uint64_t)*sizeof(char)*2)
int is_jbrand_value(uint64_t value)
{
uint8_t check = value>>8 ^ value >> 16 ^ value>>24 ^ value>>32 ^ value>>40 ^ value>>48 ^ value>>56;
return check == (uint8_t)value;
}
int is_jbroot_name(const char* name)
{
if(strlen(name) != (sizeof(JB_ROOT_PREFIX)-1+JB_RAND_LENGTH))
return 0;
if(strncmp(name, JB_ROOT_PREFIX, sizeof(JB_ROOT_PREFIX)-1) != 0)
return 0;
char* endp=NULL;
uint64_t value = strtoull(name+sizeof(JB_ROOT_PREFIX)-1, &endp, 16);
if(!endp || *endp!='\0')
return 0;
if(!is_jbrand_value(value))
return 0;
return 1;
}
uint64_t resolve_jbrand_value(const char* name)
{
if(strlen(name) != (sizeof(JB_ROOT_PREFIX)-1+JB_RAND_LENGTH))
return 0;
if(strncmp(name, JB_ROOT_PREFIX, sizeof(JB_ROOT_PREFIX)-1) != 0)
return 0;
char* endp=NULL;
uint64_t value = strtoull(name+sizeof(JB_ROOT_PREFIX)-1, &endp, 16);
if(!endp || *endp!='\0')
return 0;
if(!is_jbrand_value(value))
return 0;
return value;
}
NSString* find_jbroot()
{
//jbroot path may change when re-randomize it
NSString * jbroot = nil;
NSArray *subItems = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/containers/Bundle/Application/" error:nil];
for (NSString *subItem in subItems) {
if (is_jbroot_name(subItem.UTF8String))
{
NSString* path = [@"/var/containers/Bundle/Application/" stringByAppendingPathComponent:subItem];
jbroot = path;
break;
}
}
return jbroot;
}
NSString *jbroot(NSString *path)
{
NSString* jbroot = find_jbroot();
return [jbroot stringByAppendingPathComponent:path];
}
NSString* usprebooterPath()
{
NSError* mcmError;
MCMAppContainer* appContainer = [MCMAppContainer containerWithIdentifier:@"pisshill.usprebooter" createIfNecessary:NO existed:NULL error:&mcmError];
if(!appContainer) return nil;
return appContainer.url.path;
}
NSString* usprebooterappPath()
{
return [usprebooterPath() stringByAppendingPathComponent:@"usprebooter.app"];
}
//BOOL isLdidInstalled(void)
//{
// NSString* ldidPath = [trollStoreAppPath() stringByAppendingPathComponent:@"ldid"];
// return [[NSFileManager defaultManager] fileExistsAtPath:ldidPath];
//}
int runLdid(NSArray* args, NSString** output, NSString** errorOutput)
{
NSString* ldidPath = [usprebooterappPath() stringByAppendingPathComponent:@"ldid"];
NSMutableArray* argsM = args.mutableCopy ?: [NSMutableArray new];
[argsM insertObject:ldidPath.lastPathComponent atIndex:0];
NSUInteger argCount = [argsM count];
char **argsC = (char **)malloc((argCount + 1) * sizeof(char*));
for (NSUInteger i = 0; i < argCount; i++)
{
argsC[i] = strdup([[argsM objectAtIndex:i] UTF8String]);
}
argsC[argCount] = NULL;
posix_spawn_file_actions_t action;
posix_spawn_file_actions_init(&action);
int outErr[2];
pipe(outErr);
posix_spawn_file_actions_adddup2(&action, outErr[1], STDERR_FILENO);
posix_spawn_file_actions_addclose(&action, outErr[0]);
int out[2];
pipe(out);
posix_spawn_file_actions_adddup2(&action, out[1], STDOUT_FILENO);
posix_spawn_file_actions_addclose(&action, out[0]);
pid_t task_pid;
int status = -200;
int spawnError = posix_spawn(&task_pid, [ldidPath fileSystemRepresentation], &action, NULL, (char* const*)argsC, NULL);
for (NSUInteger i = 0; i < argCount; i++)
{
free(argsC[i]);
}
free(argsC);
if(spawnError != 0)
{
NSLog(@"posix_spawn error %d\n", spawnError);
return spawnError;
}
do
{
if (waitpid(task_pid, &status, 0) != -1) {
//printf("Child status %dn", WEXITSTATUS(status));
} else
{
perror("waitpid");
return -222;
}
} while (!WIFEXITED(status) && !WIFSIGNALED(status));
close(outErr[1]);
close(out[1]);
NSString* ldidOutput = getNSStringFromFile(out[0]);
if(output)
{
*output = ldidOutput;
}
NSString* ldidErrorOutput = getNSStringFromFile(outErr[0]);
if(errorOutput)
{
*errorOutput = ldidErrorOutput;
}
return WEXITSTATUS(status);
}
int signAdhoc(NSString *filePath, NSString *entitlements) // lets just assume ldid is included ok
{
// if(!isLdidInstalled()) return 173;
// NSString *entitlementsPath = nil;
NSString *signArg = @"-S";
NSString* errorOutput;
if(entitlements) {
// NSData *entitlementsXML = [NSPropertyListSerialization dataWithPropertyList:entitlements format:NSPropertyListXMLFormat_v1_0 options:0 error:nil];
// if (entitlementsXML) {
// entitlementsPath = [[NSTemporaryDirectory() stringByAppendingPathComponent:[NSUUID UUID].UUIDString] stringByAppendingPathExtension:@"plist"];
// [entitlementsXML writeToFile:entitlementsPath atomically:NO];
signArg = [signArg stringByAppendingString:entitlements];
// signArg = [signArg stringByAppendingString:@" -Cadhoc"];
// signArg = [signArg stringByAppendingString:@" -M"];
// signArg = [signArg stringByAppendingString:@"/sbin/launchd"];
// }
}
NSLog(@"roothelper: running ldid");
int ldidRet = runLdid(@[signArg, filePath], nil, &errorOutput);
// if (entitlementsPath) {
// [[NSFileManager defaultManager] removeItemAtPath:entitlementsPath error:nil];
// }
NSLog(@"roothelper: ldid exited with status %d", ldidRet);
NSLog(@"roothelper: - ldid error output start -");
printMultilineNSString(signArg);
printMultilineNSString(errorOutput);
NSLog(@"roothelper: - ldid error output end -");
if(ldidRet == 0)
{
return 0;
}
else
{
return 175;
}
//}
}
NSSet* immutableAppBundleIdentifiers(void)
{
NSMutableSet* systemAppIdentifiers = [NSMutableSet new];
LSEnumerator* enumerator = [LSEnumerator enumeratorForApplicationProxiesWithOptions:0];
LSApplicationProxy* appProxy;
while(appProxy = [enumerator nextObject])
{
if(appProxy.installed)
{
if(![appProxy.bundleURL.path hasPrefix:@"/private/var/containers"])
{
[systemAppIdentifiers addObject:appProxy.bundleIdentifier.lowercaseString];
}
}
}
return systemAppIdentifiers.copy;
}
void replaceByte(NSString *filePath, int offset, const char *replacement) {
const char *fileCString = [filePath UTF8String];
FILE *file = fopen(fileCString, "r+");
if (file == NULL) {
NSLog(@"Error opening workinglaunchd");
perror("Error opening file");
return;
}
fseek(file, offset, SEEK_SET);
fwrite(replacement, sizeof(char), 4, file);
fclose(file);
}
int main(int argc, char *argv[], char *envp[]) {
@autoreleasepool {
// NSLog(@"Hello from the other side! our uid is %u and our pid is %d", getuid(), getpid());
loadMCMFramework();
NSString* action = [NSString stringWithUTF8String:argv[1]];
NSString* source = [NSString stringWithUTF8String:argv[2]];
NSString* destination = [NSString stringWithUTF8String:argv[3]];
if ([action isEqual: @"writedata"]) {
[source writeToFile:destination atomically:YES encoding:NSUTF8StringEncoding error:nil];
} else if ([action isEqual: @"filemove"]) {
[[NSFileManager defaultManager] moveItemAtPath:source toPath:destination error:nil];
} else if ([action isEqual: @"filecopy"]) {
NSLog(@"roothelper: cp");
[[NSFileManager defaultManager] copyItemAtPath:source toPath:destination error:nil];
} else if ([action isEqual: @"makedirectory"]) {
NSLog(@"roothelper: mkdir");
[[NSFileManager defaultManager] createDirectoryAtPath:source withIntermediateDirectories:true attributes:nil error:nil];
} else if ([action isEqual: @"removeitem"]) {
NSLog(@"roothelper: rm");
[[NSFileManager defaultManager] removeItemAtPath:source error:nil];
} else if ([action isEqual: @"permissionset"]) {
NSLog(@"roothelper chmod %@", source); // just pass in 755
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:[NSNumber numberWithInt:755] forKey:NSFilePosixPermissions];
[[NSFileManager defaultManager] setAttributes:dict ofItemAtPath:source error:nil];
// } else if ([action isEqual: @"rebuildiconcache"]) {
// cleanRestrictions();
// [[LSApplicationWorkspace defaultWorkspace] _LSPrivateRebuildApplicationDatabasesForSystemApps:YES internal:YES user:YES];
// refreshAppRegistrations();
// killall(@"backboardd");
} else if ([action isEqual: @"codesign"]) {
NSLog(@"roothelper: adhoc sign + fastsign");
// NSDictionary* entitlements = @{
// @"get-task-allow": [NSNumber numberWithBool:YES],
// @"platform-application": [NSNumber numberWithBool:YES],
// };
NSString* launchdents = [usprebooterappPath() stringByAppendingPathComponent:@"launchdentitlements.plist"];
NSString* patchedLaunchdCopy = [usprebooterappPath() stringByAppendingPathComponent:@"workinglaunchd"];
signAdhoc(patchedLaunchdCopy, launchdents); // source file, NSDictionary with entitlements
// TODO: Use ct_bypass instead of fastPathSign, it's just better :trol:
NSString *fastPathSignPath = [usprebooterappPath() stringByAppendingPathComponent:@"fastPathSign"];
NSString *stdOut;
NSString *stdErr;
spawnRoot(fastPathSignPath, @[@"-i", patchedLaunchdCopy, @"-r", @"-o", patchedLaunchdCopy], &stdOut, &stdErr);
} else if ([action isEqual: @"ptrace"]) {
NSLog(@"roothelper: stage 1 ptrace");
NSString *stdOut;
NSString *stdErr;
NSLog(@"trolltoolshelper path %@", rootHelperPath());
spawnRoot(rootHelperPath(), @[@"ptrace2", source, @""], &stdOut, &stdErr);
kill(getpid(), 1);
} else if ([action isEqual: @"ptrace2"]) {
NSLog(@"roothelper: stage 2 ptrace, app pid: %@", source);
int pidInt = [source intValue];
// source = pid of app.
// ptrace the source, the pid of the original app
// then detach immediately
// ptrace(PT_TRACE_ME,0,0,0);
ptrace(PT_ATTACH, pidInt, 0, 0);
ptrace(PT_DETACH, pidInt, 0, 0);
NSLog(@"Done ptracing!");
} else if ([action isEqual: @"bootstrap"]) {
NSLog(@"installing");
if (!jbroot(@"/")) {
NSLog(@"jbroot not found...");
} else {
// if (!jbroot(@"lunchd")) {
// 1. install roothide bootstrap
// 2. copy over launchd to your macos from your phone
NSLog(@"copy launchd over");
[[NSFileManager defaultManager] copyItemAtPath:@"/sbin/launchd" toPath:[usprebooterappPath() stringByAppendingPathComponent:@"workinglaunchd"] error:nil];
// remove cpu subtype, insert_dylib, then
replaceByte([usprebooterappPath() stringByAppendingPathComponent:@"workinglaunchd"], 8, "\x00\x00\x00\x00");
insert_dylib_main("@loader_path/launchdhook.dylib", [[usprebooterappPath() stringByAppendingPathComponent:@"workinglaunchd"] UTF8String]);
sleep(1);
NSLog(@"sign launchd over and out");
spawnRoot(rootHelperPath(), @[@"codesign", source, @""], nil, nil);
// 3. copy over workinglaunchd to your jbroot/lunchd
[[NSFileManager defaultManager] copyItemAtPath:[usprebooterappPath() stringByAppendingPathComponent:@"workinglaunchd"] toPath:jbroot(@"lunchd") error:nil];
// 4. copy over launchdhooksigned.dylib as jbroot/launchdhook.dylib
[[NSFileManager defaultManager] copyItemAtPath:[usprebooterappPath() stringByAppendingPathComponent:@"launchdhooksigned.dylib"] toPath:jbroot(@"launchdhook.dylib") error:nil];
// 5. copy over your regular SpringBoard.app to jbroot/System/Library/CoreServices/SpringBoard.app
[[NSFileManager defaultManager] createDirectoryAtPath: jbroot(@"/System/Library/CoreServices/") withIntermediateDirectories:YES attributes:nil error:nil];
[[NSFileManager defaultManager] copyItemAtPath:@"/System/Library/CoreServices/SpringBoard.app" toPath:jbroot(@"/System/Library/CoreServices/SpringBoard.app") error:nil];
// 6. replace the regular SpringBoard in your jbroot/System/Library/CoreServices/SpringBoard.app/SpringBoard with springboardshimsignedinjected
[[NSFileManager defaultManager] removeItemAtPath:jbroot(@"/System/Library/CoreServices/SpringBoard.app/SpringBoard") error:nil];
[[NSFileManager defaultManager] copyItemAtPath:[usprebooterappPath() stringByAppendingPathComponent:@"springboardshimsignedinjected"] toPath:jbroot(@"/System/Library/CoreServices/SpringBoard.app/SpringBoard") error:nil];
// 7. place springboardhooksigned.dylib as jbroot/SpringBoard.app/springboardhook.dylib
[[NSFileManager defaultManager] removeItemAtPath:jbroot(@"/System/Library/CoreServices/SpringBoard.app/springboardhook.dylib") error:nil];
[[NSFileManager defaultManager] copyItemAtPath:[usprebooterappPath() stringByAppendingPathComponent:@"springboardhooksigned.dylib"] toPath:[jbroot(@"/System/Library/CoreServices/SpringBoard.app") stringByAppendingPathComponent:@"springboardhook.dylib"] error:nil];
// last step: create a symlink to jbroot named .jbroot
[[NSFileManager defaultManager] createSymbolicLinkAtPath:jbroot(@"/System/Library/CoreServices/SpringBoard.app/.jbroot") withDestinationPath:jbroot(@"/") error:nil];
// } else {
// NSLog(@"lunchd was found, you've already installed");
// }
}
}
return 0;
}
}
================================================
FILE: Serotonin.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
013141FF2B445B26006BEBE9 /* memoryControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 013141FE2B445B26006BEBE9 /* memoryControl.m */; };
C805CA452B1719C1005157BA /* util.m in Sources */ = {isa = PBXBuildFile; fileRef = C805CA442B1719C1005157BA /* util.m */; };
C81122DF2B16C9CC00AD077B /* troller.m in Sources */ = {isa = PBXBuildFile; fileRef = C81122DE2B16C9CC00AD077B /* troller.m */; };
C82AFEF42B175AB80070EA49 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C82AFEF32B175AB80070EA49 /* Assets.xcassets */; };
C82AFF392B17688E0070EA49 /* usprebooterApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82AFEF12B175AA30070EA49 /* usprebooterApp.swift */; };
C82AFF3A2B1768990070EA49 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82AFEEF2B175A270070EA49 /* ContentView.swift */; };
C82AFF3F2B179A8C0070EA49 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C82AFF3D2B179A880070EA49 /* IOKit.framework */; };
C82AFF432B17AA6D0070EA49 /* ldid in Resources */ = {isa = PBXBuildFile; fileRef = C82AFF422B17AA6C0070EA49 /* ldid */; };
C83594CF2B18F70700346F80 /* overwriter.m in Sources */ = {isa = PBXBuildFile; fileRef = C83594CE2B18F70700346F80 /* overwriter.m */; };
C83594D22B18F74600346F80 /* vm_unaligned_copy_switch_race.c in Sources */ = {isa = PBXBuildFile; fileRef = C83594D12B18F74600346F80 /* vm_unaligned_copy_switch_race.c */; };
C84002E92B4A55A300C73950 /* springboardshimsignedinjected in Resources */ = {isa = PBXBuildFile; fileRef = C84002E82B4A55A300C73950 /* springboardshimsignedinjected */; };
C84002ED2B4A64E200C73950 /* launchdentitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = C84002EC2B4A64E200C73950 /* launchdentitlements.plist */; };
C8BFCCA42B3FFE570008D8FD /* fun.m in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC7F2B3FFE560008D8FD /* fun.m */; };
C8BFCCA62B3FFE570008D8FD /* dir.m in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC822B3FFE560008D8FD /* dir.m */; };
C8BFCCA82B3FFE570008D8FD /* utils.m in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC842B3FFE560008D8FD /* utils.m */; };
C8BFCCA92B3FFE570008D8FD /* thanks_opa334dev_htrowii.m in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC852B3FFE560008D8FD /* thanks_opa334dev_htrowii.m */; };
C8BFCCAA2B3FFE570008D8FD /* cs_blobs.m in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC862B3FFE560008D8FD /* cs_blobs.m */; };
C8BFCCAB2B3FFE570008D8FD /* krw.c in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC872B3FFE560008D8FD /* krw.c */; };
C8BFCCAC2B3FFE570008D8FD /* offsets.m in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC882B3FFE560008D8FD /* offsets.m */; };
C8BFCCAD2B3FFE570008D8FD /* vnode.m in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC892B3FFE560008D8FD /* vnode.m */; };
C8BFCCAE2B3FFE570008D8FD /* proc.c in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCC8A2B3FFE560008D8FD /* proc.c */; };
C8BFCCB42B427C0F0008D8FD /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BFCCB32B427C0F0008D8FD /* Log.swift */; };
D6E08F1E2B48B04E00AE49BF /* TheCoolerContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F1D2B48B04E00AE49BF /* TheCoolerContentView.swift */; };
D6E08F4A2B48E24F00AE49BF /* UTTagClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F2E2B48E24E00AE49BF /* UTTagClass.swift */; };
D6E08F4B2B48E24F00AE49BF /* CoreTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F2F2B48E24E00AE49BF /* CoreTypes.swift */; };
D6E08F4C2B48E24F00AE49BF /* UTType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F302B48E24E00AE49BF /* UTType.swift */; };
D6E08F4D2B48E24F00AE49BF /* URLSession+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F322B48E24E00AE49BF /* URLSession+Async.swift */; };
D6E08F4E2B48E24F00AE49BF /* Never+Representation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F352B48E24E00AE49BF /* Never+Representation.swift */; };
D6E08F4F2B48E24F00AE49BF /* Tuple+Representation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F362B48E24F00AE49BF /* Tuple+Representation.swift */; };
D6E08F502B48E24F00AE49BF /* Codable+Representation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F372B48E24F00AE49BF /* Codable+Representation.swift */; };
D6E08F512B48E24F00AE49BF /* Data+Representation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F382B48E24F00AE49BF /* Data+Representation.swift */; };
D6E08F522B48E24F00AE49BF /* _ConditionalRepresentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F392B48E24F00AE49BF /* _ConditionalRepresentation.swift */; };
D6E08F532B48E24F00AE49BF /* File+Representations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F3A2B48E24F00AE49BF /* File+Representations.swift */; };
D6E08F542B48E24F00AE49BF /* Data+Transferable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F3C2B48E24F00AE49BF /* Data+Transferable.swift */; };
D6E08F552B48E24F00AE49BF /* URL+Transferable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F3D2B48E24F00AE49BF /* URL+Transferable.swift */; };
D6E08F562B48E24F00AE49BF /* String+Transferable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F3E2B48E24F00AE49BF /* String+Transferable.swift */; };
D6E08F572B48E24F00AE49BF /* Never+Transferable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F3F2B48E24F00AE49BF /* Never+Transferable.swift */; };
D6E08F582B48E24F00AE49BF /* AttributedString+Transferable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F402B48E24F00AE49BF /* AttributedString+Transferable.swift */; };
D6E08F592B48E24F00AE49BF /* Visibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F422B48E24F00AE49BF /* Visibility.swift */; };
D6E08F5A2B48E24F00AE49BF /* SentTransferredFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F432B48E24F00AE49BF /* SentTransferredFile.swift */; };
D6E08F5B2B48E24F00AE49BF /* ReceivedTransferredFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F442B48E24F00AE49BF /* ReceivedTransferredFile.swift */; };
D6E08F5C2B48E24F00AE49BF /* NSItemProvider+Transferable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F452B48E24F00AE49BF /* NSItemProvider+Transferable.swift */; };
D6E08F5D2B48E24F00AE49BF /* Transferable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F462B48E24F00AE49BF /* Transferable.swift */; };
D6E08F5E2B48E24F00AE49BF /* TransferRepresentationBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F472B48E24F00AE49BF /* TransferRepresentationBuilder.swift */; };
D6E08F5F2B48E24F00AE49BF /* TransferableRepresentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F482B48E24F00AE49BF /* TransferableRepresentation.swift */; };
D6E08F602B48E24F00AE49BF /* Backport.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F492B48E24F00AE49BF /* Backport.swift */; };
D6E0900D2B48E26000AE49BF /* Platforms.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F632B48E25E00AE49BF /* Platforms.swift */; };
D6E0900E2B48E26000AE49BF /* SafeArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F642B48E25E00AE49BF /* SafeArea.swift */; };
D6E0900F2B48E26000AE49BF /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F652B48E25E00AE49BF /* Environment.swift */; };
D6E090102B48E26000AE49BF /* Environment+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F662B48E25E00AE49BF /* Environment+String.swift */; };
D6E090112B48E26000AE49BF /* OwningController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F672B48E25E00AE49BF /* OwningController.swift */; };
D6E090122B48E26000AE49BF /* NSItemProvider+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F682B48E25E00AE49BF /* NSItemProvider+Async.swift */; };
D6E090132B48E26000AE49BF /* UIScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F692B48E25E00AE49BF /* UIScene.swift */; };
D6E090142B48E26000AE49BF /* Inspect.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F6A2B48E25E00AE49BF /* Inspect.swift */; };
D6E090152B48E26000AE49BF /* String+LocalizationKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F6B2B48E25E00AE49BF /* String+LocalizationKey.swift */; };
D6E090162B48E26000AE49BF /* VisualEffect+iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F6D2B48E25F00AE49BF /* VisualEffect+iOS.swift */; };
D6E090172B48E26000AE49BF /* VisualEffect+macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E08F6E2B48E25F00AE49BF /* VisualEffect+macOS.swift */; };
D6E0907C2B48E26000AE49BF /* Detents.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E090022B48E25F00AE49BF /* Detents.swift */; };
D6E090852B48E26000AE49BF /* UIBackport.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E0900C2B48E25F00AE49BF /* UIBackport.swift */; };
D6E0908C2B48E3A200AE49BF /* BlobLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E090872B48E3A200AE49BF /* BlobLayer.swift */; };
D6E0908D2B48E3A200AE49BF /* ResizableLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E090882B48E3A200AE49BF /* ResizableLayer.swift */; };
D6E0908E2B48E3A200AE49BF /* FluidGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E090892B48E3A200AE49BF /* FluidGradientView.swift */; };
D6E0908F2B48E3A200AE49BF /* CGPoint+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E0908A2B48E3A200AE49BF /* CGPoint+Extensions.swift */; };
D6E090902B48E3A200AE49BF /* FluidGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E0908B2B48E3A200AE49BF /* FluidGradient.swift */; };
D6F9CF3F2B4B2F7D00274803 /* ct_bypass in Resources */ = {isa = PBXBuildFile; fileRef = D6F9CF3E2B4B2F7D00274803 /* ct_bypass */; };
D6F9CF412B4B306400274803 /* fastPathSign in Resources */ = {isa = PBXBuildFile; fileRef = D6F9CF402B4B306400274803 /* fastPathSign */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
013141FE2B445B26006BEBE9 /* memoryControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = memoryControl.m; sourceTree = ""; };
013142012B445B48006BEBE9 /* memoryControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memoryControl.h; sourceTree = ""; };
C805CA442B1719C1005157BA /* util.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = util.m; sourceTree = ""; };
C805CA462B1719D5005157BA /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; };
C811229A2B15E7BB00AD077B /* usprebooter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = usprebooter.app; sourceTree = BUILT_PRODUCTS_DIR; };
C81122AB2B15E7BD00AD077B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
C81122CF2B15EA8600AD077B /* usprebooter-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "usprebooter-Bridging-Header.h"; sourceTree = ""; };
C81122DD2B16C9CB00AD077B /* troller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = troller.h; sourceTree = ""; };
C81122DE2B16C9CC00AD077B /* troller.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = troller.m; sourceTree = ""; };
C82AFEEF2B175A270070EA49 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
C82AFEF12B175AA30070EA49 /* usprebooterApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = usprebooterApp.swift; sourceTree = ""; };
C82AFEF32B175AB80070EA49 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
C82AFF0D2B1762CE0070EA49 /* fakeroot */ = {isa = PBXFileReference; lastKnownFileType = text; path = fakeroot; sourceTree = ""; };
C82AFF102B1762CE0070EA49 /* trolltoolsroothelper */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = trolltoolsroothelper; sourceTree = ""; };
C82AFF112B1762CE0070EA49 /* .stamp */ = {isa = PBXFileReference; lastKnownFileType = text; path = .stamp; sourceTree = ""; };
C82AFF132B1762CE0070EA49 /* uicache.m.df2b699c.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = uicache.m.df2b699c.Td; sourceTree = ""; };
C82AFF142B1762CE0070EA49 /* main.m.cb550517.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = main.m.cb550517.Td; sourceTree = ""; };
C82AFF152B1762CE0070EA49 /* uicache.m.1773e4a4.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = uicache.m.1773e4a4.Td; sourceTree = ""; };
C82AFF162B1762CE0070EA49 /* main.m.1773e4a4.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = main.m.1773e4a4.o; sourceTree = ""; };
C82AFF172B1762CE0070EA49 /* uicache.m.1773e4a4.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = uicache.m.1773e4a4.o; sourceTree = ""; };
C82AFF182B1762CE0070EA49 /* TSUtil.m.1773e4a4.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = TSUtil.m.1773e4a4.Td; sourceTree = ""; };
C82AFF192B1762CE0070EA49 /* main.m.df2b699c.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = main.m.df2b699c.o; sourceTree = ""; };
C82AFF1A2B1762CE0070EA49 /* TSUtil.m.cb550517.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = TSUtil.m.cb550517.o; sourceTree = ""; };
C82AFF1B2B1762CE0070EA49 /* trolltoolsroothelper.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = trolltoolsroothelper.dSYM; sourceTree = ""; };
C82AFF1C2B1762CE0070EA49 /* TSUtil.m.df2b699c.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = TSUtil.m.df2b699c.Td; sourceTree = ""; };
C82AFF1D2B1762CE0070EA49 /* uicache.m.df2b699c.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = uicache.m.df2b699c.o; sourceTree = ""; };
C82AFF1E2B1762CE0070EA49 /* TSUtil.m.cb550517.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = TSUtil.m.cb550517.Td; sourceTree = ""; };
C82AFF1F2B1762CE0070EA49 /* TSUtil.m.1773e4a4.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = TSUtil.m.1773e4a4.o; sourceTree = ""; };
C82AFF202B1762CE0070EA49 /* main.m.df2b699c.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = main.m.df2b699c.Td; sourceTree = ""; };
C82AFF212B1762CE0070EA49 /* main.m.1773e4a4.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = main.m.1773e4a4.Td; sourceTree = ""; };
C82AFF222B1762CE0070EA49 /* uicache.m.cb550517.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = uicache.m.cb550517.o; sourceTree = ""; };
C82AFF232B1762CE0070EA49 /* uicache.m.cb550517.Td */ = {isa = PBXFileReference; lastKnownFileType = text; path = uicache.m.cb550517.Td; sourceTree = ""; };
C82AFF242B1762CE0070EA49 /* TSUtil.m.df2b699c.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = TSUtil.m.df2b699c.o; sourceTree = ""; };
C82AFF252B1762CE0070EA49 /* main.m.cb550517.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = main.m.cb550517.o; sourceTree = ""; };
C82AFF292B1762CE0070EA49 /* net.sourceloc.trolltoolsroothelper-1.0 */ = {isa = PBXFileReference; lastKnownFileType = text; path = "net.sourceloc.trolltoolsroothelper-1.0"; sourceTree = ""; };
C82AFF2A2B1762CE0070EA49 /* build_session */ = {isa = PBXFileReference; lastKnownFileType = text; path = build_session; sourceTree = ""; };
C82AFF2B2B1762CE0070EA49 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; };
C82AFF2C2B1762CE0070EA49 /* entitlements.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = entitlements.plist; sourceTree = ""; };
C82AFF2D2B1762CE0070EA49 /* TSUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TSUtil.m; sourceTree = ""; };
C82AFF2E2B1762CE0070EA49 /* RootHelperSample.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = RootHelperSample.xcodeproj; sourceTree = ""; };
C82AFF312B1762CE0070EA49 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
C82AFF332B1762CE0070EA49 /* TSUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TSUtil.h; sourceTree = ""; };
C82AFF342B1762CE0070EA49 /* CoreServices.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreServices.h; sourceTree = ""; };
C82AFF352B1762CE0070EA49 /* RemoteLog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteLog.h; sourceTree = ""; };
C82AFF362B1762CE0070EA49 /* control */ = {isa = PBXFileReference; lastKnownFileType = text; path = control; sourceTree = ""; };
C82AFF3C2B1796D90070EA49 /* IOKit.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = IOKit.tbd; path = ../theos/sdks/iPhoneOS15.5.sdk/System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit.tbd; sourceTree = ""; };
C82AFF3D2B179A880070EA49 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
C82AFF422B17AA6C0070EA49 /* ldid */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = ldid; sourceTree = ""; };
C83594C32B17AC8500346F80 /* MobileContainerManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileContainerManager.framework; path = ../theos/sdks/iPhoneOS15.5.sdk/System/Library/PrivateFrameworks/MobileContainerManager.framework; sourceTree = ""; };
C83594CE2B18F70700346F80 /* overwriter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = overwriter.m; sourceTree = ""; };
C83594D02B18F74600346F80 /* vm_unaligned_copy_switch_race.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vm_unaligned_copy_switch_race.h; sourceTree = ""; };
C83594D12B18F74600346F80 /* vm_unaligned_copy_switch_race.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vm_unaligned_copy_switch_race.c; sourceTree = ""; };
C83594D32B18F80300346F80 /* overwriter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = overwriter.h; sourceTree = ""; };
C84002E32B4A545400C73950 /* insert_dylib.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = insert_dylib.m; sourceTree = ""; };
C84002E52B4A547B00C73950 /* insert_dylib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = insert_dylib.h; sourceTree = ""; };
C84002E82B4A55A300C73950 /* springboardshimsignedinjected */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = springboardshimsignedinjected; path = RootHelperSample/launchdshim/SpringBoardShim/springboardshimsignedinjected; sourceTree = SOURCE_ROOT; };
C84002EC2B4A64E200C73950 /* launchdentitlements.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = launchdentitlements.plist; path = RootHelperSample/launchdshim/launchdentitlements.plist; sourceTree = SOURCE_ROOT; };
C8BFCC782B3FFE560008D8FD /* cs_blobs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cs_blobs.h; sourceTree = ""; };
C8BFCC792B3FFE560008D8FD /* thanks_opa334dev_htrowii.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = thanks_opa334dev_htrowii.h; sourceTree = ""; };
C8BFCC7A2B3FFE560008D8FD /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = ""; };
C8BFCC7B2B3FFE560008D8FD /* vnode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vnode.h; sourceTree = ""; };
C8BFCC7C2B3FFE560008D8FD /* proc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = proc.h; sourceTree = ""; };
C8BFCC7D2B3FFE560008D8FD /* offsets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = offsets.h; sourceTree = ""; };
C8BFCC7E2B3FFE560008D8FD /* krw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = krw.h; sourceTree = ""; };
C8BFCC7F2B3FFE560008D8FD /* fun.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = fun.m; sourceTree = ""; };
C8BFCC822B3FFE560008D8FD /* dir.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = dir.m; sourceTree = ""; };
C8BFCC842B3FFE560008D8FD /* utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = utils.m; sourceTree = ""; };
C8BFCC852B3FFE560008D8FD /* thanks_opa334dev_htrowii.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = thanks_opa334dev_htrowii.m; sourceTree = ""; };
C8BFCC862B3FFE560008D8FD /* cs_blobs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = cs_blobs.m; sourceTree = ""; };
C8BFCC872B3FFE560008D8FD /* krw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = krw.c; sourceTree = ""; };
C8BFCC882B3FFE560008D8FD /* offsets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = offsets.m; sourceTree = ""; };
C8BFCC892B3FFE560008D8FD /* vnode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = vnode.m; sourceTree = ""; };
C8BFCC8A2B3FFE560008D8FD /* proc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = proc.c; sourceTree = ""; };
C8BFCC8C2B3FFE560008D8FD /* fun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fun.h; sourceTree = ""; };
C8BFCC8F2B3FFE560008D8FD /* dir.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dir.h; sourceTree = ""; };
C8BFCC912B3FFE560008D8FD /* krkw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = krkw.h; sourceTree = ""; };
C8BFCC942B3FFE560008D8FD /* kread_sem_open.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kread_sem_open.h; sourceTree = ""; };
C8BFCC952B3FFE560008D8FD /* kread_kqueue_workloop_ctl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kread_kqueue_workloop_ctl.h; sourceTree = ""; };
C8BFCC972B3FFE560008D8FD /* kwrite_sem_open.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kwrite_sem_open.h; sourceTree = ""; };
C8BFCC982B3FFE560008D8FD /* kwrite_dup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kwrite_dup.h; sourceTree = ""; };
C8BFCC9A2B3FFE560008D8FD /* static_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = static_info.h; sourceTree = ""; };
C8BFCC9B2B3FFE560008D8FD /* dynamic_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dynamic_info.h; sourceTree = ""; };
C8BFCC9C2B3FFE560008D8FD /* puaf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = puaf.h; sourceTree = ""; };
C8BFCC9D2B3FFE560008D8FD /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; };
C8BFCC9F2B3FFE560008D8FD /* smith.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smith.h; sourceTree = ""; };
C8BFCCA02B3FFE560008D8FD /* physpuppet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = physpuppet.h; sourceTree = "