qemu-common.h revision 81db31727ed27322c3f5e3bc40e71fe7fc54bf91
/* Common header file that is included by all of qemu. */
#ifndef QEMU_COMMON_H
#define QEMU_COMMON_H
#include "config-host.h"
#ifdef VBOX
# define snprintf RTStrPrintf
# define qemu_isalnum(c) RT_C_IS_ALNUM((unsigned char)(c))
# define qemu_isalpha(c) RT_C_IS_ALPHA((unsigned char)(c))
# define qemu_iscntrl(c) RT_C_IS_CNTRL((unsigned char)(c))
# define qemu_isdigit(c) RT_C_IS_DIGIT((unsigned char)(c))
# define qemu_isgraph(c) RT_C_IS_GRAPH((unsigned char)(c))
# define qemu_islower(c) RT_C_IS_LOWER((unsigned char)(c))
# define qemu_isprint(c) RT_C_IS_PRINT((unsigned char)(c))
# define qemu_ispunct(c) RT_C_IS_PUNCT((unsigned char)(c))
# define qemu_isspace(c) RT_C_IS_SPACE((unsigned char)(c))
# define qemu_isupper(c) RT_C_IS_UPPER((unsigned char)(c))
# define qemu_isxdigit(c) RT_C_IS_XDIGIT((unsigned char)(c))
# define qemu_tolower(c) RT_C_TO_LOWER((unsigned char)(c))
# define qemu_toupper(c) RT_C_TO_UPPER((unsigned char)(c))
# define qemu_isascii(c) RT_C_IS_ASCII((unsigned char)(c))
# define qemu_toascii(c) RT_C_TO_ASCII((unsigned char)(c))
# else
# define QEMU_WARN_UNUSED_RESULT
# endif
#else /* !VBOX */
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
/* Hack around the mess dyngen-exec.h causes: We need QEMU_NORETURN in files that
cannot include the following headers without conflicts. This condition has
to be removed once dyngen is gone. */
#ifndef __DYNGEN_EXEC_H__
/* we put basic includes here to avoid repeating them in device drivers */
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <inttypes.h>
#include <limits.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
#ifndef ENOMEDIUM
#endif
#if !defined(ENOTSUP)
#define ENOTSUP 4096
#endif
#ifndef CONFIG_IOVEC
#define CONFIG_IOVEC
struct iovec {
void *iov_base;
};
/*
* Use the same value as Linux for now.
*/
#define IOV_MAX 1024
#else
#endif
#ifdef _WIN32
extern int qemu_ftruncate64(int, int64_t);
#define ftruncate qemu_ftruncate64
{
return resolved_path;
}
#define PRId64 "I64d"
#define PRIx64 "I64x"
#define PRIu64 "I64u"
#define PRIo64 "I64o"
#endif
/* FIXME: Remove NEED_CPU_H. */
#ifndef NEED_CPU_H
#include <setjmp.h>
#include "osdep.h"
#include "bswap.h"
#else
#include "cpu.h"
#endif /* !defined(NEED_CPU_H) */
/* bottom halves */
typedef void QEMUBHFunc(void *opaque);
void async_context_push(void);
void async_context_pop(void);
int get_async_context_id(void);
/* Bottom halfs that are scheduled from a bottom half handler are instantly
* invoked. This can create an infinite loop if a bottom half handler
* schedules itself. qemu_bh_schedule_idle() avoids this infinite loop by
* ensuring that the bottom half isn't executed until the next main loop
* iteration.
*/
int qemu_bh_poll(void);
void qemu_bh_update_timeout(int *timeout);
/* cutils.c */
int qemu_strnlen(const char *s, int max_len);
int qemu_fls(int i);
int qemu_fdatasync(int fd);
/* path.c */
void init_paths(const char *prefix);
#define qemu_isalnum(c) isalnum((unsigned char)(c))
#define qemu_isalpha(c) isalpha((unsigned char)(c))
#define qemu_iscntrl(c) iscntrl((unsigned char)(c))
#define qemu_isdigit(c) isdigit((unsigned char)(c))
#define qemu_isgraph(c) isgraph((unsigned char)(c))
#define qemu_islower(c) islower((unsigned char)(c))
#define qemu_isprint(c) isprint((unsigned char)(c))
#define qemu_ispunct(c) ispunct((unsigned char)(c))
#define qemu_isspace(c) isspace((unsigned char)(c))
#define qemu_isupper(c) isupper((unsigned char)(c))
#define qemu_isxdigit(c) isxdigit((unsigned char)(c))
#define qemu_tolower(c) tolower((unsigned char)(c))
#define qemu_toupper(c) toupper((unsigned char)(c))
#define qemu_isascii(c) isascii((unsigned char)(c))
#define qemu_toascii(c) toascii((unsigned char)(c))
char *qemu_strdup(const char *str);
void *get_mmap_addr(unsigned long size);
void qemu_mutex_lock_iothread(void);
void qemu_mutex_unlock_iothread(void);
void qemu_set_cloexec(int fd);
#ifndef _WIN32
#endif
/* Error handling. */
/* IO callbacks. */
typedef int IOCanRWHandler(void *opaque);
struct ParallelIOArg {
void *buffer;
int count;
};
/* A load of opaque types so that device init declarations don't have to
pull in all the real definitions. */
typedef struct AudioState AudioState;
typedef struct BlockDriverState BlockDriverState;
typedef struct DisplayState DisplayState;
typedef struct DisplayChangeListener DisplayChangeListener;
typedef struct DisplaySurface DisplaySurface;
typedef struct DisplayAllocator DisplayAllocator;
typedef struct PixelFormat PixelFormat;
typedef struct TextConsole TextConsole;
typedef TextConsole QEMUConsole;
typedef struct CharDriverState CharDriverState;
typedef struct VLANClientState VLANClientState;
typedef struct SMBusDevice SMBusDevice;
typedef struct PCIHostState PCIHostState;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct SerialState SerialState;
typedef struct PCMCIACardState PCMCIACardState;
typedef struct MouseTransformInfo MouseTransformInfo;
typedef struct uWireSlave uWireSlave;
typedef struct DeviceState DeviceState;
/* Force QEMU to stop what it's doing and service IO */
void qemu_service_io(void);
/* Force QEMU to process pending events */
void qemu_notify_event(void);
/* Unblock cpu */
void qemu_cpu_kick(void *env);
int qemu_cpu_self(void *env);
#ifdef CONFIG_USER_ONLY
#define qemu_init_vcpu(env) do { } while (0)
#else
void qemu_init_vcpu(void *env);
#endif
typedef struct QEMUIOVector {
int niov;
int nalloc;
} QEMUIOVector;
struct Monitor;
/* Convert a byte between binary and BCD. */
{
}
{
}
#include "module.h"
#endif /* dyngen-exec.h hack */
#endif /* !VBOX */
#endif