Merge pull request #1172 from dhrdlicka/feature/msvc-compat
MSVC compatibility fixes
This commit is contained in:
@@ -9,13 +9,17 @@
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if WIN64
|
||||
#if _WIN64
|
||||
#define BITMAP windows_BITMAP
|
||||
#include <windows.h>
|
||||
#undef BITMAP
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#define BLOCK_NUM 8
|
||||
#define BLOCK_MASK (BLOCK_NUM-1)
|
||||
@@ -752,7 +756,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x6f);
|
||||
addbyte(0x07 | (3 << 3));
|
||||
|
||||
#if WIN64
|
||||
#if _WIN64
|
||||
addbyte(0x48); /*MOV RDI, RCX (voodoo_state)*/
|
||||
addbyte(0x89);
|
||||
addbyte(0xcf);
|
||||
@@ -3428,7 +3432,7 @@ void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
{
|
||||
int c;
|
||||
|
||||
#if WIN64
|
||||
#if _WIN64
|
||||
voodoo->codegen_data = VirtualAlloc(NULL, sizeof(voodoo_x86_data_t) * BLOCK_NUM * 4, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
voodoo->codegen_data = mmap(0, sizeof(voodoo_x86_data_t) * BLOCK_NUM*4, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, 0, 0);
|
||||
@@ -3458,7 +3462,7 @@ void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
|
||||
void voodoo_codegen_close(voodoo_t *voodoo)
|
||||
{
|
||||
#if WIN64
|
||||
#if _WIN64
|
||||
VirtualFree(voodoo->codegen_data, 0, MEM_RELEASE);
|
||||
#else
|
||||
munmap(voodoo->codegen_data, sizeof(voodoo_x86_data_t) * BLOCK_NUM*4);
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
#undef BITMAP
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#define BLOCK_NUM 8
|
||||
#define BLOCK_MASK (BLOCK_NUM-1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32) && !(defined __amd64__)
|
||||
#if !(defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64)
|
||||
#define NO_CODEGEN
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,6 +16,17 @@
|
||||
|
||||
#include "libslirp-version.h"
|
||||
|
||||
/* Windows does not define ssize_t, so we need to define it here. */
|
||||
#ifndef _SSIZE_T_DEFINED
|
||||
# define _SSIZE_T_DEFINED
|
||||
# undef ssize_t
|
||||
# ifdef _WIN64
|
||||
# define ssize_t int64_t
|
||||
# else
|
||||
# define ssize_t int32_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -77,6 +77,17 @@
|
||||
|
||||
/* Types */
|
||||
|
||||
/* Windows does not define ssize_t, so we need to define it here. */
|
||||
#ifndef _SSIZE_T_DEFINED
|
||||
# define _SSIZE_T_DEFINED
|
||||
# undef ssize_t
|
||||
# ifdef _WIN64
|
||||
# define ssize_t int64_t
|
||||
# else
|
||||
# define ssize_t int32_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define gboolean int
|
||||
#define gchar char
|
||||
#define gint int
|
||||
|
||||
Reference in New Issue
Block a user