Commit 49e9fba27138adb4ca52385f6ecc63b0ff0d3546

Authored by blueswir1
1 parent 78749ba8

Fix the bug introduced by subpage code preventing PC boot


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2898 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 3 additions and 3 deletions
@@ -1922,7 +1922,7 @@ static void *subpage_init (target_phys_addr_t base, uint32_t *phys, @@ -1922,7 +1922,7 @@ static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
1922 need_subpage = 1; \ 1922 need_subpage = 1; \
1923 } \ 1923 } \
1924 \ 1924 \
1925 - if (end_addr - addr > TARGET_PAGE_SIZE) \ 1925 + if ((start_addr + orig_size) - addr >= TARGET_PAGE_SIZE) \
1926 end_addr2 = TARGET_PAGE_SIZE - 1; \ 1926 end_addr2 = TARGET_PAGE_SIZE - 1; \
1927 else { \ 1927 else { \
1928 end_addr2 = (start_addr + orig_size - 1) & ~TARGET_PAGE_MASK; \ 1928 end_addr2 = (start_addr + orig_size - 1) & ~TARGET_PAGE_MASK; \
@@ -1944,9 +1944,9 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr, @@ -1944,9 +1944,9 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
1944 unsigned long orig_size = size; 1944 unsigned long orig_size = size;
1945 void *subpage; 1945 void *subpage;
1946 1946
1947 - end_addr = start_addr + (target_phys_addr_t)size;  
1948 size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK; 1947 size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
1949 - for(addr = start_addr; addr < end_addr; addr += TARGET_PAGE_SIZE) { 1948 + end_addr = start_addr + (target_phys_addr_t)size;
  1949 + for(addr = start_addr; addr != end_addr; addr += TARGET_PAGE_SIZE) {
1950 p = phys_page_find(addr >> TARGET_PAGE_BITS); 1950 p = phys_page_find(addr >> TARGET_PAGE_BITS);
1951 if (p && p->phys_offset != IO_MEM_UNASSIGNED) { 1951 if (p && p->phys_offset != IO_MEM_UNASSIGNED) {
1952 unsigned long orig_memory = p->phys_offset; 1952 unsigned long orig_memory = p->phys_offset;