diff mbox

[06/35] tcg-s390: Allocate the code_gen_buffer near the main program.

Message ID 1275678883-7082-7-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson June 4, 2010, 7:14 p.m. UTC
This allows the use of direct calls to the helpers,
and a direct branch back to the epilogue.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 exec.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

Aurelien Jarno June 9, 2010, 10:59 p.m. UTC | #1
On Fri, Jun 04, 2010 at 12:14:14PM -0700, Richard Henderson wrote:
> This allows the use of direct calls to the helpers,
> and a direct branch back to the epilogue.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  exec.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index bb3dcad..7bbfe60 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -519,6 +519,13 @@ static void code_gen_alloc(unsigned long tb_size)
>          start = (void *) 0x01000000UL;
>          if (code_gen_buffer_size > 16 * 1024 * 1024)
>              code_gen_buffer_size = 16 * 1024 * 1024;
> +#elif defined(__s390x__)
> +        /* Map the buffer so that we can use direct calls and branches.  */
> +        /* We have a +- 4GB range on the branches; leave some slop.  */
> +        if (code_gen_buffer_size > (3ul * 1024 * 1024 * 1024)) {
> +            code_gen_buffer_size = 3ul * 1024 * 1024 * 1024;
> +        }
> +        start = (void *)0x90000000UL;

Is there any reason for this address?

>  #endif
>          code_gen_buffer = mmap(start, code_gen_buffer_size,
>                                 PROT_WRITE | PROT_READ | PROT_EXEC,
> -- 
> 1.7.0.1
> 
> 
>
Richard Henderson June 10, 2010, 10:05 p.m. UTC | #2
On 06/09/2010 03:59 PM, Aurelien Jarno wrote:
>> +        start = (void *)0x90000000UL;
> 
> Is there any reason for this address?

The default link address for the main application is 0x80000000,
so this is near-by.


r~
Aurelien Jarno June 11, 2010, 7:31 a.m. UTC | #3
On Thu, Jun 10, 2010 at 03:05:16PM -0700, Richard Henderson wrote:
> On 06/09/2010 03:59 PM, Aurelien Jarno wrote:
> >> +        start = (void *)0x90000000UL;
> > 
> > Is there any reason for this address?
> 
> The default link address for the main application is 0x80000000,
> so this is near-by.
> 

Ok, that makes sense, I have applied the patch
diff mbox

Patch

diff --git a/exec.c b/exec.c
index bb3dcad..7bbfe60 100644
--- a/exec.c
+++ b/exec.c
@@ -519,6 +519,13 @@  static void code_gen_alloc(unsigned long tb_size)
         start = (void *) 0x01000000UL;
         if (code_gen_buffer_size > 16 * 1024 * 1024)
             code_gen_buffer_size = 16 * 1024 * 1024;
+#elif defined(__s390x__)
+        /* Map the buffer so that we can use direct calls and branches.  */
+        /* We have a +- 4GB range on the branches; leave some slop.  */
+        if (code_gen_buffer_size > (3ul * 1024 * 1024 * 1024)) {
+            code_gen_buffer_size = 3ul * 1024 * 1024 * 1024;
+        }
+        start = (void *)0x90000000UL;
 #endif
         code_gen_buffer = mmap(start, code_gen_buffer_size,
                                PROT_WRITE | PROT_READ | PROT_EXEC,