[Cbe-oss-dev] [PATCH 1/2] libspe2 : pass npc by value to callback handler RESEND

Kanna Shimizu kannas at ofb.net
Sat Jun 30 17:04:30 EST 2007


libspe2: pass npc by value to callback handler

The SPE npc value isn't updated by the callback code, so we don't need
to pass a pointer to it to handle_library_callback.

Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
Signed-off-by: Kanna Shimizu <kannas at us.ibm.com>

Index: libspe2/spebase/lib_builtin.c
===================================================================
--- libspe2.orig/spebase/lib_builtin.c
+++ libspe2/spebase/lib_builtin.c
@@ -135,7 +135,8 @@ int _base_spe_callback_handler_update(vo
 	return 0;
 }
 
-int handle_library_callback(struct spe_context * spe, int callnum, unsigned int * npc)
+int handle_library_callback(struct spe_context *spe, int callnum,
+		unsigned int npc)
 {
 	int (*handler)(void *, unsigned int);
 	int rc;
@@ -149,7 +150,7 @@ int handle_library_callback(struct spe_c
 
 	handler=handlers[callnum];
 	
-	rc = handler(spe->base_private->mem_mmap_base, *npc);
+	rc = handler(spe->base_private->mem_mmap_base, npc);
 	if (rc) {
 		DEBUG_PRINTF ("SPE library call unsupported.\n");
 		errno=ENOSYS;
Index: libspe2/spebase/lib_builtin.h
===================================================================
--- libspe2.orig/spebase/lib_builtin.h
+++ libspe2/spebase/lib_builtin.h
@@ -25,6 +25,7 @@
 #define MAX_CALLNUM 255
 #define RESERVED    4
 
-extern int handle_library_callback(struct spe_context * spe, int callnum, unsigned int * npc);
+extern int handle_library_callback(struct spe_context *spe, int callnum,
+		unsigned int npc);
 
 #endif
Index: libspe2/spebase/run.c
===================================================================
--- libspe2.orig/spebase/run.c
+++ libspe2/spebase/run.c
@@ -250,7 +250,7 @@ do_run:
 			/* execute library callback */
 			DEBUG_PRINTF("SPE library call: %d\n", callback_number);
 			callback_rc = handle_library_callback(spe,
-					callback_number, entry);
+					callback_number, *entry);
 
 			if (callback_rc) {
 				/* library callback failed; set errno and



More information about the cbe-oss-dev mailing list