hi,every body .
i confused that how an user mode driver using io ports in a microkernel env.
for example, a keyboard driver read a scancode using "in al,dx" instruction,but in ring 3 is not allow,i know tss io bitmap can do this,without change tss,is there another method can implement it. sorry for my english grammer and expression
how to operate io function in user mode?
Re: how to operate io function in user mode?
I'm not doing microkernel but I can think of some possibilities:
1. kernel API - the kernel expose a hardware interface to driver, the actual IO is performed by kernel in ring 0.
2. TSS.io bitmap prevent direct IO, the kernel catch the #GP and emulate the io instruction
3. Driver request to grant access right and modify io bitmap.
I think 3 is more of the standard way, and there are nice tricks like mapping the bitmap via paging to avoid "modifying" TSS on every task switch.
1. kernel API - the kernel expose a hardware interface to driver, the actual IO is performed by kernel in ring 0.
2. TSS.io bitmap prevent direct IO, the kernel catch the #GP and emulate the io instruction
3. Driver request to grant access right and modify io bitmap.
I think 3 is more of the standard way, and there are nice tricks like mapping the bitmap via paging to avoid "modifying" TSS on every task switch.
Re: how to operate io function in user mode?
thinks your reply.bluemoon wrote:I'm not doing microkernel but I can think of some possibilities:
1. kernel API - the kernel expose a hardware interface to driver, the actual IO is performed by kernel in ring 0.
2. TSS.io bitmap prevent direct IO, the kernel catch the #GP and emulate the io instruction
3. Driver request to grant access right and modify io bitmap.
I think 3 is more of the standard way, and there are nice tricks like mapping the bitmap via paging to avoid "modifying" TSS on every task switch.
but 3 will change tss every time scheduling thread which cost resource.
Re: how to operate io function in user mode?
you gave me a great help,i will try it later
- Combuster
- 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: how to operate io function in user mode?
funggong wrote:but 3 will change tss every time scheduling thread which cost resource.
Code: Select all
TSS (cpu1)
IOPB ----------------+
TSS (cpu2) |
IOPB ----------------+
(...) |
-- page boundary -- |
IO bitmap <----------+
Re: how to operate io function in user mode?
No, as I said there are tricks like page mapping, read Combuster's response for the concept.funggong wrote:but 3 will change tss every time scheduling thread which cost resource.
Re: how to operate io function in user mode?
understand now,that is said allocating a page for io bitmap which needed