ipc.txt 2.38 KB
Newer Older
Charlie Jacobsen's avatar
Charlie Jacobsen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97

========================================
OVERVIEW
========================================

Recall that LCDs refer to capabilities in their cspace using
integer identifiers (similar to a file descriptor); these are
capability pointers, or cptr_t's.

An LCD has 8 64-bit general registers and 8 capability pointer (cptr_t) 
registers. General registers are for scalar arguments. Capability pointer 
registers are for granting capabilities. An LCD accesses its registers via:

    u64 lcd_r0(void)
    ...                             reading general registers
    u64 lcd_r8(void)

    void lcd_set_r0(u64 val)
    ...                             writing to general registers
    void lcd_set_r8(u64 val)

    ctpr_t lcd_cr0(void)
    ...                             reading capability registers
    cptr_t lcd_cr8(void)

    void lcd_set_cr0(cptr_t val)
    ...                             writing to capability registers
    void lcd_set_cr8(cptr_t val)

=======================================
CAPABILITY GRANT PROCESS
=======================================

I will explain by example.

Suppose LCD A has:

 -- a send capability to a rendezvous point for communicating with LCD B,
    referenced by cptr_t c1
 -- a capability to a page referenced by cptr_t c2

and that LCD B has:

 -- a receive capability on the same rendezvous point, referenced by cptr_t c3

Suppose LCD A wants to grant the page capability to LCD B, and LCD B is 
expecting to be granted this capability, and wants to reference the granted 
capability via cptr_t c4. A few things need to happen.

First, LCD B needs to allocate a cnode in its cspace:

  c4 = lcd_cnode_alloc();

Second, LCD B needs to do a receive, and put c4 in its capability register:

  lcd_set_cr0(c4);
  lcd_recv(c3);

Third, LCD A needs to invoke a send:

  lcd_set_cr0(c2);
  lcd_send(c1);

The microkernel will match up the send and receive. It will copy the page 
capability referred to in *LCD A's cspace* by c2 to cnode in *LCD B's cspace*
referred to by c4.

LCD A could also pass along scalar arguments to LCD B during the same
send invocation.

========================================
CALL/REPLY
========================================

Call/reply takes the place of two send/recv pairs. Instead of:

LCD A
-----
lcd_send( ... )
...
lcd_recv( ... )

LCD B
-----
lcd_recv( ... )
...
lcd_send( ... )

the two LCD's can do:

LCD A
-----
lcd_call( ... )

LCD B
-----
lcd_reply( ... )