m1n1/proxyclient
Eileen Yoon 476c31e973 afk.rbep: Bootstrap ringbuf block size at runtime
Make the ringbuffer class robust to various block sizes to generalize to
both DCP and AOP.

The first three blocks of the ringbuffer is reserved for exchanging size,
rptr, wptr:

```
           bufsize      unk
00000000  00007e80 00070006 00000000 00000000 00000000 00000000 00000000 00000000
00000020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000040  *   rptr
00000080  00000600 00000000 00000000 00000000 00000000 00000000 00000000 00000000
000000a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
000000c0  *   wptr
00000100  00000680 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000120  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000140  *
```

Each block is spread out by some block_size multiple of 0x40 (step). The
0th block holds the size of the ringbuffer contents, the 1st block holds
the rptr, and the 2nd block holds the wptr. The actual contents of the
ringbuffer starts after the first three blocks, which will be
collectively called the "header".

However, this block_size isn't constant. DCP seems to consistently use
0x40, but AOP can use both 0x40/0x80. Since we're not given the block_size,
so wemust bootstrap it. Recall we are given the total size of the
rinbuffer in the mailbox message. Since we're always given the size of
the ringbuffer `bufsize` at offset +block_size * 0 (or simply 0), and we
can find the header size by subtracting `bufsize` from the total size.
Since we also know that the header is always 3 blocks wide, we can
divide the header size by 3 to obtain the block_size.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
..
experiments experiments/dcp: Make dcp*.py scripts run again 2024-10-31 01:24:36 +09:00
hv m1n1/avd: Add initial AVD driver prototype/tracer 2024-01-11 16:20:49 +09:00
m1n1 afk.rbep: Bootstrap ringbuf block size at runtime 2024-10-31 01:24:36 +09:00
tools Add ipython shell to proxyclient 2023-11-27 13:30:27 +09:00