From: rlfnb Date: Tue, 12 Jul 2016 15:20:41 +0000 (+0200) Subject: Preparations for PAE support X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F3339%2F1;p=minix.git Preparations for PAE support Change-Id: I9a7c9ed9f803e2e26d745d14149a8aec64ab0c75 --- diff --git a/minix/include/arch/i386/include/vm.h b/minix/include/arch/i386/include/vm.h index 5c0c3c109..6c6944c45 100644 --- a/minix/include/arch/i386/include/vm.h +++ b/minix/include/arch/i386/include/vm.h @@ -74,6 +74,7 @@ i386/vm.h #define CPUID1_EDX_FPU (1L) /* FPU presence */ #define CPUID1_EDX_PSE (1L << 3) /* Page Size Extension */ #define CPUID1_EDX_SYSENTER (1L << 11) /* Intel SYSENTER */ +#define CPUID1_EDX_PAE (1L << 6) /* Physical Address Extension */ #define CPUID1_EDX_PGE (1L << 13) /* Page Global (bit) Enable */ #define CPUID1_EDX_APIC_ON_CHIP (1L << 9) /* APIC is present on the chip */ #define CPUID1_EDX_TSC (1L << 4) /* Timestamp counter present */ diff --git a/minix/include/minix/cpufeature.h b/minix/include/minix/cpufeature.h index 4ceae56c5..1d9d79aac 100644 --- a/minix/include/minix/cpufeature.h +++ b/minix/include/minix/cpufeature.h @@ -25,6 +25,8 @@ #define _CPUF_I386_SYSENTER 16 /* Intel SYSENTER instrs */ #define _CPUF_I386_SYSCALL 17 /* AMD SYSCALL instrs */ +#define _CPUF_I386_PAE 18 /* Page Address Extension */ + int _cpufeature(int featureno); #endif diff --git a/minix/kernel/Makefile b/minix/kernel/Makefile index 41573f4cb..81414dc4a 100644 --- a/minix/kernel/Makefile +++ b/minix/kernel/Makefile @@ -43,6 +43,10 @@ CPPFLAGS+= -I${NETBSDSRCDIR}/minix/include/arch/${MACHINE_ARCH}/include .include "system/Makefile.inc" +.if ${MKPAE:Uno} != "no" +CPPFLAGS+= -DPAE=1 +.endif + .ifdef CONFIG_SMP SRCS+= smp.c .endif diff --git a/minix/kernel/arch/i386/arch_reset.c b/minix/kernel/arch/i386/arch_reset.c index 855bd36f2..4839a1156 100644 --- a/minix/kernel/arch/i386/arch_reset.c +++ b/minix/kernel/arch/i386/arch_reset.c @@ -11,7 +11,6 @@ #include #include #include -#include #include diff --git a/minix/kernel/arch/i386/pg_utils.c b/minix/kernel/arch/i386/pg_utils.c index 8e4e0231b..585dfc6c8 100644 --- a/minix/kernel/arch/i386/pg_utils.c +++ b/minix/kernel/arch/i386/pg_utils.c @@ -208,6 +208,11 @@ void vm_enable_paging(void) pgeok = _cpufeature(_CPUF_I386_PGE); +#ifdef PAE + if(_cpufeature(_CPUF_I386_PAE) == 0) + panic("kernel built with PAE support, CPU seems to lack PAE support?\n"); +#endif + cr0= read_cr0(); cr4= read_cr4(); diff --git a/minix/kernel/main.c b/minix/kernel/main.c index 1d8531460..d98f10056 100644 --- a/minix/kernel/main.c +++ b/minix/kernel/main.c @@ -337,6 +337,9 @@ static void announce(void) { /* Display the MINIX startup banner. */ printf("\nMINIX %s. " +#ifdef PAE +"(PAE) " +#endif #ifdef _VCS_REVISION "(" _VCS_REVISION ")\n" #endif diff --git a/minix/lib/libc/arch/i386/_cpufeature.c b/minix/lib/libc/arch/i386/_cpufeature.c index 1a7c011d5..7448c5c9a 100644 --- a/minix/lib/libc/arch/i386/_cpufeature.c +++ b/minix/lib/libc/arch/i386/_cpufeature.c @@ -51,6 +51,8 @@ int _cpufeature(int cpufeature) switch(cpufeature) { case _CPUF_I386_PSE: return edx & CPUID1_EDX_PSE; + case _CPUF_I386_PAE: + return edx & CPUID1_EDX_PAE; case _CPUF_I386_PGE: return edx & CPUID1_EDX_PGE; case _CPUF_I386_APIC_ON_CHIP: diff --git a/minix/lib/libmagicrt/include/st/state_transfer.h b/minix/lib/libmagicrt/include/st/state_transfer.h index fcb1217d3..536dc20e0 100644 --- a/minix/lib/libmagicrt/include/st/state_transfer.h +++ b/minix/lib/libmagicrt/include/st/state_transfer.h @@ -40,7 +40,7 @@ typedef struct _st_init_info_t { typedef struct st_alloc_pages { int num_pages; void *virt_addr; - uint32_t phys_addr; + phys_bytes phys_addr; struct st_alloc_pages *previous; } st_alloc_pages; diff --git a/minix/servers/vm/Makefile b/minix/servers/vm/Makefile index 4cd45a530..bf440261d 100644 --- a/minix/servers/vm/Makefile +++ b/minix/servers/vm/Makefile @@ -12,6 +12,10 @@ SRCS= main.c alloc.c utility.c exit.c fork.c break.c \ LDFLAGS+= -T ${.CURDIR}/arch/${MACHINE_ARCH}/vm.lds .endif +.if ${MKPAE:Uno} != "no" +CPPFLAGS+= -DPAE=1 +.endif + DPADD+= ${LIBSYS} ${LIBEXEC} LDADD+= -lsys -lexec diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 32a5353e4..eb7f25616 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1268,7 +1268,7 @@ _MKVARS.yes+= \ MKSYSDEBUG MKLIVEUPDATE MKLWIP MKLLVMCMDS .if (${MACHINE_ARCH} == "i386") _MKVARS.yes+= \ - MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI + MKWATCHDOG MKACPI MKPAE MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI .endif .for var in ${_MKVARS.yes} @@ -1309,7 +1309,7 @@ _MKVARS.no+= \ MKIMAGEONLY MKSMALL MKBITCODE MKMAGIC MKASR MKSRC .if !empty(MACHINE_ARCH:Mearm*) _MKVARS.no+= \ - MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI + MKWATCHDOG MKPAE MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI .endif .for var in ${_MKVARS.no} @@ -1497,7 +1497,7 @@ ${var}?= yes #MINIX-specific vars .for var in \ - USE_WATCHDOG USE_ACPI USE_APIC USE_DEBUGREG USE_SYSDEBUG \ + USE_WATCHDOG USE_ACPI USE_PAE USE_APIC USE_DEBUGREG USE_SYSDEBUG \ USE_LIVEUPDATE USE_PCI USE_BITCODE USE_MAGIC USE_ASR .if (${${var:S/USE_/MK/}} == "no") ${var}:= no