Layout of an EROS Domain

The content of this note is now obsolete. Current information can now be found on the Process page.

An EROS domain is made up of three nodes: the domain root, the general registers node, and the key registers node. There are three kinds of constraints on the content layout of these nodes:

  • Requirements for the domain to be well-formed.
  • Universal slot usage conventions, which apply to all architectures.
  • Slot usage conventions that apply to all 32-bit architectures.
  • Slot usage constraints that are specific to a particular implementation.

1. Well-Formed Domains

In order to be well-formed, a domain must meet the following constraints:

  1. The domain root node must have a read-write node key in slot 14. The node in this slot will act as the general registers node.

  2. The domain root node must have a read-write node key in slot 15. The node in this slot will act as the key registers node.

    Note 1: we are contemplating a design change in which a zero number key would be permissable in slot 15 to reduce the overhead of rehosted programs, which neither send nor receive messages. In the event that a zero number key was present and the domain was not marked as "foreign," the domain keeper would be invoked if a reference was made to the domain's key registers.

  3. The domain root node, general registers node, and key registers node (if present) must be distinct.

  4. All keys in register slots must be number keys. Register slots include all slots in the general registers node, and those slots in the domain root designated as holding register values, whether or not those slots are used by a particular architecture.

  5. All keys in reserved slots must be zero number keys.

A domain is checked to verify that it is well-formed whenever an operation is performed on a start key, resume key, or domain key. If the domain is discovered to be malformed, it is placed in a faulted state, and will not execute instructions until corrective action is taken. If a valid keeper key is present, the keeper will be invoked to inform it of the fault.

1.1 Non-Requirements:

In spite of what you might reasonably expect, the following are not required in order for a domain to be well-formed:

  • A valid address space key. A domain without a valid address space key simply does not fetch instructions.
  • A valid schedule key. A domain without a valid schedule key simply does not fetch instructions.
  • A valid keeper key. The absence of a keeper key is only an issue when the domain takes a fault. If no keeper can be notified, the domain simply becomes unable to execute instructions.

2. Universal Slot Usage Conventions

All implementations impose the following usage constraints on the slots in a domain root. Slots shown as "reserved" must hold a zero number key until these features are implemented.

Domain Root
SlotUsageSlotUsage
DR0Schedule Class keyDR8Register slot
Bytes 0-3: order/return code
Bytes 4-7: invocation ctrl block
Bytes 8-11: Invoked key slot
DR1Keeper keyDR9Register slot
Bytes 0-3: PC
Bytes 4-7: SP
DR2Address space keyDR10Architecture Defined
DR3Reserved for Symbol table space key.DR11Architecture Defined
DR4Brand keyDR12Architecture Defined
DR5Number key providing trap code and associated informationDR13Reserved for alternate message buffer key.
DR6Register slot
Message receive descriptor.
DR14General registers Node key
(if present)
DR7Register slot
Message send descriptor
DR15Key registers Node key
(if present)

2.1. Send and Receive Information

The message send and receive information share a common structure for nibbles 0 through 15. These nibbles are used as follows:

Send and Receive Information Description
NibbleMeaning
0-3Size of sent/received string buffer
4Slot of 0th sent/received key
5Slot of 1st sent/received key
6Slot of 2nd sent/received key
7Slot of 3rd sent/received key
8-15Address of string send/receive buffer
16-23Available for architecture-specific use

Note that the send and receive information blocks correspond to specific registers in the implementation architecture. Two common message cases are messages that pass no keys and messages that pass no string. The layout of the send and receive information blocks is designed to map neatly onto a 32-bit register set to minimize the number of registers clobbered by the message mechanism in these cases.

2.2. Invocation Control Block

Only the bottom three bytes of the invocation control block register have defined values. The remaining bytes must be zero. The invocation control block controls both the invocation and the send and receive of message strings, and is layed out as follows:

Invocation Control Information
NibbleMeaning
0-3Key data (returned)
4Send control block. Values are:
ValueMeaning
0x0Omit
0x1Send from buffer
5Receive control block. Values are:
ValueMeaning
0x0Omit
0x1Receive to buffer
6Invocation type. Values are:
ValueMeaning
0x0Invocation is a reply
0x1Invocation is a call
0x2Invocation is a fork
otherUndefined
7Zero

3. Common 32-bit Architecture Constraints

Slot 9 of the domain root is reserved in all 32-bit architectures to contain the values of the PC and SP registers. This is to simplify the construction of domain generation tools by keeping registers that support concepts common to all 32-bit machines in common slots. This, on 32-bit architectures, the layout of this slot is as follows:

Slot 9 Conventions
ByteMeaning
0-3PC value
4-7SP value
8-11Implementation defined

4. i386/i486/Pentium Domain Layout

The following tables give the register layouts used on the i386 family of processors. Layout inherited from above is included in normal face, and machine-specific additions are is shown in boldface.

Domain Root
SlotUsageSlotUsage
0Schedule key8Bytes 0-3: %eax
Bytes 4-7: %ebx
Bytes 8-9: %ebp
1Keeper key9Bytes 0-3: %eip
Bytes 4-7: %esp
Bytes 8-9: %cs
Bytes 10-11: %ss
2Address space key10Bytes 0-3: %EFLAGS
Bytes 4-7: zero
Bytes 8-11: zero
3Zero number key11Zero number key
4Brand key12Zero number key
5Trap code13Zero number key
6Bytes 0-3: %ecx
Bytes 4-7: %edi
Bytes 8-9: %ds
Bytes 10-11: %es
14Gen regs node key
7Bytes 0-3: %edx
Bytes 4-7: %esi
Bytes 8-9: %fs
Bytes 10-11: %gs
15Key regs node key

As it happens, all of the integer machine registers fit in the domain root on the x86 family. Registers associated with auxiliary components, such as the floating point unit and the hardware debugging registers are kept in the general registers node. Whether to reload the floating point registers can be determined by examining the bits in the EFLAGS register.

Given all of that, the layout of the general registers shown below may make more sense.

General Registers
SlotUsageSlotUsage
0Bytes 0-3: %fdp
Bytes 4-5: %fds
Bytes 6-7: %ftag
Bytes 8-9: %fstatus
Bytes 10-11: %fctrl
8Floating Reg 0
1Bytes 0-3: %fip
Bytes 4-5: %fcs
Bytes 6-11: zero
9Floating Reg 1
2Zero number key10Floating Reg 2
3Zero number key11Floating Reg 3
4Zero number key12Floating Reg 4
5Zero number key13Floating Reg 5
6Zero number key14Floating Reg 6
7Zero number key15Floating Reg 7

Copyright 1998 by Jonathan Shapiro. All rights reserved. For terms of redistribution, see the GNU General Public License