Revision 128ab2ff osdep.c
b/osdep.c | ||
---|---|---|
68 | 68 |
|
69 | 69 |
#if defined(USE_KQEMU) |
70 | 70 |
|
71 |
#ifdef __OpenBSD__ |
|
72 |
#include <sys/param.h> |
|
73 |
#include <sys/types.h> |
|
74 |
#include <sys/mount.h> |
|
75 |
#else |
|
71 | 76 |
#include <sys/vfs.h> |
77 |
#endif |
|
78 |
|
|
72 | 79 |
#include <sys/mman.h> |
73 | 80 |
#include <fcntl.h> |
74 | 81 |
|
... | ... | |
76 | 83 |
{ |
77 | 84 |
static int phys_ram_fd = -1; |
78 | 85 |
static int phys_ram_size = 0; |
86 |
void *ptr; |
|
87 |
|
|
88 |
#ifdef __OpenBSD__ /* no need (?) for a dummy file on OpenBSD */ |
|
89 |
int map_anon = MAP_ANON; |
|
90 |
#else |
|
91 |
int map_anon = 0; |
|
79 | 92 |
const char *tmpdir; |
80 | 93 |
char phys_ram_file[1024]; |
81 |
void *ptr; |
|
82 | 94 |
#ifdef HOST_SOLARIS |
83 | 95 |
struct statvfs stfs; |
84 | 96 |
#else |
... | ... | |
140 | 152 |
} |
141 | 153 |
size = (size + 4095) & ~4095; |
142 | 154 |
ftruncate(phys_ram_fd, phys_ram_size + size); |
155 |
#endif /* !__OpenBSD__ */ |
|
143 | 156 |
ptr = mmap(NULL, |
144 | 157 |
size, |
145 |
PROT_WRITE | PROT_READ, MAP_SHARED, |
|
158 |
PROT_WRITE | PROT_READ, map_anon | MAP_SHARED,
|
|
146 | 159 |
phys_ram_fd, phys_ram_size); |
147 | 160 |
if (ptr == MAP_FAILED) { |
148 | 161 |
fprintf(stderr, "Could not map physical memory\n"); |
Also available in: Unified diff