diff --git a/README.md b/README.md index 66faa79..f5b152f 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,15 @@ If you run into permission issues, [ensure that your user is in the docker group # Troubleshooting/FAQ: -All previous common problems have been solved 😎 +### Unable to install python dependency `keystone-engine` on rpi3 +If you are unable to install `keystone-engine` on a raspberry pi 3, try: +1. Update the GPU RAM to 16MB from `raspi-config` +2. Build and install keystone-engine from source (should take ~15 minutes): +``` +git clone https://github.com/keystone-engine/keystone +cd keystone/bindings/python/ +python3 -m pip install . +``` # Development Main stages to developing a feature: diff --git a/patches/keystone_cache.json b/patches/keystone_cache.json index 95598fa..942b099 100644 --- a/patches/keystone_cache.json +++ b/patches/keystone_cache.json @@ -1,6 +1,20 @@ { + "('add.w r2,r1,#0x10',){}": [1, 241, 16, 2], + "('add.w r7,r0,#0x10',){}": [0, 241, 16, 7], "('b 0x1c',){}": [12, 224], + "('b.w #0x801b504', 134280240){}": [12, 240, 104, 184], + "('ite ne; movne.w r4, #0xd2000; moveq.w r4, #0xd1000',){}": [20, 191, 79, 244, 82, 36, 79, 244, 81, 36], + "('mov r0,r5',){}": [40, 70], + "('mov r0,r7',){}": [56, 70], + "('mov r1,r6',){}": [49, 70], + "('mov r2,r7',){}": [58, 70], + "('mov r5,r1',){}": [13, 70], + "('mov r1,r2',){}": [17, 70], + "('mov r7,r0',){}": [7, 70], "('mov.w r1, #0x00000',){}": [79, 240, 0, 1], "('mov.w r2, #45056',){}": [79, 244, 48, 66], - "('mov.w r3, #45056',){}": [79, 244, 48, 67] + "('mov.w r3, #45056',){}": [79, 244, 48, 67], + "('sub sp,#0x10',){}": [132, 176], + "('sub.w r1,r8,#0x10',){}": [168, 241, 16, 1], + "('sub.w r6,r2,#0x10',){}": [162, 241, 16, 6] } diff --git a/patches/patch.py b/patches/patch.py index e5dc42a..9d71387 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -17,17 +17,14 @@ def twos_compliment(value, bits): class CachedKeystone: - """Keystone can be annoying to install; so we just cache the responses for end-users.""" - def __init__(self, path="patches/keystone_cache.json"): self.path = Path(path) self._ks = None - with suppress(ImportError): - from keystone import KS_ARCH_ARM, KS_MODE_THUMB, Ks + from keystone import KS_ARCH_ARM, KS_MODE_THUMB, Ks - self._ks = Ks(KS_ARCH_ARM, KS_MODE_THUMB) - self._sig = inspect.signature(self._ks.asm) + self._ks = Ks(KS_ARCH_ARM, KS_MODE_THUMB) + self._sig = inspect.signature(self._ks.asm) self._cache = {} with suppress(FileNotFoundError): diff --git a/requirements.txt b/requirements.txt index 9cc60c5..71b483f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ colorama numpy pycryptodome pyelftools +keystone-engine