I've got a problem while coding a driver for RTL8139 Ethernet card.
The thing is that after receiving a packet when I am acknowledging the reception I got an exception of type "Segment not present."
If I decoded the error correctly it means that there is a mess up in the IDT, but I don't know why. RTL8139's IRQ number which I read from PCI configuration space is 11 and I add to it 32 (in irq managemet routine, https://github.com/narke/Aragveli/blob/ ... /irq.c#L45), 11+32=43 but in the error message it seems that there is an issue with an IDT entry 47, I don't know why.
This all happens when the following line is being executed:
Code: Select all
outw(rtl8139_device.io_base + ISR, status);
Here status is always 1.
Here is the source file for the driver: https://github.com/narke/Aragveli/blob/ ... /rtl8139.c
You will not see mapping() because I use flat space memory organization without paging for the moment.
I debugged it for hours but I think that I am not seeing a little detail that you me see obviously.
I will be very grateful for an advice.
I run the .iso image with:
Code: Select all
sudo qemu-system-i386 -m 32 -machine accel=kvm \
-cpu host \
-netdev bridge,br=br0,id=net0 \
-device rtl8139,netdev=net0 \
-cdrom aragveli.iso
Code: Select all
narke@apex ~> cat /etc/qemu/bridge.conf
allow br0
Code: Select all
narke@apex ~> sudo brctl addbr br0
To build:
Code: Select all
narke@apex ~> git clone https://github.com/narke/Aragveli.git
narke@apex ~> cd Aragveli/src/kernel/
narke@apex ~> make