FPU state management in L4Fiasco.OC program
haohui.mai at gmail.com
Thu Apr 12 08:34:09 CEST 2012
I forgot to mention that my OS is running simultaneously with L4Linux.
In this case, it seems that Thread::transfer_fpu() becomes a no-op --
since the vcpu task for L4Linux has the FPU, but is the owner of FPU, and
my OS doesn't. Therefore my OS cannot grant my user-level task the FPU
since it doesn't have it.
However, my OS can grant the FPU to my user-level task, once I insert an
floating-point instruction right before trying to grant my user-level
process the FPU. In this case my OS magically becomes the owner of the FPU,
and everything works smoothly.
What I really don't understand is that how this "magic" works. First, both
L4Linux and my OS are started independently by ned:
(1) If FPU ownership can only be transferred via exception #7 and IPC, I
don't understand why my OS can grab the FPU transparently, simply by
executing an floating-point instruction.
(2) If there's some transparent way that an process can get an FPU, then I
don't understand why my user-level process can't grab the FPU
transparently. Maybe this is because that my OS is a non-alien task but my
user-level task is an alien?
I really appreciate if you can explain it a little bit --- I'm really
appreciated if you can share your idea of what would be the correct way of
On Tue, Apr 10, 2012 at 5:07 PM, Adam Lackorzynski <
adam at os.inf.tu-dresden.de> wrote:
> On Sun Apr 08, 2012 at 17:22:21 -0500, Mai, Haohui wrote:
> > I'm writing a new OS kernel atop of L4Fiasco.OC. I'm having some
> > difficulties to let my OS support user-level processes that uses
> > floating-point instruction.
> > So far, My OS closely follows L4Linux, it creates a new task for each
> > user-level process, and marks as all threads of the task as alien thread
> > capture all page faults and exceptions.
> > My OS works fines with page fault and syscalls. However, I'm confused
> > what I should do with floating-point exception (exception #7), which is
> > issued to my kernel at the first time it tries to perform floating-point
> > arithmetic.
> > I tried to return to the user-level process with an empty message (
> > l4_msgtag_t tag = l4_msgtag(0, 0, 0, 0) ), or an empty message with
> > L4_MSGTAG_TRANSFER_FPU (l4_msgtag_t tag = l4_msgtag(0, 0, 0,
> > L4_MSGTAG_TRANSFER_FPU) ), but I had no luck.
> > The user-level process immediately calls "int $0x3" and stops.
> > I read through L4Linux's code and it seems it's doing similar thing,
> > that it did initialize the FPU state before asking L4 to transfer the FPU
> > state to user-level process.
> I do not see anything (obvious) wrong. Can you pinpoint where the int3
> Adam adam at os.inf.tu-dresden.de
> Lackorzynski http://os.inf.tu-dresden.de/~adam/
> l4-hackers mailing list
> l4-hackers at os.inf.tu-dresden.de
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the l4-hackers