comparison libdha/mtrr.c @ 5872:02576893af2a

OpenBSD, NetBSD portability patches by Bj«Órn Sandell <biorn@dce.chalmers.se> Marcus <core@antbear.org> Bernd Ernesti <mplayer@lists.veego.de>
author arpi
date Sat, 27 Apr 2002 22:42:27 +0000
parents 1f0282f9a723
children 5f020e2dc745
comparison
equal deleted inserted replaced
5871:c03422eaaadf 5872:02576893af2a
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <errno.h> 11 #include <errno.h>
12 #include "libdha.h" 12 #include "libdha.h"
13 #include "AsmMacros.h" 13 #include "AsmMacros.h"
14 14
15 #if defined (__i386__) && defined (__NetBSD__)
16 #include <stdint.h>
17 #include <stdlib.h>
18 #include <machine/mtrr.h>
19 #include <machine/sysarch.h>
20 #endif
15 21
16 #if defined( __i386__ ) 22 #if defined( __i386__ )
17 int mtrr_set_type(unsigned base,unsigned size,int type) 23 int mtrr_set_type(unsigned base,unsigned size,int type)
18 { 24 {
19 #ifdef linux 25 #ifdef linux
38 /*printf("MTRR: %s\n",sout);*/ 44 /*printf("MTRR: %s\n",sout);*/
39 fclose(mtrr_fd); 45 fclose(mtrr_fd);
40 return wr_len == strlen(sout) ? 0 : EPERM; 46 return wr_len == strlen(sout) ? 0 : EPERM;
41 } 47 }
42 return ENOSYS; 48 return ENOSYS;
49 #elif defined (__NetBSD__)
50 struct mtrr *mtrrp;
51 int n;
52
53 mtrrp = malloc(sizeof (struct mtrr));
54 mtrrp->base = base;
55 mtrrp->len = size;
56 mtrrp->type = type;
57 mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
58 n = 1;
59
60 if (i386_set_mtrr(mtrrp, &n) < 0) {
61 free(mtrrp);
62 return errno;
63 }
64 free(mtrrp);
65 return 0;
43 #else 66 #else
44 #warning Please port MTRR stuff!!! 67 #warning Please port MTRR stuff!!!
45 return ENOSYS; 68 return ENOSYS;
46 #endif 69 #endif
47 } 70 }