xref: /qemu/accel/tcg/tcg-all.c (revision 8b3ae692b83ecffb9315892d67b8ade5e0427e74)
1a9ded601SYang Zhong /*
2a9ded601SYang Zhong  * QEMU System Emulator, accelerator interfaces
3a9ded601SYang Zhong  *
4a9ded601SYang Zhong  * Copyright (c) 2003-2008 Fabrice Bellard
5a9ded601SYang Zhong  * Copyright (c) 2014 Red Hat Inc.
6a9ded601SYang Zhong  *
7a9ded601SYang Zhong  * Permission is hereby granted, free of charge, to any person obtaining a copy
8a9ded601SYang Zhong  * of this software and associated documentation files (the "Software"), to deal
9a9ded601SYang Zhong  * in the Software without restriction, including without limitation the rights
10a9ded601SYang Zhong  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11a9ded601SYang Zhong  * copies of the Software, and to permit persons to whom the Software is
12a9ded601SYang Zhong  * furnished to do so, subject to the following conditions:
13a9ded601SYang Zhong  *
14a9ded601SYang Zhong  * The above copyright notice and this permission notice shall be included in
15a9ded601SYang Zhong  * all copies or substantial portions of the Software.
16a9ded601SYang Zhong  *
17a9ded601SYang Zhong  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18a9ded601SYang Zhong  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19a9ded601SYang Zhong  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20a9ded601SYang Zhong  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21a9ded601SYang Zhong  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22a9ded601SYang Zhong  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23a9ded601SYang Zhong  * THE SOFTWARE.
24a9ded601SYang Zhong  */
25a9ded601SYang Zhong 
26a9ded601SYang Zhong #include "qemu/osdep.h"
27a9ded601SYang Zhong #include "sysemu/accel.h"
28a9ded601SYang Zhong #include "sysemu/sysemu.h"
29a9ded601SYang Zhong #include "qom/object.h"
30a9ded601SYang Zhong 
31*8b3ae692SPaolo Bonzini unsigned long tcg_tb_size;
32a9ded601SYang Zhong static bool tcg_allowed = true;
33a9ded601SYang Zhong 
34a9ded601SYang Zhong static int tcg_init(MachineState *ms)
35a9ded601SYang Zhong {
36a9ded601SYang Zhong     tcg_exec_init(tcg_tb_size * 1024 * 1024);
37a9ded601SYang Zhong     return 0;
38a9ded601SYang Zhong }
39a9ded601SYang Zhong 
40a9ded601SYang Zhong static void tcg_accel_class_init(ObjectClass *oc, void *data)
41a9ded601SYang Zhong {
42a9ded601SYang Zhong     AccelClass *ac = ACCEL_CLASS(oc);
43a9ded601SYang Zhong     ac->name = "tcg";
44a9ded601SYang Zhong     ac->init_machine = tcg_init;
45a9ded601SYang Zhong     ac->allowed = &tcg_allowed;
46a9ded601SYang Zhong }
47a9ded601SYang Zhong 
48a9ded601SYang Zhong #define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
49a9ded601SYang Zhong 
50a9ded601SYang Zhong static const TypeInfo tcg_accel_type = {
51a9ded601SYang Zhong     .name = TYPE_TCG_ACCEL,
52a9ded601SYang Zhong     .parent = TYPE_ACCEL,
53a9ded601SYang Zhong     .class_init = tcg_accel_class_init,
54a9ded601SYang Zhong };
55a9ded601SYang Zhong 
56a9ded601SYang Zhong static void register_accel_types(void)
57a9ded601SYang Zhong {
58a9ded601SYang Zhong     type_register_static(&tcg_accel_type);
59a9ded601SYang Zhong }
60a9ded601SYang Zhong 
61a9ded601SYang Zhong type_init(register_accel_types);
62