[OpenBIOS] [commit] r733 - trunk/openbios-devel/libopenbios

repository service svn at openbios.org
Sat Apr 3 15:03:39 CEST 2010


Author: mcayland
Date: Sat Apr  3 15:03:39 2010
New Revision: 733
URL: http://tracker.coreboot.org/trac/openbios/changeset/733

Log:
Another couple of client interface fixes:

i) Ensure that the CIF caller's idea of pb->nret is always respected, but if there is a mismatch then log a warning if DEBUG_CIF 
is enabled, then correct the stack and continue.

ii) Correct the code path for call-method and interpret to ensure they ignore the extra status variable pushed onto the stack by 
client-call-iface.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>

Modified:
   trunk/openbios-devel/libopenbios/client.c

Modified: trunk/openbios-devel/libopenbios/client.c
==============================================================================
--- trunk/openbios-devel/libopenbios/client.c	Sat Apr  3 10:25:47 2010	(r732)
+++ trunk/openbios-devel/libopenbios/client.c	Sat Apr  3 15:03:39 2010	(r733)
@@ -245,7 +245,11 @@
 	push_str( pb->service );
 	fword("client-call-iface");
 
-	for( i=0; i<pb->nret && dstackcnt > dstacksave; i++ ) {
+	/* Drop the return code from client-call-iface (status is handled by the 
+	   catch result which is the first parameter below) */
+	POP();
+
+	for( i=0; i<pb->nret; i++ ) {
                 val = POP();
 		pb->args[pb->nargs + i] = val;
 
@@ -253,9 +257,10 @@
 		if( !i && val )
 			break;
 	}
+
 #ifdef DEBUG_CIF
 	/* useful for debug but not necessarily an error */
-	if( i != pb->nret || dstacksave != dstacksave ) {
+	if( i != pb->nret || dstackcnt != dstacksave ) {
                 printk("%s '%s': possible argument error (%ld--%ld) got %d\n",
 		       pb->service, (char*)pb->args[0], pb->nargs-2, pb->nret, i );
 	}
@@ -266,6 +271,7 @@
         }
         printk("\n");
 #endif
+
 	dstackcnt = dstacksave;
 	return 0;
 }
@@ -279,6 +285,7 @@
 	if( pb->nargs < 0 || pb->nret < 0 ||
             pb->nargs + pb->nret > PROM_MAX_ARGS)
 		return -1;
+
 #ifdef DEBUG_CIF
 	dump_service(pb);
 #endif
@@ -302,16 +309,21 @@
 		return -1;
 	}
 
-	for( pb->nret=0; dstackcnt > dstacksave ; pb->nret++ )
-		pb->args[pb->nargs + pb->nret] = POP();
+	for( i=0; i<pb->nret ; i++ )
+		pb->args[pb->nargs + i] = POP();
 
-#ifdef DEBUG_CIF
 	if( dstackcnt != dstacksave ) {
-		printk("service %s: argument count error (%d %d)\n",
+#ifdef DEBUG_CIF
+		printk("service %s: possible argument error (%d %d)\n",
 		       pb->service, i, dstackcnt - dstacksave );
+#endif
+		/* Some clients request less parameters than the CIF method
+		returns, e.g. getprop with OpenSolaris. Hence we drop any
+		stack parameters after issuing a warning above */
 		dstackcnt = dstacksave;
 	}
 
+#ifdef DEBUG_CIF
 	dump_return(pb);
 #endif
 	return 0;



More information about the OpenBIOS mailing list