mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
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@siriusit.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@733 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Mark Cave-Ayland
parent
3111a2293b
commit
a757d43d04
@@ -245,7 +245,11 @@ handle_calls( prom_args_t *pb )
|
||||
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 @@ handle_calls( prom_args_t *pb )
|
||||
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 @@ handle_calls( prom_args_t *pb )
|
||||
}
|
||||
printk("\n");
|
||||
#endif
|
||||
|
||||
dstackcnt = dstacksave;
|
||||
return 0;
|
||||
}
|
||||
@@ -279,6 +285,7 @@ of_client_interface( int *params )
|
||||
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 @@ of_client_interface( int *params )
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user