@@ -125,7 +125,10 @@ static void mem_load(hart_t *hart,
125125 return ;
126126 }
127127
128- if ((addr >> 28 ) == 0xF ) { /* MMIO at 0xF_______ */
128+ if ((addr >> 28 ) == 0x2 ) { /* MMIO at 0x2_______ */
129+ virtio_pci_read (hart , & data -> vsnd , addr , width , value );
130+ return ;
131+ } else if ((addr >> 28 ) == 0xF ) { /* MMIO at 0xF_______ */
129132 /* 256 regions of 1MiB */
130133 switch ((addr >> 20 ) & MASK (8 )) {
131134 case 0x0 :
@@ -192,7 +195,15 @@ static void mem_store(hart_t *hart,
192195 return ;
193196 }
194197
195- if ((addr >> 28 ) == 0xF ) { /* MMIO at 0xF_______ */
198+ /* TODO */
199+ if (addr >= 0x100000 && addr <= 0x200000 ) {
200+ printf ("!!!!!!!!!!!!!!!!!\n\n\n\n\n" );
201+ }
202+
203+ if ((addr >> 28 ) == 0x2 ) { /* MMIO at 0x2_______ */
204+ virtio_pci_write (hart , & data -> vsnd , addr , width , value );
205+ return ;
206+ } else if ((addr >> 28 ) == 0xF ) { /* MMIO at 0xF_______ */
196207 /* 256 regions of 1MiB */
197208 switch ((addr >> 20 ) & MASK (8 )) {
198209 case 0x0 :
@@ -668,6 +679,9 @@ static int semu_init(emu_state_t *emu, int argc, char **argv)
668679 /* Set up peripherals */
669680 emu -> uart .in_fd = 0 , emu -> uart .out_fd = 1 ;
670681 capture_keyboard_input (); /* set up uart */
682+ #if SEMU_HAS (VIRTIOPCI )
683+ virtio_pci_init (& (emu -> vpci ));
684+ #endif
671685#if SEMU_HAS (VIRTIONET )
672686 if (!virtio_net_init (& (emu -> vnet ), netdev ))
673687 fprintf (stderr , "No virtio-net functioned\n" );
0 commit comments