diff mbox

[v3,8/8] cpu-exec: Purge all uses of ENV_GET_CPU()

Message ID 558C2936.9090004@suse.de
State New
Headers show

Commit Message

Andreas Färber June 25, 2015, 4:15 p.m. UTC
Am 24.06.2015 um 19:32 schrieb Andreas Färber:
> Am 24.06.2015 um 04:10 schrieb Peter Crosthwaite:
>> On Thu, Jun 18, 2015 at 10:24 AM, Peter Crosthwaite
>> <crosthwaitepeter@gmail.com> wrote:
>>> diff --git a/bsd-user/main.c b/bsd-user/main.c
>>> index 45a1436..7196285 100644
>>> --- a/bsd-user/main.c
>>> +++ b/bsd-user/main.c
>>> @@ -166,6 +166,7 @@ static void set_idt(int n, unsigned int dpl)
>>>
>>>  void cpu_loop(CPUX86State *env)
>>>  {
>>> +    CPUState *cs = CPU(x86_env_get_cpu(env));
> 
> An (unwritten?) convention has been to avoid double-casts by having an
> explicit X86CPU *cpu variable.


uc32 is dancing out of line, too, but I actually like its naming better
and renaming would be a separate patch either way.

Regards,
Andreas
diff mbox

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 7196285..f46728b 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -166,7 +166,8 @@  static void set_idt(int n, unsigned int dpl)

 void cpu_loop(CPUX86State *env)
 {
-    CPUState *cs = CPU(x86_env_get_cpu(env));
+    X86CPU *cpu = x86_env_get_cpu(env);
+    CPUState *cs = CPU(cpu);
     int trapnr;
     abi_ulong pc;
     //target_siginfo_t info;

And another nit while touching that line:

diff --git a/linux-user/main.c b/linux-user/main.c
index 8c4634a..6f07644 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2655,7 +2655,7 @@  void cpu_loop(CPUOpenRISCState *env)

     for (;;) {
         cpu_exec_start(cs);
-        trapnr = cpu_exec(cs);
+        trapnr = cpu_openrisc_exec(cs);
         cpu_exec_end(cs);
         gdbsig = 0;