<juri_>
always here, but not always in this timezone. :)
Stromeko has quit [Ping timeout: 260 seconds]
Stromeko has joined ##raspberrypi-internals
bonda_000 has quit [Ping timeout: 268 seconds]
bonda_000 has joined ##raspberrypi-internals
<f_>
juri_: ;)
<f_ridge>
<x2x6_/D> Hi
<juri_>
Hi!
<bonda_000>
are you guys working on reverse engineering the vpu code as well? juri: f_ridge:
<bonda_000>
it's been quite here since I joined only talked to clever for the most part
f_ has quit [Quit: To contact me, send a memo using MemoServ, PM f_[xmpp], or send an email. See https://vitali64.duckdns.org/.]
<f_ridge>
<x2x6_/D> I eventually do that from time to time. Especially now, when Clever has pointed me to an unstripped version . Before that it was a more tough experience
<f_ridge>
<x2x6_/D> I eventually do that from time to time. Especially now, when Clever has pointed me to an unstripped version of start_x. Before that it was a more tough experience(edited)
user_user has joined ##raspberrypi-internals
user_user has quit [Quit: leaving]
user_user has joined ##raspberrypi-internals
<user_user>
I want to measure exact periods of time to understand how my functions are performing on a baremetal code on PI3
<clever>
user_user: i think the best option is to just read ST_CLO before and after running your function, but the resolution is only 1 uSec
<clever>
the arm timer might also work, if its not being reset by other things
<clever>
oh, and the arm has dedicated performance counters you could look into
<user_user>
I think I should use a systimer but I remember some controversal info seen somewhere that videocore tweaks clocks for ARM cpu.
<clever>
i think those can count things like clock cycles elapsed, and cache misses
<clever>
assuming your not having thermal throttling, the VPU will only change the arm clock when you ask it to
<user_user>
So if it does so I can not really rely on anything that is clock based?
<clever>
usually via the linux cpufreq driver
<clever>
ST_CLO is always clocked at 1mhz, that never changes
user_user has quit [Quit: leaving]
<bonda_000>
so far figured out
<bonda_000>
the first program that is run after the init
<bonda_000>
vmcs_app
<bonda_000>
ends up in vmcs_task_alloc_ex that creates first 12 threads
<bonda_000>
I'm not sure if you call those queues or threads
<bonda_000>
clever: do you consider this a code obfuscation if values are swapped back and forth between lo regs, the stack, and high regs?
<bonda_000>
I notice that the nested function calls of vcos/tx tend to reach back to the stack of the caller function to grab something
<clever>
bonda_000: is it just doing sp + offset to go back in the stack, or is it being passed a pointer?
<bonda_000>
one that I am at right now, had sp passed as an argument and yeah goes back up the stack
<clever>
the only time ive noticed any real code obfuscation, is when dealing with some of the hmac keys in start.elf
<clever>
it has a big array of the expected keys, but they have all been xor'd with a constant
<clever>
so you have to xor each of them with that constant, to get the real key
<bonda_000>
vcos_thread_create param_3 is a stack pointer of a caller, vcos_thread_create_classic
<clever>
that sounds like its just a struct allocated on the local stack frame
<clever>
so basically, `struct foo; bar(&foo);`
<clever>
which is totally normal c stuff
<bonda_000>
uh, sort of
<bonda_000>
default_attrs
<bonda_000>
got copied there
<clever>
ah yes, the thread attributes, i saw that recently
<bonda_000>
and then
<clever>
thats just initializing the thread attributes to a default value
<bonda_000>
yeah it has a pointer to 0x2000 bytes of malloced memory
<bonda_000>
then a constant 2000h
<bonda_000>
nvm, that's not a default
<bonda_000>
that's for these first 12 threads
<bonda_000>
and then
<bonda_000>
it has hidden two function pointers
<bonda_000>
on a stack and into a thread_struct that is of size 1F4
<bonda_000>
vmcs_app_message_handler() is the one you want to take a look at
<bonda_000>
it's not a message handler but it's basically the meat of the VPU code
<bonda_000>
it initiates everything
<bonda_000>
arm, linux kernel, cameras, hdmi
<clever>
yeah, vmcs_app_message_handler, seems to be starting nearly everything on the system