This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sometimes you have a large file on a small disk and would like to "transform" | |
// it in some way: for example, by decompressing it. However, you might not have | |
// enough space on disk to keep both the the compressed file and the | |
// decompressed results. If the process can be done in a streaming fashion, it | |
// would be nice if the file could be "drained"; that is, the file would be | |
// sequentially deleted as it is consumed. At the start you'd have 100% of the | |
// original file, somewhere in the middle you'd have about half of the original | |
// file and half of your output, and by the end the original file will be gone | |
// and you'll be left with just the results. If you do it this way, you might | |
// be able to do the entire operation without extra space! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.global _main | |
.extern _putchar | |
.align 4 | |
_main: | |
// prolog; save fp,lr,x19 | |
stp x29, x30, [sp, #-0x20]! | |
str x19, [sp, #0x10] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang path_hook.mm -shared -ldl -g -framework Foundation path_hook.o -L/usr/lib/swift | |
#include <cassert> | |
#include <cstdint> | |
#include <dlfcn.h> | |
#include <mach/arm/vm_param.h> | |
#include <mach/kern_return.h> | |
#include <mach/mach_init.h> | |
#include <mach/vm_map.h> | |
#include <mach/vm_prot.h> |