Revision f01576f1 exec.c
b/exec.c | ||
---|---|---|
42 | 42 |
#if defined(CONFIG_USER_ONLY) |
43 | 43 |
#include <qemu.h> |
44 | 44 |
#include <signal.h> |
45 |
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
|
46 |
#include <sys/param.h> |
|
47 |
#if __FreeBSD_version >= 700104 |
|
48 |
#define HAVE_KINFO_GETVMMAP |
|
49 |
#define sigqueue sigqueue_freebsd /* avoid redefinition */ |
|
50 |
#include <sys/time.h> |
|
51 |
#include <sys/proc.h> |
|
52 |
#include <machine/profile.h> |
|
53 |
#define _KERNEL |
|
54 |
#include <sys/user.h> |
|
55 |
#undef _KERNEL |
|
56 |
#undef sigqueue |
|
57 |
#include <libutil.h> |
|
58 |
#endif |
|
59 |
#endif |
|
45 | 60 |
#endif |
46 | 61 |
|
47 | 62 |
//#define DEBUG_TB_INVALIDATE |
... | ... | |
275 | 290 |
|
276 | 291 |
#if !defined(_WIN32) && defined(CONFIG_USER_ONLY) |
277 | 292 |
{ |
293 |
#ifdef HAVE_KINFO_GETVMMAP |
|
294 |
struct kinfo_vmentry *freep; |
|
295 |
int i, cnt; |
|
296 |
|
|
297 |
freep = kinfo_getvmmap(getpid(), &cnt); |
|
298 |
if (freep) { |
|
299 |
mmap_lock(); |
|
300 |
for (i = 0; i < cnt; i++) { |
|
301 |
unsigned long startaddr, endaddr; |
|
302 |
|
|
303 |
startaddr = freep[i].kve_start; |
|
304 |
endaddr = freep[i].kve_end; |
|
305 |
if (h2g_valid(startaddr)) { |
|
306 |
startaddr = h2g(startaddr) & TARGET_PAGE_MASK; |
|
307 |
|
|
308 |
if (h2g_valid(endaddr)) { |
|
309 |
endaddr = h2g(endaddr); |
|
310 |
page_set_flags(startaddr, endaddr, PAGE_RESERVED); |
|
311 |
} else { |
|
312 |
#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS |
|
313 |
endaddr = ~0ul; |
|
314 |
page_set_flags(startaddr, endaddr, PAGE_RESERVED); |
|
315 |
#endif |
|
316 |
} |
|
317 |
} |
|
318 |
} |
|
319 |
free(freep); |
|
320 |
mmap_unlock(); |
|
321 |
} |
|
322 |
#else |
|
278 | 323 |
FILE *f; |
279 | 324 |
|
280 | 325 |
last_brk = (unsigned long)sbrk(0); |
281 | 326 |
|
327 |
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
|
328 |
f = fopen("/compat/linux/proc/self/maps", "r"); |
|
329 |
#else |
|
282 | 330 |
f = fopen("/proc/self/maps", "r"); |
331 |
#endif |
|
283 | 332 |
if (f) { |
284 | 333 |
mmap_lock(); |
285 | 334 |
|
... | ... | |
304 | 353 |
fclose(f); |
305 | 354 |
mmap_unlock(); |
306 | 355 |
} |
356 |
#endif |
|
307 | 357 |
} |
308 | 358 |
#endif |
309 | 359 |
} |
Also available in: Unified diff