Skip to content

Instantly share code, notes, and snippets.

brendan greg's incredibleness: http://www.brendangregg.com/Perf/linux_observability_tools.png
vim practice: wget https://raw.githubusercontent.com/jtgi/algs-ds/1e4f2b066f0b0f102a35e8573d9a12b1f0c19e0b/Trees/Bst.java
@jtgi
jtgi / sigtramp.c
Created November 23, 2014 00:07
Implementing signals via trampolining
#include <xeroskernel.h>
/*
* Runs in user space, executing handler then
* returning to previous stack of the process
*/
void sigtramp(void (*handler)(void *), void *ctx_frame, unsigned int old_esp) {
handler(ctx_frame);
syssigreturn(old_esp);
}
@jtgi
jtgi / findMax.s
Created January 20, 2014 17:50
find max int in an array.
.pos 0x100
main: irmovl bottom, %esp # initialize stack
irmovl a, %edi # address of the first element of a
irmovl alen, %esi
mrmovl (%esi), %esi # number of elements of a
irmovl $0x1, %eax
subl %eax, %esi # last index in a
# ready to call findmax: a --> edi, last --> esi
call findmax