Patchwork Re: [PATCH] Remove IO_MEM_SUBWIDTH.

login
register
mail settings
Submitter Richard Henderson
Date April 27, 2010, 6:30 p.m.
Message ID <4BD72D5D.8000306@twiddle.net>
Download mbox | patch
Permalink /patch/51100/
State New
Headers show

Comments

Richard Henderson - April 27, 2010, 6:30 p.m.
On 04/26/2010 02:54 PM, Artyom Tarasenko wrote:
> This patch introduces a regression. qemu crashes on lance test:

I'm not sure how to get to this, since the sparc-test images don't
include ifconfig, and I havn't been able to find a sparc install
image that works (doesn't support sparc32 or sparc64 fails to load).

That said, try this and see if it works.


r~

---
Artyom Tarasenko - April 28, 2010, 7:29 p.m.
2010/4/27 Richard Henderson <rth@twiddle.net>:
> On 04/26/2010 02:54 PM, Artyom Tarasenko wrote:
>> This patch introduces a regression. qemu crashes on lance test:
>
> I'm not sure how to get to this, since the sparc-test images don't
> include ifconfig, and I havn't been able to find a sparc install
> image that works (doesn't support sparc32 or sparc64 fails to load).
>
> That said, try this and see if it works.
>
>
> r~
>
> ---
> diff --git a/exec.c b/exec.c
> index 14d1fd7..572d3fd 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3286,6 +3286,8 @@ static int cpu_register_io_memory_fixed(int io_index,
>                                         CPUWriteMemoryFunc * const *mem_write,
>                                         void *opaque)
>  {
> +    int i;
> +
>     if (io_index <= 0) {
>         io_index = get_free_io_mem_idx();
>         if (io_index == -1)
> @@ -3296,8 +3298,14 @@ static int cpu_register_io_memory_fixed(int io_index,
>             return -1;
>     }
>
> -    memcpy(io_mem_read[io_index], mem_read, 3 * sizeof(CPUReadMemoryFunc*));
> -    memcpy(io_mem_write[io_index], mem_write, 3 * sizeof(CPUWriteMemoryFunc*));
> +    for (i = 0; i < 3; ++i) {
> +        io_mem_read[io_index][i]
> +            = (mem_read[i] ? mem_read[i] : unassigned_mem_read[i]);
> +    }
> +    for (i = 0; i < 3; ++i) {
> +        io_mem_write[io_index][i]
> +            = (mem_write[i] ? mem_write[i] : unassigned_mem_write[i]);
> +    }
>     io_mem_opaque[io_index] = opaque;
>
>     return (io_index << IO_MEM_SHIFT);
>

Looks good, thanks.

Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
Artyom Tarasenko - May 6, 2010, 8:25 p.m.
2010/4/28 Artyom Tarasenko <atar4qemu@googlemail.com>:
> 2010/4/27 Richard Henderson <rth@twiddle.net>:
>> On 04/26/2010 02:54 PM, Artyom Tarasenko wrote:
>>> This patch introduces a regression. qemu crashes on lance test:
>>
>> I'm not sure how to get to this, since the sparc-test images don't
>> include ifconfig, and I havn't been able to find a sparc install
>> image that works (doesn't support sparc32 or sparc64 fails to load).
>>
>> That said, try this and see if it works.
>>
>>
>> r~
>>
>> ---
>> diff --git a/exec.c b/exec.c
>> index 14d1fd7..572d3fd 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -3286,6 +3286,8 @@ static int cpu_register_io_memory_fixed(int io_index,
>>                                         CPUWriteMemoryFunc * const *mem_write,
>>                                         void *opaque)
>>  {
>> +    int i;
>> +
>>     if (io_index <= 0) {
>>         io_index = get_free_io_mem_idx();
>>         if (io_index == -1)
>> @@ -3296,8 +3298,14 @@ static int cpu_register_io_memory_fixed(int io_index,
>>             return -1;
>>     }
>>
>> -    memcpy(io_mem_read[io_index], mem_read, 3 * sizeof(CPUReadMemoryFunc*));
>> -    memcpy(io_mem_write[io_index], mem_write, 3 * sizeof(CPUWriteMemoryFunc*));
>> +    for (i = 0; i < 3; ++i) {
>> +        io_mem_read[io_index][i]
>> +            = (mem_read[i] ? mem_read[i] : unassigned_mem_read[i]);
>> +    }
>> +    for (i = 0; i < 3; ++i) {
>> +        io_mem_write[io_index][i]
>> +            = (mem_write[i] ? mem_write[i] : unassigned_mem_write[i]);
>> +    }
>>     io_mem_opaque[io_index] = opaque;
>>
>>     return (io_index << IO_MEM_SHIFT);
>>

Why the fix didn't make it into the git?
Does it introduce other problems?

> Looks good, thanks.
>
> Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
>
Blue Swirl - May 7, 2010, 3:28 p.m.
On 5/6/10, Artyom Tarasenko <atar4qemu@googlemail.com> wrote:
> 2010/4/28 Artyom Tarasenko <atar4qemu@googlemail.com>:
>
> > 2010/4/27 Richard Henderson <rth@twiddle.net>:
>  >> On 04/26/2010 02:54 PM, Artyom Tarasenko wrote:
>  >>> This patch introduces a regression. qemu crashes on lance test:
>  >>
>  >> I'm not sure how to get to this, since the sparc-test images don't
>  >> include ifconfig, and I havn't been able to find a sparc install
>  >> image that works (doesn't support sparc32 or sparc64 fails to load).
>  >>
>  >> That said, try this and see if it works.
>  >>
>  >>
>  >> r~
>  >>
>  >> ---
>  >> diff --git a/exec.c b/exec.c
>  >> index 14d1fd7..572d3fd 100644
>  >> --- a/exec.c
>  >> +++ b/exec.c
>  >> @@ -3286,6 +3286,8 @@ static int cpu_register_io_memory_fixed(int io_index,
>  >>                                         CPUWriteMemoryFunc * const *mem_write,
>  >>                                         void *opaque)
>  >>  {
>  >> +    int i;
>  >> +
>  >>     if (io_index <= 0) {
>  >>         io_index = get_free_io_mem_idx();
>  >>         if (io_index == -1)
>  >> @@ -3296,8 +3298,14 @@ static int cpu_register_io_memory_fixed(int io_index,
>  >>             return -1;
>  >>     }
>  >>
>  >> -    memcpy(io_mem_read[io_index], mem_read, 3 * sizeof(CPUReadMemoryFunc*));
>  >> -    memcpy(io_mem_write[io_index], mem_write, 3 * sizeof(CPUWriteMemoryFunc*));
>  >> +    for (i = 0; i < 3; ++i) {
>  >> +        io_mem_read[io_index][i]
>  >> +            = (mem_read[i] ? mem_read[i] : unassigned_mem_read[i]);
>  >> +    }
>  >> +    for (i = 0; i < 3; ++i) {
>  >> +        io_mem_write[io_index][i]
>  >> +            = (mem_write[i] ? mem_write[i] : unassigned_mem_write[i]);
>  >> +    }
>  >>     io_mem_opaque[io_index] = opaque;
>  >>
>  >>     return (io_index << IO_MEM_SHIFT);
>  >>
>
>
> Why the fix didn't make it into the git?
>  Does it introduce other problems?

A diff is not a patch, there is no commit description or SoB.

>  > Looks good, thanks.
>  >
>  > Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
>  >
>
>  --
>  Regards,
>  Artyom Tarasenko
>
>  solaris/sparc under qemu blog: http://tyom.blogspot.com/
>

Patch

diff --git a/exec.c b/exec.c
index 14d1fd7..572d3fd 100644
--- a/exec.c
+++ b/exec.c
@@ -3286,6 +3286,8 @@  static int cpu_register_io_memory_fixed(int io_index,
                                         CPUWriteMemoryFunc * const *mem_write,
                                         void *opaque)
 {
+    int i;
+
     if (io_index <= 0) {
         io_index = get_free_io_mem_idx();
         if (io_index == -1)
@@ -3296,8 +3298,14 @@  static int cpu_register_io_memory_fixed(int io_index,
             return -1;
     }
 
-    memcpy(io_mem_read[io_index], mem_read, 3 * sizeof(CPUReadMemoryFunc*));
-    memcpy(io_mem_write[io_index], mem_write, 3 * sizeof(CPUWriteMemoryFunc*));
+    for (i = 0; i < 3; ++i) {
+        io_mem_read[io_index][i]
+            = (mem_read[i] ? mem_read[i] : unassigned_mem_read[i]);
+    }
+    for (i = 0; i < 3; ++i) {
+        io_mem_write[io_index][i]
+            = (mem_write[i] ? mem_write[i] : unassigned_mem_write[i]);
+    }
     io_mem_opaque[io_index] = opaque;
 
     return (io_index << IO_MEM_SHIFT);