[Cbe-oss-dev] [PATCH] libspe2: unmap PS area

Kazunori Asayama asayama at sm.sony.co.jp
Thu Nov 16 13:00:57 EST 2006


Attached is a patch to fix the bug in libspe2 below:

	- PS area is not unmapped when SPE context is destroyed.

--
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t
-------------- next part --------------
Index: libspe2/spebase/create.c
===================================================================
--- libspe2.orig/spebase/create.c
+++ libspe2/spebase/create.c
@@ -117,6 +117,7 @@ spe_context_ptr_t _base_spe_context_crea
 	}
 	
 	spe->base_private->mem_mmap_base = (void*) -1;
+	spe->base_private->psmap_mmap_base = (void*) -1;
 	spe->base_private->mssync_mmap_base = (void*) -1;
 	spe->base_private->mfc_mmap_base = (void*) -1;
 	spe->base_private->cntl_mmap_base = (void*) -1;
@@ -253,14 +254,21 @@ int _base_spe_context_destroy(spe_contex
 {
 	int i;
 	
-	if(spe->base_private->mfc_mmap_base != (void*)-1)
-		munmap(spe->base_private->mfc_mmap_base, MFC_SIZE);
-	if(spe->base_private->cntl_mmap_base != (void*)-1)
-		munmap(spe->base_private->cntl_mmap_base, CNTL_SIZE);
-	if(spe->base_private->signal1_mmap_base != (void*)-1)
-		munmap(spe->base_private->signal1_mmap_base,SIGNAL_SIZE);
-	if(spe->base_private->signal2_mmap_base != (void*)-1)
-		munmap(spe->base_private->signal2_mmap_base, SIGNAL_SIZE);
+	if(spe->base_private->psmap_mmap_base != (void*)-1) {
+		munmap(spe->base_private->psmap_mmap_base, PSMAP_SIZE);
+	}
+	else {
+		if(spe->base_private->mfc_mmap_base != (void*)-1)
+			munmap(spe->base_private->mfc_mmap_base, MFC_SIZE);
+		if(spe->base_private->mssync_mmap_base != (void*)-1)
+			munmap(spe->base_private->mssync_mmap_base, MSS_SIZE);
+		if(spe->base_private->cntl_mmap_base != (void*)-1)
+			munmap(spe->base_private->cntl_mmap_base, CNTL_SIZE);
+		if(spe->base_private->signal1_mmap_base != (void*)-1)
+			munmap(spe->base_private->signal1_mmap_base,SIGNAL_SIZE);
+		if(spe->base_private->signal2_mmap_base != (void*)-1)
+			munmap(spe->base_private->signal2_mmap_base, SIGNAL_SIZE);
+	}
 
 	if(spe->base_private->mem_mmap_base != (void*)-1)
 		munmap(spe->base_private->mem_mmap_base, LS_SIZE);


More information about the cbe-oss-dev mailing list