]> Joshua Wise's Git repositories - netwatch.git/blobdiff - netwatch/pagingstub.c
More ICH2-specific code diked out.
[netwatch.git] / netwatch / pagingstub.c
index 941be86ef737baaaab8845cd78b41d82d78ca3e3..7fa240b23335c9f943f0602518c893c6b70df292 100644 (file)
@@ -1,3 +1,14 @@
+/* pagingstub.c
+ * Paging enable routines
+ * NetWatch system management mode administration console
+ *
+ * Copyright (c) 2008 Jacob Potter and Joshua Wise.  All rights reserved.
+ * This program is free software; you can redistribute and/or modify it under
+ * the terms found in the file LICENSE in the root of this source tree.
+ *
+ */
+
+
 #include <io.h>
 #include <smram.h>
 #include <video_defines.h>
 #include <io.h>
 #include <smram.h>
 #include <video_defines.h>
@@ -43,6 +54,7 @@ void ps_switch_stack (void (*call)(), int stack);
 
 #define        CR0_PG  0x80000000
 #define CR4_PSE        0x00000010
 
 #define        CR0_PG  0x80000000
 #define CR4_PSE        0x00000010
+#define CR4_OSFXSR 0x00000200
 
 #define MAP_FLAGS      (PTE_PRESENT | PTE_READ_WRITE)
 
 
 #define MAP_FLAGS      (PTE_PRESENT | PTE_READ_WRITE)
 
@@ -120,19 +132,6 @@ int addmap_4m(unsigned long vaddr, unsigned long paddr)
        return 0;
 }
 
        return 0;
 }
 
-void *demap(unsigned long client_pd, unsigned long vaddr)
-{
-       unsigned long pde = ((unsigned long *)p2v(client_pd))[PDE_FOR(vaddr)];
-       unsigned long pte;
-       
-       if (!(pde & PTE_PRESENT))
-               return (void*)0x0;
-       pte = ((unsigned long *)p2v(ADDR_12_MASK(pde)))[PTE_FOR(vaddr)];
-       if (!(pte & PTE_PRESENT))
-               return (void*)0x0;
-       return p2v((pte & ~0xFFF) + (vaddr & 0xFFF));
-}
-
 static void pt_setup(int tseg_start, int tseg_size) {
        int i;
 
 static void pt_setup(int tseg_start, int tseg_size) {
        int i;
 
@@ -172,54 +171,66 @@ static void pt_setup(int tseg_start, int tseg_size) {
 
 void init_and_run(void)
 {
 
 void init_and_run(void)
 {
+       DBG(0x0A);
+
        if (!initialized)
        {
        if (!initialized)
        {
+               DBG(0x0B);
                smi_init();
                initialized = 1;
        }
        
                smi_init();
                initialized = 1;
        }
        
+       DBG(0x0C);
        smi_entry();
        smi_entry();
+
+       DBG(0xCC);
 }
 
 void c_entry(void)
 {
        paging_enb = 0;
 
 }
 
 void c_entry(void)
 {
        paging_enb = 0;
 
-       outb(0x80, 0x01);       
+       DBG(0x01);
+
        if (!initialized)
                pt_setup(0x1FF80000, 0x80000);
        if (!initialized)
                pt_setup(0x1FF80000, 0x80000);
-       outb(0x80, 0x02);
-               
+
+       DBG(0x02);
+
        /* Enable paging. */
        set_cr3((unsigned long)pd);
        /* Enable paging. */
        set_cr3((unsigned long)pd);
-       set_cr4(get_cr4() | CR4_PSE);   /* ITT, we 4MByte page. */ 
+       set_cr4(get_cr4() | CR4_PSE | CR4_OSFXSR);      /* ITT, we 4MByte page. */ 
        set_cr0(get_cr0() | CR0_PG);
        set_cr0(get_cr0() | CR0_PG);
-       outb(0x80, 0x03);
+
+       DBG(0x03);
        paging_enb = 1;
 
        /* If this is the first goround, copy in data. */
        if (!initialized)
        {
                unsigned char *p;
        paging_enb = 1;
 
        /* If this is the first goround, copy in data. */
        if (!initialized)
        {
                unsigned char *p;
-               
-               outb(0x80, 0x04);
+
+               DBG(0x04);
+
                for (p = (void *)0x200000; (void *)p < (void *)&_bss; p++)
                        *p = *(p + 0x100000);
                for (p = (void *)&_bss; (void *)p < (void *)&_bssend; p++)
                        *p = 0;
                for (p = (void *)0x200000; (void *)p < (void *)&_bss; p++)
                        *p = *(p + 0x100000);
                for (p = (void *)&_bss; (void *)p < (void *)&_bssend; p++)
                        *p = 0;
-               outb(0x80, 0x05);
+
+               DBG(0x05);
                
                /* Only now is it safe to call other functions. */
                serial_init();
                
                /* Only now is it safe to call other functions. */
                serial_init();
+               DBG(0x06);
                dolog("Evacuation to TSEG complete.");
                dolog("Evacuation to TSEG complete.");
+               DBG(0x07);
        }
        }
-       
-       outb(0x80, 0x06);
 
 
+       DBG(0x08);
        traps_install();
        
        traps_install();
        
-       outb(0x80, 0x07);
-
+       DBG(0x09);
        ps_switch_stack(init_and_run, 0x270000);
        ps_switch_stack(init_and_run, 0x270000);
-       outb(0x80, 0xFA);
+
+       DBG(0xFA);
 }
 }
This page took 0.030832 seconds and 4 git commands to generate.