Skip to content

Instantly share code, notes, and snippets.

View snickerbockers's full-sized avatar
🐎
Beating the shit out of this dead horse.

snickerbockers

🐎
Beating the shit out of this dead horse.
View GitHub Profile
@snickerbockers
snickerbockers / backpatch.org
Created December 24, 2022 03:39
memory backpatch state machine

mem_access

this is an object that tracks a memory access (either read or write) in a code block. There will be one mem_access object for each memory access; thus any given code block could contain several mem_access objects or none at all.

mem_access will contain information that will be needed to backpatch the corresponding memory access; alternatively we might instead recompile the entire code block instead of backpatching (probably less efficient but also less complicated).

@snickerbockers
snickerbockers / gist:04f1863f0ded52c0d61f3cd47d4ba26e
Created October 9, 2022 22:41
perl one-liner to turn a text file into a c-string
perl -pe 's;^(.*)$;\"\1\\n\";;' < input.txt
@snickerbockers
snickerbockers / wash.cfg
Created July 5, 2022 02:33
WashingtonDC default config file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; AUTOMATICALLY GENERATED BY WASHINGTONDC
;;
;; This is WashingtonDC's config file. Config settings consist of a config
;; name followed by its value on the same line
;; the semicolon (;) character can be used to create single-line comments
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@snickerbockers
snickerbockers / calc.pl
Created January 18, 2022 06:01
calculator that evaluates polynomial expressions in the correct order based on operator precedence
#!/usr/bin/env perl
###################################################################
#
# calc.pl
#
# simple compiler for evaluating polynomial expressions in the correct
# order based on operator precedence
#
# input is taken from either stdin or arguments (using perl's ARGV file handle)
(gdb) hbreak *0x0c17218a
Hardware assisted breakpoint 1 at 0xc17218a
(gdb) c
Continuing.
Breakpoint 1, 0x0c17218a in ?? ()
1: x/i $pc
=> 0xc17218a: mov.l @r10,r8
(gdb) si
p0x0c17218c in ?? ()
1: x/i $pc
@snickerbockers
snickerbockers / crazy_taxi_gprof.txt
Last active December 1, 2020 03:04
gprof running through one cycle of crazy taxi's attract
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
5.25 0.57 0.57 314561309 0.00 0.00 arm7_decode
4.79 1.09 0.52 sh4_sq_pref
4.61 1.59 0.50 169386 0.00 0.02 run_to_next_arm7_event
4.61 2.09 0.50 213494262 0.00 0.00 memory_map_read_double
4.06 2.53 0.44 216297650 0.00 0.00 memory_map_write_double
@snickerbockers
snickerbockers / gprof_nosse.txt
Last active July 14, 2020 03:47
sa1_intro_fmv_gprof (no sse)
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
7.13 4.01 4.01 923943802 0.00 0.00 memory_map_read_double
4.38 6.47 2.46 517213049 0.00 0.00 memory_map_write_double
4.19 8.82 2.35 memory_map_write_float
4.16 11.15 2.34 249065856 0.00 0.00 pvr2_framebuffer_notify_write
3.82 13.30 2.15 memory_map_write_16
@snickerbockers
snickerbockers / gprof.txt
Last active July 12, 2020 21:32
sa1_intro_fmv_gprof (SSE version)
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
12.24 8.81 8.81 980745394 0.00 0.00 pvr2_framebuffer_notify_write
5.79 12.98 4.17 923958452 0.00 0.00 memory_map_read_double
4.31 16.08 3.11 30488481 0.00 0.00 pvr2_tex_mem_64bit_write_raw
3.81 18.83 2.75 517221569 0.00 0.00 memory_map_write_double
3.54 21.37 2.55 1115240679 0.00 0.00 pvr2_tex_mem_64bit_read8
@snickerbockers
snickerbockers / to_fixed.by
Created July 6, 2020 01:49
simple script for converting a floating point to a fixed point with 16 bits of precision
#!/usr/bin/env python
import sys
N_FRAC_BITS = 16
val = val_orig = float(sys.argv[1])
frac_part = 0
for i in range(N_FRAC_BITS):
snckrs@Tails:~/ghidra_projects/netbsd_crash$ telnet localhost 1998
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
[ 1.0000000] Loaded initial symtab at 0x8c3949ac, strtab at 0x8c3c1adc, # entries 11524
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.0000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.0000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.