Mercurial > mplayer.hg
annotate libdha/mtrr.c @ 11321:ef36cd5b757e
VobSubs are stripped of their MPEG PS in the muxer already, and only the SPU packets remain. So no more need for mpeg_run in the demuxer. The muxer compresses each entry independently with a full deflateInit, deflateEnd.
author | mosu |
---|---|
date | Wed, 29 Oct 2003 18:09:20 +0000 |
parents | e9bd97d5c5cc |
children | 243f6f5d0bb9 |
rev | line source |
---|---|
4476 | 1 /* |
2 mtrr.c - Stuff for optimizing memory access | |
3 Copyrights: | |
4 2002 - Linux version by Nick Kurshev | |
5 Licence: GPL | |
6 */ | |
7 | |
8 #include "config.h" | |
9 | |
10 #include <stdio.h> | |
6335
e9bd97d5c5cc
warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
6011
diff
changeset
|
11 #include <string.h> |
4476 | 12 #include <errno.h> |
13 #include "libdha.h" | |
14 #include "AsmMacros.h" | |
15 | |
5872 | 16 #if defined (__i386__) && defined (__NetBSD__) |
6011
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
17 #include <sys/param.h> |
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
18 #if __NetBSD_Version__ > 105240000 |
5872 | 19 #include <stdint.h> |
20 #include <stdlib.h> | |
21 #include <machine/mtrr.h> | |
22 #include <machine/sysarch.h> | |
23 #endif | |
6011
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
24 #endif |
4476 | 25 |
26 #if defined( __i386__ ) | |
27 int mtrr_set_type(unsigned base,unsigned size,int type) | |
28 { | |
29 #ifdef linux | |
30 FILE * mtrr_fd; | |
31 char * stype; | |
32 switch(type) | |
33 { | |
34 case MTRR_TYPE_UNCACHABLE: stype = "uncachable"; break; | |
35 case MTRR_TYPE_WRCOMB: stype = "write-combining"; break; | |
36 case MTRR_TYPE_WRTHROUGH: stype = "write-through"; break; | |
37 case MTRR_TYPE_WRPROT: stype = "write-protect"; break; | |
38 case MTRR_TYPE_WRBACK: stype = "write-back"; break; | |
39 default: return EINVAL; | |
40 } | |
41 mtrr_fd = fopen("/proc/mtrr","wt"); | |
42 if(mtrr_fd) | |
43 { | |
4495 | 44 char sout[256]; |
45 unsigned wr_len; | |
46 sprintf(sout,"base=0x%08X size=0x%08X type=%s\n",base,size,stype); | |
47 wr_len = fprintf(mtrr_fd,sout); | |
48 /*printf("MTRR: %s\n",sout);*/ | |
4476 | 49 fclose(mtrr_fd); |
4495 | 50 return wr_len == strlen(sout) ? 0 : EPERM; |
4476 | 51 } |
52 return ENOSYS; | |
5872 | 53 #elif defined (__NetBSD__) |
6011
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
54 #if __NetBSD_Version__ > 105240000 |
5872 | 55 struct mtrr *mtrrp; |
56 int n; | |
57 | |
58 mtrrp = malloc(sizeof (struct mtrr)); | |
59 mtrrp->base = base; | |
60 mtrrp->len = size; | |
61 mtrrp->type = type; | |
62 mtrrp->flags = MTRR_VALID | MTRR_PRIVATE; | |
63 n = 1; | |
64 | |
65 if (i386_set_mtrr(mtrrp, &n) < 0) { | |
66 free(mtrrp); | |
67 return errno; | |
68 } | |
69 free(mtrrp); | |
70 return 0; | |
4476 | 71 #else |
6011
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
72 /* NetBSD prior to 1.5Y doesn't have MTRR support */ |
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
73 return ENOSYS; |
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
74 #endif |
5f020e2dc745
patchs for NetBSD by Bernd Ernesti <mplayer@lists.veego.de>:
pl
parents:
5872
diff
changeset
|
75 #else |
4476 | 76 #warning Please port MTRR stuff!!! |
4510 | 77 return ENOSYS; |
4476 | 78 #endif |
79 } | |
80 #else | |
81 int mtrr_set_type(unsigned base,unsigned size,int type) | |
82 { | |
4495 | 83 return ENOSYS; |
4476 | 84 } |
6335
e9bd97d5c5cc
warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
6011
diff
changeset
|
85 #endif |