qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] exec: Don't request an address for code_gen_buf


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH] exec: Don't request an address for code_gen_buffer if -fpie
Date: Sun, 7 Oct 2012 19:40:48 +0000

On Sun, Oct 7, 2012 at 7:20 PM, Richard Henderson <address@hidden> wrote:
> On 10/07/2012 09:34 AM, Blue Swirl wrote:
>>> > +#ifdef USE_MMAP
>>> > +    code_gen_buffer = mmap((void *)start, code_gen_buffer_size,
>>> > +                           PROT_WRITE | PROT_READ | PROT_EXEC,
>>> > +                           flags, -1, 0);
>>> > +    if (code_gen_buffer == MAP_FAILED) {
>>> > +        fprintf(stderr, "Could not allocate dynamic translator 
>>> > buffer\n");
>>> > +        exit(1);
>>> >      }
>>> >  #else
>>> >      code_gen_buffer = g_malloc(code_gen_buffer_size);
>>> >      map_exec(code_gen_buffer, code_gen_buffer_size);
>> In this branch (e.g. mingw32), 'start' is unused:
>> /src/qemu/exec.c: In function 'code_gen_alloc':
>> /src/qemu/exec.c:531: warning: unused variable 'start'
>
> Well, I've rearranged the code to handle this, and it does avoid the warning.
> But I'm not sure I like the two separate blocks.  Especially for the x86_64
> MAP32 case.  Perhaps we're better off with an __attribute__((unused)) there?

How about splitting the function into three: common part, mmap case
and non-mmap case? It could improve readability.

>
>
> r~
>
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]