commit 811b47d5d9bbb0bab6af6f21f300591d251cdb21 from: Gleb Nesterov date: Sun Mar 22 17:36:57 2026 UTC Start writing rv_dump_regs commit - 5c19b3855c296bea828f9a37a10af99a2c39d54f commit + 811b47d5d9bbb0bab6af6f21f300591d251cdb21 blob - af7e3c0f80d9c5a2f936c884b6916daaca484060 blob + 1a72c6c665b441d2852d254720fbcd8b679dbee1 --- rvvm/rvhart.c +++ rvvm/rvhart.c @@ -1,5 +1,7 @@ #include #include +#include +#include #include "rvhart.h" #include "rvram.h" @@ -103,3 +105,15 @@ rv_simple_step(struct rv_hart *h, uint32_t *prog) i = rv_decode(word); rv_execute(h, NULL, i); } + +void +rv_dump_regs(struct rv_hart *h) +{ + int i; + + for (i = 0; i < RV_RFILE_SIZE; ++i) { + // TODO: Write actual printf + if ((i + 1) % 4 == 0) + printf("\n"); + } +} blob - 3d24458936cf5f2198dc1e4fa0ea097fd5af06bd blob + 835076f7ee32bd32ba3f8243749fb78ab0e90a65 --- rvvm/rvhart.h +++ rvvm/rvhart.h @@ -36,7 +36,15 @@ struct rv_hart { uint64_t rfile[RV_RFILE_SIZE]; }; +static const char *rv_regs_abi_names[RV_RFILE_SIZE] = { + "zero", "ra", "sp", "gp", "tp", "t0", "t1", "t2", + "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5", + "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7", + "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6" +}; + struct rv_instr rv_decode(uint32_t word); void rv_execute(struct rv_hart *h, struct rv_ram *m, struct rv_instr i); void rv_step(struct rv_hart *h, struct rv_ram *m); +void rv_dump_regs(struct rv_hart *h); #endif