1/**
2 * \file
3 * \brief Startup prototypes.
4 */
5
6/*
7 * Copyright (c) 2007, 2008, 2009, 2010, ETH Zurich.
8 * All rights reserved.
9 *
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, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef __KERNEL_STARTUP_H
16#define __KERNEL_STARTUP_H
17
18struct capability;
19struct mem_region;
20struct bootinfo;
21enum region_type;
22
23struct spawn_state {
24    /// Init's cnodes
25    struct cte *taskcn, *segcn, *supercn, *physaddrcn, *modulecn,
26               *pagecn, *basepagecn, *earlycncn,
27               *slot_alloc_cn0, *slot_alloc_cn1, *slot_alloc_cn2;
28
29    /// Next slot in each cnode
30    cslot_t segcn_slot, supercn_slot, physaddrcn_slot, modulecn_slot;
31
32    /// Address of arguments page
33    lpaddr_t args_page;
34};
35
36errval_t create_caps_to_cnode(lpaddr_t base_addr, size_t size,
37                              enum region_type type,
38                              struct spawn_state *st, struct bootinfo *bootinfo);
39
40/**
41 * \brief Linear physical memory allocator callback function.
42 *
43 * This function allocates a linear region of addresses of size 'size' from
44 * physical memory.
45 *
46 * \param size  Number of bytes to allocate.
47 *
48 * \return Base physical address of memory region.
49 */
50typedef lpaddr_t (*alloc_phys_func)(size_t size);
51
52/* As for alloc_phys_func, but aligned to size 'align'. */
53typedef lpaddr_t (*alloc_phys_aligned_func)(size_t size, size_t align);
54
55struct dcb *spawn_module(struct spawn_state *st,
56                         const char *name, int argc, const char** argv,
57                         lpaddr_t bootinfo, lvaddr_t args_base,
58                         alloc_phys_func alloc_phys,
59                         alloc_phys_aligned_func alloc_phys_aligned,
60                         lvaddr_t *retparamaddr);
61
62extern lpaddr_t app_alloc_phys_start;
63
64extern lpaddr_t app_alloc_phys_end;
65
66lpaddr_t app_alloc_phys(size_t size);
67
68lpaddr_t app_alloc_phys_aligned(size_t size, size_t align);
69
70extern lpaddr_t bsp_init_alloc_addr;
71
72lpaddr_t bsp_alloc_phys(size_t size);
73
74lpaddr_t bsp_alloc_phys_aligned(size_t size, size_t align);
75
76#endif // __KERNEL_STARTUP_H
77