From 3111a2293bbff8b239390176cf627f78225ca1d4 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Sat, 3 Apr 2010 08:25:47 +0000 Subject: [PATCH] Fix two errors related to argument passing in the client interface: i) client-call-iface did not set a return value of 0 on success; hence the top stack argument was dropped as part of the status check causing an off-by-one error. ii) instead of setting pb->nret to be the number of arguments returned, the (random) value being passed in was being used to control the number of arguments being returned. Signed-off-by: Mark Cave-Ayland git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@732 f158a5a8-5612-0410-a976-696ce0be7e32 --- forth/system/ciface.fs | 1 + libopenbios/client.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/forth/system/ciface.fs b/forth/system/ciface.fs index b2035bc..aada422 100644 --- a/forth/system/ciface.fs +++ b/forth/system/ciface.fs @@ -341,4 +341,5 @@ device-end : client-call-iface ( [args] name len -- [args] -1 | [rets] 0 ) ciface-ph find-method 0= if -1 exit then execute + 0 ; diff --git a/libopenbios/client.c b/libopenbios/client.c index ffb6a31..178ffa2 100644 --- a/libopenbios/client.c +++ b/libopenbios/client.c @@ -302,11 +302,11 @@ of_client_interface( int *params ) return -1; } - for( i=0; inret && dstackcnt > dstacksave ; i++ ) - pb->args[pb->nargs + i] = POP(); + for( pb->nret=0; dstackcnt > dstacksave ; pb->nret++ ) + pb->args[pb->nargs + pb->nret] = POP(); #ifdef DEBUG_CIF - if( i != pb->nret || dstackcnt != dstacksave ) { + if( dstackcnt != dstacksave ) { printk("service %s: argument count error (%d %d)\n", pb->service, i, dstackcnt - dstacksave ); dstackcnt = dstacksave;