mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-07-23 11:24:38 +00:00
Map code buffers below 2G on Sparc64
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4951 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
c070355d39
commit
141ac468ab
18
exec.c
18
exec.c
|
@ -89,9 +89,9 @@ int nb_tbs;
|
||||||
/* any access to the tbs or the page table must use this lock */
|
/* any access to the tbs or the page table must use this lock */
|
||||||
spinlock_t tb_lock = SPIN_LOCK_UNLOCKED;
|
spinlock_t tb_lock = SPIN_LOCK_UNLOCKED;
|
||||||
|
|
||||||
#if defined(__arm__)
|
#if defined(__arm__) || defined(__sparc_v9__)
|
||||||
/* The prologue must be reachable with a direct jump. ARM has a
|
/* The prologue must be reachable with a direct jump. ARM and Sparc64
|
||||||
limited branch range (possibly also PPC and SPARC?) so place it in a
|
have limited branch ranges (possibly also PPC) so place it in a
|
||||||
section close to code segment. */
|
section close to code segment. */
|
||||||
#define code_gen_section \
|
#define code_gen_section \
|
||||||
__attribute__((__section__(".gen_code"))) \
|
__attribute__((__section__(".gen_code"))) \
|
||||||
|
@ -410,15 +410,23 @@ void code_gen_alloc(unsigned long tb_size)
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
|
void *start = NULL;
|
||||||
|
|
||||||
flags = MAP_PRIVATE | MAP_ANONYMOUS;
|
flags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
flags |= MAP_32BIT;
|
flags |= MAP_32BIT;
|
||||||
/* Cannot map more than that */
|
/* Cannot map more than that */
|
||||||
if (code_gen_buffer_size > (800 * 1024 * 1024))
|
if (code_gen_buffer_size > (800 * 1024 * 1024))
|
||||||
code_gen_buffer_size = (800 * 1024 * 1024);
|
code_gen_buffer_size = (800 * 1024 * 1024);
|
||||||
|
#elif defined(__sparc_v9__)
|
||||||
|
// Map the buffer below 2G, so we can use direct calls and branches
|
||||||
|
flags |= MAP_FIXED;
|
||||||
|
start = (void *) 0x60000000UL;
|
||||||
|
if (code_gen_buffer_size > (512 * 1024 * 1024))
|
||||||
|
code_gen_buffer_size = (512 * 1024 * 1024);
|
||||||
#endif
|
#endif
|
||||||
code_gen_buffer = mmap(NULL, code_gen_buffer_size,
|
code_gen_buffer = mmap(start, code_gen_buffer_size,
|
||||||
PROT_WRITE | PROT_READ | PROT_EXEC,
|
PROT_WRITE | PROT_READ | PROT_EXEC,
|
||||||
flags, -1, 0);
|
flags, -1, 0);
|
||||||
if (code_gen_buffer == MAP_FAILED) {
|
if (code_gen_buffer == MAP_FAILED) {
|
||||||
fprintf(stderr, "Could not allocate dynamic translator buffer\n");
|
fprintf(stderr, "Could not allocate dynamic translator buffer\n");
|
||||||
|
|
|
@ -69,6 +69,7 @@ SECTIONS
|
||||||
. = ALIGN(0x100000) + (. & (0x100000 - 1));
|
. = ALIGN(0x100000) + (. & (0x100000 - 1));
|
||||||
.data :
|
.data :
|
||||||
{
|
{
|
||||||
|
*(.gen_code)
|
||||||
*(.data)
|
*(.data)
|
||||||
*(.gnu.linkonce.d*)
|
*(.gnu.linkonce.d*)
|
||||||
CONSTRUCTORS
|
CONSTRUCTORS
|
||||||
|
|
Loading…
Reference in a new issue