]> Git Repo - qemu.git/blob - include/qemu/thread-context.h
works with less than base ISA qemu-system-riscv32 -M virt -bios none -kernel output...
[qemu.git] / include / qemu / thread-context.h
1 /*
2  * QEMU Thread Context
3  *
4  * Copyright Red Hat Inc., 2022
5  *
6  * Authors:
7  *  David Hildenbrand <[email protected]>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10  * See the COPYING file in the top-level directory.
11  */
12
13 #ifndef SYSEMU_THREAD_CONTEXT_H
14 #define SYSEMU_THREAD_CONTEXT_H
15
16 #include "qapi/qapi-types-machine.h"
17 #include "qemu/thread.h"
18 #include "qom/object.h"
19
20 #define TYPE_THREAD_CONTEXT "thread-context"
21 OBJECT_DECLARE_TYPE(ThreadContext, ThreadContextClass,
22                     THREAD_CONTEXT)
23
24 struct ThreadContextClass {
25     ObjectClass parent_class;
26 };
27
28 struct ThreadContext {
29     /* private */
30     Object parent;
31
32     /* private */
33     unsigned int thread_id;
34     QemuThread thread;
35
36     /* Semaphore to wait for context thread action. */
37     QemuSemaphore sem;
38     /* Semaphore to wait for action in context thread. */
39     QemuSemaphore sem_thread;
40     /* Mutex to synchronize requests. */
41     QemuMutex mutex;
42
43     /* Commands for the thread to execute. */
44     int thread_cmd;
45     void *thread_cmd_data;
46
47     /* CPU affinity bitmap used for initialization. */
48     unsigned long *init_cpu_bitmap;
49     int init_cpu_nbits;
50 };
51
52 void thread_context_create_thread(ThreadContext *tc, QemuThread *thread,
53                                   const char *name,
54                                   void *(*start_routine)(void *), void *arg,
55                                   int mode);
56
57 #endif /* SYSEMU_THREAD_CONTEXT_H */
This page took 0.027282 seconds and 4 git commands to generate.