273 |
|
|
274 |
#else |
#else |
275 |
|
|
276 |
#ifdef _BSD |
#ifdef _WIN32 |
277 |
|
#include <windows.h> |
278 |
|
#elif defined(_BSD) |
279 |
#include <stdlib.h> |
#include <stdlib.h> |
280 |
#else |
#else |
281 |
#include <malloc.h> |
#include <malloc.h> |
282 |
#endif |
#endif |
|
#ifdef _WIN32 |
|
|
/* XXX: find a solution to have page aligned data */ |
|
|
#define memalign(align, size) malloc(size) |
|
|
#endif |
|
283 |
|
|
284 |
int qemu_write(int fd, const void *buf, size_t n) |
int qemu_write(int fd, const void *buf, size_t n) |
285 |
{ |
{ |
306 |
return malloc(size); |
return malloc(size); |
307 |
} |
} |
308 |
|
|
309 |
#if defined(USE_KQEMU) |
#if defined(_WIN32) |
310 |
|
|
311 |
|
void *qemu_vmalloc(size_t size) |
312 |
|
{ |
313 |
|
/* FIXME: this is not exactly optimal solution since VirtualAlloc |
314 |
|
has 64Kb granularity, but at least it guarantees us that the |
315 |
|
memory is page aligned. */ |
316 |
|
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE); |
317 |
|
} |
318 |
|
|
319 |
|
void qemu_vfree(void *ptr) |
320 |
|
{ |
321 |
|
VirtualFree(ptr, 0, MEM_RELEASE); |
322 |
|
} |
323 |
|
|
324 |
|
#elif defined(USE_KQEMU) |
325 |
|
|
326 |
#include <sys/mman.h> |
#include <sys/mman.h> |
327 |
#include <fcntl.h> |
#include <fcntl.h> |