sysprog21 / semu

A minimalist RISC-V system emulator capable of running Linux kernel
MIT License
251 stars 47 forks source link

Refactor VirtIO MMIO register map handling #23

Closed shengwen-tw closed 1 year ago

shengwen-tw commented 1 year ago

Two adjustments are conducted in this pull request:

  1. Replace the hard-coded register address checking with enum.
  2. Handle the configuration space read / write with device-specific structures.
shengwen-tw commented 1 year ago

Should we also add destructor functions to clean up the allocated memory (i.e., vnet->priv and vblk->priv) explicitly even if the program will only be terminated by pressing Ctrl+A then X?

jserv commented 1 year ago

Should we also add destructor functions to clean up the allocated memory (i.e., vnet->priv and vblk->priv) explicitly even if the program will only be terminated by pressing Ctrl+A then X?

Yes, you can do it in next pull request(s). Follow the way how kvm-host does.

jserv commented 1 year ago

Thank @shengwen-tw for contributing!