• Interrupt-driven IDE disk access - [康朴塔散思]

    2009-08-20

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://damocles.blogbus.com/logs/44697611.html

    Challenge! Implement interrupt-driven IDE disk access, with or without DMA. You can decide whether to move the device driver into the kernel, keep it in user space along with the file system, or even (if you really want to get into the micro-kernel spirit) move it into a separate environment of its own.

    We know that JOS is exokernel style operating system. To put ide driver into kernel space is not a graceful solution. But use upcall to dispatch them into user space needs more effort. It maybe resemble the way JOS to process the user page fault in the fork.

    I choose the easy style to move ide driver from user space to kernel. There are some points need to be take care.

    1.  JOS file system is not in kernel space. If we send read or write request from file system to ide driver, the address translation is needed. Read and write port's address is the address in the current context. I just map the page to the temp address in the current env's address space during the handling of the ide irq. But remember NOT to do this in the ide_{read,write} function because maybe the environment has yielded in the later time.

    2. After file system sends request, it needs to be blocked. But simply making it not runnable is not correct because we will return back from the system call. Return to a not runnable env is not possible. I choose to sleep the env and send signal from kernel to wake it up if the read and write operation has been completed. This is much more like the AIO model, but the advantage is that file system now is in user space, we just need to yield to other process and sleep.

    Or you can just make it not runnable when i/o and restore it to runnable if i/o complete.

    3. Write into disk needs to wait that disk is ready. Otherwise the write interrupt cannot be sent from disk.

    Future work

    1. Add an io server to process the request parallelly. More exokernel : - )

    2. Add an io scheduler to process requests in a more reasonable way.

     


    收藏到:Del.icio.us