qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC][PATCH 11/15] memory: Allow unaligned address_spac


From: Jan Kiszka
Subject: Re: [Qemu-devel] [RFC][PATCH 11/15] memory: Allow unaligned address_space_rw
Date: Mon, 06 May 2013 16:58:46 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2013-05-06 16:55, Paolo Bonzini wrote:
> Il 06/05/2013 16:26, Jan Kiszka ha scritto:
>> This will be needed for some corner cases with para-virtual the I/O
>> ports.
>>
>> Signed-off-by: Jan Kiszka <address@hidden>
>> ---
>>  exec.c |   33 ++++++++++++++++++---------------
>>  1 files changed, 18 insertions(+), 15 deletions(-)
>>
>> diff --git a/exec.c b/exec.c
>> index 3ee1f3f..9c582b1 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -1833,38 +1833,41 @@ void address_space_rw(AddressSpace *as, hwaddr addr, 
>> uint8_t *buf,
>>      uint8_t *ptr;
>>      uint32_t val;
>>      MemoryRegionSection *section;
>> +    MemoryRegion *mr;
>>  
>>      while (len > 0) {
>>          l = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr;
>>          if (l > len)
>>              l = len;
>>          section = address_space_lookup_region(as, addr);
>> +        mr = section->mr;
>>  
>>          if (is_write) {
>> -            if (!memory_region_is_ram(section->mr)) {
>> +            if (!memory_region_is_ram(mr)) {
>>                  hwaddr addr1;
>>                  addr1 = memory_region_section_addr(section, addr);
>>                  /* XXX: could force cpu_single_env to NULL to avoid
>>                     potential bugs */
>> -                if (l >= 4 && ((addr1 & 3) == 0)) {
>> +                if (l >= 4 && ((addr1 & 3) == 0 || 
>> mr->ops->impl.unaligned)) {
> 
> Does the length matter at all if unaligned accesses are allowed?  I
> think it shouldn't...

What do you mean? The length test here is not about alignment, it's
about proper split-up depending on the input size (we cannot use 32 bit
for all accesses and do not want to make them all byte accesses, do we?).

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux



reply via email to

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