VirtualBox

Ignore:
Timestamp:
Jun 29, 2011 7:07:14 AM (13 years ago)
Author:
vboxsync
Message:

rem: Synced with v0.12.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/qemu-common.h

    r36175 r37675  
    33#define QEMU_COMMON_H
    44
     5#include "config-host.h"
     6
    57#ifdef VBOX
    68
    7 # include <string.h>
    8 # include <inttypes.h>
     9# include <iprt/string.h>
     10# include <iprt/types.h>
    911# include <iprt/ctype.h>
    10 
    11 #define QEMU_NORETURN __attribute__ ((__noreturn__))
    1212
    1313void pstrcpy(char *buf, int buf_size, const char *str);
    1414char *pstrcat(char *buf, int buf_size, const char *s);
    15 # define snprintf RTStrPrintf
    16 
    17 #define qemu_isalnum(c)         RT_C_IS_ALNUM((unsigned char)(c))
    18 #define qemu_isalpha(c)         RT_C_IS_ALPHA((unsigned char)(c))
    19 #define qemu_iscntrl(c)         RT_C_IS_CNTRL((unsigned char)(c))
    20 #define qemu_isdigit(c)         RT_C_IS_DIGIT((unsigned char)(c))
    21 #define qemu_isgraph(c)         RT_C_IS_GRAPH((unsigned char)(c))
    22 #define qemu_islower(c)         RT_C_IS_LOWER((unsigned char)(c))
    23 #define qemu_isprint(c)         RT_C_IS_PRINT((unsigned char)(c))
    24 #define qemu_ispunct(c)         RT_C_IS_PUNCT((unsigned char)(c))
    25 #define qemu_isspace(c)         RT_C_IS_SPACE((unsigned char)(c))
    26 #define qemu_isupper(c)         RT_C_IS_UPPER((unsigned char)(c))
    27 #define qemu_isxdigit(c)        RT_C_IS_XDIGIT((unsigned char)(c))
    28 #define qemu_tolower(c)         RT_C_TO_LOWER((unsigned char)(c))
    29 #define qemu_toupper(c)         RT_C_TO_UPPER((unsigned char)(c))
    30 #define qemu_isascii(c)         RT_C_IS_ASCII((unsigned char)(c))
    31 #define qemu_toascii(c)         RT_C_TO_ASCII((unsigned char)(c))
    32 
    33 #define qemu_init_vcpu(env)     do { } while (0) /* we don't need this :-) */
    34 
     15# define snprintf               RTStrPrintf
     16
     17# define qemu_isalnum(c)        RT_C_IS_ALNUM((unsigned char)(c))
     18# define qemu_isalpha(c)        RT_C_IS_ALPHA((unsigned char)(c))
     19# define qemu_iscntrl(c)        RT_C_IS_CNTRL((unsigned char)(c))
     20# define qemu_isdigit(c)        RT_C_IS_DIGIT((unsigned char)(c))
     21# define qemu_isgraph(c)        RT_C_IS_GRAPH((unsigned char)(c))
     22# define qemu_islower(c)        RT_C_IS_LOWER((unsigned char)(c))
     23# define qemu_isprint(c)        RT_C_IS_PRINT((unsigned char)(c))
     24# define qemu_ispunct(c)        RT_C_IS_PUNCT((unsigned char)(c))
     25# define qemu_isspace(c)        RT_C_IS_SPACE((unsigned char)(c))
     26# define qemu_isupper(c)        RT_C_IS_UPPER((unsigned char)(c))
     27# define qemu_isxdigit(c)       RT_C_IS_XDIGIT((unsigned char)(c))
     28# define qemu_tolower(c)        RT_C_TO_LOWER((unsigned char)(c))
     29# define qemu_toupper(c)        RT_C_TO_UPPER((unsigned char)(c))
     30# define qemu_isascii(c)        RT_C_IS_ASCII((unsigned char)(c))
     31# define qemu_toascii(c)        RT_C_TO_ASCII((unsigned char)(c))
     32
     33# define qemu_init_vcpu(env)    do { } while (0) /* we don't need this :-) */
     34
     35# define QEMU_NORETURN              __attribute__((__noreturn__))
     36# ifdef CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT
     37#  define QEMU_WARN_UNUSED_RESULT   __attribute__((warn_unused_result))
     38# else
     39#  define QEMU_WARN_UNUSED_RESULT
     40# endif
    3541
    3642#else /* !VBOX */
     
    6369#include <sys/stat.h>
    6470#include <assert.h>
    65 #include "config-host.h"
    6671
    6772#ifndef O_LARGEFILE
     
    7176#define O_BINARY 0
    7277#endif
    73 
     78#ifndef MAP_ANONYMOUS
     79#define MAP_ANONYMOUS MAP_ANON
     80#endif
    7481#ifndef ENOMEDIUM
    7582#define ENOMEDIUM ENODEV
    7683#endif
    77 
    78 #ifndef HAVE_IOVEC
    79 #define HAVE_IOVEC
     84#if !defined(ENOTSUP)
     85#define ENOTSUP 4096
     86#endif
     87
     88#ifndef CONFIG_IOVEC
     89#define CONFIG_IOVEC
    8090struct iovec {
    8191    void *iov_base;
    8292    size_t iov_len;
    8393};
     94/*
     95 * Use the same value as Linux for now.
     96 */
     97#define IOV_MAX         1024
    8498#else
    8599#include <sys/uio.h>
     
    89103#define fsync _commit
    90104#define lseek _lseeki64
    91 #define ENOTSUP 4096
    92105extern int qemu_ftruncate64(int, int64_t);
    93106#define ftruncate qemu_ftruncate64
    94 
    95107
    96108static inline char *realpath(const char *path, char *resolved_path)
     
    123135
    124136typedef void QEMUBHFunc(void *opaque);
     137
     138void async_context_push(void);
     139void async_context_pop(void);
     140int get_async_context_id(void);
    125141
    126142QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
     
    136152void qemu_bh_delete(QEMUBH *bh);
    137153int qemu_bh_poll(void);
     154void qemu_bh_update_timeout(int *timeout);
    138155
    139156uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
     
    150167time_t mktimegm(struct tm *tm);
    151168int qemu_fls(int i);
     169int qemu_fdatasync(int fd);
     170
     171/* path.c */
     172void init_paths(const char *prefix);
     173const char *path(const char *pathname);
    152174
    153175#define qemu_isalnum(c)         isalnum((unsigned char)(c))
     
    177199
    178200
     201void qemu_mutex_lock_iothread(void);
     202void qemu_mutex_unlock_iothread(void);
     203
     204int qemu_open(const char *name, int flags, ...);
     205void qemu_set_cloexec(int fd);
     206
     207#ifndef _WIN32
     208int qemu_pipe(int pipefd[2]);
     209#endif
     210
    179211/* Error handling.  */
    180212
     
    208240typedef TextConsole QEMUConsole;
    209241typedef struct CharDriverState CharDriverState;
     242typedef struct MACAddr MACAddr;
    210243typedef struct VLANState VLANState;
     244typedef struct VLANClientState VLANClientState;
    211245typedef struct QEMUFile QEMUFile;
    212246typedef struct i2c_bus i2c_bus;
     
    214248typedef struct SMBusDevice SMBusDevice;
    215249typedef struct QEMUTimer QEMUTimer;
     250typedef struct PCIHostState PCIHostState;
     251typedef struct PCIExpressHost PCIExpressHost;
    216252typedef struct PCIBus PCIBus;
    217253typedef struct PCIDevice PCIDevice;
     
    255291void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov);
    256292void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
     293void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t size);
    257294void qemu_iovec_destroy(QEMUIOVector *qiov);
    258295void qemu_iovec_reset(QEMUIOVector *qiov);
     
    263300typedef struct Monitor Monitor;
    264301
     302/* Convert a byte between binary and BCD.  */
     303static inline uint8_t to_bcd(uint8_t val)
     304{
     305    return ((val / 10) << 4) | (val % 10);
     306}
     307
     308static inline uint8_t from_bcd(uint8_t val)
     309{
     310    return ((val >> 4) * 10) + (val & 0x0f);
     311}
     312
    265313#include "module.h"
    266314
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette