@@ -17,8 +17,6 @@ net_virtio_init:
1717 push rbx
1818 push rax
1919
20- ; push rdx ; Save packed bus address
21-
2220 mov rdi , net_table
2321 xor eax , eax
2422 mov al , [ os_net_icount ]
@@ -47,27 +45,23 @@ net_virtio_init:
4745 call os_bus_write
4846
4947 ; Configure MSI-X (if available)
48+ ; TODO - Keep track of used vectors and increment as needed
5049 mov al , 0xB0
5150 call msix_init
5251 jc net_virtio_init_skip_int
5352
5453 ; Create gate(s) in the IDT
5554 push rdi
56- sub rdi , 0x1C
57- mov ax , 0x0001 ; Set flag for nt_interrupt
58- stosw
5955 mov edi , 0xB0
6056 mov rax , net_virtio_int
6157 call create_gate
62- mov edi , 0xB1
63- mov rax , net_virtio_int
64- call create_gate
65- ; mov edi, 0xB2
66- ; mov rax, net_virtio_int
67- ; call create_gate
68- ; mov edi, 0xB3
69- ; mov rax, net_virtio_int
70- ; call create_gate
58+ pop rdi
59+
60+ ; Set flag for interrupts enabled in net_table
61+ push rdi
62+ sub rdi , 0x1C
63+ mov ax , 0x0001 ; Set flag for nt_interrupt
64+ stosw
7165 pop rdi
7266
7367net_virtio_init_skip_int:
@@ -269,7 +263,7 @@ virtio_net_init_reset_wait:
269263 ; reading and possibly writing the device’s virtio configuration space
270264 ; population of virtqueues
271265
272- mov ax , 0xFFFF
266+ mov ax , 0xFFFF ; Disable config interrupts
273267 mov [ rsi + VIRTIO_CONFIG_MSIX_VECTOR ], ax
274268
275269 ; Set up Queue 0 (Receive)
@@ -293,7 +287,7 @@ virtio_net_init_reset_wait:
293287 rol rax , 32
294288 mov [ rsi + VIRTIO_QUEUE_DEVICE + 8 ], eax
295289 rol rax , 32
296- mov ax , 0x0000
290+ mov ax , 0x0000 ; MSI-X index 0
297291 mov [ rsi + VIRTIO_QUEUE_MSIX_VECTOR ], ax
298292 mov ax , 1
299293 mov [ rsi + VIRTIO_QUEUE_ENABLE ], ax
@@ -559,10 +553,6 @@ net_virtio_int:
559553 push rcx
560554 push rax
561555
562- ; Clear pending interrupt (if set)
563- mov al , 0xab
564- call os_debug_dump_al
565-
566556 ; Acknowledge the interrupt
567557 mov ecx , APIC_EOI
568558 xor eax , eax
@@ -574,7 +564,6 @@ net_virtio_int:
574564; -----------------------------------------------------------------------------
575565
576566
577-
578567; Variables
579568virtio_net_notify_offset: dq 0
580569virtio_net_notify_offset_multiplier: dq 0
0 commit comments