Skip to content

Instantly share code, notes, and snippets.

View SmoothHacker's full-sized avatar

Scott Lagler SmoothHacker

View GitHub Profile
@mcastelino
mcastelino / kvm-qemu-signals.md
Created March 30, 2018 16:56
KVM - How does the VM return control back to the controlling VMM process on signals

How to setup the controlling process to handle signals

  1. Setup a signal handler for the vcpu thread for that signal. It does not have to do anything
  2. When a signal is sent to the thread hosting the VM it will result in EINTR (not a reported kvm exit reason)
                signal(SIGUSR1,sig_func); // Register signal handler inside thread, the function is empty
                ret = ioctl(kvm->vcpus->vcpu_fd, KVM_RUN, 0);

                if (ret < 0) {
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active April 16, 2025 07:20
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@michaeljclark
michaeljclark / riscv-imm.cc
Last active October 17, 2022 00:47
RISC-V Immediate Decoder Template Metaprogram
/*
* RISC-V Immediate Decoder Template Metaprogram
*
* Author: Michael Clark <[email protected]>
*/
#include <cstdio>
#include <cstdint>
/* sign extension template */
@iainconnor
iainconnor / Android Studio .gitignore
Created January 24, 2014 20:20
A .gitignore for use in Android Studio
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
@jakub-g
jakub-g / git-diff-stat-sort.sh
Last active July 20, 2024 09:17
sort git diff --stat starting from the files that have most lines changed
git show HEAD --stat=200 | tail +7 | awk '{ print $3 " "$4 " " $1}' | sort -n -r | less