[OpenBIOS] r624 - trunk/openbios-devel/forth/system

Blue Swirl blauwirbel at gmail.com
Sun Nov 22 21:18:35 CET 2009


On Sun, Nov 22, 2009 at 3:44 PM, Mark Cave-Ayland
<mark.cave-ayland at siriusit.co.uk> wrote:
> Laurent Vivier wrote:
>
>> Same result as previous one: yaboot hangs, but quik exits with:
>> "call-method seek: exception -21"
>>
>> Regards,
>> Laurent
>
> Thanks Laurent. Now I get it: the conversion routine in modules/client.c
> mistakenly put the CIF arguments into Forth the wrong way around using this
> piece of code:
>
>        for( i=pb->nargs-1; i>=0; i-- )
>                PUSH( pb->args[i] );
>
> So, in other words: in order to fix this, we need to reverse the above loop
> so that the arguments are simply pushed onto the Forth stack in forward
> order, and then alter the Forth client interface words to take the new
> ordering into account. Then the CIF words can be called correctly from both
> Fcode and the C interface, and both our cases should work.

But this patch also does not work:
[sparc64] Booting file 'cdrom' with parameters ''
Not a bootable ELF image
Not a Linux kernel image
Loading a.out image...
Loaded 7680 bytes
entry point is 0x4000
Jumping to entry point...
switching to new context: entry point 0x4000 stack 0x00000000ffe02a71
call-method : exception -21
call-method : exception -21
call-method : exception -21
EXIT

diff --git a/forth/system/ciface.fs b/forth/system/ciface.fs
index eefb1b7..77ea3be 100644
--- a/forth/system/ciface.fs
+++ b/forth/system/ciface.fs
@@ -212,21 +212,16 @@ external
   close-dev
 ;

-: read ( ihandle addr len -- actual )
-  rot dup ihandle>phandle " read" rot find-method
-  if swap call-package else 3drop -1 then
+: read ( len addr ihandle -- actual )
+  rot swap " read" call-method
 ;

-: write ( ihandle addr len -- actual )
-  rot dup ihandle>phandle " write" rot find-method
-  if swap call-package else 3drop -1 then
+: write ( len addr ihandle -- actual )
+  rot swap " write" call-method
 ;

-: seek ( ihandle pos_hi pos_lo -- status )
-  \ package methods uses ( pos_lo pos_hi -- status )
-  swap
-  rot dup ihandle>phandle " seek" rot find-method
-  if swap call-package else 3drop -1 then
+: seek ( pos_lo pos_hi ihandle -- status )
+  " seek" call-method
 ;


diff --git a/modules/client.c b/modules/client.c
index cf47692..d5d92a3 100644
--- a/modules/client.c
+++ b/modules/client.c
@@ -239,7 +239,7 @@ handle_calls( prom_args_t *pb )
                pb->nargs, pb->nret);
 #endif

-       for( i=pb->nargs-1; i>=0; i-- )
+        for (i = 0; i < pb->nargs - 1; i++)
                PUSH( pb->args[i] );

        push_str( pb->service );



More information about the OpenBIOS mailing list