Library call for cpu features; make kernel and vm use this to query cpu

features (specifically: 4MB pages and TLB global bit).  Only enable
these features in CR4 if available. 4MB pages to be used in the near
future.
This commit is contained in:
Ben Gras
2009-05-15 17:07:36 +00:00
parent d0b6e76bfb
commit bdab3c4cfb
10 changed files with 134 additions and 13 deletions

View File

@@ -6,6 +6,7 @@
#include <minix/type.h>
#include <minix/syslib.h>
#include <minix/sysutil.h>
#include <minix/cpufeature.h>
#include <string.h>
#include <sys/vm_i386.h>
@@ -155,7 +156,10 @@ PRIVATE void set_cr3()
PRIVATE void vm_enable_paging(void)
{
u32_t cr0, cr4;
int psok, pgeok;
psok = _cpufeature(_CPUF_I386_PSE);
pgeok = _cpufeature(_CPUF_I386_PGE);
cr0= read_cr0();
cr4= read_cr4();
@@ -169,7 +173,14 @@ PRIVATE void vm_enable_paging(void)
/* First enable paging, then enable global page flag. */
write_cr0(cr0 | I386_CR0_PG);
write_cr4(cr4 | I386_CR4_PGE);
/* May we enable these features? */
if(pgeok)
cr4 |= I386_CR4_PGE;
if(psok)
cr4 |= I386_CR4_PSE;
write_cr4(cr4);
}
PUBLIC vir_bytes alloc_remote_segment(u32_t *selector,

View File

@@ -24,7 +24,7 @@
#define DEBUG_TIME_LOCKS 1
/* Runtime sanity checking. */
#define DEBUG_VMASSERT 0
#define DEBUG_VMASSERT 1
#define DEBUG_SCHED_CHECK 0
#endif /* DEBUG_H */