#
✕ nick:marcan
#asahi · 2021-06-19 06:37
marcanPMed
#asahi · 2021-06-19 06:34
marcancan you upload the System.map somewhere?
#asahi · 2021-06-19 06:34
marcanmaybe there's an offset anyway?
#asahi · 2021-06-19 06:34
marcanhm
#asahi · 2021-06-19 06:34
marcanthe stack trace addresses are guest addresses (virtual)
#asahi · 2021-06-19 06:33
marcanyou probably have kASLR
#asahi · 2021-06-19 06:31
marcan(it should eventually be a real single-step but I haven't gotten around to using the debug hardware yet)
#asahi · 2021-06-19 06:30
marcanthough there is `step` which is a funny hack that just runs the guest for a few cycles (driven by a timer interrupt)
#asahi · 2021-06-19 06:30
marcanthat's a big missing thing
#asahi · 2021-06-19 06:30
marcanwell, except breakpoints and single-stepping
#asahi · 2021-06-19 06:30
marcanneeds a lot more work to make it an ergonomic debugger, but the primitives are there
#asahi · 2021-06-19 06:30
marcanand yeah, wfi, so idle loop :)
#asahi · 2021-06-19 06:29
marcanglad you like it :)
#asahi · 2021-06-19 06:28
marcanI should make that use keystone/capstone instead of that hideous shell-out hack
#asahi · 2021-06-19 06:28
marcan(you need to have gcc/binutils for aarch64 installed)
#asahi · 2021-06-19 06:27
marcantry that
#asahi · 2021-06-19 06:27
marcandisassemble_at(p.hv_translate(hv.ctx.elr, True) - 32, 64)
#asahi · 2021-06-19 06:27
marcanyou can also do a disasm thing, sec
#asahi · 2021-06-19 06:27
marcanquite likely the idle loop, yeah
#asahi · 2021-06-19 06:26
marcanhonestly it should just expose a gdb stub at some point, so you can just use standard tools to load symbols etc
#asahi · 2021-06-19 06:25
marcanright now it only does that on exceptions
#asahi · 2021-06-19 06:25
marcanI should add more proper debug-friendly commands, like a "show regs" thing :)
#asahi · 2021-06-19 06:25
marcanyou can get a backtrace with `bt`
#asahi · 2021-06-19 06:25
marcanhv.ctx.regs[0] etc will give you the GPRs
#asahi · 2021-06-19 06:25
marcanhv.ctx.elr is the guest return address (i.e. next instruction to be executed after returning)
#asahi · 2021-06-19 06:24
marcanfrom the shell? the shell runs on cpu0, you're in that context
#asahi · 2021-06-19 06:23
marcanbut I need spinlock primitives and some trivial emulation of the cpustart hardware :)
#asahi · 2021-06-19 06:23
marcanit shouldn't be too hard to make the HV support SMP
#asahi · 2021-06-19 06:23
marcanand the HV wants to use one of the secondaries for the watchdog
#asahi · 2021-06-19 06:23
marcanthat's just because the m1n1 smp support is initialized with a one shot function that starts all CPUs
#asahi · 2021-06-19 06:22
marcanbut the guest only sees CPU0
#asahi · 2021-06-19 06:22
marcanyes
#asahi · 2021-06-19 06:22
marcanso technically all CPUs are up but only CPU0 is usable
#asahi · 2021-06-19 06:22
marcanthen only uses CPU0 except it puts the watchdog on CPU1 (or was it 7?)
#asahi · 2021-06-19 06:22
marcanthe HV *does* start all CPUs
#asahi · 2021-06-19 06:22
marcanunless you mean the beginning bit
#asahi · 2021-06-19 06:22
marcanonly CPU 0 should be alive when running under the HV
#asahi · 2021-06-19 06:21
marcanFDT: CPU 1 is not alive, disabling... etc
#asahi · 2021-06-19 06:21
marcanno, it shouldn't
#asahi · 2021-06-19 06:21
marcanbut for now you can stick it directly in the devicetree
#asahi · 2021-06-19 06:21
marcanI've wanted to add a concat thing to set kernel commandlines more easily, something like just 'cmdline:' + commandline + '\0' as a payload format
#asahi · 2021-06-19 06:21
marcanyup
#asahi · 2021-06-19 06:19
marcanI guess? I didn't write that initrd
#asahi · 2021-06-19 06:18
marcanno kernel debug args though I guess
#asahi · 2021-06-19 06:18
marcankind of impressed it got to a shell, heh
#asahi · 2021-06-19 06:17
marcanat least I guess I should make the HV unmap that from the guest :-)
#asahi · 2021-06-19 06:15
marcanalso, if the devicetree is instantiating the USB device that the HV is using, that will go very wrong; there is no logic in m1n1 to disable that in the devtree if it's missing in the ADT, maybe that should be added
#asahi · 2021-06-19 06:15
marcan(once it loads)
#asahi · 2021-06-19 06:15
marcanbut I expect the linux UART driver to really hate my lame vuart
#asahi · 2021-06-19 06:15
marcanyou should see m1n1 boot and at least linux earlycon output

plus ›