L4, Posix and Drivers implementations
Posted: Thu Oct 06, 2011 5:29 am
Hello everybody,
I'm Gianluca Magnini, a student in Computer Science in Siena (Italy). This is my first post in the forum!
Actually, I'm studying about various L4 Microkernel implementations (Pistachio, Codezero, OKL4), but I have some doubts about how to implement functionalities user-oriented.
In fact, I would like to understand how to implement a Posix layer and use it to implement Device drivers as user-servers. I've looked for documentation in OKL4, Pistachio and Codezero manuals, and furthermore I've tried to undestand the code of the three Microkernels, but it seems that all of those Microkernel uses some frameworks (such as Genode, Iguana, or similar) to add some abstraction layer between Microkernel and user-threads.
I would like to implement the Posix layer directly using the Microkernel functionalities, and the Drivers directly using Posix layer abstraction. I tought about the creation of a Posix server that is launched at the beginning, and that contains data structures and functions capable of serving "posix requests", such as pthread_create. Each Posix is so an IPC to that server. I think Codezero has a similar implementation, in which the Posix server is called VFS. My problem is that I don't understand how to implement read/write functions from User thread to Device driver. I explain it better: suppose I've an user thread that would like to read an ethernet packet, using "read" function. The user will "open" the ethernet device and will read from it.
User code:
This translate in two IPCs (one for Open and one for Read) to the Posix server that will create a sort of file descriptor in the first case (Open) and will read the data in the second case, transferring the data from the driver to the user (Read). Anyway, I cannot figure how to pass the data between Driver (and Driver address space) and User (and User address space) without sharing sensible data! I mean: the user buffer is in the User address space, and the Driver buffer is in the Driver address space. Should be the Posix pager to copy a buffer to another? And how it is supposed to do it without making a mapping between the two address spaces?
I cannot use Iguana or other services since my need is to develop these services in the most direct way...
Something like the picture below (Sigma0 excluded, which function is only to launch Posix pager and manage memory requests from it).
+------------------------+
Drivers | User Thread
+---------+------------- +
Posix pager
+------------------------+
uKernel
+------------------------+
Thanks for your help
Gianluca
I'm Gianluca Magnini, a student in Computer Science in Siena (Italy). This is my first post in the forum!
Actually, I'm studying about various L4 Microkernel implementations (Pistachio, Codezero, OKL4), but I have some doubts about how to implement functionalities user-oriented.
In fact, I would like to understand how to implement a Posix layer and use it to implement Device drivers as user-servers. I've looked for documentation in OKL4, Pistachio and Codezero manuals, and furthermore I've tried to undestand the code of the three Microkernels, but it seems that all of those Microkernel uses some frameworks (such as Genode, Iguana, or similar) to add some abstraction layer between Microkernel and user-threads.
I would like to implement the Posix layer directly using the Microkernel functionalities, and the Drivers directly using Posix layer abstraction. I tought about the creation of a Posix server that is launched at the beginning, and that contains data structures and functions capable of serving "posix requests", such as pthread_create. Each Posix is so an IPC to that server. I think Codezero has a similar implementation, in which the Posix server is called VFS. My problem is that I don't understand how to implement read/write functions from User thread to Device driver. I explain it better: suppose I've an user thread that would like to read an ethernet packet, using "read" function. The user will "open" the ethernet device and will read from it.
User code:
Code: Select all
[...]
uint8_t buf[4096];
eth = open("eth", "r");
read(eth, buf, size);
[...]
I cannot use Iguana or other services since my need is to develop these services in the most direct way...
Something like the picture below (Sigma0 excluded, which function is only to launch Posix pager and manage memory requests from it).
+------------------------+
Drivers | User Thread
+---------+------------- +
Posix pager
+------------------------+
uKernel
+------------------------+
Thanks for your help
Gianluca