Port-macppc archive

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

Re: [PATCH] Incorrect segment 0 initialization for PMAC G5



In article <5153732A.8070406%mail.ru@localhost>,
Phileas Fogg  <phileas-fogg%mail.ru@localhost> wrote:
>Hi,
>
>i'm trying to run/port NetBSD on my PowerMac 11,2 G5 and stumbled upon 
>the following bug
>in function arch/powerpc/oea/pmap.c:pmap_setup_segment0_map.
>
>Here is the patch:
>
>--- arch/powerpc/oea/pmap.c    2013-03-27 19:37:18.652744773 +0100
>+++ arch/powerpc/oea/pmap.c.new        2013-03-27 23:23:34.383534571 +0100
>@@ -3077,7 +3077,7 @@
>  int
>  pmap_setup_segment0_map(int use_large_pages, ...)
>  {
>-    vaddr_t va;
>+    vaddr_t va, va_end;
>
>      register_t pte_lo = 0x0;
>      int ptegidx = 0, i = 0;
>@@ -3110,7 +3110,8 @@
>          pa = va_arg(ap, paddr_t);
>          size = va_arg(ap, size_t);
>
>-        for (; va < (va + size); va += 0x1000, pa += 0x1000) {
>+        va_end = va + size;
>+        for (; va < va_end; va += 0x1000, pa += 0x1000) {
>  #if 0
>           printf("%s: Inserting: va: %#" _PRIxva ", pa: %#" _PRIxpa "\n", 
>__func__,  va, pa);
>  #endif
>
>In consequence of the incorrect loop invariant, the loop terminates 
>after the overflow of the variable va.

Good catch!

>And i would appreciate any pointers regarding porting NetBSD to PowerMac 
>G5. I managed to get the display console working and
>currently implementing support for U4 MPIC which is not supported by 
>NetBSD yet.


What specifically do you need? Do you have any questions?

christos



Home | Main Index | Thread Index | Old Index