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