[haiku-development] Re: Haiku on PowerPC - try 2. SUCCESS - PATCH attached

On Thu, 23 Jul 2009 10:22:50 +0200 CEST, "Axel Dörfler"
<axeld@xxxxxxxxxxxxxxxx> wrote:
> Alexander von Gluck <kallisti5@xxxxxxxxxxx> wrote:
>> man.. worst patch release ever..
>> here is final.. final.. final.
>> i forgot to take out the old isync();
> 
> Can you try putting isync()/sync() out of the loop, and call both just 
> before that loop instead? I have the feeling this is a bit of overkill.
> In any case, I've applied it now, thanks!
> 
> Bye,
>    Axel.

Hey, the changes look great.  I should of taken the time to look where
isync was defined, thanks for the good call on that one.  Sorry about the
patch quality, I promise it will be better next time.. I was just in a
hurry cause I finally got that damn boot loader going. :)


After I found where the code was locking up, I looked over how Apple did
the contexts in their XNU kernel...

http://www.opensource.apple.com/source/xnu/xnu-124.1/osfmk/ppc/ppc_init.c

        /* Set up segment registers as VM through space 0 */
        for (i=0; i<=15; i++) {
          isync();
          mtsrin((KERNEL_SEG_REG0_VALUE | (i << 20)), i * 0x10000000);
          sync();
        }

The for loop looks similar right?  Not word for word, but it looks like our
contexts are laid out about the same.

I also found an awesome explanation of when to sync and when to isync with
mtsrin calls:

http://application-notes.digchip.com/314/314-67492.pdf

I am not exactly sure what our mtsrin counts as on that chart, but after
looking at lots and lots of ppc code it seems more sync's are better. For
example I saw this quite common:

for
sync(); isync();
mtsrin call
sync(); isync();
loop

That may be just the code of someone who has no idea what their doing
though...  who knows.


-- 
Thanks!
Alexander von Gluck
http://unixzen.com
PGP: F079C049
Google Voice: 832-592-7635

Other related posts: