[Prev][Next][Index][Thread]

Re: OSKit & processes



You might want to look at the pthreads implementation in oskit/threads
(oskit/doc/pthread.tex). First off, the internal task switch mechanism
performs, well, rather poorly, compared to a hand rolled switch
routine, especially in the context of the oskit where most of the
stuff being switched is not necessary. Second, the pthreads library
addresses many of the re-entrancy issues in the device driver
framework.  You will need to reimplement all that if you plan to have
multiple threads entering the driver code (network stack, filesystems,
linux device drivers, ...). Take a look at the "Thread-safe Adaptors"
section in the pthread chapter of the documentation, and at the
discussion in the "Sleep/Wakeup" section of the "Device Driver
Framework" chapter. This should get you started on the intricacies of
adding threads/processes to the base oskit environment.

Good Luck!
Lbs

> From: "Slavi Ivanov" <sivanov@sz.inetg.bg>
> Subject: OSKit & processes
> 
>     Since OSkit does not support processes directly, I decided I should =
> give it a try and implement some of it myself. One of the easy ways is =
> to use TSS and let the CPU handle all the state saving. I can easily put =
> a task gate in the IDT, but how can I do an "iretd" from a TSS =
> exception/interrupt handler? By coding it by hand, i.e. asm("iretd") or =
> however gas requires? I don't think this should work, since the compiler =
> inevitably places some "push"-es on the entry of the function and messes =
> stacks. When I was fiddling with NASM and Visual C++ to make a simple =
> 32-bit protected kernel, things were easy, because VC++ does _very_ =
> simple code, and was easy to disassemble and see what it does in terms =
> of asm instructions. Since I cannot do that here, and base_trap_* stuff =
> obviously cannot handle task gates, and I do not want to make a software =
> task switch, what should I do?
> BTW, task switching can be very easily implemented this way, just change =
> the back_link field in the kernel's TSS and iretd, that's all...
>     Any advice? 10x in advance.