Skip to content

Instantly share code, notes, and snippets.

/* --------------NON-FP------------------ */
000084e4 <foo>:
int foo(int a, int b)
{
84e4: e24dd008 sub sp, sp, #8
84e8: e58d0004 str r0, [sp, #4]
84ec: e58d1000 str r1, [sp]
return 2 * a + b;
84f0: e59d3004 ldr r3, [sp, #4]
84f4: e1a02083 lsl r2, r3, #1
@soap-DEIM
soap-DEIM / viz.cpp
Created May 16, 2014 02:41
graphicviz-dot example
#include <cstdio>
#include <fstream>
#define VISUAL(caller, callee, ofs) \
ofs << caller << "->"; \
callee(ofs); \
ofs << ';' << '\n'
void foo(std::ofstream &ofs)
{
function solve_board_step(solve_state) {
if (solve_state.p >= solve_state.max_length) {
solve_state.finish_callback(solve_state.solutions);
return;
}
++ solve_state.p;
solve_state.solutions = evolve_solutions(solve_state.solutions,
solve_state.weights,
solve_state.dir_step);
/*
* -------------------------
* | NW | N | NE |
* |i-1,j-1| i-1,j |i-1,j+1|
* | | | |
* -------------------------
* | W | ^_^ | E |
* | i ,j-1| i ,j | i ,j+1|
* | | | |
* -------------------------
FATAL Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/cmath:41: 'bits/c++config.h' file not found
FATAL Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/cstddef:41: 'bits/c++config.h' file not found
Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_relops.h:67: expected '{'
Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_relops.h:67: C++ requires a type specifier for all declarations
Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_relops.h:67: expected expression
Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_relops.h:67: expected ';' after top level declarator
FATAL Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:33: 'bits/c++config.h' file not found
Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:95: no member named 'FILE' in the global namespace
Error: /usr/lib/gcc/i686-linux-gnu/4.8/../../../../include/c
@soap-DEIM
soap-DEIM / fake_compiler.sh
Created March 19, 2014 19:43
This script can be used to generate the compile_commands.json file
#! /bin/sh
#
# This script can be used to generate the compile_commands.json file.
# Configure this script as the compiler.
# Export the $COMPILATION_COMMANDS environement variable to the full path of the compile_commands.json file.
# set $FORWARD_COMPILER to the path of the actual compiler to perform the actual compilation.
#
# Example:
#
@soap-DEIM
soap-DEIM / oif.py
Last active August 29, 2015 13:57
simple script for calculating OIF
import sys
import re
import os.path
if len(sys.argv) == 2 and os.path.lexists(sys.argv[1]):
print sys.argv[1]
print sys.argv[1][:-4]
else:
print "Usage: python oif.py FILE_NAME.csv"
sys.exit()
EXTERN_C void *pthread_fn(void *data)
{
Romain::App_thread *t = (Romain::App_thread*)data;
l4_cap_idx_t cap = (l4_cap_idx_t)pthread_getl4cap(pthread_self());
t->vcpu_cap(L4::Cap<L4::Thread>(cap));
/*
* Thread creation and config.
*/
extern "C" void _exit(int code) __attribute__ ((__noreturn__, __weak__));
void _exit(int code)
{
L4Re::Env const *e;
if (l4re_global_env && (e = L4Re::Env::env()) && e->parent().is_valid())
e->parent()->signal(0, code);
for (;;)
l4_ipc_sleep(L4_IPC_NEVER);
}
/* --(.'w'.)-( .'w')-( )-( )-('w'. )-(.'w'.)-( .'w')-( )-( )-('w'. )-(.'w'.)-- */