interrupt handler and process address spaces

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
dansmahajan
Member
Member
Posts: 62
Joined: Mon Jan 07, 2013 10:38 am

interrupt handler and process address spaces

Post by dansmahajan »

Hi everyone, i am trying to develop network support for my os and recently faced an issue- whenever a packet is received from network, an interrupt is raised; problem here is since mmio address of device is mapped to a network process's vas resulting in a page fault exception
so i guess my option here is either i have to switch the address space in the interrupt handler or i have to map the correct memory addresses..as far as i know interrupt handler should be as short as possible but in either of the cases its a lot of work for the interrupt handler
so is there any other solution ??
or
am i doing it wrong ??
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: interrupt handler and process address spaces

Post by Combuster »

You say you have a network process with device access (microkernel) yet you try to run device-specific code in kernel land (monolithic). Where do you want to go?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
dansmahajan
Member
Member
Posts: 62
Joined: Mon Jan 07, 2013 10:38 am

Re: interrupt handler and process address spaces

Post by dansmahajan »

Combuster wrote:You say you have a network process with device access (microkernel) yet you try to run device-specific code in kernel land (monolithic). Where do you want to go?
my network process just initializes the device and sets up a handler thats it (by the way it is a ring0 process). So when an interrupt occurs its the kernel which do rest of the thing

PS: only vm86 process is running in ring3 every thing else is in ring0
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: interrupt handler and process address spaces

Post by Gigasoft »

You should preferably have a way to allocate linear pages that are visible in every process, as some devices may require writing to a register to deassert an IRQ. Otherwise, address space switching is unavoidable, but you can reduce the number of switches needed when nested interrupts happen by putting any further interrupts in a queue and executing the handlers in an orderly fashion. An EOI should then not be sent until all drivers that are registered with a given interrupt line have finished processing the interrupt.
dansmahajan
Member
Member
Posts: 62
Joined: Mon Jan 07, 2013 10:38 am

Re: interrupt handler and process address spaces

Post by dansmahajan »

Gigasoft wrote:You should preferably have a way to allocate linear pages that are visible in every process, as some devices may require writing to a register to deassert an IRQ. Otherwise, address space switching is unavoidable, but you can reduce the number of switches needed when nested interrupts happen by putting any further interrupts in a queue and executing the handlers in an orderly fashion. An EOI should then not be sent until all drivers that are registered with a given interrupt line have finished processing the interrupt.
Thank you Gigasoft for your reply
this is what i should do; map the corresponding frames in the current address space and complete the interrupt handler,send and EOI and then resume back..by doing this theres a possibility of missing some interrupts???
Post Reply