7 * Copyright (c) 2008, 2009, 2010, 2011, 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 LIBBARRELFISH_CORESTATE_H
16 #define LIBBARRELFISH_CORESTATE_H
18 #include <../lib/c/src/k_r_malloc.h>
19 #include <barrelfish/waitset.h>
21 /* DELETEME! I can't find anything that uses this -AB 20120110 */
24 * XXX: This currently very small (4096 frames tracked, using 384KB
25 * memory). Obviously making it much bigger results in a huge .bss
26 * segment. Unfortunately, making this a dynamic data structure turns
27 * out to be harder than one might expect, as this is in the critical
28 * path of memory allocation, we cannot call into slab_alloc() to get
29 * more memory. A cspace-based solution, where RAM caps are stored at
30 * a resolvable address from their corresponding frame, also doesn't
31 * work, as the interface is designed such that the frame cap slot is
32 * given by the user, while the RAM cap slot is determined by
35 #define MAX_TRACK_FRAMES 4096
38 struct capref framecap;
43 struct morecore_state {
44 struct thread_mutex mutex;
47 struct vspace_mmu_aware mmu_state;
49 struct captrack track_frames[MAX_TRACK_FRAMES];
53 struct ram_alloc_state {
54 bool mem_connect_done;
55 errval_t mem_connect_err;
56 struct thread_mutex ram_alloc_lock;
57 ram_alloc_func_t ram_alloc_func;
58 uint64_t default_minbase;
59 uint64_t default_maxlimit;
65 struct skb_rpc_client *skb;
68 struct slot_alloc_state {
69 struct multi_slot_allocator defca;
71 struct single_slot_allocator top;
72 struct slot_allocator_list head;
73 struct slot_allocator_list reserve;
75 struct cnode_meta top_buf[SLOT_ALLOC_CNODE_SLOTS / 2];
76 struct cnode_meta head_buf[SLOT_ALLOC_CNODE_SLOTS / 2];
77 struct cnode_meta reserve_buf[SLOT_ALLOC_CNODE_SLOTS / 2];
79 struct single_slot_allocator rootca;
80 struct cnode_meta root_buf[DEFAULT_CNODE_SLOTS / 2];
83 struct terminal_state;
84 struct dist2_rpc_client;
87 struct monitor_binding;
88 struct mem_rpc_client;
89 struct spawn_rpc_client;
91 struct core_state_generic {
92 struct waitset default_waitset;
93 struct monitor_binding *monitor_binding;
94 struct monitor_blocking_rpc_client *monitor_blocking_rpc_client;
95 struct mem_rpc_client *mem_st;
96 struct morecore_state morecore_state;
97 struct ram_alloc_state ram_alloc_state;
98 struct dist2_rpc_client *nameservice_rpc_client;
99 struct spawn_rpc_client *spawn_rpc_clients[MAX_CPUS];
100 struct terminal_state *terminal_state;
101 struct domain_state *domain_state;
102 struct spawn_state *spawn_state;
103 struct slot_alloc_state slot_alloc_state;
104 struct skb_state skb_state;