3 * \brief init user-space domain special structures.
7 * Copyright (c) 2007, 2008, 2009, 2010, 2012, ETH Zurich.
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
15 #ifndef BARRELFISH_KPI_INIT_H
16 #define BARRELFISH_KPI_INIT_H
21 * Size of bootinfo mapping.
23 #define BOOTINFO_SIZEBITS (BASE_PAGE_BITS + 2)
24 #define BOOTINFO_SIZE (1UL << BOOTINFO_SIZEBITS)
27 * Address (in spawned domain) of page with command-line arguments and environment
29 #define ARGS_FRAME_BITS 17 // 128 kB
30 #define ARGS_SIZE ((genpaddr_t)1 << ARGS_FRAME_BITS)
31 #define MAX_CMDLINE_ARGS 128
32 #define MAX_ENVIRON_VARS 128
35 * Size of page with inherited file descriptors
37 #define FDS_SIZE (32 * 1024) // estimate worst case here.
41 * Size of dispatcher frame
43 #define DISPATCHER_SIZE ((genpaddr_t)1 << DISPATCHER_FRAME_BITS)
46 * Size of initial page to carry out monitor URPC
48 // Supports at least #MON_URPC_CHANNEL_LEN
49 // Change #MON_URPC_CHANNEL_LEN if changing this
50 #define MON_URPC_SIZE (2 * BASE_PAGE_SIZE)
54 * Maximum possible number of entries in the memory regions array. This is
55 * limited by the page size minus the size of the initial part of the bootinfo
58 #define MAX_MEM_REGIONS ((BOOTINFO_SIZE - sizeof(struct bootinfo)) / \
59 sizeof(struct mem_region))
62 #define ROOTCN_SLOT_TASKCN 0 ///< Taskcn slot in root cnode
63 #define ROOTCN_SLOT_PAGECN 1 ///< Pagecn slot in root cnode
64 #define ROOTCN_SLOT_BASE_PAGE_CN 2 ///< Slot for a cnode of BASE_PAGE_SIZE frames
65 #define ROOTCN_SLOT_SUPERCN 3 ///< Slot for a cnode of SUPER frames
66 #define ROOTCN_SLOT_SEGCN 4 ///< SegCN slot in root cnode
67 #define ROOTCN_SLOT_PACN 5 ///< PhysAddr cnode slot in root cnode
68 #define ROOTCN_SLOT_MODULECN 6 ///< Multiboot modules cnode slot in root cnode
69 #define ROOTCN_SLOT_SLOT_ALLOC0 7 ///< Root of slot alloc0
70 #define ROOTCN_SLOT_SLOT_ALLOC1 8 ///< Root of slot alloc1
71 #define ROOTCN_SLOT_SLOT_ALLOC2 9 ///< Root of slot alloc2
72 #define ROOTCN_SLOT_ARGCN 10 ///< Argcn slot in root cnode
73 #define ROOTCN_SLOT_BSPKCB 11 ///< BSP KCB cap to fix reverse lookup issues
74 #define ROOTCN_SLOTS_USER 12 ///< First free slot in root cnode for user
76 /* Size of CNodes in Root CNode if not the default size */
77 #define SLOT_ALLOC_CNODE_BITS L2_CNODE_BITS
78 #define SLOT_ALLOC_CNODE_SLOTS L2_CNODE_SLOTS
81 #define TASKCN_SLOT_TASKCN 0 ///< Task CNode in itself (XXX)
82 #define TASKCN_SLOT_DISPATCHER 1 ///< Dispatcher cap in task cnode
83 #define TASKCN_SLOT_ROOTCN 2 ///< RootCN slot in task cnode
84 #define TASKCN_SLOT_DISPFRAME 4 ///< Dispatcher frame cap in task cnode
85 #define TASKCN_SLOT_IRQ 5 ///< IRQ cap in task cnode
86 #define TASKCN_SLOT_IO 6 ///< IO cap in task cnode
87 #define TASKCN_SLOT_BOOTINFO 7 ///< Bootinfo frame slot in task cnode
88 #define TASKCN_SLOT_KERNELCAP 8 ///< Kernel cap in task cnode
89 #define TASKCN_SLOT_TRACEBUF 9 ///< Trace buffer cap in task cnode
90 #define TASKCN_SLOT_ARGSPAGE 10 ///< ?
91 #define TASKCN_SLOT_MON_URPC 11 ///< Frame cap for urpc comm.
92 #define TASKCN_SLOT_SESSIONID 12 ///< Session ID domain belongs to
93 #define TASKCN_SLOT_FDSPAGE 13 ///< cap for inherited file descriptors
94 #define TASKCN_SLOT_PERF_MON 14 ///< cap for performance monitoring
95 #define TASKCN_SLOT_SYSMEM 15 ///< ???
96 #define TASKCN_SLOT_COREBOOT 16 ///< Copy of realmode section used to bootstrap a core
97 #define TASKCN_SLOT_IPI 17 ///< Copy of IPI cap
98 #define TASKCN_SLOT_PROC_MNG 18 ///< Cap for the process manager
99 #define TASKCN_SLOTS_USER 19 ///< First free slot in taskcn for user
102 #define PAGECN_SLOT_VROOT 0 ///< First slot of page cnode is root page table
104 #define ROOTCN_SLOT_LEVEL CSPACE_LEVEL_L1
105 #define ROOTCN_SLOT_ADDR(slot) ((slot) << L2_CNODE_BITS)
107 // Cspace addresses for well-defined L2 CNodes
108 #define CPTR_TASKCN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_TASKCN)
109 #define CPTR_BASE_PAGE_CN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_BASE_PAGE_CN)
110 #define CPTR_SUPERCN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_SUPERCN)
111 #define CPTR_PHYADDRCN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_PACN)
112 #define CPTR_MODULECN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_MODULECN)
113 #define CPTR_PAGECN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_PAGECN)
116 * Memory region types.
119 /// Empty memory: describes a RAM cap in supercn
121 /// Code/Data of init itself: describes a Frame cap in segcn
123 /// Physical address range (not RAM): describes a PhysAddr cap in physaddrcn
125 /// BIOS tables and platform-specific data: describes a PhysAddr cap in physaddrcn
126 RegionType_PlatformData,
127 /// Multiboot module: describes multiple Frame caps in modulecn
129 ///< describes memory region that is an ACPI table
130 RegionType_ACPI_TABLE,
131 RegionType_Max ///< Must be last
138 genpaddr_t mr_base;///< Address of the start of the region
139 enum region_type mr_type;///< Type of region
140 gensize_t mr_bytes;///< Size in bytes
141 bool mr_consumed;///< Flag for user code to mark region consumed
142 size_t mrmod_size;///< Size in bytes (module type only)
143 ptrdiff_t mrmod_data;///< Offset of module string (module type only)
144 int mrmod_slot;///< First slot containing caps (module only)
148 * This structure holds essential information for the init process to
149 * allocate and manage its address space.
154 uint8_t host_msg_bits;
156 /// Number of entries in regions array
157 size_t regions_length;
158 /// Amount of memory required to spawn another core
159 size_t mem_spawn_core;
160 /// Memory regions array
161 struct mem_region regions[];