Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Adding 'i386_use_pae' variable, and expose it through sysctl



Hi list,

Would it be acceptable to add a "pae" sysctl variable to machdep subtree
for i386, including Xen?

To handle the kernel correctly through kvm(3), I need to figure out
whether it was using PAE at the time of the dump.

So I would like to add an "i386_use_pae" global variable, and
preferably, expose it through sysctl(3) for convenience (attempting to
find out if the booted kernel uses PAE is not quite straightforward
currently).

Patch attached. Ok to commit?

-- 
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost
Index: arch/i386/i386/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.692
diff -u -p -r1.692 machdep.c
--- arch/i386/i386/machdep.c    7 Aug 2010 20:07:26 -0000       1.692
+++ arch/i386/i386/machdep.c    15 Aug 2010 00:46:45 -0000
@@ -250,6 +250,7 @@ int i386_fpu_exception;
 int    i386_fpu_fdivbug;
 
 int    i386_use_fxsave;
+int    i386_use_pae = 0;
 int    i386_has_sse;
 int    i386_has_sse2;
 
@@ -667,6 +668,11 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
                       CTL_MACHDEP, CPU_OSFXSR, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT,
+                      CTLTYPE_INT, "pae", "Whether the kernel uses PAE",
+                      NULL, 0, &i386_use_pae, 0,
+                      CTL_MACHDEP, CPU_PAE, CTL_EOL);
+       sysctl_createv(clog, 0, NULL, NULL,
+                      CTLFLAG_PERMANENT,
                       CTLTYPE_INT, "sse", NULL,
                       NULL, 0, &i386_has_sse, 0,
                       CTL_MACHDEP, CPU_SSE, CTL_EOL);
@@ -1302,6 +1308,10 @@ init386(paddr_t first_avail)
 
        cpu_init_msrs(&cpu_info_primary, true);
 
+#ifdef PAE
+       i386_use_pae = 1;
+#endif
+
 #ifdef XEN
        pcb->pcb_cr3 = PDPpaddr;
        __PRINTK(("pcb_cr3 0x%lx cr3 0x%lx\n",
Index: arch/x86/include/cpu.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/include/cpu.h,v
retrieving revision 1.24
diff -u -p -r1.24 cpu.h
--- arch/x86/include/cpu.h      4 Aug 2010 10:02:11 -0000       1.24
+++ arch/x86/include/cpu.h      15 Aug 2010 00:46:48 -0000
@@ -341,6 +341,7 @@ extern int cpu_class;
 extern char cpu_brand_string[];
 
 extern int i386_use_fxsave;
+extern int i386_use_pae;
 extern int i386_has_sse;
 extern int i386_has_sse2;
 
@@ -463,6 +464,7 @@ void x86_bus_space_mallocok(void);
 #define        CPU_TMLR_VOLTAGE        13      /* int: curret voltage */
 #define        CPU_TMLR_PERCENTAGE     14      /* int: current clock 
percentage */
 #define        CPU_MAXID               15      /* number of valid machdep ids 
*/
+#define        CPU_PAE                 16      /* int: OS uses PAE mode */
 
 /*
  * Structure for CPU_DISKINFO sysctl call.


Home | Main Index | Thread Index | Old Index