├── .circleci └── config.yml ├── .dockerignore ├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── CONTRIBUTING.adoc ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.adoc ├── _config.yml ├── asciidoctor ├── extract-header-ids ├── extract-link-targets ├── link-target-github.rb └── link-target-up.rb ├── baremetal ├── README.adoc ├── arch │ ├── aarch64 │ │ ├── contextidr_el1.c │ │ ├── dump_regs.c │ │ ├── multicore.c │ │ ├── no_bootloader │ │ │ ├── exit.S │ │ │ ├── m5_exit_addr.S │ │ │ ├── multicore_asm.S │ │ │ ├── semihost_exit.S │ │ │ └── wfe_loop.S │ │ ├── semihost_exit.S │ │ ├── svc.c │ │ ├── svc_asm.S │ │ └── timer.c │ └── arm │ │ ├── dump_regs.c │ │ ├── enable_cache.S │ │ ├── multicore.c │ │ ├── no_bootloader │ │ ├── multicore_asm.S │ │ └── semihost_exit.S │ │ └── semihost_exit.S ├── lib │ ├── aarch64.S │ ├── arm.S │ ├── syscalls.c │ └── syscalls_asm.S ├── link.ld └── linker_variables.c ├── bench-all ├── bench-cmd ├── bisect-gem5-gdb ├── bisect-gem5-linux-boot ├── bisect-linux-boot-gem5 ├── bisect-qemu-linux-boot ├── bst-vs-heap-vs-hashmap-gem5-stats ├── bst-vs-heap-vs-hashmap.gnuplot ├── build ├── build-android ├── build-baremetal ├── build-buildroot ├── build-crosstool-ng ├── build-disk2 ├── build-doc ├── build-docker ├── build-gem5 ├── build-linux ├── build-m5 ├── build-modules ├── build-qemu ├── build-test ├── build-test-boot ├── build-userland ├── build-userland-in-tree ├── build-xen ├── buildroot_config ├── default ├── gpio ├── kmscube └── x11 ├── buildroot_override ├── buildroot_packages ├── README.adoc ├── kernel_modules │ ├── Config.in │ ├── Makefile │ ├── README.adoc │ ├── buildroot_dep.c │ ├── buildroot_dep2.c │ ├── buildroot_hello.c │ ├── external.desc │ └── external.mk ├── lkmc_many_files │ ├── Config.in │ ├── Makefile │ ├── external.desc │ ├── external.mk │ └── lkmc_many_files.c ├── parsec_benchmark │ ├── Config.in │ ├── external.desc │ └── external.mk └── sample_package │ ├── Config.in │ ├── Makefile │ ├── external.desc │ ├── external.mk │ └── sample_package.c ├── busybox_config_fragment ├── cli_function.py ├── cli_function_test_config.py ├── cli_function_test_config_2.py ├── common.py ├── config.py ├── copy-overlay ├── crosstool_ng_config ├── aarch64 └── arm ├── disas ├── docinfo-footer.html ├── docinfo.html ├── eeval ├── gem5-bench-cache ├── gem5-bench-dhrystone ├── gem5-regression ├── gem5-shell ├── gem5-stat ├── getprops ├── getvar ├── hello_host_kernel_module ├── Makefile ├── README.adoc └── hello.c ├── java ├── kernel_modules.code-workspace ├── kernel_modules ├── .lvimrc ├── Makefile ├── README.adoc ├── anonymous_inode.c ├── character_device.c ├── character_device_create.c ├── debugfs.c ├── dep.c ├── dep2.c ├── dump_regs.c ├── dump_stack.c ├── float.c ├── fops.c ├── hello.c ├── hello2.c ├── init_module.c ├── ioctl.c ├── irq.c ├── kprobe_example.c ├── kstrto.c ├── kthread.c ├── kthreads.c ├── memcpy_overflow.c ├── memfile.c ├── mmap.c ├── module_info.c ├── myprintk.c ├── netlink.c ├── oops.c ├── panic.c ├── params.c ├── pmccntr.c ├── poll.c ├── procfs.c ├── qemu_edu.c ├── ring0.c ├── schedule.c ├── scull.c ├── seq_file.c ├── seq_file_single_open.c ├── sleep.c ├── strlen_overflow.c ├── sysfs.c ├── timer.c ├── vermagic.c ├── vermagic_fail.c ├── virt_to_phys.c ├── wait_queue.c ├── wait_queue2.c ├── warn_on.c ├── work_from_work.c └── workqueue_cheat.c ├── linux-kernel-module-cheat.code-workspace ├── linux_config ├── README.adoc ├── buildroot-aarch64 ├── buildroot-arm ├── buildroot-x86_64 ├── default ├── display ├── gpio ├── leds ├── min ├── nfs └── selinux ├── lkmc.c ├── lkmc.h ├── lkmc ├── README.adoc ├── __init__.py ├── aarch64.h ├── aarch64_dump_regs.h ├── anonymous_inode.h ├── arm.h ├── arm_aarch64.h ├── file_io.h ├── float.h ├── futex.h ├── gic.h ├── import_path.py ├── ioctl.h ├── m5ops.h ├── math.h ├── netlink.h ├── pagemap.h ├── ring0.h └── x86_64.h ├── nodejs ├── npm ├── README.adoc └── data-files │ ├── .nvmrc │ ├── README.adoc │ ├── cirosantilli-data-files │ ├── index.js │ ├── mydata.txt │ ├── package-lock.json │ └── package.json ├── patches ├── README.adoc ├── global │ └── README.adoc └── manual │ ├── README.adoc │ ├── gem5-commmonitor-se.patch │ └── gem5-semihost.patch ├── path_properties.py ├── publish-gh-pages ├── python ├── qemu-monitor ├── qemu-rr ├── qemu-trace2txt ├── release-download-latest ├── release-upload ├── release-zip ├── requirements.txt ├── rootfs-post-build-script ├── rootfs_overlay ├── .profile ├── README.adoc ├── etc │ ├── fstab │ ├── init.d │ │ └── S98 │ ├── inittab │ ├── ld.so.cache │ ├── modprobe.conf │ └── ssh │ │ └── sshd_config └── lkmc │ ├── anonymous_inode.sh │ ├── character_device.sh │ ├── character_device_create.sh │ ├── conf.sh │ ├── count.sh │ ├── debugfs.sh │ ├── dep.sh │ ├── eval_base64.sh │ ├── fb.sh │ ├── fops.sh │ ├── fork_bomb.sh │ ├── gdbserver.sh │ ├── gem5.sh │ ├── gem5_exit.sh │ ├── gpio.sh │ ├── init_forward.sh │ ├── init_lkmc.sh │ ├── init_module.sh │ ├── insrm.sh │ ├── ioctl.sh │ ├── java │ ├── LinkedHashMapCheat.java │ └── Makefile │ ├── kgdb.sh │ ├── kstrto.sh │ ├── loginroot.sh │ ├── memfile.sh │ ├── mknoddev.sh │ ├── mmap.sh │ ├── netlink.sh │ ├── nodejs │ ├── .nvmrc │ ├── README.adoc │ ├── alphanumeric.js │ ├── assert_cheat.js │ ├── cjs │ │ ├── README.adoc │ │ ├── main.js │ │ └── notmain.js │ ├── command_line_arguments.js │ ├── date.js │ ├── env.js │ ├── esm │ │ ├── README.adoc │ │ ├── main.js │ │ ├── notmain.js │ │ ├── notmain2.js │ │ └── package.json │ ├── file_write_read.js │ ├── hello.js │ ├── http.js │ ├── list_object_methods.js │ ├── mocha.sh │ ├── mocha │ │ ├── mytest.js │ │ └── utils.js │ ├── object_to_json.js │ ├── object_to_string.js │ ├── package-lock.json │ ├── package.json │ ├── promise.js │ ├── read_stdin_to_string.js │ ├── static.js │ ├── tmp │ │ ├── express.js │ │ ├── package-lock.json │ │ └── package.json │ ├── typescript │ │ ├── js-from-ts │ │ │ ├── main.ts │ │ │ └── notmain.js │ │ ├── ts-from-js │ │ │ ├── main.js │ │ │ ├── notmain.ts │ │ │ └── notmain2.ts │ │ └── ts-from-ts │ │ │ ├── main.ts │ │ │ └── notmain.ts │ └── worker_threads_test.js │ ├── params.sh │ ├── pci_rescan.sh │ ├── pmccntr.sh │ ├── poll.sh │ ├── pr_debug.sh │ ├── procfs.sh │ ├── psa.sh │ ├── python │ ├── README.adoc │ ├── count.py │ ├── hello.py │ ├── iter_method.py │ ├── relative_import │ │ ├── README.adoc │ │ ├── __init__.py │ │ ├── mydir │ │ │ ├── __init__.py │ │ │ └── myfile_user.py │ │ ├── myfile.py │ │ ├── myfile_user.py │ │ └── test │ └── unittest_find │ │ ├── README.adoc │ │ ├── mydir │ │ ├── __init__.py │ │ ├── myfile.py │ │ └── test │ │ │ ├── __init__.py │ │ │ └── test_myfile.py │ │ ├── mydir_noinit │ │ └── test_myfile.py │ │ ├── myfile.py │ │ ├── myfile2.py │ │ └── test │ │ ├── __init__.py │ │ ├── myfile.py │ │ └── test_myfile.py │ ├── qemu_edu.sh │ ├── rand_check_poweroff.sh │ ├── scull.sh │ ├── seq_file.sh │ ├── seq_file_single_open.sh │ ├── sshd.sh │ ├── sysfs.sh │ ├── test_all.sh │ ├── test_fail.sh │ ├── uio_read.sh │ ├── vermagic.sh │ └── virt_to_phys.sh ├── run ├── run-android ├── run-docker ├── run-gdb ├── run-toolchain ├── setup ├── shell_helpers.py ├── test ├── test-boot ├── test-build-userland ├── test-executables ├── test-executables-in-tree ├── test-gdb ├── test-gem5-graphics ├── test-test-executables ├── test-userland-full-system ├── thread_pool.py ├── tmux-split ├── trace-boot ├── trace2line ├── trace2line.sh ├── update-buildroot-kernel-configs ├── user_table ├── userland ├── README.adoc ├── algorithm │ ├── README.adoc │ ├── build │ ├── set │ │ ├── README.adoc │ │ ├── build │ │ ├── generate_io │ │ ├── main.hpp │ │ ├── parse_output │ │ ├── std_priority_queue.cpp │ │ ├── std_priority_queue_gem5.cpp │ │ ├── std_set.cpp │ │ ├── std_set_gem5.cpp │ │ ├── std_unordered_set.cpp │ │ ├── std_unordered_set_gem5.cpp │ │ ├── test │ │ └── test_data │ │ │ ├── 3.e │ │ │ ├── 3.i │ │ │ ├── 4.e │ │ │ ├── 4.i │ │ │ ├── 5.e │ │ │ ├── 5.i │ │ │ ├── 8.e │ │ │ └── 8.i │ └── test ├── arch │ ├── aarch64 │ │ ├── add.S │ │ ├── add_vector.S │ │ ├── adr.S │ │ ├── adrp.S │ │ ├── beq.S │ │ ├── bfi.S │ │ ├── build │ │ ├── cbz.S │ │ ├── comments.S │ │ ├── cset.S │ │ ├── dump_regs.c │ │ ├── fadd_scalar.S │ │ ├── fadd_vector.S │ │ ├── freestanding │ │ │ ├── README.adoc │ │ │ ├── build │ │ │ ├── linux │ │ │ │ ├── build │ │ │ │ ├── disassembly_test.S │ │ │ │ ├── hazard.S │ │ │ │ ├── hazard4.S │ │ │ │ ├── hazardless.S │ │ │ │ ├── hello.S │ │ │ │ ├── sevl_wfe.S │ │ │ │ ├── speculative.S │ │ │ │ ├── stall.S │ │ │ │ ├── stall_gain.S │ │ │ │ ├── stall_hazard4.S │ │ │ │ ├── test │ │ │ │ ├── wfe.S │ │ │ │ └── wfe_wfe.S │ │ │ └── test │ │ ├── gas_data_sizes.S │ │ ├── gdb_tests │ │ │ ├── README.adoc │ │ │ ├── build │ │ │ ├── floating_registers.S │ │ │ ├── floating_registers.py │ │ │ ├── integer_registers.S │ │ │ ├── integer_registers.py │ │ │ ├── set_registers.S │ │ │ ├── set_registers.py │ │ │ └── test │ │ ├── immediates.S │ │ ├── inline_asm │ │ │ ├── build │ │ │ ├── earlyclobber.c │ │ │ ├── freestanding │ │ │ │ ├── build │ │ │ │ ├── linux │ │ │ │ │ ├── build │ │ │ │ │ ├── hello.c │ │ │ │ │ ├── hello_clobbers.c │ │ │ │ │ └── test │ │ │ │ └── test │ │ │ ├── futex_ldxr_stxr.c │ │ │ ├── futex_sev.cpp │ │ │ ├── inc.c │ │ │ ├── inc_32.c │ │ │ ├── inc_float.c │ │ │ ├── linux │ │ │ │ ├── asm_from_c.c │ │ │ │ ├── build │ │ │ │ └── test │ │ │ ├── multiline.cpp │ │ │ ├── reg_var.c │ │ │ ├── reg_var_float.c │ │ │ ├── sve_addvl.c │ │ │ ├── test │ │ │ ├── wfe_ldxr_str.cpp │ │ │ ├── wfe_ldxr_stxr.cpp │ │ │ └── wfe_sev.cpp │ │ ├── ld2.S │ │ ├── ldrsw.S │ │ ├── lkmc_assert_eq_fail.S │ │ ├── lkmc_assert_memcmp_fail.S │ │ ├── movk.S │ │ ├── movn.S │ │ ├── nostartfiles │ │ │ ├── README.adoc │ │ │ ├── build │ │ │ ├── exit.S │ │ │ ├── test │ │ │ └── wfe.S │ │ ├── pc.S │ │ ├── registers.S │ │ ├── ret.S │ │ ├── str.S │ │ ├── sve.S │ │ ├── sve_addvl.S │ │ ├── test │ │ ├── ubfm.S │ │ ├── ubfx.S │ │ ├── udf.S │ │ └── x31.S │ ├── arm │ │ ├── add.S │ │ ├── address_modes.S │ │ ├── adr.S │ │ ├── and.S │ │ ├── b.S │ │ ├── beq.S │ │ ├── bfi.S │ │ ├── bic.S │ │ ├── bl.S │ │ ├── build │ │ ├── clz.S │ │ ├── comments.S │ │ ├── cond.S │ │ ├── dump_regs.c │ │ ├── freestanding │ │ │ ├── README.adoc │ │ │ ├── build │ │ │ ├── linux │ │ │ │ ├── build │ │ │ │ ├── hello.S │ │ │ │ ├── hello_thumb.S │ │ │ │ └── test │ │ │ └── test │ │ ├── gas_data_sizes.S │ │ ├── gdb_tests │ │ │ ├── README.adoc │ │ │ ├── build │ │ │ ├── integer_registers.S │ │ │ ├── integer_registers.py │ │ │ ├── set_registers.S │ │ │ ├── set_registers.py │ │ │ └── test │ │ ├── immediates.S │ │ ├── inc_array.S │ │ ├── inline_asm │ │ │ ├── add.c │ │ │ ├── build │ │ │ ├── freestanding │ │ │ │ ├── build │ │ │ │ ├── linux │ │ │ │ │ ├── build │ │ │ │ │ ├── hello.c │ │ │ │ │ └── test │ │ │ │ └── test │ │ │ ├── inc.c │ │ │ ├── inc_float.c │ │ │ ├── inc_memory.c │ │ │ ├── inc_memory_global.c │ │ │ ├── reg_var.c │ │ │ └── test │ │ ├── ldmia.S │ │ ├── ldr_pseudo.S │ │ ├── ldrb.S │ │ ├── ldrh.S │ │ ├── linux │ │ │ ├── build │ │ │ ├── c_from_asm.S │ │ │ └── test │ │ ├── lkmc_assert_eq_fail.S │ │ ├── lkmc_assert_memcmp_fail.S │ │ ├── mov.S │ │ ├── movw.S │ │ ├── mul.S │ │ ├── nop.S │ │ ├── orr.S │ │ ├── push.S │ │ ├── rbit.S │ │ ├── registers.S │ │ ├── rev.S │ │ ├── s_suffix.S │ │ ├── shift.S │ │ ├── str.S │ │ ├── sub.S │ │ ├── test │ │ ├── thumb.S │ │ ├── tst.S │ │ ├── udf.S │ │ ├── vadd_scalar.S │ │ ├── vadd_vector.S │ │ ├── vcvt.S │ │ ├── vcvta.S │ │ └── vcvtr.S │ ├── build │ ├── empty.S │ ├── lkmc_assert_fail.S │ ├── test │ └── x86_64 │ │ ├── adc.S │ │ ├── add.S │ │ ├── addpd.S │ │ ├── address_modes.S │ │ ├── and.S │ │ ├── binutils_hack.c │ │ ├── binutils_nohack.c │ │ ├── bswap.S │ │ ├── bt.S │ │ ├── btc.S │ │ ├── btr.S │ │ ├── build │ │ ├── char_literals.S │ │ ├── cltq.S │ │ ├── cmovcc.S │ │ ├── cmp.S │ │ ├── cmps.S │ │ ├── cmpxchg.S │ │ ├── cpuid.S │ │ ├── cqto.S │ │ ├── cvttss2si.S │ │ ├── dec.S │ │ ├── div.S │ │ ├── div_overflow.S │ │ ├── div_zero.S │ │ ├── enter.S │ │ ├── fabs.S │ │ ├── fadd.S │ │ ├── faddp.S │ │ ├── fchs.S │ │ ├── fild.S │ │ ├── fld1.S │ │ ├── fldl_literal.S │ │ ├── fldz.S │ │ ├── freestanding │ │ ├── README.adoc │ │ ├── build │ │ ├── linux │ │ │ ├── build │ │ │ ├── hello.S │ │ │ ├── int_system_call.S │ │ │ └── test │ │ └── test │ │ ├── fscale.S │ │ ├── fsqrt.S │ │ ├── fxch.S │ │ ├── gas_data_sizes.S │ │ ├── gdb_tests │ │ ├── README.adoc │ │ ├── build │ │ ├── integer_registers.S │ │ ├── integer_registers.py │ │ ├── set_registers.S │ │ ├── set_registers.py │ │ └── test │ │ ├── idiv.S │ │ ├── ieee754.S │ │ ├── imul.S │ │ ├── inc.S │ │ ├── inline_asm │ │ ├── add.c │ │ ├── build │ │ ├── freestanding │ │ │ ├── build │ │ │ ├── linux │ │ │ │ ├── build │ │ │ │ ├── hello.c │ │ │ │ ├── hello_regvar.c │ │ │ │ └── test │ │ │ └── test │ │ ├── inc.c │ │ ├── scratch.c │ │ ├── scratch_hardcode.c │ │ ├── sqrt_x87.c │ │ └── test │ │ ├── intrinsics │ │ ├── README.adoc │ │ ├── addpd.c │ │ ├── build │ │ ├── paddq.c │ │ ├── rdtsc.c │ │ ├── rdtscp.c │ │ └── test │ │ ├── jcc.S │ │ ├── jmp.S │ │ ├── jmp_indirect.S │ │ ├── lea.S │ │ ├── lkmc_assert_eq_fail.S │ │ ├── lkmc_assert_memcmp_fail.S │ │ ├── lods.S │ │ ├── loop.S │ │ ├── mov.S │ │ ├── movaps.S │ │ ├── movs.S │ │ ├── movss.S │ │ ├── movsx.S │ │ ├── movups.S │ │ ├── movzx.S │ │ ├── mul.S │ │ ├── neg.S │ │ ├── nop.S │ │ ├── nostartfiles │ │ ├── README.adoc │ │ ├── build │ │ ├── exit.S │ │ └── test │ │ ├── not.S │ │ ├── or.S │ │ ├── paddq.S │ │ ├── popcnt.S │ │ ├── push.S │ │ ├── pushf.S │ │ ├── rcl.S │ │ ├── rdrand.S │ │ ├── rdtsc.S │ │ ├── rdtscp.S │ │ ├── registers.S │ │ ├── rep.S │ │ ├── ring0.c │ │ ├── rol.S │ │ ├── sal.S │ │ ├── sbb.S │ │ ├── scas.S │ │ ├── setcc.S │ │ ├── shl.S │ │ ├── stos.S │ │ ├── sub.S │ │ ├── test │ │ ├── test.S │ │ ├── vfmadd132pd.S │ │ ├── xadd.S │ │ ├── xchg.S │ │ └── xor.S ├── build ├── c │ ├── README.adoc │ ├── abort.c │ ├── assert_fail.c │ ├── atomic.c │ ├── atomic │ │ ├── README.adoc │ │ ├── aarch64_add.c │ │ ├── aarch64_ldadd.c │ │ ├── aarch64_ldaxr_stlxr.c │ │ ├── build │ │ ├── fail.c │ │ ├── main.h │ │ ├── mutex.c │ │ ├── std_atomic.c │ │ ├── test │ │ ├── x86_64_inc.c │ │ └── x86_64_lock_inc.c │ ├── build │ ├── cat.c │ ├── command_line_arguments.c │ ├── empty.c │ ├── exit0.c │ ├── exit1.c │ ├── exit2.c │ ├── false.c │ ├── file_write_read.c │ ├── gcc_hack.c │ ├── getchar.c │ ├── hello.c │ ├── loop.c │ ├── m5ops.c │ ├── malloc.c │ ├── malloc_size.c │ ├── malloc_touch.c │ ├── memory_leak.c │ ├── multidimentional_array.c │ ├── return0.c │ ├── return1.c │ ├── return2.c │ ├── smash_stack.c │ ├── snprintf.c │ ├── stderr.c │ ├── test │ └── timespec_get.c ├── cpp │ ├── README.adoc │ ├── atomic │ │ ├── README.adoc │ │ ├── aarch64_add.cpp │ │ ├── aarch64_ldadd.cpp │ │ ├── aarch64_ldaxr_stlxr.cpp │ │ ├── build │ │ ├── fail.cpp │ │ ├── main.hpp │ │ ├── mutex.cpp │ │ ├── std_atomic.cpp │ │ ├── test │ │ ├── x86_64_inc.cpp │ │ └── x86_64_lock_inc.cpp │ ├── bst_vs_heap_vs_hashmap.cpp │ ├── build │ ├── constexpr_func_infinite_loop.cpp │ ├── copyfmt.cpp │ ├── count.cpp │ ├── custom_iterator.cpp │ ├── decltype.cpp │ ├── empty.cpp │ ├── file_write_read.cpp │ ├── hello.cpp │ ├── if_constexpr.cpp │ ├── initialization_types.cpp │ ├── initializer_list_constructor.cpp │ ├── m5ops.cpp │ ├── map.cpp │ ├── most_vexing_parse.cpp │ ├── multimap.cpp │ ├── parallel_sort.cpp │ ├── random.cpp │ ├── rule_of_five.cpp │ ├── set.cpp │ ├── sfinae.cpp │ ├── static_dynamic_reinterpret_cast.cpp │ ├── template.cpp │ ├── template_class_with_static_member.cpp │ ├── temporary_directory.cpp │ ├── test │ ├── thread_get_id.cpp │ ├── thread_hardware_concurrency.cpp │ ├── thread_return_value.cpp │ └── virtual.cpp ├── freestanding │ ├── README.adoc │ ├── gem5_checkpoint.S │ └── gem5_exit.S ├── gcc │ ├── README.adoc │ ├── build │ ├── busy_loop.c │ ├── empty_struct.c │ ├── openmp.c │ ├── prevent_reorder.cpp │ ├── profile.c │ └── test ├── gdb_tests │ ├── README.adoc │ ├── add.c │ └── add.py ├── kernel_modules │ ├── README.adoc │ ├── anonymous_inode.c │ ├── build │ ├── ioctl.c │ ├── mmap.c │ ├── netlink.c │ ├── poll.c │ ├── test │ └── uio_read.c ├── libs │ ├── README.adoc │ ├── boost │ │ ├── bimap.cpp │ │ ├── build │ │ └── test │ ├── build │ ├── cython │ │ ├── helloworld.pyx │ │ ├── main.py │ │ ├── primes.pyx │ │ ├── setup.py │ │ └── test │ ├── eigen │ │ ├── build │ │ ├── hello.cpp │ │ └── test │ ├── googletest │ │ ├── build │ │ ├── fail.cpp │ │ ├── main.cpp │ │ └── test │ ├── hdf5 │ │ ├── README.adoc │ │ ├── build │ │ ├── hello_cpp.cpp │ │ └── test │ ├── libdrm │ │ ├── build │ │ ├── modeset.c │ │ └── test │ ├── openblas │ │ ├── build │ │ ├── hello.c │ │ └── test │ ├── pybind11 │ │ ├── class_test.cpp │ │ ├── class_test_main.py │ │ └── test │ ├── python_embed │ │ ├── Makefile │ │ ├── README.adoc │ │ ├── eval.c │ │ ├── pure.c │ │ ├── pure.py │ │ ├── pure_cpp.cpp │ │ └── test │ └── test ├── linux │ ├── README.adoc │ ├── brk.c │ ├── build │ ├── ctrl_alt_del.c │ ├── futex.c │ ├── getcpu.c │ ├── getcpu_syscall.c │ ├── init_env_poweroff.c │ ├── mmap_anonymous.c │ ├── mmap_anonymous_touch.c │ ├── myinsmod.c │ ├── myrmmod.c │ ├── open_o_tmpfile.c │ ├── pagemap_dump.c │ ├── perf_event_open.c │ ├── poweroff.c │ ├── proc_events.c │ ├── rand_check.c │ ├── sched_getaffinity.c │ ├── sched_getaffinity_threads.c │ ├── sched_getcpu.c │ ├── sched_getcpu_barrier.c │ ├── sysconf.c │ ├── test │ ├── time_boot.c │ ├── total_memory.c │ └── virt_to_phys_user.c ├── posix │ ├── README.adoc │ ├── build │ ├── count.c │ ├── count_to.c │ ├── environ.c │ ├── fork.c │ ├── fork_bomb.c │ ├── getpid.c │ ├── kill.c │ ├── mmap_file.c │ ├── pthread_barrier.c │ ├── pthread_count.c │ ├── pthread_deadlock.c │ ├── pthread_mutex.c │ ├── pthread_self.c │ ├── sleep_forever.c │ ├── sysconf.c │ ├── test │ ├── uname.c │ ├── virt_to_phys_test.c │ └── wget.c └── test ├── vnc └── x11.png /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore everything, since we get the repository files 2 | # with a volume. 3 | * 4 | .* 5 | !requirements.txt 6 | !setup 7 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: cirosantilli 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # https://cirosantilli.com/linux-kernel-module-cheat#travis 2 | 3 | language: cpp 4 | 5 | sudo: required 6 | 7 | script: | 8 | cd "$TRAVIS_BUILD_DIR" 9 | # awk: without it, too much stdout (4Mb max) 10 | # If we ignore stdout: Travis kills job because it spent 11 | # too long without any new stdout. 12 | bash -x ./build --download-dependencies --travis |& awk 'NR % 1000 == 0' 13 | bash -x ./run --kernel-cli 'init=/poweroff.out' 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.adoc: -------------------------------------------------------------------------------- 1 | = CONTRIBUTING 2 | 3 | See: link:README.adoc#contributing[] 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # https://cirosantilli.com/linux-kernel-module-cheat#docker 2 | FROM ubuntu:20.04 3 | COPY setup / 4 | COPY requirements.txt / 5 | # https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container/65942222#65942222 6 | ENV LKMC_IN_DOCKER=true 7 | RUN /setup -y 8 | CMD bash 9 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'asciidoctor', '2.0.11' 4 | gem 'asciidoctor-multipage', '0.0.12' 5 | #gem 'jekyll', '3.8.6' 6 | gem 'github-pages' 7 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | exclude: [ 2 | data/, 3 | out/, 4 | rootfs_overlay/etc/ld.so.cache, 5 | submodules/, 6 | ] 7 | -------------------------------------------------------------------------------- /asciidoctor/extract-header-ids: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # https://cirosantilli.com/linux-kernel-module-cheat#asciidoctor-extract-header-ids 4 | 5 | require 'asciidoctor' 6 | require 'asciidoctor/extensions' 7 | 8 | class Main < Asciidoctor::Extensions::TreeProcessor 9 | def process document 10 | return unless document.blocks? 11 | (document.find_by context: :section).each do |section| 12 | if section.id 13 | puts section.id 14 | end 15 | end 16 | nil 17 | end 18 | end 19 | 20 | Asciidoctor::Extensions.register do 21 | treeprocessor Main 22 | end 23 | 24 | (Asciidoctor.load_file(ARGV[0])).convert 25 | -------------------------------------------------------------------------------- /asciidoctor/extract-link-targets: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # https://cirosantilli.com/linux-kernel-module-cheat#asciidoctor-extract-link-targets 4 | 5 | require 'asciidoctor' 6 | require 'asciidoctor/extensions' 7 | 8 | class Main < Asciidoctor::Extensions::InlineMacroProcessor 9 | use_dsl 10 | named :link 11 | def process parent, target, attrs 12 | puts target 13 | end 14 | end 15 | 16 | Asciidoctor::Extensions.register do 17 | inline_macro Main 18 | end 19 | 20 | (Asciidoctor.load_file(ARGV[0])).convert 21 | -------------------------------------------------------------------------------- /asciidoctor/link-target-github.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # https://cirosantilli.com/linux-kernel-module-cheat#asciidoctor-link-target-up-rb 4 | 5 | require 'asciidoctor' 6 | require 'asciidoctor/extensions' 7 | 8 | require_relative 'link-target-up.rb' 9 | 10 | class LinkTargetGitHub < LinkTargetUp 11 | named :link 12 | def target_base 13 | 'https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/' 14 | end 15 | end 16 | 17 | Asciidoctor::Extensions.register do 18 | inline_macro LinkTargetGitHub 19 | end 20 | -------------------------------------------------------------------------------- /baremetal/README.adoc: -------------------------------------------------------------------------------- 1 | https://cirosantilli.com/linux-kernel-module-cheat#baremetal-setup 2 | -------------------------------------------------------------------------------- /baremetal/arch/aarch64/contextidr_el1.c: -------------------------------------------------------------------------------- 1 | /* https://cirosantilli.com/linux-kernel-module-cheat#config-pid-in-contextidr */ 2 | 3 | #include 4 | 5 | int main(void) { 6 | for (int i = 0; i < 10; i++) { 7 | __asm__ ("msr contextidr_el1, %0" : : "r" (i) :); 8 | } 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /baremetal/arch/aarch64/dump_regs.c: -------------------------------------------------------------------------------- 1 | /* https://cirosantilli.com/linux-kernel-module-cheat#dump-regs */ 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | int main(void) { 9 | lkmc_dump_system_regs(); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /baremetal/arch/aarch64/no_bootloader/exit.S: -------------------------------------------------------------------------------- 1 | /* Test _exit. */ 2 | 3 | #include 4 | 5 | .global _start 6 | _start: 7 | mov x0, 0 8 | bl _exit 9 | -------------------------------------------------------------------------------- /baremetal/arch/aarch64/no_bootloader/m5_exit_addr.S: -------------------------------------------------------------------------------- 1 | /* https://cirosantilli.com/linux-kernel-module-cheat#m5ops-magic-addresses */ 2 | 3 | .global _start 4 | _start: 5 | # First parameter. 6 | mov x0, 0 7 | # 0x21 is exit. 8 | # 0x10010000 is system.m5ops_base 9 | ldr x10, =(0x21 << 8) 10 | ldr x9, =0x10010000 11 | # Do the magic access. 12 | ldr x0, [x9, x10] 13 | -------------------------------------------------------------------------------- /baremetal/arch/aarch64/no_bootloader/semihost_exit.S: -------------------------------------------------------------------------------- 1 | /* https://cirosantilli.com/linux-kernel-module-cheat#semihosting 2 | * 3 | * Since our stack pointer is not setup, we just a allocate a memory 4 | * region to contain the semihosting arguments, which must be in memory. 5 | */ 6 | 7 | .global _start 8 | _start: 9 | mov x1, 0x26 10 | movk x1, 2, lsl 16 11 | ldr x2, =.Lsemihost_args 12 | str x1, [x2, 0] 13 | mov x0, 0 14 | str x0, [x2, 8] 15 | mov x1, x2 16 | mov w0, 0x18 17 | hlt 0xf000 18 | .Lsemihost_args: 19 | .skip 16 20 | -------------------------------------------------------------------------------- /baremetal/arch/aarch64/no_bootloader/wfe_loop.S: -------------------------------------------------------------------------------- 1 | /* https://cirosantilli.com/linux-kernel-module-cheat#gem5-simulate-limit-reached */ 2 | 3 | #include 4 | 5 | .global _start 6 | _start: 7 | wfe 8 | b _start 9 | -------------------------------------------------------------------------------- /baremetal/arch/aarch64/semihost_exit.S: -------------------------------------------------------------------------------- 1 | /* https://cirosantilli.com/linux-kernel-module-cheat#semihosting */ 2 | 3 | .global main 4 | main: 5 | /* 0x20026 == ADP_Stopped_ApplicationExit */ 6 | mov x1, 0x26 7 | movk x1, 2, lsl 16 8 | str x1, [sp, 0] 9 | 10 | /* Exit status code. Host QEMU process exits with that status. */ 11 | mov x0, 0 12 | str x0, [sp, 8] 13 | 14 | /* x1 contains the address of parameter block. 15 | * Any memory address could be used. 16 | */ 17 | mov x1, sp 18 | 19 | /* SYS_EXIT */ 20 | mov w0, 0x18 21 | 22 | /* Do the semihosting call on A64. */ 23 | hlt 0xf000 24 | -------------------------------------------------------------------------------- /baremetal/arch/arm/no_bootloader/semihost_exit.S: -------------------------------------------------------------------------------- 1 | .global _start 2 | _start: 3 | mov r0, #0x18 4 | ldr r1, =#0x20026 5 | svc 0x00123456 6 | -------------------------------------------------------------------------------- /baremetal/arch/arm/semihost_exit.S: -------------------------------------------------------------------------------- 1 | .global main 2 | main: 3 | /* SYS_EXIT */ 4 | mov r0, #0x18 5 | /* ADP_Stopped_ApplicationExit */ 6 | ldr r1, =#0x20026 7 | /* Do the semihosting call on A32. */ 8 | svc 0x00123456 9 | -------------------------------------------------------------------------------- /baremetal/linker_variables.c: -------------------------------------------------------------------------------- 1 | /* https://cirosantilli.com/linux-kernel-module-cheat#baremetal-linker-script */ 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | extern int32_t lkmc_argc; 8 | extern int32_t lkmc_heap_low; 9 | 10 | int main(int argc, char **argv) { 11 | (void)argc; 12 | (void)argv; 13 | printf("&lkmc_heap_low %p\n", (void *)&lkmc_heap_low); 14 | printf("&lkmc_argc %p\n", (void *)&lkmc_argc); 15 | printf("argc %d\n", argc); 16 | printf("argv %p\n", (void *)argv); 17 | printf("lkmc_argc %" PRId32 "\n", lkmc_argc); 18 | } 19 | -------------------------------------------------------------------------------- /bench-cmd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Benchmark a command as a string and output results 3 | # to a file with format: 4 | # 5 | # cmd 6 | # time