[OpenBIOS] [RFC] Make BootX from Mac OS X 10.4 work

Alexander Graf agraf at suse.de
Fri Jul 31 12:53:38 CEST 2009


On 31.07.2009, at 12:46, Blue Swirl wrote:

> On Thu, Jul 30, 2009 at 7:00 PM, Alexander Graf<agraf at suse.de> wrote:
>> Using this patch stacked on Steven Noonan's I was able to make  
>> BootX from
>> Mac OS X 10.4 load XNU successfully in qemu-system-ppc.
>>
>> Unfortunately, most of this patch is nothing but a mere hack to  
>> find out
>> what we really need to get this working.
>>
>> Also I didn't manage to get anything but 10.4 running. Other  
>> versions broke
>> in the partition table interpretation.
>>
>> I would not feel good taking the patch as is, because it would be  
>> better to
>> implement the correct Forth magic to make the real callbacks work.  
>> Here is
>> what I found to be broken:
>>
>>  - unselect-dev is missing
>>  - local variables don't work ({ ... })
>>  - I ran into an endless loop, getting isi and dsi faults on the  
>> same 2
>>    addresses all the time
>>
>> Also, Qemu's only usable Desktop PPC target is a G3 Beige which is  
>> only
>> supported up to 10.2.8 IIRC. So even getting the bootloader running  
>> for
>> 10.4 didn't exactly buy me much.
>
> mac99 also should do something. What machines have the best support?
>
>> Don't apply the patch as is!
>> It'd be great to see someone build on this!
>> ---
>>  arch/ppc/qemu/ofmem.c |    4 ++--
>>  modules/client.c      |   40 ++++++++++++++++++++++++++++++++++++++ 
>> ++
>>  2 files changed, 42 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/ppc/qemu/ofmem.c b/arch/ppc/qemu/ofmem.c
>> index a1a8fb1..32642e2 100644
>> --- a/arch/ppc/qemu/ofmem.c
>> +++ b/arch/ppc/qemu/ofmem.c
>> @@ -716,8 +716,8 @@ hash_page_32( ulong ea, ulong phys, int mode )
>>
>>        /* out of slots, just evict one */
>>        if( !found ) {
>> -               i = next_grab_slot + 1;
>> -               next_grab_slot = (next_grab_slot + 1) % 8;
>> +               i = next_grab_slot + 3;
>> +               next_grab_slot = (next_grab_slot + 3) % 8;
>>        }
>>        i--;
>>        upte[i*2] = cmp;
>> diff --git a/modules/client.c b/modules/client.c
>> index a2e8405..a8c89ff 100644
>> --- a/modules/client.c
>> +++ b/modules/client.c
>> @@ -49,6 +49,46 @@ handle_calls( prom_args_t *pb )
>>                pb->nargs, pb->nret);
>>  #endif
>>
>> +#if 1
>> +       if (!strcmp(pb->service, "interpret"))
>> +       {
>> +               char *ns;
>> +
>> +               ns = strstr((char*)pb->args[0], "{ ; dpth }");
>> +               if (ns) return 0;

In fact, it does this:

 >> interpret  hex unselect-dev " /packages" find-device new-device "  
sl_words" device-name : open true ; : close ; 0 value outputLevel :  
slw_set_output_level   dup 0= if 0 stdout ! then   to outputLevel ; :  
slw_emit 2 outputLevel <= if emit else drop then ; : slw_cr   2  
outputLevel <= if cr then ; 0 value keyboardIH 20 buffer: keyMap :  
slw_init_keymap   to keyboardIH   keyMap dup 20 0 fill ; :  
slw_update_keymap { ; dpth }   depth -> dpth   keyboardIH if     " get- 
key-map" keyboardIH $call-method     depth dpth - 1 = if 20 then      
4 / 0 do       dup i 4 * + l@ keyMap i 4 * + tuck l@ or swap l!      
loop drop   then ; 0 value screenIH 0 value cursorAddr 0 value cursorX  
0 value cursorY 0 value cursorW 0 value cursorH 0 value cursorFrames 0  
value cursorPixelSize 0 value cursorStage 0 value cursorTime 0 value  
cursorDelay : slw_spin   screenIH 0<> cursorAddr 0<> and if     get- 
msecs dup cursorTime - cursorDelay >= if       to cursorTime        
slw_update_keymap       cursorStage 1+ cursorFrames mod dup to  
cursorStage of_client_interface: finddevice 56128f0


>> +
>> +               ns = strstr((char*)pb->args[0], "dev /chosen ");
>> +               if (ns) memcpy(ns, " \" /chosen\"", 11);

 >> interpret  dev /chosen new-device " memory-map" device-name active- 
package device-end ([1] -- [2])

Alex



More information about the OpenBIOS mailing list