Skip to content

Instantly share code, notes, and snippets.

@ssvb
ssvb / gist:38bec10f9b49806bf4fb7881dfc5241a
Created July 29, 2016 14:34
Revert 1a83fb4 commit in U-Boot v2016.09-rc1 for Pine64
$ diff --unified=20 u-boot.orig-v2016.09-rc1.disasm u-boot.revert-1a83fb4.disasm
--- u-boot.orig-v2016.09-rc1.disasm 2016-07-29 17:28:31.000000000 +0300
+++ u-boot.revert-1a83fb4.disasm 2016-07-29 17:28:41.000000000 +0300
@@ -1,22 +1,22 @@
-u-boot.orig: file format elf64-littleaarch64
+u-boot: file format elf64-littleaarch64
Disassembly of section .text:
From aaa3428877546e7dff686e4e526f886becc59323 Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Date: Mon, 25 Jul 2016 19:43:58 +0300
Subject: [PATCH] musl nothreshold malloc
---
src/malloc/malloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/malloc/malloc.c b/src/malloc/malloc.c
@ssvb
ssvb / gist:84bf3b34d0906fbd43b3261837546f24
Created June 11, 2016 18:42
Allwinner A64 BROM, initialization of the boot media identifier
-----------------------------------------------------------------------
49f0: e3a00001 mov r0, #1
49f4: e5cb0028 strb r0, [fp, #40] ; 0x28
-----------------------------------------------------------------------
4e5c: e3a00801 mov r0, #65536 ; 0x10000
4e60: e58d0000 str r0, [sp]
[...]
sunxi-tools 9e7f3a3a93290654c6a30a157484c46d37686d20
$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/arm-linux-gnueabihf/gcc-bin/4.7.4/arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-linux-gnueabihf/4.7.4/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /var/tmp/portage/cross-arm-linux-gnueabihf/gcc-4.7.4/work/gcc-4.7.4/configure --host=x86_64-pc-linux-gnu --target=arm-linux-gnueabihf --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/arm-linux-gnueabihf/gcc-bin/4.7.4 --includedir=/usr/lib/gcc/arm-linux-gnueabihf/4.7.4/include --datadir=/usr/share/gcc-data/arm-linux-gnueabihf/4.7.4 --mandir=/usr/share/gcc-data/arm-linux-gnueabihf/4.7.4/man --infodir=/usr/share/gcc-data/arm-linux-gnueabihf/4.7.4/info --with-gxx-include-dir=/usr/lib/gcc/arm-linux-gnueabihf/4.7.4/include/g++-v4 --with-python-dir=/share/gcc-data/arm-linux-gnueabihf/4.7.4/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror -
#!/usr/bin/env ruby
data = []
File.open(ARGV[0]).each_byte {|b| data.push(b) }
(0..(data.size - 1)).step(4) {|i|
x0 = data[i + 0]
x1 = data[i + 1]
x2 = data[i + 2]
x3 = data[i + 3]
$ cat coin_jam.cr
n = 16
j = 50
max_bound = (2**n - 1).to_u64
min_bound = (max_bound - 2**(n-1) + 2).to_u64
puts "Case #1:"
cur = min_bound
/*
* Usage: gcc -DCPU_CLOCK_FREQUENCY=1200000000 test-arm-neon-mix.S && time ./a.out
* gcc -DCPU_CLOCK_FREQUENCY=1200000000 -DINTERLEAVED test-arm-neon-mix.S && time ./a.out
*
* | -DINTERLEAVED | separate ARM and NEON code chunks
* ------------+---------------+-----------------------------------
* Cortex-A15 | ~6.7 cycles | ~5.7 cycles (!)
* ------------+---------------+-----------------------------------
* Cortex-A8 | 7.0 cycles | 7.0 cycles
* ------------+---------------+-----------------------------------
diff --git a/util.c b/util.c
index 52e88b4..ec7c6ff 100644
--- a/util.c
+++ b/util.c
@@ -59,26 +59,30 @@ void aligned_block_copy_backwards(int64_t * __restrict dst,
int size)
{
int64_t t1, t2, t3, t4;
- src += size / 8 - 1;
- dst += size / 8 - 1;
@ssvb
ssvb / div-loop.c
Created March 21, 2016 20:02
Maybe a test for Cortex-A7 erratum 823274: Load or store which fails condition code check might cause deadlock or data corruption ? To be run together with sun4i-ss
int main()
{
volatile double a = 1.0;
volatile double b = 1.0;
for (;;) {
a /= b;
}
return 0;
}
@ssvb
ssvb / remix-mini-dmesg.txt
Created January 31, 2016 09:14
dmesg output from Remix OS running on Jide Remix Mini
<6>[ 0.000000] Initializing cgroup subsys cpuset
<6>[ 0.000000] Initializing cgroup subsys cpu
<6>[ 0.000000] Initializing cgroup subsys cpuacct
<5>[ 0.000000] Linux version 3.10.93 (jenkins@pallas.corp.jide.com) (gcc version 4.9.3 20150113 (prerelease) (Linaro GCC 4.9-2015.01-3) ) #1 SMP PREEMPT Thu Jan 14 13:49:55 CST 2016
<4>[ 0.000000] CPU: AArch64 Processor [410fd034] revision 4
<6>[ 0.000000] Machine: sun50iw1p1
<6>[ 0.000000] bootconsole [earlycon0] enabled
<6>[ 0.000000] cma: CMA: reserved 300 MiB at ad400000
<7>[ 0.000000] On node 0 totalpages: 520192
<7>[ 0.000000] DMA zone: 7112 pages used for memmap