qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/2] w64: Fix data type of tb_next and other


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH v2 1/2] w64: Fix data type of tb_next and other variables used for host addresses
Date: Sat, 7 Apr 2012 11:25:25 +0000

On Fri, Apr 6, 2012 at 20:23, Stefan Weil <address@hidden> wrote:
> Am 29.03.2012 22:27, schrieb Blue Swirl:
>
>> On Sat, Mar 24, 2012 at 21:25, Stefan Weil <address@hidden> wrote:
>>>
>>> QEMU host addresses must use uintptr_t to be portable for hosts with
>>> an unusual size of long (w64).
>>>
>>> tb_jmp_offset is an uint16_t value, therefore the local variable offset
>>> in function tb_set_jmp_target was changed from unsigned long to uint16_t.
>>>
>>> The type cast to long in function tb_add_jump now also uses uintptr_t.
>>> For the bit operation used here, the signedness of the type cast does
>>> not matter.
>>>
>>> Some remaining unsigned long values are either only used for ARM
>>> assembler
>>> code or will be fixed in a later patch for PPC.
>>>
>>> v2:
>>> Fix signature of tb_find_pc in exec.c, too (hint from Blue Swirl,
>>> thanks).
>>> There remain lots of other long / unsigned long in exec.c which must be
>>> replaced by uintptr_t. This will be done in a separate patch. Here
>>> only one of these type casts is fixed.
>>>
>>> Signed-off-by: Stefan Weil <address@hidden>
>>> ---
>>>  exec-all.h      |   33 ++++++++++++++++-----------------
>>>  exec.c          |    4 ++--
>>>  translate-all.c |    6 +++---
>>>  3 files changed, 21 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/exec-all.h b/exec-all.h
>>> index 93a5b22..a6d6519 100644
>>> --- a/exec-all.h
>>> +++ b/exec-all.h
>>> @@ -85,7 +85,7 @@ void cpu_gen_init(void);
>>>  int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
>>>                 int *gen_code_size_ptr);
>>>  int cpu_restore_state(struct TranslationBlock *tb,
>>> -                      CPUArchState *env, unsigned long searched_pc);
>>> +                      CPUArchState *env, uintptr_t searched_pc);
>>>  void cpu_resume_from_signal(CPUArchState *env1, void *puc);
>>>  void cpu_io_recompile(CPUArchState *env, void *retaddr);
>>>  TranslationBlock *tb_gen_code(CPUArchState *env,
>>> @@ -93,7 +93,7 @@ TranslationBlock *tb_gen_code(CPUArchState *env,
>>>                              int cflags);
>>>  void cpu_exec_init(CPUArchState *env);
>>>  void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
>>> -int page_unprotect(target_ulong address, unsigned long pc, void *puc);
>>> +int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
>>
>>
>> Now I get this error on i386:
>> /src/qemu/exec.c:2505: error: conflicting types for 'page_unprotect'
>> /src/qemu/exec-all.h:96: note: previous declaration of 'page_unprotect'
>> was here
>
>
> I'm really sorry that I missed that declaration. My compilers don't
> complain - no matter whether I compile for 32 or 64 bits, Linux or Windows,
> but of course the declaration was wrong.
>
> Which compiler do you use?

IIRC this was in i386 chroot, Debian stable. There stdint.h defines
uintptr_t in 32 bit case with:
typedef unsigned int            uintptr_t;

This won't match unsigned long.

I'm also using GCC 4.6.0, just moved to 4.7.0.

>
> I'll send patch v3.
>
> Regards,
>
> Stefan W.
>



reply via email to

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