]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/SDL-1.2.11-asm-page.h.patch
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-2.x
[ipfire-2.x.git] / src / patches / SDL-1.2.11-asm-page.h.patch
1 diff -urN SDL-1.2.11.orig/src/video/fbcon/SDL_fbvideo.c SDL-1.2.11/src/video/fbcon/SDL_fbvideo.c
2 --- SDL-1.2.11.orig/src/video/fbcon/SDL_fbvideo.c 2006-05-17 06:16:06.000000000 +0300
3 +++ SDL-1.2.11/src/video/fbcon/SDL_fbvideo.c 2007-06-24 22:19:41.000000000 +0300
4 @@ -29,9 +29,17 @@
5 #include <unistd.h>
6 #include <sys/ioctl.h>
7 #include <sys/mman.h>
8 -#include <asm/page.h> /* For definition of PAGE_SIZE */
9 #include <linux/vt.h>
10
11 +#if defined(linux)
12 +#define HAS_MMAP_ANON
13 +#include <sys/types.h>
14 +#include <sys/mman.h>
15 +#include <asm/page.h> /* PAGE_SIZE */
16 +#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
17 +#define HAS_GETPAGESIZE
18 +#endif /* linux */
19 +
20 #include "SDL_video.h"
21 #include "SDL_mouse.h"
22 #include "../SDL_sysvideo.h"
23 @@ -474,6 +482,7 @@
24 unsigned int current_h;
25 const char *SDL_fbdev;
26 FILE *modesdb;
27 + int pagesize = -1;
28
29 /* Initialize the library */
30 SDL_fbdev = SDL_getenv("SDL_FBDEV");
31 @@ -545,9 +554,27 @@
32 }
33 }
34
35 +#if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
36 + pagesize = sysconf(_SC_PAGESIZE);
37 +#endif
38 +#ifdef _SC_PAGE_SIZE
39 + if (pagesize == -1)
40 + pagesize = sysconf(_SC_PAGE_SIZE);
41 +#endif
42 +#ifdef HAS_GETPAGESIZE
43 + if (pagesize == -1)
44 + pagesize = getpagesize();
45 +#endif
46 +#ifdef PAGE_SIZE
47 + if (pagesize == -1)
48 + pagesize = PAGE_SIZE;
49 +#endif
50 + if (pagesize == -1)
51 + pagesize = 4096;
52 +
53 /* Memory map the device, compensating for buggy PPC mmap() */
54 mapped_offset = (((long)finfo.smem_start) -
55 - (((long)finfo.smem_start)&~(PAGE_SIZE-1)));
56 + (((long)finfo.smem_start)&~(pagesize-1)));
57 mapped_memlen = finfo.smem_len+mapped_offset;
58 mapped_mem = do_mmap(NULL, mapped_memlen,
59 PROT_READ|PROT_WRITE, MAP_SHARED, console_fd, 0);