import
This commit is contained in:
62
qemu/include/sysemu/accel.h
Normal file
62
qemu/include/sysemu/accel.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* QEMU accelerator interfaces
|
||||
*
|
||||
* Copyright (c) 2014 Red Hat Inc
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef HW_ACCEL_H
|
||||
#define HW_ACCEL_H
|
||||
|
||||
#include "qemu/typedefs.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct AccelState {
|
||||
/*< private >*/
|
||||
Object parent_obj;
|
||||
} AccelState;
|
||||
|
||||
typedef struct AccelClass {
|
||||
/*< private >*/
|
||||
ObjectClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
const char *opt_name;
|
||||
const char *name;
|
||||
int (*available)(void);
|
||||
int (*init_machine)(MachineState *ms);
|
||||
bool *allowed;
|
||||
} AccelClass;
|
||||
|
||||
#define TYPE_ACCEL "accel"
|
||||
|
||||
#define ACCEL_CLASS_SUFFIX "-" TYPE_ACCEL
|
||||
#define ACCEL_CLASS_NAME(a) (a ACCEL_CLASS_SUFFIX)
|
||||
|
||||
#define ACCEL_CLASS(uc, klass) \
|
||||
OBJECT_CLASS_CHECK(uc, AccelClass, (klass), TYPE_ACCEL)
|
||||
#define ACCEL(uc, obj) \
|
||||
OBJECT_CHECK(uc, AccelState, (obj), TYPE_ACCEL)
|
||||
#define ACCEL_GET_CLASS(uc, obj) \
|
||||
OBJECT_GET_CLASS(uc, AccelClass, (obj), TYPE_ACCEL)
|
||||
|
||||
int configure_accelerator(MachineState *ms);
|
||||
|
||||
void register_accel_types(struct uc_struct *uc);
|
||||
|
||||
#endif
|
||||
26
qemu/include/sysemu/cpus.h
Normal file
26
qemu/include/sysemu/cpus.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef QEMU_CPUS_H
|
||||
#define QEMU_CPUS_H
|
||||
|
||||
struct uc_struct;
|
||||
|
||||
/* cpus.c */
|
||||
void qemu_init_cpu_loop(struct uc_struct*);
|
||||
void resume_all_vcpus(struct uc_struct*);
|
||||
void pause_all_vcpus(struct uc_struct*);
|
||||
void cpu_stop_current(struct uc_struct*);
|
||||
|
||||
void cpu_synchronize_all_states(void);
|
||||
void cpu_synchronize_all_post_reset(void);
|
||||
void cpu_synchronize_all_post_init(void);
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* vl.c */
|
||||
extern int smp_cores;
|
||||
extern int smp_threads;
|
||||
#else
|
||||
/* *-user doesn't have configurable SMP topology */
|
||||
#define smp_cores 1
|
||||
#define smp_threads 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
40
qemu/include/sysemu/iothread.h
Normal file
40
qemu/include/sysemu/iothread.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Event loop thread
|
||||
*
|
||||
* Copyright Red Hat Inc., 2013
|
||||
*
|
||||
* Authors:
|
||||
* Stefan Hajnoczi <stefanha@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IOTHREAD_H
|
||||
#define IOTHREAD_H
|
||||
|
||||
#include "block/aio.h"
|
||||
#include "qemu/thread.h"
|
||||
|
||||
#define TYPE_IOTHREAD "iothread"
|
||||
|
||||
typedef struct {
|
||||
Object parent_obj;
|
||||
|
||||
QemuThread thread;
|
||||
AioContext *ctx;
|
||||
QemuMutex init_done_lock;
|
||||
QemuCond init_done_cond; /* is thread initialization done? */
|
||||
bool stopping;
|
||||
int thread_id;
|
||||
} IOThread;
|
||||
|
||||
#define IOTHREAD(obj) \
|
||||
OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD)
|
||||
|
||||
IOThread *iothread_find(const char *id);
|
||||
char *iothread_get_id(IOThread *iothread);
|
||||
AioContext *iothread_get_aio_context(IOThread *iothread);
|
||||
|
||||
#endif /* IOTHREAD_H */
|
||||
83
qemu/include/sysemu/memory_mapping.h
Normal file
83
qemu/include/sysemu/memory_mapping.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* QEMU memory mapping
|
||||
*
|
||||
* Copyright Fujitsu, Corp. 2011, 2012
|
||||
*
|
||||
* Authors:
|
||||
* Wen Congyang <wency@cn.fujitsu.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MEMORY_MAPPING_H
|
||||
#define MEMORY_MAPPING_H
|
||||
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/typedefs.h"
|
||||
|
||||
typedef struct GuestPhysBlock {
|
||||
/* visible to guest, reflects PCI hole, etc */
|
||||
hwaddr target_start;
|
||||
|
||||
/* implies size */
|
||||
hwaddr target_end;
|
||||
|
||||
/* points into host memory */
|
||||
uint8_t *host_addr;
|
||||
|
||||
QTAILQ_ENTRY(GuestPhysBlock) next;
|
||||
} GuestPhysBlock;
|
||||
|
||||
/* point-in-time snapshot of guest-visible physical mappings */
|
||||
typedef struct GuestPhysBlockList {
|
||||
unsigned num;
|
||||
QTAILQ_HEAD(GuestPhysBlockHead, GuestPhysBlock) head;
|
||||
} GuestPhysBlockList;
|
||||
|
||||
/* The physical and virtual address in the memory mapping are contiguous. */
|
||||
typedef struct MemoryMapping {
|
||||
hwaddr phys_addr;
|
||||
target_ulong virt_addr;
|
||||
ram_addr_t length;
|
||||
QTAILQ_ENTRY(MemoryMapping) next;
|
||||
} MemoryMapping;
|
||||
|
||||
struct MemoryMappingList {
|
||||
unsigned int num;
|
||||
MemoryMapping *last_mapping;
|
||||
QTAILQ_HEAD(, MemoryMapping) head;
|
||||
};
|
||||
|
||||
/*
|
||||
* add or merge the memory region [phys_addr, phys_addr + length) into the
|
||||
* memory mapping's list. The region's virtual address starts with virt_addr,
|
||||
* and is contiguous. The list is sorted by phys_addr.
|
||||
*/
|
||||
void memory_mapping_list_add_merge_sorted(MemoryMappingList *list,
|
||||
hwaddr phys_addr,
|
||||
hwaddr virt_addr,
|
||||
ram_addr_t length);
|
||||
|
||||
void memory_mapping_list_free(MemoryMappingList *list);
|
||||
|
||||
void memory_mapping_list_init(MemoryMappingList *list);
|
||||
|
||||
void guest_phys_blocks_free(GuestPhysBlockList *list);
|
||||
void guest_phys_blocks_init(GuestPhysBlockList *list);
|
||||
//void guest_phys_blocks_append(GuestPhysBlockList *list);
|
||||
|
||||
void qemu_get_guest_memory_mapping(struct uc_struct *uc,
|
||||
MemoryMappingList *list,
|
||||
const GuestPhysBlockList *guest_phys_blocks,
|
||||
Error **errp);
|
||||
|
||||
/* get guest's memory mapping without do paging(virtual address is 0). */
|
||||
void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list,
|
||||
const GuestPhysBlockList *guest_phys_blocks);
|
||||
|
||||
void memory_mapping_filter(MemoryMappingList *list, int64_t begin,
|
||||
int64_t length);
|
||||
|
||||
#endif
|
||||
53
qemu/include/sysemu/os-posix.h
Normal file
53
qemu/include/sysemu/os-posix.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* posix specific declarations
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
* Copyright (c) 2010 Jes Sorensen <Jes.Sorensen@redhat.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_OS_POSIX_H
|
||||
#define QEMU_OS_POSIX_H
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
void os_set_line_buffering(void);
|
||||
void os_set_proc_name(const char *s);
|
||||
void os_setup_signal_handling(void);
|
||||
void os_daemonize(void);
|
||||
void os_setup_post(void);
|
||||
int os_mlock(void);
|
||||
|
||||
typedef struct timeval qemu_timeval;
|
||||
#define qemu_gettimeofday(tp) gettimeofday(tp, NULL)
|
||||
|
||||
#ifndef CONFIG_UTIMENSAT
|
||||
#ifndef UTIME_NOW
|
||||
# define UTIME_NOW ((1l << 30) - 1l)
|
||||
#endif
|
||||
#ifndef UTIME_OMIT
|
||||
# define UTIME_OMIT ((1l << 30) - 2l)
|
||||
#endif
|
||||
#endif
|
||||
typedef struct timespec qemu_timespec;
|
||||
|
||||
bool is_daemonized(void);
|
||||
|
||||
#endif
|
||||
116
qemu/include/sysemu/os-win32.h
Normal file
116
qemu/include/sysemu/os-win32.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* win32 specific declarations
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
* Copyright (c) 2010 Jes Sorensen <Jes.Sorensen@redhat.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_OS_WIN32_H
|
||||
#define QEMU_OS_WIN32_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
/* Workaround for older versions of MinGW. */
|
||||
#ifndef ECONNREFUSED
|
||||
# define ECONNREFUSED WSAECONNREFUSED
|
||||
#endif
|
||||
#ifndef EINPROGRESS
|
||||
# define EINPROGRESS WSAEINPROGRESS
|
||||
#endif
|
||||
#ifndef EHOSTUNREACH
|
||||
# define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
#endif
|
||||
#ifndef EINTR
|
||||
# define EINTR WSAEINTR
|
||||
#endif
|
||||
#ifndef EINPROGRESS
|
||||
# define EINPROGRESS WSAEINPROGRESS
|
||||
#endif
|
||||
#ifndef ENETUNREACH
|
||||
# define ENETUNREACH WSAENETUNREACH
|
||||
#endif
|
||||
#ifndef ENOTCONN
|
||||
# define ENOTCONN WSAENOTCONN
|
||||
#endif
|
||||
#ifndef EWOULDBLOCK
|
||||
# define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
/* On w64, setjmp is implemented by _setjmp which needs a second parameter.
|
||||
* If this parameter is NULL, longjump does no stack unwinding.
|
||||
* That is what we need for QEMU. Passing the value of register rsp (default)
|
||||
* lets longjmp try a stack unwinding which will crash with generated code. */
|
||||
# undef setjmp
|
||||
# define setjmp(env) _setjmp(env, NULL)
|
||||
#endif
|
||||
/* QEMU uses sigsetjmp()/siglongjmp() as the portable way to specify
|
||||
* "longjmp and don't touch the signal masks". Since we know that the
|
||||
* savemask parameter will always be zero we can safely define these
|
||||
* in terms of setjmp/longjmp on Win32.
|
||||
*/
|
||||
#define sigjmp_buf jmp_buf
|
||||
#define sigsetjmp(env, savemask) setjmp(env)
|
||||
#define siglongjmp(env, val) longjmp(env, val)
|
||||
|
||||
/* Declaration of ffs() is missing in MinGW's strings.h. */
|
||||
int ffs(int i);
|
||||
|
||||
/* Missing POSIX functions. Don't use MinGW-w64 macros. */
|
||||
#undef gmtime_r
|
||||
struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||
#undef localtime_r
|
||||
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
||||
|
||||
// char *strtok_r(char *str, const char *delim, char **saveptr);
|
||||
|
||||
static inline void os_setup_signal_handling(void) {}
|
||||
static inline void os_daemonize(void) {}
|
||||
static inline void os_setup_post(void) {}
|
||||
void os_set_line_buffering(void);
|
||||
static inline void os_set_proc_name(const char *dummy) {}
|
||||
|
||||
size_t getpagesize(void);
|
||||
|
||||
#if !defined(EPROTONOSUPPORT)
|
||||
# define EPROTONOSUPPORT EINVAL
|
||||
#endif
|
||||
|
||||
int setenv(const char *name, const char *value, int overwrite);
|
||||
|
||||
typedef struct {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
} qemu_timeval;
|
||||
int qemu_gettimeofday(qemu_timeval *tp);
|
||||
|
||||
static inline bool is_daemonized(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int os_mlock(void)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
#endif
|
||||
29
qemu/include/sysemu/sysemu.h
Normal file
29
qemu/include/sysemu/sysemu.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef SYSEMU_H
|
||||
#define SYSEMU_H
|
||||
/* Misc. things related to the system emulator. */
|
||||
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
#include "qemu/timer.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
/* vl.c */
|
||||
|
||||
struct uc_struct;
|
||||
|
||||
int runstate_is_running(void);
|
||||
typedef struct vm_change_state_entry VMChangeStateEntry;
|
||||
|
||||
#define VMRESET_SILENT false
|
||||
#define VMRESET_REPORT true
|
||||
|
||||
void vm_start(struct uc_struct*);
|
||||
|
||||
void qemu_system_reset_request(struct uc_struct*);
|
||||
void qemu_system_shutdown_request(void);
|
||||
void qemu_system_powerdown_request(void);
|
||||
void qemu_system_reset(bool report);
|
||||
|
||||
extern int smp_cpus;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user