xref: /qemu/include/tcg/startup.h (revision bb302772)
1 /*
2  * Tiny Code Generator for QEMU: definitions used by runtime startup
3  *
4  * Copyright (c) 2008 Fabrice Bellard
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
25 #ifndef TCG_STARTUP_H
26 #define TCG_STARTUP_H
27 
28 /**
29  * tcg_init: Initialize the TCG runtime
30  * @tb_size: translation buffer size
31  * @splitwx: use separate rw and rx mappings
32  * @max_cpus: number of vcpus in system mode
33  *
34  * Allocate and initialize TCG resources, especially the JIT buffer.
35  * In user-only mode, @max_cpus is unused.
36  */
37 void tcg_init(size_t tb_size, int splitwx, unsigned max_cpus);
38 
39 /**
40  * tcg_register_thread: Register this thread with the TCG runtime
41  *
42  * All TCG threads except the parent (i.e. the one that called the TCG
43  * accelerator's init_machine() method) must register with this
44  * function before initiating translation.
45  */
46 void tcg_register_thread(void);
47 
48 /**
49  * tcg_prologue_init(): Generate the code for the TCG prologue
50  *
51  * In softmmu this is done automatically as part of the TCG
52  * accelerator's init_machine() method, but for user-mode, the
53  * user-mode code must call this function after it has loaded
54  * the guest binary and the value of guest_base is known.
55  */
56 void tcg_prologue_init(void);
57 
58 #endif
59