{"id":27247737,"url":"https://github.com/mbeardwell/arm-fp-emu","last_synced_at":"2025-10-29T20:34:05.552Z","repository":{"id":223504225,"uuid":"760506851","full_name":"mbeardwell/arm-fp-emu","owner":"mbeardwell","description":"Final-year BSc project on CPU performance","archived":false,"fork":false,"pushed_at":"2025-03-03T08:58:20.000Z","size":6058,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-10T22:58:35.055Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbeardwell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-20T14:48:10.000Z","updated_at":"2025-03-03T08:58:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8584fda-7821-40e4-af4d-8d7a01541ca6","html_url":"https://github.com/mbeardwell/arm-fp-emu","commit_stats":null,"previous_names":["mbeardwell/prj-final-submission"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbeardwell%2Farm-fp-emu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbeardwell%2Farm-fp-emu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbeardwell%2Farm-fp-emu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbeardwell%2Farm-fp-emu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbeardwell","download_url":"https://codeload.github.com/mbeardwell/arm-fp-emu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312147,"owners_count":21082638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-10T22:58:40.222Z","updated_at":"2025-10-29T20:34:05.547Z","avatar_url":"https://github.com/mbeardwell.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [Download the report](https://raw.githubusercontent.com/mbeardwell/arm-fp-emu/main/docs/1681382_report.pdf) 📥\n\n# Faster Dynamically Instrumented Programs\n\n_A look at floating-point emulation in ARM Linux_\n\n## Overview\n\nThis is the final submission of my third-year university project at King's College London.\n\n### Abstract\n\nThis project borrows existing dynamic program instrumentation techniques to propose a faster method of emulating floating-point instructions on Unix-like operating systems than what is provided by the kernel. The proposed method replaces floating-point instructions with branches that indirectly lead to emulation code resident in the same process’ memory. This prevents some execution flow switching into kernel code to run the kernel’s floating-point instruction emulator which theoretically reduces overhead for every instruction emulated.\n\n## Introduction\n\nThis tool is designed to be built and run on Armel Debian on an ARMv7(-a) CPU. It requires the 'librunt' and 'keystone' git repositories as well as other dependencies.\n\n## Video Walkthrough\n\nThis video provides a step-by-step demonstration of how my floating-point emulation program works using the GNU Debugger (GDB). It walks through a test binary, showing how floating-point instructions are replaced with branches to trampoline code that redirects execution to an emulation routine.\n\n### What’s Covered in the Video?\n\n* Debugging the program using GDB.\n* How floating-point instructions are replaced with branch instructions.\n* The role of trampoline code in redirecting execution.\n* How the emulation routine processes floating-point operations.\n* Why this method is eventually faster than kernel-based instruction emulation.\n\n**Watch the project demonstration here:**  \n[Watch on YouTube](https://youtu.be/_kRSL5yiPrg) \u003cimg src=\"assets/youtube.svg\" height=\"24\" width=\"24\" /\u003e\n\n## Installation\n\nTo set up the project, clone the repository:\n\n```bash\ngit clone https://github.com/mbeardwell/arm-fp-emu.git\ncd arm-fp-emu\n```\n\n## Build instructions\n\n1. Install dependencies\n\n```\ngit submodule update --init --recursive\nbash install-dependencies.sh\n```\n\n_Note: The script automates installation but does not guarantee robustness or safety._\n\n2. Build\n\n```bash\nmake librunt\nmake keystone\nmake arm-fp-emu\nmake build-tests\n```\n\nThis can take hours which is why each must be made separately. If something goes wrong building one, less progress is lost restarting at the point of failure.\n    \n## Testing\n\nTo run tests:\n\n```bash\nmake test\n```\n\nThis will run something of the form\n\n```bash\nLD_LIBRARY_PATH=[...]/lib LD_PRELOAD=./build/arm-fp-emu.so ./tests/build/vadd10 10\n```\n\nLD_LIBRARY_PATH is necessary for how I'm using Keystone, but Keystone could technically be used in a way that removes the need to use this environment variable.\n\n## References\n\n1. ARM Options. https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html.\n2. Debian ARM Ports. https://wiki.debian.org/ArmPorts.\n3. Debian Ports. https://www.debian.org/ports/index.en.html.\n4. GNU Binutils. https://www.gnu.org/software/binutils/.\n5. The ‘Capstone’ Disassembly Framework. http://www.capstone-engine.org/.\n6. ld.so(8) — Linux manual page. https://man7.org/linux/man-pages/man8/ld.so.8.html, Aug 2021.\n7. ARM Limited. Arm® architecture reference manual: Armv7-a and armv7-r edition. https://developer.arm.com/documentation/ddi0406/cd/.\n8. Fabrice Bellard. QEMU, a Fast and Portable Dynamic Translator. In FREENIX Track: 2005 USENIX Annual Technical Conference, pages 41–46, 2005.\n9. Derek Bruening and Saman Amarasinghe. Efficient, transparent, and comprehensive runtime code manipulation. PhD thesis, Massachusetts Institute of Technology, Department of Electrical Engineering . . . , 2004. \n10. Buddhika Chamith, Bo Joel Svensson, Luke Dalessandro, and Ryan R Newton. Instruction punning: Lightweight instrumentation for x86-64. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 320–332, 2017. \n11. Syed Zohaib Gilani, Nam Sung Kim, and Michael Schulte. Virtual floating-point units for low-power embedded processors. In 2012 IEEE 23rd International Conference on Application-Specific Systems, Architectures and Processors, pages 61–68, 2012.\n12. Gabriel Ferreira Teles Gomes and E Borin. Indirect branch emulation techniques in virtual machines. PhD thesis, Dissertation, University of\nCampinas, 2014. \n13. Mingyi Huang and Chengyu Song. ARMPatch: A Binary Patching Framework for ARM-based IoT Device. Journal of Web Engineering, pages 1829–1852, 2021.\n14. Peter B Kessler. Fast breakpoints: Design and implementation. ACM SIGPLAN Notices, 25(6):78–84, 1990. \n15. Michael A. Laurenzano, Mustafa M. Tikir, Laura Carrington, and Allan Snavely. Pebil: Efficient static binary instrumentation for linux. In 2010\nIEEE International Symposium on Performance Analysis of Systems \u0026 Software (ISPASS), pages 175–183, 2010. \n16. Arm Ltd. ARM Architecture Reference Manual Debug supplement: Breakpoint Debug Events. https://developer.arm.com/documentation/ddi0379/a/Debug-Events/Software-Debug-events/Breakpoint-Debug-events.\n17. Arm Ltd. ARM Compiler - Arm C and C++ Libraries and Floating-Point Support User Guide Version 6.11: About floating-point support. https://developer.arm.com/documentation/100073/0611/floating-point-support/about-floating-point-support.\n18. Arm Ltd. What is RISC? https://www.arm.com/glossary/risc.\n19. Nicholas Nethercote and Julian Seward. Valgrind: a framework for heavyweight dynamic binary instrumentation. ACM Sigplan notices, 42(6):89–100, 2007.\n20. Ignacio Sanmillan. Executable and Linkable Format 101 - Part 1 Sections and Segments. https://www.intezer.com/blog/research/executable-linkable-format-101-part1-sections-segments/.\n\n* * *\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbeardwell%2Farm-fp-emu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbeardwell%2Farm-fp-emu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbeardwell%2Farm-fp-emu/lists"}