Hi, the attached two patches are necessary on sh4
Cheers, Andre'
>From a2cdcb98527aee293b75769a271b93a74522165b Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Andr=C3=A9=20Draszik?= <andre.dras...@st.com> Date: Sat, 14 Feb 2009 13:12:58 +0000 Subject: [PATCH] (sh4) alignment fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit sh4 (and several other architectures) have special requirements on the alignment of mmap()ed MAP_FIXED | MAP_SHARED memory (D-Cache aliasing issues). However, this patch cares about sh4 only and leaves other arches untouched! Signed-off-by: André Draszik <andre.dras...@st.com> --- lib/fusion/fusion.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/lib/fusion/fusion.c b/lib/fusion/fusion.c index 3383e48..71d10c7 100644 --- a/lib/fusion/fusion.c +++ b/lib/fusion/fusion.c @@ -405,6 +405,7 @@ fusion_enter( int world_index, FusionEnter enter; char buf1[20]; char buf2[20]; + unsigned long base, offset; D_DEBUG_AT( Fusion_Main, "%s( %d, %d, %p )\n", __FUNCTION__, world_index, abi_version, ret_world ); @@ -563,7 +564,14 @@ fusion_enter( int world_index, } /* Map shared area. */ - shared = mmap( (void*) 0x20000000 + 0x2000 * world_index, sizeof(FusionWorldShared), +#ifdef __SH4__ + base = 0x20000000; + offset = 0x4000 * world_index; +#else + base = 0x20000000; + offset = 0x2000 * world_index; +#endif + shared = mmap( (void*) (base + offset), sizeof(FusionWorldShared), PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 0 ); if (shared == MAP_FAILED) { D_PERROR( "Fusion/Init: Mapping shared area failed!\n" ); -- 1.5.6.3
>From 804684780df6abbea3b981b23b25dba3ea6b7937 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Andr=C3=A9=20Draszik?= <andre.dras...@st.com> Date: Fri, 27 Feb 2009 23:17:58 +0000 Subject: [PATCH] (sh4) alignment fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit the experimental fusion multiapp userspace code needs to know about MMAP_SHARED | MMAP_FIXED alignment restrictions to work around D-Cache aliasing issues as well but was missed out previously. Again, it takes care of the sh4 arch only Signed-off-by: André Draszik <andre.dras...@st.com> --- lib/fusion/shm/heap.c | 2 +- lib/fusion/shm/pool.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/fusion/shm/heap.c b/lib/fusion/shm/heap.c index c3e6fe1..5b1f77d 100644 --- a/lib/fusion/shm/heap.c +++ b/lib/fusion/shm/heap.c @@ -642,7 +642,7 @@ __shmalloc_init_heap( FusionSHM *shm, fchmod( fd, 0660 ); ftruncate( fd, size ); - D_DEBUG_AT( Fusion_SHMHeap, " -> mmaping shared memory file... (%d bytes)\n", size ); + D_DEBUG_AT( Fusion_SHMHeap, " -> mmaping shared memory file... (%p %d bytes)\n", addr_base, size ); /* map it shared */ heap = mmap( addr_base, size + space, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0 ); diff --git a/lib/fusion/shm/pool.c b/lib/fusion/shm/pool.c index ca718aa..4cc00e4 100644 --- a/lib/fusion/shm/pool.c +++ b/lib/fusion/shm/pool.c @@ -732,7 +732,12 @@ init_pool( FusionSHM *shm, BLOCKALIGN( (max_size + BLOCKSIZE-1) / BLOCKSIZE * sizeof(shmalloc_info) ); pool_addr_base = world->shared->pool_base; - world->shared->pool_base += ((pool_max_size + page_size - 1) & ~(page_size - 1)) + page_size; +#ifdef __SH4__ + #define SHM_ALIGN_SIZE 0x4000 +#else + #define SHM_ALIGN_SIZE page_size +#endif + world->shared->pool_base += ((pool_max_size + page_size - 1) & ~(SHM_ALIGN_SIZE - 1)) + SHM_ALIGN_SIZE; /* Exceeded limit? */ if (world->shared->pool_base > world->shared->pool_max) return DR_NOSHAREDMEMORY; -- 1.5.6.3
_______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev