1 /* |
1 /* |
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
203 size_t split, bool realloc); |
203 size_t split, bool realloc); |
204 static bool commit_memory(char* addr, size_t bytes); |
204 static bool commit_memory(char* addr, size_t bytes); |
205 static bool commit_memory(char* addr, size_t size, size_t alignment_hint); |
205 static bool commit_memory(char* addr, size_t size, size_t alignment_hint); |
206 static bool uncommit_memory(char* addr, size_t bytes); |
206 static bool uncommit_memory(char* addr, size_t bytes); |
207 static bool release_memory(char* addr, size_t bytes); |
207 static bool release_memory(char* addr, size_t bytes); |
208 static bool protect_memory(char* addr, size_t bytes); |
208 |
|
209 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX }; |
|
210 static bool protect_memory(char* addr, size_t bytes, ProtType prot, |
|
211 bool is_committed = false); |
|
212 |
209 static bool guard_memory(char* addr, size_t bytes); |
213 static bool guard_memory(char* addr, size_t bytes); |
210 static bool unguard_memory(char* addr, size_t bytes); |
214 static bool unguard_memory(char* addr, size_t bytes); |
211 static char* map_memory(int fd, const char* file_name, size_t file_offset, |
215 static char* map_memory(int fd, const char* file_name, size_t file_offset, |
212 char *addr, size_t bytes, bool read_only = false, |
216 char *addr, size_t bytes, bool read_only = false, |
213 bool allow_exec = false); |
217 bool allow_exec = false); |
396 static const char* dll_file_extension(); |
400 static const char* dll_file_extension(); |
397 |
401 |
398 static const char* get_temp_directory(); |
402 static const char* get_temp_directory(); |
399 static const char* get_current_directory(char *buf, int buflen); |
403 static const char* get_current_directory(char *buf, int buflen); |
400 |
404 |
|
405 // Builds a platform-specific full library path given a ld path and lib name |
|
406 static void dll_build_name(char* buffer, size_t size, |
|
407 const char* pathname, const char* fname); |
|
408 |
401 // Symbol lookup, find nearest function name; basically it implements |
409 // Symbol lookup, find nearest function name; basically it implements |
402 // dladdr() for all platforms. Name of the nearest function is copied |
410 // dladdr() for all platforms. Name of the nearest function is copied |
403 // to buf. Distance from its base address is returned as offset. |
411 // to buf. Distance from its base address is returned as offset. |
404 // If function name is not found, buf[0] is set to '\0' and offset is |
412 // If function name is not found, buf[0] is set to '\0' and offset is |
405 // set to -1. |
413 // set to -1. |
418 |
426 |
419 // Loads .dll/.so and |
427 // Loads .dll/.so and |
420 // in case of error it checks if .dll/.so was built for the |
428 // in case of error it checks if .dll/.so was built for the |
421 // same architecture as Hotspot is running on |
429 // same architecture as Hotspot is running on |
422 static void* dll_load(const char *name, char *ebuf, int ebuflen); |
430 static void* dll_load(const char *name, char *ebuf, int ebuflen); |
|
431 |
|
432 // lookup symbol in a shared library |
|
433 static void* dll_lookup(void* handle, const char* name); |
423 |
434 |
424 // Print out system information; they are called by fatal error handler. |
435 // Print out system information; they are called by fatal error handler. |
425 // Output format may be different on different platforms. |
436 // Output format may be different on different platforms. |
426 static void print_os_info(outputStream* st); |
437 static void print_os_info(outputStream* st); |
427 static void print_cpu_info(outputStream* st); |
438 static void print_cpu_info(outputStream* st); |