[coyotos-dev] Executable format for Coyotos

Jonathan Adams jwadams at eros-os.com
Fri Mar 9 09:27:12 CST 2007


On Fri, 2007-03-09 at 08:00 +0100, Pierre THIERRY wrote:
> Scribit Jonathan S. Shapiro dies 08/03/2007 hora 23:51:
> > At a high level, the answer is: you go to the zero space constructor
> > (zsc) and ask it to fabricate a new, demand-allocated space full of
> > zeros for you. You map this at any convenient location and write bytes
> > to it.
> 
> Shouldn't mapping involve invoking a capability to a kernel implemented
> object?

It does.  Here's the full procedure: ("You" is a process)

    You send a request to the zero space constructor (ZSC).  It returns
    an oGPT (opaque GPT) capability to an address space which is full of
    read-only, zeroed pages, and which has a "handler" installed on the
    top node of the space. 

    You then install this oGPT into your address space, which requires
    you to do a kernel invocation on a GPT.  This causes the zeroed 
    space (or a subset thereof) to appear in your address space.

    You access the memory.  Read accesses will succeed immediately.  
    Write accesses will fault, causing a local Exception (see:
       http://coyotos.org/docs/ukernel/spec.html#3.3
    ), which will cause the local handler to be invoked with
    a DataAccessViolation and the address accessed.

    The local handler will then reflect this fault to the address space
    using ogpt.probe(addr, WRITE, FAULT);  the kernel will find the
    zsc's handler on its way down the address space, and invoke it with
    the correct offset.

    The ZSC's handler then walks down the address tree based on 
    the offset, replacing read-only GPTs and pages with writable 
    copies (allocating storage from the space bank as needed). 
    Once it reaches the leaf page, it returns success back to "you".

    You now continue (still in Handler mode), see that the fault 
    succeeded, and finish handler mode, causing the faulting 
    instruction to be retried.  It will now succeed, and modify the
    newly COWed page.

Does that make more sense?  (I did skip over a few things;  in
particular, the final "successful" write will require a kernel page
fault to establish the mapping)

Cheers,
- jonathan




More information about the coyotos-dev mailing list