diff --git a/allegro-4.2.0-mprotect.patch b/allegro-4.2.0-mprotect.patch index da8fc5c..1d21702 100644 --- a/allegro-4.2.0-mprotect.patch +++ b/allegro-4.2.0-mprotect.patch @@ -1,5 +1,5 @@ --- allegro-4.2.0/tools/grabber.c.mprotect 2005-09-04 18:00:18.000000000 +0200 -+++ allegro-4.2.0/tools/grabber.c 2006-03-08 23:13:39.000000000 +0100 ++++ allegro-4.2.0/tools/grabber.c 2006-03-11 23:27:31.000000000 +0100 @@ -3121,6 +3121,7 @@ case OSTYPE_SUNOS: s = "SunOS/Solaris"; break; case OSTYPE_FREEBSD: s = "FreeBSD"; break; @@ -9,7 +9,7 @@ case OSTYPE_DARWIN: s = "Darwin"; break; case OSTYPE_QNX: s = "QNX"; break; --- allegro-4.2.0/include/allegro/platform/alunixac.hin.mprotect 2005-10-30 21:23:33.000000000 +0100 -+++ allegro-4.2.0/include/allegro/platform/alunixac.hin 2006-03-08 23:13:39.000000000 +0100 ++++ allegro-4.2.0/include/allegro/platform/alunixac.hin 2006-03-11 23:27:31.000000000 +0100 @@ -169,6 +169,9 @@ /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP @@ -21,7 +21,7 @@ #undef HAVE_NDIR_H --- allegro-4.2.0/include/allegro/system.h.mprotect 2005-03-15 21:32:43.000000000 +0100 -+++ allegro-4.2.0/include/allegro/system.h 2006-03-08 23:13:39.000000000 +0100 ++++ allegro-4.2.0/include/allegro/system.h 2006-03-11 23:27:31.000000000 +0100 @@ -53,6 +53,7 @@ #define OSTYPE_SUNOS AL_ID('S','U','N',' ') #define OSTYPE_FREEBSD AL_ID('F','B','S','D') @@ -31,7 +31,7 @@ #define OSTYPE_DARWIN AL_ID('D','A','R','W') #define OSTYPE_QNX AL_ID('Q','N','X',' ') --- allegro-4.2.0/configure.mprotect 2005-11-06 10:54:00.000000000 +0100 -+++ allegro-4.2.0/configure 2006-03-08 23:13:39.000000000 +0100 ++++ allegro-4.2.0/configure 2006-03-11 23:27:31.000000000 +0100 @@ -11225,7 +11225,7 @@ @@ -42,7 +42,7 @@ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 --- allegro-4.2.0/configure.in.mprotect 2005-08-07 23:50:49.000000000 +0200 -+++ allegro-4.2.0/configure.in 2006-03-08 23:13:39.000000000 +0100 ++++ allegro-4.2.0/configure.in 2006-03-11 23:27:31.000000000 +0100 @@ -713,7 +713,7 @@ AC_STRUCT_TM AC_TYPE_SIGNAL @@ -53,7 +53,7 @@ dnl Tweak header files for library build CFLAGS="$CFLAGS -DALLEGRO_LIB_BUILD" --- allegro-4.2.0/src/unix/usystem.c.mprotect 2005-09-04 18:00:17.000000000 +0200 -+++ allegro-4.2.0/src/unix/usystem.c 2006-03-08 23:13:39.000000000 +0100 ++++ allegro-4.2.0/src/unix/usystem.c 2006-03-11 23:27:31.000000000 +0100 @@ -196,6 +196,9 @@ else if (!strcmp(utsn.sysname, "NetBSD")) { os_type = OSTYPE_NETBSD; @@ -65,7 +65,7 @@ || (!strcmp(utsn.sysname, "IRIX64"))) { os_type = OSTYPE_IRIX; --- allegro-4.2.0/src/unix/uesd.c.mprotect 2005-03-12 08:54:27.000000000 +0100 -+++ allegro-4.2.0/src/unix/uesd.c 2006-03-08 23:13:39.000000000 +0100 ++++ allegro-4.2.0/src/unix/uesd.c 2006-03-11 23:27:31.000000000 +0100 @@ -27,6 +27,7 @@ #include @@ -75,25 +75,31 @@ #include --- allegro-4.2.0/src/i386/istretch.c.mprotect 2005-03-15 19:02:22.000000000 +0100 -+++ allegro-4.2.0/src/i386/istretch.c 2006-03-08 23:14:52.000000000 +0100 -@@ -30,6 +30,10 @@ ++++ allegro-4.2.0/src/i386/istretch.c 2006-03-11 23:31:44.000000000 +0100 +@@ -30,6 +30,11 @@ #include "winalleg.h" /* For VirtualProtect */ #endif /* ifdef ALLEGRO_WINDOWS */ +#ifdef HAVE_MPROTECT + #include + #include ++ #include +#endif /* helper macro for generating stretchers in each color depth */ -@@ -435,7 +439,9 @@ +@@ -435,7 +440,14 @@ #ifdef ALLEGRO_WINDOWS /* Play nice with Windows executable memory protection */ VirtualProtect(_scratch_mem, _scratch_mem_size, PAGE_EXECUTE_READWRITE, &old_protect); - #endif /* ifdef ALLEGRO_WINDOWS */ + #elif defined(HAVE_MPROTECT) -+ mprotect(_scratch_mem, _scratch_mem_size, PROT_EXEC|PROT_READ|PROT_WRITE); ++ { ++ char *p = (char *)((unsigned long)_scratch_mem & ~(PAGE_SIZE-1ul)); ++ if (mprotect(p, _scratch_mem_size + ((char *)_scratch_mem - p), ++ PROT_EXEC|PROT_READ|PROT_WRITE)) ++ perror("allegro-error: mprotect failed during stretched blit!"); ++ } + #endif /* call the stretcher */ diff --git a/allegro.spec b/allegro.spec index a691442..c81321b 100644 --- a/allegro.spec +++ b/allegro.spec @@ -1,6 +1,6 @@ Name: allegro Version: 4.2.0 -Release: 9 +Release: 10 Summary: A game programming library Summary(es): Una libreria de programacion de juegos @@ -219,6 +219,11 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Mar 11 2006 Hans de Goede 4.2.0-10 +- really fix asm stretch code on i386 with NX processors, on OpenBSD mprotects + first argument does not need to be page-aligned, but on Linux it does. + Note that for this to work you may also need to disable selinux (rh 185214) + * Wed Mar 8 2006 Hans de Goede 4.2.0-9 - fix fullscreen <-> window switching bug (bz 183645) - fix asm stretch code on i386 with NX processors, thanks to openBSD.